id
int32 0
165k
| 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
|
---|---|---|---|---|---|---|---|---|---|---|---|
162,800 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
|
ClassUtils.isPrimitiveArray
|
public static boolean isPrimitiveArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && clazz.getComponentType().isPrimitive());
}
|
java
|
public static boolean isPrimitiveArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && clazz.getComponentType().isPrimitive());
}
|
[
"public",
"static",
"boolean",
"isPrimitiveArray",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isArray",
"(",
")",
"&&",
"clazz",
".",
"getComponentType",
"(",
")",
".",
"isPrimitive",
"(",
")",
")",
";",
"}"
] |
Check if the given class represents an array of primitives,
i.e. boolean, byte, char, short, int, long, float, or double.
@param clazz the class to check
@return whether the given class is a primitive array class
|
[
"Check",
"if",
"the",
"given",
"class",
"represents",
"an",
"array",
"of",
"primitives",
"i",
".",
"e",
".",
"boolean",
"byte",
"char",
"short",
"int",
"long",
"float",
"or",
"double",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L865-L868
|
162,801 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
|
ClassUtils.isPrimitiveWrapperArray
|
public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
}
|
java
|
public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
}
|
[
"public",
"static",
"boolean",
"isPrimitiveWrapperArray",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isArray",
"(",
")",
"&&",
"isPrimitiveWrapper",
"(",
"clazz",
".",
"getComponentType",
"(",
")",
")",
")",
";",
"}"
] |
Check if the given class represents an array of primitive wrappers,
i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double.
@param clazz the class to check
@return whether the given class is a primitive wrapper array class
|
[
"Check",
"if",
"the",
"given",
"class",
"represents",
"an",
"array",
"of",
"primitive",
"wrappers",
"i",
".",
"e",
".",
"Boolean",
"Byte",
"Character",
"Short",
"Integer",
"Long",
"Float",
"or",
"Double",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L876-L879
|
162,802 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
|
ClassUtils.resolvePrimitiveIfNecessary
|
public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isPrimitive() && clazz != void.class? primitiveTypeToWrapperMap.get(clazz) : clazz);
}
|
java
|
public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isPrimitive() && clazz != void.class? primitiveTypeToWrapperMap.get(clazz) : clazz);
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"resolvePrimitiveIfNecessary",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isPrimitive",
"(",
")",
"&&",
"clazz",
"!=",
"void",
".",
"class",
"?",
"primitiveTypeToWrapperMap",
".",
"get",
"(",
"clazz",
")",
":",
"clazz",
")",
";",
"}"
] |
Resolve the given class if it is a primitive class,
returning the corresponding primitive wrapper type instead.
@param clazz the class to check
@return the original class, or a primitive wrapper for the original primitive type
|
[
"Resolve",
"the",
"given",
"class",
"if",
"it",
"is",
"a",
"primitive",
"class",
"returning",
"the",
"corresponding",
"primitive",
"wrapper",
"type",
"instead",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L887-L890
|
162,803 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
|
ClassUtils.toClassArray
|
public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
if (collection == null) {
return null;
}
return collection.toArray(new Class<?>[collection.size()]);
}
|
java
|
public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
if (collection == null) {
return null;
}
return collection.toArray(new Class<?>[collection.size()]);
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"toClassArray",
"(",
"Collection",
"<",
"Class",
"<",
"?",
">",
">",
"collection",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"collection",
".",
"toArray",
"(",
"new",
"Class",
"<",
"?",
">",
"[",
"collection",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Copy the given Collection into a Class array.
The Collection must contain Class elements only.
@param collection the Collection to copy
@return the Class array ({@code null} if the passed-in
Collection was {@code null})
|
[
"Copy",
"the",
"given",
"Collection",
"into",
"a",
"Class",
"array",
".",
"The",
"Collection",
"must",
"contain",
"Class",
"elements",
"only",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L1052-L1057
|
162,804 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
|
ClassUtils.determineCommonAncestor
|
public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) {
if (clazz1 == null) {
return clazz2;
}
if (clazz2 == null) {
return clazz1;
}
if (clazz1.isAssignableFrom(clazz2)) {
return clazz1;
}
if (clazz2.isAssignableFrom(clazz1)) {
return clazz2;
}
Class<?> ancestor = clazz1;
do {
ancestor = ancestor.getSuperclass();
if (ancestor == null || Object.class.equals(ancestor)) {
return null;
}
}
while (!ancestor.isAssignableFrom(clazz2));
return ancestor;
}
|
java
|
public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) {
if (clazz1 == null) {
return clazz2;
}
if (clazz2 == null) {
return clazz1;
}
if (clazz1.isAssignableFrom(clazz2)) {
return clazz1;
}
if (clazz2.isAssignableFrom(clazz1)) {
return clazz2;
}
Class<?> ancestor = clazz1;
do {
ancestor = ancestor.getSuperclass();
if (ancestor == null || Object.class.equals(ancestor)) {
return null;
}
}
while (!ancestor.isAssignableFrom(clazz2));
return ancestor;
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"determineCommonAncestor",
"(",
"Class",
"<",
"?",
">",
"clazz1",
",",
"Class",
"<",
"?",
">",
"clazz2",
")",
"{",
"if",
"(",
"clazz1",
"==",
"null",
")",
"{",
"return",
"clazz2",
";",
"}",
"if",
"(",
"clazz2",
"==",
"null",
")",
"{",
"return",
"clazz1",
";",
"}",
"if",
"(",
"clazz1",
".",
"isAssignableFrom",
"(",
"clazz2",
")",
")",
"{",
"return",
"clazz1",
";",
"}",
"if",
"(",
"clazz2",
".",
"isAssignableFrom",
"(",
"clazz1",
")",
")",
"{",
"return",
"clazz2",
";",
"}",
"Class",
"<",
"?",
">",
"ancestor",
"=",
"clazz1",
";",
"do",
"{",
"ancestor",
"=",
"ancestor",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"ancestor",
"==",
"null",
"||",
"Object",
".",
"class",
".",
"equals",
"(",
"ancestor",
")",
")",
"{",
"return",
"null",
";",
"}",
"}",
"while",
"(",
"!",
"ancestor",
".",
"isAssignableFrom",
"(",
"clazz2",
")",
")",
";",
"return",
"ancestor",
";",
"}"
] |
Determine the common ancestor of the given classes, if any.
@param clazz1 the class to introspect
@param clazz2 the other class to introspect
@return the common ancestor (i.e. common superclass, one interface
extending the other), or {@code null} if none found. If any of the
given classes is {@code null}, the other class will be returned.
@since 2.0
|
[
"Determine",
"the",
"common",
"ancestor",
"of",
"the",
"given",
"classes",
"if",
"any",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L1166-L1188
|
162,805 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java
|
GenericTypeResolver.resolveReturnType
|
public static Class<?> resolveReturnType(Method method, Class<?> clazz) {
Assert.notNull(method, "Method must not be null");
Type genericType = method.getGenericReturnType();
Assert.notNull(clazz, "Class must not be null");
Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);
Type rawType = getRawType(genericType, typeVariableMap);
return (rawType instanceof Class ? (Class<?>) rawType : method.getReturnType());
}
|
java
|
public static Class<?> resolveReturnType(Method method, Class<?> clazz) {
Assert.notNull(method, "Method must not be null");
Type genericType = method.getGenericReturnType();
Assert.notNull(clazz, "Class must not be null");
Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);
Type rawType = getRawType(genericType, typeVariableMap);
return (rawType instanceof Class ? (Class<?>) rawType : method.getReturnType());
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"resolveReturnType",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"Method must not be null\"",
")",
";",
"Type",
"genericType",
"=",
"method",
".",
"getGenericReturnType",
"(",
")",
";",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"Map",
"<",
"TypeVariable",
",",
"Type",
">",
"typeVariableMap",
"=",
"getTypeVariableMap",
"(",
"clazz",
")",
";",
"Type",
"rawType",
"=",
"getRawType",
"(",
"genericType",
",",
"typeVariableMap",
")",
";",
"return",
"(",
"rawType",
"instanceof",
"Class",
"?",
"(",
"Class",
"<",
"?",
">",
")",
"rawType",
":",
"method",
".",
"getReturnType",
"(",
")",
")",
";",
"}"
] |
Determine the target type for the generic return type of the given method,
where formal type variables are declared on the given class.
@param method the method to introspect
@param clazz the class to resolve type variables against
@return the corresponding generic parameter or return type
@see #resolveReturnTypeForGenericMethod
|
[
"Determine",
"the",
"target",
"type",
"for",
"the",
"generic",
"return",
"type",
"of",
"the",
"given",
"method",
"where",
"formal",
"type",
"variables",
"are",
"declared",
"on",
"the",
"given",
"class",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L101-L108
|
162,806 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java
|
GenericTypeResolver.resolveReturnTypeArgument
|
public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) {
Assert.notNull(method, "method must not be null");
Type returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
if (returnType.equals(genericIfc)) {
if (genericReturnType instanceof ParameterizedType) {
ParameterizedType targetType = (ParameterizedType) genericReturnType;
Type[] actualTypeArguments = targetType.getActualTypeArguments();
Type typeArg = actualTypeArguments[0];
if (!(typeArg instanceof WildcardType)) {
return (Class<?>) typeArg;
}
}
else {
return null;
}
}
return resolveTypeArgument((Class<?>) returnType, genericIfc);
}
|
java
|
public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) {
Assert.notNull(method, "method must not be null");
Type returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
if (returnType.equals(genericIfc)) {
if (genericReturnType instanceof ParameterizedType) {
ParameterizedType targetType = (ParameterizedType) genericReturnType;
Type[] actualTypeArguments = targetType.getActualTypeArguments();
Type typeArg = actualTypeArguments[0];
if (!(typeArg instanceof WildcardType)) {
return (Class<?>) typeArg;
}
}
else {
return null;
}
}
return resolveTypeArgument((Class<?>) returnType, genericIfc);
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"resolveReturnTypeArgument",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"genericIfc",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"method must not be null\"",
")",
";",
"Type",
"returnType",
"=",
"method",
".",
"getReturnType",
"(",
")",
";",
"Type",
"genericReturnType",
"=",
"method",
".",
"getGenericReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
".",
"equals",
"(",
"genericIfc",
")",
")",
"{",
"if",
"(",
"genericReturnType",
"instanceof",
"ParameterizedType",
")",
"{",
"ParameterizedType",
"targetType",
"=",
"(",
"ParameterizedType",
")",
"genericReturnType",
";",
"Type",
"[",
"]",
"actualTypeArguments",
"=",
"targetType",
".",
"getActualTypeArguments",
"(",
")",
";",
"Type",
"typeArg",
"=",
"actualTypeArguments",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"(",
"typeArg",
"instanceof",
"WildcardType",
")",
")",
"{",
"return",
"(",
"Class",
"<",
"?",
">",
")",
"typeArg",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"resolveTypeArgument",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"returnType",
",",
"genericIfc",
")",
";",
"}"
] |
Resolve the single type argument of the given generic interface against the given
target method which is assumed to return the given interface or an implementation
of it.
@param method the target method to check the return type of
@param genericIfc the generic interface or superclass to resolve the type argument from
@return the resolved parameter type of the method return type, or {@code null}
if not resolvable or if the single argument is of type {@link WildcardType}.
|
[
"Resolve",
"the",
"single",
"type",
"argument",
"of",
"the",
"given",
"generic",
"interface",
"against",
"the",
"given",
"target",
"method",
"which",
"is",
"assumed",
"to",
"return",
"the",
"given",
"interface",
"or",
"an",
"implementation",
"of",
"it",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L209-L227
|
162,807 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java
|
GenericTypeResolver.resolveTypeArgument
|
public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) {
Class<?>[] typeArgs = resolveTypeArguments(clazz, genericIfc);
if (typeArgs == null) {
return null;
}
if (typeArgs.length != 1) {
throw new IllegalArgumentException("Expected 1 type argument on generic interface [" +
genericIfc.getName() + "] but found " + typeArgs.length);
}
return typeArgs[0];
}
|
java
|
public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) {
Class<?>[] typeArgs = resolveTypeArguments(clazz, genericIfc);
if (typeArgs == null) {
return null;
}
if (typeArgs.length != 1) {
throw new IllegalArgumentException("Expected 1 type argument on generic interface [" +
genericIfc.getName() + "] but found " + typeArgs.length);
}
return typeArgs[0];
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"resolveTypeArgument",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"genericIfc",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"typeArgs",
"=",
"resolveTypeArguments",
"(",
"clazz",
",",
"genericIfc",
")",
";",
"if",
"(",
"typeArgs",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"typeArgs",
".",
"length",
"!=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected 1 type argument on generic interface [\"",
"+",
"genericIfc",
".",
"getName",
"(",
")",
"+",
"\"] but found \"",
"+",
"typeArgs",
".",
"length",
")",
";",
"}",
"return",
"typeArgs",
"[",
"0",
"]",
";",
"}"
] |
Resolve the single type argument of the given generic interface against
the given target class which is assumed to implement the generic interface
and possibly declare a concrete type for its type variable.
@param clazz the target class to check against
@param genericIfc the generic interface or superclass to resolve the type argument from
@return the resolved type of the argument, or {@code null} if not resolvable
|
[
"Resolve",
"the",
"single",
"type",
"argument",
"of",
"the",
"given",
"generic",
"interface",
"against",
"the",
"given",
"target",
"class",
"which",
"is",
"assumed",
"to",
"implement",
"the",
"generic",
"interface",
"and",
"possibly",
"declare",
"a",
"concrete",
"type",
"for",
"its",
"type",
"variable",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L237-L247
|
162,808 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java
|
GenericTypeResolver.extractClass
|
private static Class<?> extractClass(Class<?> ownerClass, Type arg) {
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
else if (arg instanceof GenericArrayType) {
GenericArrayType gat = (GenericArrayType) arg;
Type gt = gat.getGenericComponentType();
Class<?> componentClass = extractClass(ownerClass, gt);
return Array.newInstance(componentClass, 0).getClass();
}
else if (arg instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) arg;
arg = getTypeVariableMap(ownerClass).get(tv);
if (arg == null) {
arg = extractBoundForTypeVariable(tv);
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
}
else {
return extractClass(ownerClass, arg);
}
}
return (arg instanceof Class ? (Class) arg : Object.class);
}
|
java
|
private static Class<?> extractClass(Class<?> ownerClass, Type arg) {
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
else if (arg instanceof GenericArrayType) {
GenericArrayType gat = (GenericArrayType) arg;
Type gt = gat.getGenericComponentType();
Class<?> componentClass = extractClass(ownerClass, gt);
return Array.newInstance(componentClass, 0).getClass();
}
else if (arg instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) arg;
arg = getTypeVariableMap(ownerClass).get(tv);
if (arg == null) {
arg = extractBoundForTypeVariable(tv);
if (arg instanceof ParameterizedType) {
return extractClass(ownerClass, ((ParameterizedType) arg).getRawType());
}
}
else {
return extractClass(ownerClass, arg);
}
}
return (arg instanceof Class ? (Class) arg : Object.class);
}
|
[
"private",
"static",
"Class",
"<",
"?",
">",
"extractClass",
"(",
"Class",
"<",
"?",
">",
"ownerClass",
",",
"Type",
"arg",
")",
"{",
"if",
"(",
"arg",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
"extractClass",
"(",
"ownerClass",
",",
"(",
"(",
"ParameterizedType",
")",
"arg",
")",
".",
"getRawType",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"arg",
"instanceof",
"GenericArrayType",
")",
"{",
"GenericArrayType",
"gat",
"=",
"(",
"GenericArrayType",
")",
"arg",
";",
"Type",
"gt",
"=",
"gat",
".",
"getGenericComponentType",
"(",
")",
";",
"Class",
"<",
"?",
">",
"componentClass",
"=",
"extractClass",
"(",
"ownerClass",
",",
"gt",
")",
";",
"return",
"Array",
".",
"newInstance",
"(",
"componentClass",
",",
"0",
")",
".",
"getClass",
"(",
")",
";",
"}",
"else",
"if",
"(",
"arg",
"instanceof",
"TypeVariable",
")",
"{",
"TypeVariable",
"tv",
"=",
"(",
"TypeVariable",
")",
"arg",
";",
"arg",
"=",
"getTypeVariableMap",
"(",
"ownerClass",
")",
".",
"get",
"(",
"tv",
")",
";",
"if",
"(",
"arg",
"==",
"null",
")",
"{",
"arg",
"=",
"extractBoundForTypeVariable",
"(",
"tv",
")",
";",
"if",
"(",
"arg",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
"extractClass",
"(",
"ownerClass",
",",
"(",
"(",
"ParameterizedType",
")",
"arg",
")",
".",
"getRawType",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"extractClass",
"(",
"ownerClass",
",",
"arg",
")",
";",
"}",
"}",
"return",
"(",
"arg",
"instanceof",
"Class",
"?",
"(",
"Class",
")",
"arg",
":",
"Object",
".",
"class",
")",
";",
"}"
] |
Extract a Class from the given Type.
|
[
"Extract",
"a",
"Class",
"from",
"the",
"given",
"Type",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L316-L340
|
162,809 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java
|
GenericTypeResolver.getRawType
|
static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
}
|
java
|
static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = genericType;
if (genericType instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) genericType;
resolvedType = typeVariableMap.get(tv);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(tv);
}
}
if (resolvedType instanceof ParameterizedType) {
return ((ParameterizedType) resolvedType).getRawType();
}
else {
return resolvedType;
}
}
|
[
"static",
"Type",
"getRawType",
"(",
"Type",
"genericType",
",",
"Map",
"<",
"TypeVariable",
",",
"Type",
">",
"typeVariableMap",
")",
"{",
"Type",
"resolvedType",
"=",
"genericType",
";",
"if",
"(",
"genericType",
"instanceof",
"TypeVariable",
")",
"{",
"TypeVariable",
"tv",
"=",
"(",
"TypeVariable",
")",
"genericType",
";",
"resolvedType",
"=",
"typeVariableMap",
".",
"get",
"(",
"tv",
")",
";",
"if",
"(",
"resolvedType",
"==",
"null",
")",
"{",
"resolvedType",
"=",
"extractBoundForTypeVariable",
"(",
"tv",
")",
";",
"}",
"}",
"if",
"(",
"resolvedType",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
"(",
"(",
"ParameterizedType",
")",
"resolvedType",
")",
".",
"getRawType",
"(",
")",
";",
"}",
"else",
"{",
"return",
"resolvedType",
";",
"}",
"}"
] |
Determine the raw type for the given generic parameter type.
@param genericType the generic type to resolve
@param typeVariableMap the TypeVariable Map to resolved against
@return the resolved raw type
|
[
"Determine",
"the",
"raw",
"type",
"for",
"the",
"given",
"generic",
"parameter",
"type",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericTypeResolver.java#L364-L379
|
162,810 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
|
GenericCollectionTypeResolver.getMapValueFieldType
|
public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) {
return getGenericFieldType(mapField, Map.class, 1, null, nestingLevel);
}
|
java
|
public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) {
return getGenericFieldType(mapField, Map.class, 1, null, nestingLevel);
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"getMapValueFieldType",
"(",
"Field",
"mapField",
",",
"int",
"nestingLevel",
")",
"{",
"return",
"getGenericFieldType",
"(",
"mapField",
",",
"Map",
".",
"class",
",",
"1",
",",
"null",
",",
"nestingLevel",
")",
";",
"}"
] |
Determine the generic value type of the given Map field.
@param mapField the map field to introspect
@param nestingLevel the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)
@return the generic type, or {@code null} if none
|
[
"Determine",
"the",
"generic",
"value",
"type",
"of",
"the",
"given",
"Map",
"field",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L160-L162
|
162,811 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
|
GenericCollectionTypeResolver.getGenericReturnType
|
private static Class<?> getGenericReturnType(Method method, Class<?> source, int typeIndex, int nestingLevel) {
return extractType(method.getGenericReturnType(), source, typeIndex, null, null, nestingLevel, 1);
}
|
java
|
private static Class<?> getGenericReturnType(Method method, Class<?> source, int typeIndex, int nestingLevel) {
return extractType(method.getGenericReturnType(), source, typeIndex, null, null, nestingLevel, 1);
}
|
[
"private",
"static",
"Class",
"<",
"?",
">",
"getGenericReturnType",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"source",
",",
"int",
"typeIndex",
",",
"int",
"nestingLevel",
")",
"{",
"return",
"extractType",
"(",
"method",
".",
"getGenericReturnType",
"(",
")",
",",
"source",
",",
"typeIndex",
",",
"null",
",",
"null",
",",
"nestingLevel",
",",
"1",
")",
";",
"}"
] |
Extract the generic return type from the given method.
@param method the method to check the return type for
@param source the source class/interface defining the generic parameter types
@param typeIndex the index of the type (e.g. 0 for Collections,
0 for Map keys, 1 for Map values)
@param nestingLevel the nesting level of the target type
@return the generic type, or {@code null} if none
|
[
"Extract",
"the",
"generic",
"return",
"type",
"from",
"the",
"given",
"method",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L307-L309
|
162,812 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
|
GenericCollectionTypeResolver.extractTypeFromClass
|
private static Class<?> extractTypeFromClass(Class<?> clazz, Class<?> source, int typeIndex,
Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel,
int nestingLevel, int currentLevel) {
if (clazz.getName().startsWith("java.util.")) {
return null;
}
if (clazz.getSuperclass() != null && isIntrospectionCandidate(clazz.getSuperclass())) {
try {
return extractType(clazz.getGenericSuperclass(), source, typeIndex, typeVariableMap,
typeIndexesPerLevel, nestingLevel, currentLevel);
}
catch (MalformedParameterizedTypeException ex) {
// from getGenericSuperclass() - ignore and continue with interface introspection
}
}
Type[] ifcs = clazz.getGenericInterfaces();
if (ifcs != null) {
for (Type ifc : ifcs) {
Type rawType = ifc;
if (ifc instanceof ParameterizedType) {
rawType = ((ParameterizedType) ifc).getRawType();
}
if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) {
return extractType(ifc, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel);
}
}
}
return null;
}
|
java
|
private static Class<?> extractTypeFromClass(Class<?> clazz, Class<?> source, int typeIndex,
Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel,
int nestingLevel, int currentLevel) {
if (clazz.getName().startsWith("java.util.")) {
return null;
}
if (clazz.getSuperclass() != null && isIntrospectionCandidate(clazz.getSuperclass())) {
try {
return extractType(clazz.getGenericSuperclass(), source, typeIndex, typeVariableMap,
typeIndexesPerLevel, nestingLevel, currentLevel);
}
catch (MalformedParameterizedTypeException ex) {
// from getGenericSuperclass() - ignore and continue with interface introspection
}
}
Type[] ifcs = clazz.getGenericInterfaces();
if (ifcs != null) {
for (Type ifc : ifcs) {
Type rawType = ifc;
if (ifc instanceof ParameterizedType) {
rawType = ((ParameterizedType) ifc).getRawType();
}
if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) {
return extractType(ifc, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel);
}
}
}
return null;
}
|
[
"private",
"static",
"Class",
"<",
"?",
">",
"extractTypeFromClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"source",
",",
"int",
"typeIndex",
",",
"Map",
"<",
"TypeVariable",
",",
"Type",
">",
"typeVariableMap",
",",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"typeIndexesPerLevel",
",",
"int",
"nestingLevel",
",",
"int",
"currentLevel",
")",
"{",
"if",
"(",
"clazz",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"java.util.\"",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"clazz",
".",
"getSuperclass",
"(",
")",
"!=",
"null",
"&&",
"isIntrospectionCandidate",
"(",
"clazz",
".",
"getSuperclass",
"(",
")",
")",
")",
"{",
"try",
"{",
"return",
"extractType",
"(",
"clazz",
".",
"getGenericSuperclass",
"(",
")",
",",
"source",
",",
"typeIndex",
",",
"typeVariableMap",
",",
"typeIndexesPerLevel",
",",
"nestingLevel",
",",
"currentLevel",
")",
";",
"}",
"catch",
"(",
"MalformedParameterizedTypeException",
"ex",
")",
"{",
"// from getGenericSuperclass() - ignore and continue with interface introspection",
"}",
"}",
"Type",
"[",
"]",
"ifcs",
"=",
"clazz",
".",
"getGenericInterfaces",
"(",
")",
";",
"if",
"(",
"ifcs",
"!=",
"null",
")",
"{",
"for",
"(",
"Type",
"ifc",
":",
"ifcs",
")",
"{",
"Type",
"rawType",
"=",
"ifc",
";",
"if",
"(",
"ifc",
"instanceof",
"ParameterizedType",
")",
"{",
"rawType",
"=",
"(",
"(",
"ParameterizedType",
")",
"ifc",
")",
".",
"getRawType",
"(",
")",
";",
"}",
"if",
"(",
"rawType",
"instanceof",
"Class",
"&&",
"isIntrospectionCandidate",
"(",
"(",
"Class",
")",
"rawType",
")",
")",
"{",
"return",
"extractType",
"(",
"ifc",
",",
"source",
",",
"typeIndex",
",",
"typeVariableMap",
",",
"typeIndexesPerLevel",
",",
"nestingLevel",
",",
"currentLevel",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Extract the generic type from the given Class object.
@param clazz the Class to check
@param source the expected raw source type (can be {@code null})
@param typeIndex the index of the actual type argument
@param nestingLevel the nesting level of the target type
@param currentLevel the current nested level
@return the generic type as Class, or {@code null} if none
|
[
"Extract",
"the",
"generic",
"type",
"from",
"the",
"given",
"Class",
"object",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L442-L471
|
162,813 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/io/AssetResource.java
|
AssetResource.exists
|
@Override
public boolean exists() {
try {
InputStream inputStream = this.assetManager.open(this.fileName);
if (inputStream != null) {
return true;
} else {
return false;
}
} catch (IOException e) {
return false;
}
}
|
java
|
@Override
public boolean exists() {
try {
InputStream inputStream = this.assetManager.open(this.fileName);
if (inputStream != null) {
return true;
} else {
return false;
}
} catch (IOException e) {
return false;
}
}
|
[
"@",
"Override",
"public",
"boolean",
"exists",
"(",
")",
"{",
"try",
"{",
"InputStream",
"inputStream",
"=",
"this",
".",
"assetManager",
".",
"open",
"(",
"this",
".",
"fileName",
")",
";",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
This implementation returns whether the underlying asset exists.
|
[
"This",
"implementation",
"returns",
"whether",
"the",
"underlying",
"asset",
"exists",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/io/AssetResource.java#L57-L69
|
162,814 |
spring-projects/spring-android
|
spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java
|
HttpComponentsClientHttpRequest.addHeaders
|
static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
String headerName = entry.getKey();
if (HttpHeaders.COOKIE.equalsIgnoreCase(headerName)) { // RFC 6265
String headerValue = StringUtils.collectionToDelimitedString(entry.getValue(), "; ");
httpRequest.addHeader(headerName, headerValue);
}
else if (!HTTP.CONTENT_LEN.equalsIgnoreCase(headerName) &&
!HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)) {
for (String headerValue : entry.getValue()) {
httpRequest.addHeader(headerName, headerValue);
}
}
}
}
|
java
|
static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
String headerName = entry.getKey();
if (HttpHeaders.COOKIE.equalsIgnoreCase(headerName)) { // RFC 6265
String headerValue = StringUtils.collectionToDelimitedString(entry.getValue(), "; ");
httpRequest.addHeader(headerName, headerValue);
}
else if (!HTTP.CONTENT_LEN.equalsIgnoreCase(headerName) &&
!HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)) {
for (String headerValue : entry.getValue()) {
httpRequest.addHeader(headerName, headerValue);
}
}
}
}
|
[
"static",
"void",
"addHeaders",
"(",
"HttpUriRequest",
"httpRequest",
",",
"HttpHeaders",
"headers",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"entry",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"headerName",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"HttpHeaders",
".",
"COOKIE",
".",
"equalsIgnoreCase",
"(",
"headerName",
")",
")",
"{",
"// RFC 6265",
"String",
"headerValue",
"=",
"StringUtils",
".",
"collectionToDelimitedString",
"(",
"entry",
".",
"getValue",
"(",
")",
",",
"\"; \"",
")",
";",
"httpRequest",
".",
"addHeader",
"(",
"headerName",
",",
"headerValue",
")",
";",
"}",
"else",
"if",
"(",
"!",
"HTTP",
".",
"CONTENT_LEN",
".",
"equalsIgnoreCase",
"(",
"headerName",
")",
"&&",
"!",
"HTTP",
".",
"TRANSFER_ENCODING",
".",
"equalsIgnoreCase",
"(",
"headerName",
")",
")",
"{",
"for",
"(",
"String",
"headerValue",
":",
"entry",
".",
"getValue",
"(",
")",
")",
"{",
"httpRequest",
".",
"addHeader",
"(",
"headerName",
",",
"headerValue",
")",
";",
"}",
"}",
"}",
"}"
] |
Add the given headers to the given HTTP request.
@param httpRequest the request to add the headers to
@param headers the headers to add
|
[
"Add",
"the",
"given",
"headers",
"to",
"the",
"given",
"HTTP",
"request",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequest.java#L101-L115
|
162,815 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java
|
GenericConversionService.canBypassConvert
|
public boolean canBypassConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
Assert.notNull(targetType, "The targetType to convert to cannot be null");
if (sourceType == null) {
return true;
}
GenericConverter converter = getConverter(sourceType, targetType);
return (converter == NO_OP_CONVERTER);
}
|
java
|
public boolean canBypassConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
Assert.notNull(targetType, "The targetType to convert to cannot be null");
if (sourceType == null) {
return true;
}
GenericConverter converter = getConverter(sourceType, targetType);
return (converter == NO_OP_CONVERTER);
}
|
[
"public",
"boolean",
"canBypassConvert",
"(",
"TypeDescriptor",
"sourceType",
",",
"TypeDescriptor",
"targetType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"targetType",
",",
"\"The targetType to convert to cannot be null\"",
")",
";",
"if",
"(",
"sourceType",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"GenericConverter",
"converter",
"=",
"getConverter",
"(",
"sourceType",
",",
"targetType",
")",
";",
"return",
"(",
"converter",
"==",
"NO_OP_CONVERTER",
")",
";",
"}"
] |
Returns true if conversion between the sourceType and targetType can be bypassed.
More precisely this method will return true if objects of sourceType can be
converted to the targetType by returning the source object unchanged.
@param sourceType context about the source type to convert from (may be null if source is null)
@param targetType context about the target type to convert to (required)
@return true if conversion can be bypassed
@throws IllegalArgumentException if targetType is null
|
[
"Returns",
"true",
"if",
"conversion",
"between",
"the",
"sourceType",
"and",
"targetType",
"can",
"be",
"bypassed",
".",
"More",
"precisely",
"this",
"method",
"will",
"return",
"true",
"if",
"objects",
"of",
"sourceType",
"can",
"be",
"converted",
"to",
"the",
"targetType",
"by",
"returning",
"the",
"source",
"object",
"unchanged",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java#L140-L147
|
162,816 |
spring-projects/spring-android
|
spring-android-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java
|
ConcurrentReferenceHashMap.calculateShift
|
protected static int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
}
|
java
|
protected static int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
}
|
[
"protected",
"static",
"int",
"calculateShift",
"(",
"int",
"minimumValue",
",",
"int",
"maximumValue",
")",
"{",
"int",
"shift",
"=",
"0",
";",
"int",
"value",
"=",
"1",
";",
"while",
"(",
"value",
"<",
"minimumValue",
"&&",
"value",
"<",
"maximumValue",
")",
"{",
"value",
"<<=",
"1",
";",
"shift",
"++",
";",
"}",
"return",
"shift",
";",
"}"
] |
Calculate a shift value that can be used to create a power-of-two value between
the specified maximum and minimum values.
@param minimumValue the minimum value
@param maximumValue the maximum value
@return the calculated shift (use {@code 1 << shift} to obtain a value)
|
[
"Calculate",
"a",
"shift",
"value",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"power",
"-",
"of",
"-",
"two",
"value",
"between",
"the",
"specified",
"maximum",
"and",
"minimum",
"values",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java#L383-L391
|
162,817 |
spring-projects/spring-android
|
spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java
|
MediaType.copyQualityValue
|
public MediaType copyQualityValue(MediaType mediaType) {
if (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));
return new MediaType(this, params);
}
|
java
|
public MediaType copyQualityValue(MediaType mediaType) {
if (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));
return new MediaType(this, params);
}
|
[
"public",
"MediaType",
"copyQualityValue",
"(",
"MediaType",
"mediaType",
")",
"{",
"if",
"(",
"!",
"mediaType",
".",
"parameters",
".",
"containsKey",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
"{",
"return",
"this",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"(",
"this",
".",
"parameters",
")",
";",
"params",
".",
"put",
"(",
"PARAM_QUALITY_FACTOR",
",",
"mediaType",
".",
"parameters",
".",
"get",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
";",
"return",
"new",
"MediaType",
"(",
"this",
",",
"params",
")",
";",
"}"
] |
Return a replica of this instance with the quality value of the given MediaType.
@return the same instance if the given MediaType doesn't have a quality value, or a new one otherwise
|
[
"Return",
"a",
"replica",
"of",
"this",
"instance",
"with",
"the",
"quality",
"value",
"of",
"the",
"given",
"MediaType",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java#L582-L589
|
162,818 |
spring-projects/spring-android
|
spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java
|
MediaType.removeQualityValue
|
public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
}
|
java
|
public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
}
|
[
"public",
"MediaType",
"removeQualityValue",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"parameters",
".",
"containsKey",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
"{",
"return",
"this",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"(",
"this",
".",
"parameters",
")",
";",
"params",
".",
"remove",
"(",
"PARAM_QUALITY_FACTOR",
")",
";",
"return",
"new",
"MediaType",
"(",
"this",
",",
"params",
")",
";",
"}"
] |
Return a replica of this instance with its quality value removed.
@return the same instance if the media type doesn't contain a quality value, or a new one otherwise
|
[
"Return",
"a",
"replica",
"of",
"this",
"instance",
"with",
"its",
"quality",
"value",
"removed",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java#L595-L602
|
162,819 |
spring-projects/spring-android
|
spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java
|
HttpHeaders.getFirst
|
@Override
public String getFirst(String headerName) {
List<String> headerValues = headers.get(headerName);
return headerValues != null ? headerValues.get(0) : null;
}
|
java
|
@Override
public String getFirst(String headerName) {
List<String> headerValues = headers.get(headerName);
return headerValues != null ? headerValues.get(0) : null;
}
|
[
"@",
"Override",
"public",
"String",
"getFirst",
"(",
"String",
"headerName",
")",
"{",
"List",
"<",
"String",
">",
"headerValues",
"=",
"headers",
".",
"get",
"(",
"headerName",
")",
";",
"return",
"headerValues",
"!=",
"null",
"?",
"headerValues",
".",
"get",
"(",
"0",
")",
":",
"null",
";",
"}"
] |
Return the first header value for the given header name, if any.
@param headerName the header name
@return the first header value, or {@code null} if none
|
[
"Return",
"the",
"first",
"header",
"value",
"for",
"the",
"given",
"header",
"name",
"if",
"any",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L921-L925
|
162,820 |
spring-projects/spring-android
|
spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java
|
HttpHeaders.add
|
@Override
public void add(String headerName, String headerValue) {
List<String> headerValues = headers.get(headerName);
if (headerValues == null) {
headerValues = new LinkedList<String>();
this.headers.put(headerName, headerValues);
}
headerValues.add(headerValue);
}
|
java
|
@Override
public void add(String headerName, String headerValue) {
List<String> headerValues = headers.get(headerName);
if (headerValues == null) {
headerValues = new LinkedList<String>();
this.headers.put(headerName, headerValues);
}
headerValues.add(headerValue);
}
|
[
"@",
"Override",
"public",
"void",
"add",
"(",
"String",
"headerName",
",",
"String",
"headerValue",
")",
"{",
"List",
"<",
"String",
">",
"headerValues",
"=",
"headers",
".",
"get",
"(",
"headerName",
")",
";",
"if",
"(",
"headerValues",
"==",
"null",
")",
"{",
"headerValues",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"this",
".",
"headers",
".",
"put",
"(",
"headerName",
",",
"headerValues",
")",
";",
"}",
"headerValues",
".",
"add",
"(",
"headerValue",
")",
";",
"}"
] |
Add the given, single header value under the given name.
@param headerName the header name
@param headerValue the header value
@throws UnsupportedOperationException if adding headers is not supported
@see #put(String, List)
@see #set(String, String)
|
[
"Add",
"the",
"given",
"single",
"header",
"value",
"under",
"the",
"given",
"name",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L935-L943
|
162,821 |
spring-projects/spring-android
|
spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java
|
HttpHeaders.set
|
@Override
public void set(String headerName, String headerValue) {
List<String> headerValues = new LinkedList<String>();
headerValues.add(headerValue);
headers.put(headerName, headerValues);
}
|
java
|
@Override
public void set(String headerName, String headerValue) {
List<String> headerValues = new LinkedList<String>();
headerValues.add(headerValue);
headers.put(headerName, headerValues);
}
|
[
"@",
"Override",
"public",
"void",
"set",
"(",
"String",
"headerName",
",",
"String",
"headerValue",
")",
"{",
"List",
"<",
"String",
">",
"headerValues",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"headerValues",
".",
"add",
"(",
"headerValue",
")",
";",
"headers",
".",
"put",
"(",
"headerName",
",",
"headerValues",
")",
";",
"}"
] |
Set the given, single header value under the given name.
@param headerName the header name
@param headerValue the header value
@throws UnsupportedOperationException if adding headers is not supported
@see #put(String, List)
@see #add(String, String)
|
[
"Set",
"the",
"given",
"single",
"header",
"value",
"under",
"the",
"given",
"name",
"."
] |
941296e152d49a40e0745a3e81628a974f72b7e4
|
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L953-L958
|
162,822 |
Trinea/android-auto-scroll-view-pager
|
src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java
|
AutoScrollViewPager.setViewPagerScroller
|
private void setViewPagerScroller() {
try {
Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
scrollerField.setAccessible(true);
Field interpolatorField = ViewPager.class.getDeclaredField("sInterpolator");
interpolatorField.setAccessible(true);
scroller = new CustomDurationScroller(getContext(), (Interpolator)interpolatorField.get(null));
scrollerField.set(this, scroller);
} catch (Exception e) {
e.printStackTrace();
}
}
|
java
|
private void setViewPagerScroller() {
try {
Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
scrollerField.setAccessible(true);
Field interpolatorField = ViewPager.class.getDeclaredField("sInterpolator");
interpolatorField.setAccessible(true);
scroller = new CustomDurationScroller(getContext(), (Interpolator)interpolatorField.get(null));
scrollerField.set(this, scroller);
} catch (Exception e) {
e.printStackTrace();
}
}
|
[
"private",
"void",
"setViewPagerScroller",
"(",
")",
"{",
"try",
"{",
"Field",
"scrollerField",
"=",
"ViewPager",
".",
"class",
".",
"getDeclaredField",
"(",
"\"mScroller\"",
")",
";",
"scrollerField",
".",
"setAccessible",
"(",
"true",
")",
";",
"Field",
"interpolatorField",
"=",
"ViewPager",
".",
"class",
".",
"getDeclaredField",
"(",
"\"sInterpolator\"",
")",
";",
"interpolatorField",
".",
"setAccessible",
"(",
"true",
")",
";",
"scroller",
"=",
"new",
"CustomDurationScroller",
"(",
"getContext",
"(",
")",
",",
"(",
"Interpolator",
")",
"interpolatorField",
".",
"get",
"(",
"null",
")",
")",
";",
"scrollerField",
".",
"set",
"(",
"this",
",",
"scroller",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
set ViewPager scroller to change animation duration when sliding
|
[
"set",
"ViewPager",
"scroller",
"to",
"change",
"animation",
"duration",
"when",
"sliding"
] |
6dcbf643236a347b5c4ca15ad62b444c60783d05
|
https://github.com/Trinea/android-auto-scroll-view-pager/blob/6dcbf643236a347b5c4ca15ad62b444c60783d05/src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java#L140-L152
|
162,823 |
Trinea/android-auto-scroll-view-pager
|
src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java
|
AutoScrollViewPager.scrollOnce
|
public void scrollOnce() {
PagerAdapter adapter = getAdapter();
int currentItem = getCurrentItem();
int totalCount;
if (adapter == null || (totalCount = adapter.getCount()) <= 1) {
return;
}
int nextItem = (direction == LEFT) ? --currentItem : ++currentItem;
if (nextItem < 0) {
if (isCycle) {
setCurrentItem(totalCount - 1, isBorderAnimation);
}
} else if (nextItem == totalCount) {
if (isCycle) {
setCurrentItem(0, isBorderAnimation);
}
} else {
setCurrentItem(nextItem, true);
}
}
|
java
|
public void scrollOnce() {
PagerAdapter adapter = getAdapter();
int currentItem = getCurrentItem();
int totalCount;
if (adapter == null || (totalCount = adapter.getCount()) <= 1) {
return;
}
int nextItem = (direction == LEFT) ? --currentItem : ++currentItem;
if (nextItem < 0) {
if (isCycle) {
setCurrentItem(totalCount - 1, isBorderAnimation);
}
} else if (nextItem == totalCount) {
if (isCycle) {
setCurrentItem(0, isBorderAnimation);
}
} else {
setCurrentItem(nextItem, true);
}
}
|
[
"public",
"void",
"scrollOnce",
"(",
")",
"{",
"PagerAdapter",
"adapter",
"=",
"getAdapter",
"(",
")",
";",
"int",
"currentItem",
"=",
"getCurrentItem",
"(",
")",
";",
"int",
"totalCount",
";",
"if",
"(",
"adapter",
"==",
"null",
"||",
"(",
"totalCount",
"=",
"adapter",
".",
"getCount",
"(",
")",
")",
"<=",
"1",
")",
"{",
"return",
";",
"}",
"int",
"nextItem",
"=",
"(",
"direction",
"==",
"LEFT",
")",
"?",
"--",
"currentItem",
":",
"++",
"currentItem",
";",
"if",
"(",
"nextItem",
"<",
"0",
")",
"{",
"if",
"(",
"isCycle",
")",
"{",
"setCurrentItem",
"(",
"totalCount",
"-",
"1",
",",
"isBorderAnimation",
")",
";",
"}",
"}",
"else",
"if",
"(",
"nextItem",
"==",
"totalCount",
")",
"{",
"if",
"(",
"isCycle",
")",
"{",
"setCurrentItem",
"(",
"0",
",",
"isBorderAnimation",
")",
";",
"}",
"}",
"else",
"{",
"setCurrentItem",
"(",
"nextItem",
",",
"true",
")",
";",
"}",
"}"
] |
scroll only once
|
[
"scroll",
"only",
"once"
] |
6dcbf643236a347b5c4ca15ad62b444c60783d05
|
https://github.com/Trinea/android-auto-scroll-view-pager/blob/6dcbf643236a347b5c4ca15ad62b444c60783d05/src/cn/trinea/android/view/autoscrollviewpager/AutoScrollViewPager.java#L157-L177
|
162,824 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java
|
MaterialNavigationDrawer.setHomeAsUpIndicator
|
public void setHomeAsUpIndicator(Drawable indicator) {
if(!deviceSupportMultiPane()) {
pulsante.setHomeAsUpIndicator(indicator);
}
else {
actionBar.setHomeAsUpIndicator(indicator);
}
}
|
java
|
public void setHomeAsUpIndicator(Drawable indicator) {
if(!deviceSupportMultiPane()) {
pulsante.setHomeAsUpIndicator(indicator);
}
else {
actionBar.setHomeAsUpIndicator(indicator);
}
}
|
[
"public",
"void",
"setHomeAsUpIndicator",
"(",
"Drawable",
"indicator",
")",
"{",
"if",
"(",
"!",
"deviceSupportMultiPane",
"(",
")",
")",
"{",
"pulsante",
".",
"setHomeAsUpIndicator",
"(",
"indicator",
")",
";",
"}",
"else",
"{",
"actionBar",
".",
"setHomeAsUpIndicator",
"(",
"indicator",
")",
";",
"}",
"}"
] |
Set the HomeAsUpIndicator that is visible when user navigate to a fragment child
@param indicator the resource drawable to use as indicator
|
[
"Set",
"the",
"HomeAsUpIndicator",
"that",
"is",
"visible",
"when",
"user",
"navigate",
"to",
"a",
"fragment",
"child"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L1444-L1451
|
162,825 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java
|
MaterialNavigationDrawer.getSectionByTitle
|
public MaterialSection getSectionByTitle(String title) {
for(MaterialSection section : sectionList) {
if(section.getTitle().equals(title)) {
return section;
}
}
for(MaterialSection section : bottomSectionList) {
if(section.getTitle().equals(title))
return section;
}
return null;
}
|
java
|
public MaterialSection getSectionByTitle(String title) {
for(MaterialSection section : sectionList) {
if(section.getTitle().equals(title)) {
return section;
}
}
for(MaterialSection section : bottomSectionList) {
if(section.getTitle().equals(title))
return section;
}
return null;
}
|
[
"public",
"MaterialSection",
"getSectionByTitle",
"(",
"String",
"title",
")",
"{",
"for",
"(",
"MaterialSection",
"section",
":",
"sectionList",
")",
"{",
"if",
"(",
"section",
".",
"getTitle",
"(",
")",
".",
"equals",
"(",
"title",
")",
")",
"{",
"return",
"section",
";",
"}",
"}",
"for",
"(",
"MaterialSection",
"section",
":",
"bottomSectionList",
")",
"{",
"if",
"(",
"section",
".",
"getTitle",
"(",
")",
".",
"equals",
"(",
"title",
")",
")",
"return",
"section",
";",
"}",
"return",
"null",
";",
"}"
] |
Get a setted section knowing his title
N.B. this search only into section list and bottom section list.
@param title is the title of the section
@return the section with title or null if the section is not founded
|
[
"Get",
"a",
"setted",
"section",
"knowing",
"his",
"title"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L1964-L1978
|
162,826 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java
|
MaterialNavigationDrawer.getSectionList
|
public List<MaterialSection> getSectionList() {
List<MaterialSection> list = new LinkedList<>();
for(MaterialSection section : sectionList)
list.add(section);
for(MaterialSection section : bottomSectionList)
list.add(section);
return list;
}
|
java
|
public List<MaterialSection> getSectionList() {
List<MaterialSection> list = new LinkedList<>();
for(MaterialSection section : sectionList)
list.add(section);
for(MaterialSection section : bottomSectionList)
list.add(section);
return list;
}
|
[
"public",
"List",
"<",
"MaterialSection",
">",
"getSectionList",
"(",
")",
"{",
"List",
"<",
"MaterialSection",
">",
"list",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"MaterialSection",
"section",
":",
"sectionList",
")",
"list",
".",
"(",
"section",
")",
";",
"for",
"(",
"MaterialSection",
"section",
":",
"bottomSectionList",
")",
"list",
".",
"(",
"section",
")",
";",
"return",
"list",
";",
"}"
] |
Get the section list
N.B. The section list contains the bottom sections
@return the list of sections setted
|
[
"Get",
"the",
"section",
"list"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L1986-L1996
|
162,827 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java
|
MaterialNavigationDrawer.getAccountAtCurrentPosition
|
public MaterialAccount getAccountAtCurrentPosition(int position) {
if (position < 0 || position >= accountManager.size())
throw new RuntimeException("Account Index Overflow");
return findAccountNumber(position);
}
|
java
|
public MaterialAccount getAccountAtCurrentPosition(int position) {
if (position < 0 || position >= accountManager.size())
throw new RuntimeException("Account Index Overflow");
return findAccountNumber(position);
}
|
[
"public",
"MaterialAccount",
"getAccountAtCurrentPosition",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"position",
"<",
"0",
"||",
"position",
">=",
"accountManager",
".",
"size",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Account Index Overflow\"",
")",
";",
"return",
"findAccountNumber",
"(",
"position",
")",
";",
"}"
] |
Get the account knowing his position
@param position the position of the account (it can change at runtime!)
@return the account
|
[
"Get",
"the",
"account",
"knowing",
"his",
"position"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L2019-L2025
|
162,828 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java
|
MaterialNavigationDrawer.getAccountByTitle
|
public MaterialAccount getAccountByTitle(String title) {
for(MaterialAccount account : accountManager)
if(currentAccount.getTitle().equals(title))
return account;
return null;
}
|
java
|
public MaterialAccount getAccountByTitle(String title) {
for(MaterialAccount account : accountManager)
if(currentAccount.getTitle().equals(title))
return account;
return null;
}
|
[
"public",
"MaterialAccount",
"getAccountByTitle",
"(",
"String",
"title",
")",
"{",
"for",
"(",
"MaterialAccount",
"account",
":",
"accountManager",
")",
"if",
"(",
"currentAccount",
".",
"getTitle",
"(",
")",
".",
"equals",
"(",
"title",
")",
")",
"return",
"account",
";",
"return",
"null",
";",
"}"
] |
Get the account knowing his title
@param title the title of the account (it can change at runtime!)
@return the account founded or null if the account not exists
|
[
"Get",
"the",
"account",
"knowing",
"his",
"title"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/MaterialNavigationDrawer.java#L2032-L2038
|
162,829 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java
|
MaterialSection.onTouch
|
@Override
@SuppressLint("NewApi")
public boolean onTouch(View v, MotionEvent event) {
if(touchable) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
view.setBackgroundColor(colorPressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_CANCEL) {
if (isSelected)
view.setBackgroundColor(colorSelected);
else
view.setBackgroundColor(colorUnpressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_UP) {
view.setBackgroundColor(colorSelected);
afterClick();
return true;
}
}
return false;
}
|
java
|
@Override
@SuppressLint("NewApi")
public boolean onTouch(View v, MotionEvent event) {
if(touchable) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
view.setBackgroundColor(colorPressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_CANCEL) {
if (isSelected)
view.setBackgroundColor(colorSelected);
else
view.setBackgroundColor(colorUnpressed);
return true;
}
if (event.getAction() == MotionEvent.ACTION_UP) {
view.setBackgroundColor(colorSelected);
afterClick();
return true;
}
}
return false;
}
|
[
"@",
"Override",
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"boolean",
"onTouch",
"(",
"View",
"v",
",",
"MotionEvent",
"event",
")",
"{",
"if",
"(",
"touchable",
")",
"{",
"if",
"(",
"event",
".",
"getAction",
"(",
")",
"==",
"MotionEvent",
".",
"ACTION_DOWN",
")",
"{",
"view",
".",
"setBackgroundColor",
"(",
"colorPressed",
")",
";",
"return",
"true",
";",
"}",
"if",
"(",
"event",
".",
"getAction",
"(",
")",
"==",
"MotionEvent",
".",
"ACTION_CANCEL",
")",
"{",
"if",
"(",
"isSelected",
")",
"view",
".",
"setBackgroundColor",
"(",
"colorSelected",
")",
";",
"else",
"view",
".",
"setBackgroundColor",
"(",
"colorUnpressed",
")",
";",
"return",
"true",
";",
"}",
"if",
"(",
"event",
".",
"getAction",
"(",
")",
"==",
"MotionEvent",
".",
"ACTION_UP",
")",
"{",
"view",
".",
"setBackgroundColor",
"(",
"colorSelected",
")",
";",
"afterClick",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
touch event without ripple support
|
[
"touch",
"event",
"without",
"ripple",
"support"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java#L240-L271
|
162,830 |
neokree/MaterialNavigationDrawer
|
MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java
|
MaterialSection.setBackgroundColor
|
public void setBackgroundColor(int color) {
colorUnpressed = color;
if(!isSelected()) {
if (rippleAnimationSupport()) {
ripple.setRippleBackground(colorUnpressed);
}
else {
view.setBackgroundColor(colorUnpressed);
}
}
}
|
java
|
public void setBackgroundColor(int color) {
colorUnpressed = color;
if(!isSelected()) {
if (rippleAnimationSupport()) {
ripple.setRippleBackground(colorUnpressed);
}
else {
view.setBackgroundColor(colorUnpressed);
}
}
}
|
[
"public",
"void",
"setBackgroundColor",
"(",
"int",
"color",
")",
"{",
"colorUnpressed",
"=",
"color",
";",
"if",
"(",
"!",
"isSelected",
"(",
")",
")",
"{",
"if",
"(",
"rippleAnimationSupport",
"(",
")",
")",
"{",
"ripple",
".",
"setRippleBackground",
"(",
"colorUnpressed",
")",
";",
"}",
"else",
"{",
"view",
".",
"setBackgroundColor",
"(",
"colorUnpressed",
")",
";",
"}",
"}",
"}"
] |
alias of setColorUnpressed
|
[
"alias",
"of",
"setColorUnpressed"
] |
86e355f6190dcb7255c6b9c28c1e54cf96f46358
|
https://github.com/neokree/MaterialNavigationDrawer/blob/86e355f6190dcb7255c6b9c28c1e54cf96f46358/MaterialNavigationDrawerModule/src/main/java/it/neokree/materialnavigationdrawer/elements/MaterialSection.java#L379-L390
|
162,831 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getNodes
|
public List<NodeInfo> getNodes() {
final URI uri = uriWithPath("./nodes/");
return Arrays.asList(this.rt.getForObject(uri, NodeInfo[].class));
}
|
java
|
public List<NodeInfo> getNodes() {
final URI uri = uriWithPath("./nodes/");
return Arrays.asList(this.rt.getForObject(uri, NodeInfo[].class));
}
|
[
"public",
"List",
"<",
"NodeInfo",
">",
"getNodes",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./nodes/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"NodeInfo",
"[",
"]",
".",
"class",
")",
")",
";",
"}"
] |
Retrieves state and metrics information for all nodes in the cluster.
@return list of nodes in the cluster
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"nodes",
"in",
"the",
"cluster",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L267-L270
|
162,832 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getNode
|
public NodeInfo getNode(String name) {
final URI uri = uriWithPath("./nodes/" + encodePathSegment(name));
return this.rt.getForObject(uri, NodeInfo.class);
}
|
java
|
public NodeInfo getNode(String name) {
final URI uri = uriWithPath("./nodes/" + encodePathSegment(name));
return this.rt.getForObject(uri, NodeInfo.class);
}
|
[
"public",
"NodeInfo",
"getNode",
"(",
"String",
"name",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./nodes/\"",
"+",
"encodePathSegment",
"(",
"name",
")",
")",
";",
"return",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"NodeInfo",
".",
"class",
")",
";",
"}"
] |
Retrieves state and metrics information for individual node.
@param name node name
@return node information
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"individual",
"node",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L278-L281
|
162,833 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getConnections
|
public List<ConnectionInfo> getConnections() {
final URI uri = uriWithPath("./connections/");
return Arrays.asList(this.rt.getForObject(uri, ConnectionInfo[].class));
}
|
java
|
public List<ConnectionInfo> getConnections() {
final URI uri = uriWithPath("./connections/");
return Arrays.asList(this.rt.getForObject(uri, ConnectionInfo[].class));
}
|
[
"public",
"List",
"<",
"ConnectionInfo",
">",
"getConnections",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./connections/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"ConnectionInfo",
"[",
"]",
".",
"class",
")",
")",
";",
"}"
] |
Retrieves state and metrics information for all client connections across the cluster.
@return list of connections across the cluster
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"client",
"connections",
"across",
"the",
"cluster",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L288-L291
|
162,834 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getConnection
|
public ConnectionInfo getConnection(String name) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(name));
return this.rt.getForObject(uri, ConnectionInfo.class);
}
|
java
|
public ConnectionInfo getConnection(String name) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(name));
return this.rt.getForObject(uri, ConnectionInfo.class);
}
|
[
"public",
"ConnectionInfo",
"getConnection",
"(",
"String",
"name",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./connections/\"",
"+",
"encodePathSegment",
"(",
"name",
")",
")",
";",
"return",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"ConnectionInfo",
".",
"class",
")",
";",
"}"
] |
Retrieves state and metrics information for individual client connection.
@param name connection name
@return connection information
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"individual",
"client",
"connection",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L299-L302
|
162,835 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getChannels
|
public List<ChannelInfo> getChannels() {
final URI uri = uriWithPath("./channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
}
|
java
|
public List<ChannelInfo> getChannels() {
final URI uri = uriWithPath("./channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
}
|
[
"public",
"List",
"<",
"ChannelInfo",
">",
"getChannels",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./channels/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"ChannelInfo",
"[",
"]",
".",
"class",
")",
")",
";",
"}"
] |
Retrieves state and metrics information for all channels across the cluster.
@return list of channels across the cluster
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"channels",
"across",
"the",
"cluster",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L336-L339
|
162,836 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getChannels
|
public List<ChannelInfo> getChannels(String connectionName) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(connectionName) + "/channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
}
|
java
|
public List<ChannelInfo> getChannels(String connectionName) {
final URI uri = uriWithPath("./connections/" + encodePathSegment(connectionName) + "/channels/");
return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
}
|
[
"public",
"List",
"<",
"ChannelInfo",
">",
"getChannels",
"(",
"String",
"connectionName",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./connections/\"",
"+",
"encodePathSegment",
"(",
"connectionName",
")",
"+",
"\"/channels/\"",
")",
";",
"return",
"Arrays",
".",
"asList",
"(",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"ChannelInfo",
"[",
"]",
".",
"class",
")",
")",
";",
"}"
] |
Retrieves state and metrics information for all channels on individual connection.
@param connectionName the connection name to retrieve channels
@return list of channels on the connection
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"all",
"channels",
"on",
"individual",
"connection",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L346-L349
|
162,837 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getChannel
|
public ChannelInfo getChannel(String name) {
final URI uri = uriWithPath("./channels/" + encodePathSegment(name));
return this.rt.getForObject(uri, ChannelInfo.class);
}
|
java
|
public ChannelInfo getChannel(String name) {
final URI uri = uriWithPath("./channels/" + encodePathSegment(name));
return this.rt.getForObject(uri, ChannelInfo.class);
}
|
[
"public",
"ChannelInfo",
"getChannel",
"(",
"String",
"name",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./channels/\"",
"+",
"encodePathSegment",
"(",
"name",
")",
")",
";",
"return",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"ChannelInfo",
".",
"class",
")",
";",
"}"
] |
Retrieves state and metrics information for individual channel.
@param name channel name
@return channel information
|
[
"Retrieves",
"state",
"and",
"metrics",
"information",
"for",
"individual",
"channel",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L357-L360
|
162,838 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.getQueueBindings
|
public List<BindingInfo> getQueueBindings(String vhost, String queue) {
final URI uri = uriWithPath("./queues/" + encodePathSegment(vhost) +
"/" + encodePathSegment(queue) + "/bindings");
final BindingInfo[] result = this.rt.getForObject(uri, BindingInfo[].class);
return asListOrNull(result);
}
|
java
|
public List<BindingInfo> getQueueBindings(String vhost, String queue) {
final URI uri = uriWithPath("./queues/" + encodePathSegment(vhost) +
"/" + encodePathSegment(queue) + "/bindings");
final BindingInfo[] result = this.rt.getForObject(uri, BindingInfo[].class);
return asListOrNull(result);
}
|
[
"public",
"List",
"<",
"BindingInfo",
">",
"getQueueBindings",
"(",
"String",
"vhost",
",",
"String",
"queue",
")",
"{",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./queues/\"",
"+",
"encodePathSegment",
"(",
"vhost",
")",
"+",
"\"/\"",
"+",
"encodePathSegment",
"(",
"queue",
")",
"+",
"\"/bindings\"",
")",
";",
"final",
"BindingInfo",
"[",
"]",
"result",
"=",
"this",
".",
"rt",
".",
"getForObject",
"(",
"uri",
",",
"BindingInfo",
"[",
"]",
".",
"class",
")",
";",
"return",
"asListOrNull",
"(",
"result",
")",
";",
"}"
] |
Returns a list of bindings where provided queue is the destination.
@param vhost vhost of the exchange
@param queue destination queue name
@return list of bindings
|
[
"Returns",
"a",
"list",
"of",
"bindings",
"where",
"provided",
"queue",
"is",
"the",
"destination",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L632-L637
|
162,839 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.declareShovel
|
public void declareShovel(String vhost, ShovelInfo info) {
Map<String, Object> props = info.getDetails().getPublishProperties();
if(props != null && props.isEmpty()) {
throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null");
}
final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName()));
this.rt.put(uri, info);
}
|
java
|
public void declareShovel(String vhost, ShovelInfo info) {
Map<String, Object> props = info.getDetails().getPublishProperties();
if(props != null && props.isEmpty()) {
throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null");
}
final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName()));
this.rt.put(uri, info);
}
|
[
"public",
"void",
"declareShovel",
"(",
"String",
"vhost",
",",
"ShovelInfo",
"info",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"info",
".",
"getDetails",
"(",
")",
".",
"getPublishProperties",
"(",
")",
";",
"if",
"(",
"props",
"!=",
"null",
"&&",
"props",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Shovel publish properties must be a non-empty map or null\"",
")",
";",
"}",
"final",
"URI",
"uri",
"=",
"uriWithPath",
"(",
"\"./parameters/shovel/\"",
"+",
"encodePathSegment",
"(",
"vhost",
")",
"+",
"\"/\"",
"+",
"encodePathSegment",
"(",
"info",
".",
"getName",
"(",
")",
")",
")",
";",
"this",
".",
"rt",
".",
"put",
"(",
"uri",
",",
"info",
")",
";",
"}"
] |
Declares a shovel.
@param vhost virtual host where to declare the shovel
@param info Shovel info.
|
[
"Declares",
"a",
"shovel",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L768-L775
|
162,840 |
rabbitmq/hop
|
src/main/java/com/rabbitmq/http/client/Client.java
|
Client.deleteShovel
|
public void deleteShovel(String vhost, String shovelname) {
this.deleteIgnoring404(uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(shovelname)));
}
|
java
|
public void deleteShovel(String vhost, String shovelname) {
this.deleteIgnoring404(uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(shovelname)));
}
|
[
"public",
"void",
"deleteShovel",
"(",
"String",
"vhost",
",",
"String",
"shovelname",
")",
"{",
"this",
".",
"deleteIgnoring404",
"(",
"uriWithPath",
"(",
"\"./parameters/shovel/\"",
"+",
"encodePathSegment",
"(",
"vhost",
")",
"+",
"\"/\"",
"+",
"encodePathSegment",
"(",
"shovelname",
")",
")",
")",
";",
"}"
] |
Deletes the specified shovel from specified virtual host.
@param vhost virtual host from where to delete the shovel
@param shovelname Shovel to be deleted.
|
[
"Deletes",
"the",
"specified",
"shovel",
"from",
"specified",
"virtual",
"host",
"."
] |
94e70f1f7e39f523a11ab3162b4efc976311ee03
|
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L827-L829
|
162,841 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_CellContext.java
|
AT_CellContext.setCharTranslator
|
public void setCharTranslator(CharacterTranslator charTranslator) {
if(charTranslator!=null){
this.charTranslator = charTranslator;
this.htmlElementTranslator = null;
this.targetTranslator = null;
}
}
|
java
|
public void setCharTranslator(CharacterTranslator charTranslator) {
if(charTranslator!=null){
this.charTranslator = charTranslator;
this.htmlElementTranslator = null;
this.targetTranslator = null;
}
}
|
[
"public",
"void",
"setCharTranslator",
"(",
"CharacterTranslator",
"charTranslator",
")",
"{",
"if",
"(",
"charTranslator",
"!=",
"null",
")",
"{",
"this",
".",
"charTranslator",
"=",
"charTranslator",
";",
"this",
".",
"htmlElementTranslator",
"=",
"null",
";",
"this",
".",
"targetTranslator",
"=",
"null",
";",
"}",
"}"
] |
Sets the character translator.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param charTranslator translator
|
[
"Sets",
"the",
"character",
"translator",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L173-L179
|
162,842 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_CellContext.java
|
AT_CellContext.setHtmlElementTranslator
|
public void setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
if(htmlElementTranslator!=null){
this.htmlElementTranslator = htmlElementTranslator;
this.charTranslator = null;
this.targetTranslator = null;
}
}
|
java
|
public void setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
if(htmlElementTranslator!=null){
this.htmlElementTranslator = htmlElementTranslator;
this.charTranslator = null;
this.targetTranslator = null;
}
}
|
[
"public",
"void",
"setHtmlElementTranslator",
"(",
"HtmlElementTranslator",
"htmlElementTranslator",
")",
"{",
"if",
"(",
"htmlElementTranslator",
"!=",
"null",
")",
"{",
"this",
".",
"htmlElementTranslator",
"=",
"htmlElementTranslator",
";",
"this",
".",
"charTranslator",
"=",
"null",
";",
"this",
".",
"targetTranslator",
"=",
"null",
";",
"}",
"}"
] |
Sets the HTML entity translator.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param htmlElementTranslator translator
|
[
"Sets",
"the",
"HTML",
"entity",
"translator",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L187-L193
|
162,843 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_CellContext.java
|
AT_CellContext.setPadding
|
public AT_CellContext setPadding(int padding){
if(padding>-1){
this.paddingTop = padding;
this.paddingBottom = padding;
this.paddingLeft = padding;
this.paddingRight = padding;
}
return this;
}
|
java
|
public AT_CellContext setPadding(int padding){
if(padding>-1){
this.paddingTop = padding;
this.paddingBottom = padding;
this.paddingLeft = padding;
this.paddingRight = padding;
}
return this;
}
|
[
"public",
"AT_CellContext",
"setPadding",
"(",
"int",
"padding",
")",
"{",
"if",
"(",
"padding",
">",
"-",
"1",
")",
"{",
"this",
".",
"paddingTop",
"=",
"padding",
";",
"this",
".",
"paddingBottom",
"=",
"padding",
";",
"this",
".",
"paddingLeft",
"=",
"padding",
";",
"this",
".",
"paddingRight",
"=",
"padding",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets all padding to the same value.
@param padding new padding for top, bottom, left, and right, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"all",
"padding",
"to",
"the",
"same",
"value",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L200-L208
|
162,844 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_CellContext.java
|
AT_CellContext.setTargetTranslator
|
public void setTargetTranslator(TargetTranslator targetTranslator) {
if(targetTranslator!=null){
this.targetTranslator = targetTranslator;
this.charTranslator = null;
this.htmlElementTranslator = null;
}
}
|
java
|
public void setTargetTranslator(TargetTranslator targetTranslator) {
if(targetTranslator!=null){
this.targetTranslator = targetTranslator;
this.charTranslator = null;
this.htmlElementTranslator = null;
}
}
|
[
"public",
"void",
"setTargetTranslator",
"(",
"TargetTranslator",
"targetTranslator",
")",
"{",
"if",
"(",
"targetTranslator",
"!=",
"null",
")",
"{",
"this",
".",
"targetTranslator",
"=",
"targetTranslator",
";",
"this",
".",
"charTranslator",
"=",
"null",
";",
"this",
".",
"htmlElementTranslator",
"=",
"null",
";",
"}",
"}"
] |
Sets the target translator.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param targetTranslator translator
|
[
"Sets",
"the",
"target",
"translator",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_CellContext.java#L366-L372
|
162,845 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/CWC_LongestWord.java
|
CWC_LongestWord.longestWord
|
public static int[] longestWord(LinkedList<AT_Row> rows, int colNumbers){
if(rows==null){
return null;
}
if(rows.size()==0){
return new int[0];
}
int[] ret = new int[colNumbers];
for(AT_Row row : rows){
if(row.getType()==TableRowType.CONTENT) {
LinkedList<AT_Cell> cells = row.getCells();
for(int i=0; i<cells.size(); i++) {
if(cells.get(i).getContent()!=null){
String[] ar = StringUtils.split(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString());
for(int k=0; k<ar.length; k++){
int count = ar[k].length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight();
if(count>ret[i]){
ret[i] = count;
}
}
}
}
}
}
return ret;
}
|
java
|
public static int[] longestWord(LinkedList<AT_Row> rows, int colNumbers){
if(rows==null){
return null;
}
if(rows.size()==0){
return new int[0];
}
int[] ret = new int[colNumbers];
for(AT_Row row : rows){
if(row.getType()==TableRowType.CONTENT) {
LinkedList<AT_Cell> cells = row.getCells();
for(int i=0; i<cells.size(); i++) {
if(cells.get(i).getContent()!=null){
String[] ar = StringUtils.split(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString());
for(int k=0; k<ar.length; k++){
int count = ar[k].length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight();
if(count>ret[i]){
ret[i] = count;
}
}
}
}
}
}
return ret;
}
|
[
"public",
"static",
"int",
"[",
"]",
"longestWord",
"(",
"LinkedList",
"<",
"AT_Row",
">",
"rows",
",",
"int",
"colNumbers",
")",
"{",
"if",
"(",
"rows",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"rows",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"int",
"[",
"0",
"]",
";",
"}",
"int",
"[",
"]",
"ret",
"=",
"new",
"int",
"[",
"colNumbers",
"]",
";",
"for",
"(",
"AT_Row",
"row",
":",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"LinkedList",
"<",
"AT_Cell",
">",
"cells",
"=",
"row",
".",
"getCells",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cells",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cells",
".",
"get",
"(",
"i",
")",
".",
"getContent",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"ar",
"=",
"StringUtils",
".",
"split",
"(",
"Object_To_StrBuilder",
".",
"convert",
"(",
"cells",
".",
"get",
"(",
"i",
")",
".",
"getContent",
"(",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"ar",
".",
"length",
";",
"k",
"++",
")",
"{",
"int",
"count",
"=",
"ar",
"[",
"k",
"]",
".",
"length",
"(",
")",
"+",
"cells",
".",
"get",
"(",
"i",
")",
".",
"getContext",
"(",
")",
".",
"getPaddingLeft",
"(",
")",
"+",
"cells",
".",
"get",
"(",
"i",
")",
".",
"getContext",
"(",
")",
".",
"getPaddingRight",
"(",
")",
";",
"if",
"(",
"count",
">",
"ret",
"[",
"i",
"]",
")",
"{",
"ret",
"[",
"i",
"]",
"=",
"count",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Returns an array with the width of the longest word per column calculated from the given table.
Default padding will be added per column.
Padding for individual columns will be added if defined.
@param rows the table rows for calculations
@param colNumbers number of columns in the table
@return array with width of longest word for each column, null if input table was null
|
[
"Returns",
"an",
"array",
"with",
"the",
"width",
"of",
"the",
"longest",
"word",
"per",
"column",
"calculated",
"from",
"the",
"given",
"table",
".",
"Default",
"padding",
"will",
"be",
"added",
"per",
"column",
".",
"Padding",
"for",
"individual",
"columns",
"will",
"be",
"added",
"if",
"defined",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/CWC_LongestWord.java#L49-L79
|
162,846 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.createRule
|
public static AT_Row createRule(TableRowType type, TableRowStyle style){
Validate.notNull(type);
Validate.validState(type!=TableRowType.UNKNOWN);
Validate.validState(type!=TableRowType.CONTENT);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
return new AT_Row(){
@Override
public TableRowType getType(){
return type;
}
@Override
public TableRowStyle getStyle(){
return style;
}
};
}
|
java
|
public static AT_Row createRule(TableRowType type, TableRowStyle style){
Validate.notNull(type);
Validate.validState(type!=TableRowType.UNKNOWN);
Validate.validState(type!=TableRowType.CONTENT);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
return new AT_Row(){
@Override
public TableRowType getType(){
return type;
}
@Override
public TableRowStyle getStyle(){
return style;
}
};
}
|
[
"public",
"static",
"AT_Row",
"createRule",
"(",
"TableRowType",
"type",
",",
"TableRowStyle",
"style",
")",
"{",
"Validate",
".",
"notNull",
"(",
"type",
")",
";",
"Validate",
".",
"validState",
"(",
"type",
"!=",
"TableRowType",
".",
"UNKNOWN",
")",
";",
"Validate",
".",
"validState",
"(",
"type",
"!=",
"TableRowType",
".",
"CONTENT",
")",
";",
"Validate",
".",
"notNull",
"(",
"style",
")",
";",
"Validate",
".",
"validState",
"(",
"style",
"!=",
"TableRowStyle",
".",
"UNKNOWN",
")",
";",
"return",
"new",
"AT_Row",
"(",
")",
"{",
"@",
"Override",
"public",
"TableRowType",
"getType",
"(",
")",
"{",
"return",
"type",
";",
"}",
"@",
"Override",
"public",
"TableRowStyle",
"getStyle",
"(",
")",
"{",
"return",
"style",
";",
"}",
"}",
";",
"}"
] |
Creates a new row representing a rule.
@param type the type for the rule row, must not be null nor {@link TableRowType#CONTENT} nor {@link TableRowType#UNKNOWN}
@param style the style for the rule row, must not be null nor {@link TableRowStyle#UNKNOWN}
@return a new row representing a rule
@throws {@link NullPointerException} if type or style where null
@throws {@link IllegalStateException} if type or style where unknown or if type was {@link TableRowType#CONTENT}
|
[
"Creates",
"a",
"new",
"row",
"representing",
"a",
"rule",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L60-L78
|
162,847 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.createContentRow
|
public static AT_Row createContentRow(Object[] content, TableRowStyle style){
Validate.notNull(content);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>();
for(Object o : content){
cells.add(new AT_Cell(o));
}
return new AT_Row(){
@Override
public TableRowType getType(){
return TableRowType.CONTENT;
}
@Override
public TableRowStyle getStyle(){
return style;
}
@Override
public LinkedList<AT_Cell> getCells(){
return cells;
}
};
}
|
java
|
public static AT_Row createContentRow(Object[] content, TableRowStyle style){
Validate.notNull(content);
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN);
LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>();
for(Object o : content){
cells.add(new AT_Cell(o));
}
return new AT_Row(){
@Override
public TableRowType getType(){
return TableRowType.CONTENT;
}
@Override
public TableRowStyle getStyle(){
return style;
}
@Override
public LinkedList<AT_Cell> getCells(){
return cells;
}
};
}
|
[
"public",
"static",
"AT_Row",
"createContentRow",
"(",
"Object",
"[",
"]",
"content",
",",
"TableRowStyle",
"style",
")",
"{",
"Validate",
".",
"notNull",
"(",
"content",
")",
";",
"Validate",
".",
"notNull",
"(",
"style",
")",
";",
"Validate",
".",
"validState",
"(",
"style",
"!=",
"TableRowStyle",
".",
"UNKNOWN",
")",
";",
"LinkedList",
"<",
"AT_Cell",
">",
"cells",
"=",
"new",
"LinkedList",
"<",
"AT_Cell",
">",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"content",
")",
"{",
"cells",
".",
"add",
"(",
"new",
"AT_Cell",
"(",
"o",
")",
")",
";",
"}",
"return",
"new",
"AT_Row",
"(",
")",
"{",
"@",
"Override",
"public",
"TableRowType",
"getType",
"(",
")",
"{",
"return",
"TableRowType",
".",
"CONTENT",
";",
"}",
"@",
"Override",
"public",
"TableRowStyle",
"getStyle",
"(",
")",
"{",
"return",
"style",
";",
"}",
"@",
"Override",
"public",
"LinkedList",
"<",
"AT_Cell",
">",
"getCells",
"(",
")",
"{",
"return",
"cells",
";",
"}",
"}",
";",
"}"
] |
Creates a new row with content with given cell context and a normal row style.
@param content the content for the row, each member of the array represents the content for a cell in the row, must not be null but can contain null members
@return a new row with content
@throws {@link NullPointerException} if content was null
|
[
"Creates",
"a",
"new",
"row",
"with",
"content",
"with",
"given",
"cell",
"context",
"and",
"a",
"normal",
"row",
"style",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L96-L122
|
162,848 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPadding
|
public AT_Row setPadding(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPadding(padding);
}
}
return this;
}
|
java
|
public AT_Row setPadding(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPadding(padding);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPadding",
"(",
"int",
"padding",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPadding",
"(",
"padding",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets all padding for all cells in the row to the same value.
@param padding new padding for top, bottom, left, and right, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"all",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"to",
"the",
"same",
"value",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L129-L136
|
162,849 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingBottom
|
public AT_Row setPaddingBottom(int paddingBottom) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottom(paddingBottom);
}
}
return this;
}
|
java
|
public AT_Row setPaddingBottom(int paddingBottom) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottom(paddingBottom);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingBottom",
"(",
"int",
"paddingBottom",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingBottom",
"(",
"paddingBottom",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the bottom padding for all cells in the row.
@param paddingBottom new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"bottom",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L143-L150
|
162,850 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingBottomChar
|
public AT_Row setPaddingBottomChar(Character paddingBottomChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottomChar(paddingBottomChar);
}
}
return this;
}
|
java
|
public AT_Row setPaddingBottomChar(Character paddingBottomChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingBottomChar(paddingBottomChar);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingBottomChar",
"(",
"Character",
"paddingBottomChar",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingBottomChar",
"(",
"paddingBottomChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the bottom padding character for all cells in the row.
@param paddingBottomChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"bottom",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L157-L164
|
162,851 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingLeft
|
public AT_Row setPaddingLeft(int paddingLeft) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeft(paddingLeft);
}
}
return this;
}
|
java
|
public AT_Row setPaddingLeft(int paddingLeft) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeft(paddingLeft);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingLeft",
"(",
"int",
"paddingLeft",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingLeft",
"(",
"paddingLeft",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the left padding for all cells in the row.
@param paddingLeft new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"left",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L171-L178
|
162,852 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingLeftChar
|
public AT_Row setPaddingLeftChar(Character paddingLeftChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftChar(paddingLeftChar);
}
}
return this;
}
|
java
|
public AT_Row setPaddingLeftChar(Character paddingLeftChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftChar(paddingLeftChar);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingLeftChar",
"(",
"Character",
"paddingLeftChar",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingLeftChar",
"(",
"paddingLeftChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the left padding character for all cells in the row.
@param paddingLeftChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"left",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L185-L192
|
162,853 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingLeftRight
|
public AT_Row setPaddingLeftRight(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(padding);
}
}
return this;
}
|
java
|
public AT_Row setPaddingLeftRight(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(padding);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingLeftRight",
"(",
"int",
"padding",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingLeftRight",
"(",
"padding",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets left and right padding for all cells in the row.
@param padding new padding for left and right, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"left",
"and",
"right",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L199-L206
|
162,854 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingRight
|
public AT_Row setPaddingRight(int paddingRight) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingRight(paddingRight);
}
}
return this;
}
|
java
|
public AT_Row setPaddingRight(int paddingRight) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingRight(paddingRight);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingRight",
"(",
"int",
"paddingRight",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingRight",
"(",
"paddingRight",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the right padding for all cells in the row.
@param paddingRight new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"right",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L228-L235
|
162,855 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingRightChar
|
public AT_Row setPaddingRightChar(Character paddingRightChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingRightChar(paddingRightChar);
}
}
return this;
}
|
java
|
public AT_Row setPaddingRightChar(Character paddingRightChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingRightChar(paddingRightChar);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingRightChar",
"(",
"Character",
"paddingRightChar",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingRightChar",
"(",
"paddingRightChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the right padding character for all cells in the row.
@param paddingRightChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"right",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L242-L249
|
162,856 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingTop
|
public AT_Row setPaddingTop(int paddingTop) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingTop(paddingTop);
}
}
return this;
}
|
java
|
public AT_Row setPaddingTop(int paddingTop) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingTop(paddingTop);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingTop",
"(",
"int",
"paddingTop",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingTop",
"(",
"paddingTop",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the top padding for all cells in the row.
@param paddingTop new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"top",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L256-L263
|
162,857 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingTopBottom
|
public AT_Row setPaddingTopBottom(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingTopBottom(padding);
}
}
return this;
}
|
java
|
public AT_Row setPaddingTopBottom(int padding){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingTopBottom(padding);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingTopBottom",
"(",
"int",
"padding",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingTopBottom",
"(",
"padding",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets top and bottom padding for all cells in the row.
@param padding new padding for top and bottom, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"top",
"and",
"bottom",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L270-L277
|
162,858 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setPaddingTopChar
|
public AT_Row setPaddingTopChar(Character paddingTopChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingTopChar(paddingTopChar);
}
}
return this;
}
|
java
|
public AT_Row setPaddingTopChar(Character paddingTopChar) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingTopChar(paddingTopChar);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setPaddingTopChar",
"(",
"Character",
"paddingTopChar",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingTopChar",
"(",
"paddingTopChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the top padding character for all cells in the row.
@param paddingTopChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"top",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L299-L306
|
162,859 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setTextAlignment
|
public AT_Row setTextAlignment(TextAlignment textAlignment){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setTextAlignment(textAlignment);
}
}
return this;
}
|
java
|
public AT_Row setTextAlignment(TextAlignment textAlignment){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setTextAlignment(textAlignment);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setTextAlignment",
"(",
"TextAlignment",
"textAlignment",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setTextAlignment",
"(",
"textAlignment",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the text alignment for all cells in the row.
@param textAlignment new text alignment
@throws NullPointerException if the argument was null
@return this to allow chaining
@throws {@link NullPointerException} if the argument was null
|
[
"Sets",
"the",
"text",
"alignment",
"for",
"all",
"cells",
"in",
"the",
"row",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L315-L322
|
162,860 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setTargetTranslator
|
public AT_Row setTargetTranslator(TargetTranslator targetTranslator) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setTargetTranslator(targetTranslator);
}
}
return this;
}
|
java
|
public AT_Row setTargetTranslator(TargetTranslator targetTranslator) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setTargetTranslator(targetTranslator);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setTargetTranslator",
"(",
"TargetTranslator",
"targetTranslator",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setTargetTranslator",
"(",
"targetTranslator",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the target translator for all cells in the row.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param targetTranslator translator
@return this to allow chaining
|
[
"Sets",
"the",
"target",
"translator",
"for",
"all",
"cells",
"in",
"the",
"row",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L331-L338
|
162,861 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setHtmlElementTranslator
|
public AT_Row setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setHtmlElementTranslator(htmlElementTranslator);
}
}
return this;
}
|
java
|
public AT_Row setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setHtmlElementTranslator(htmlElementTranslator);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setHtmlElementTranslator",
"(",
"HtmlElementTranslator",
"htmlElementTranslator",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setHtmlElementTranslator",
"(",
"htmlElementTranslator",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the HTML entity translator for all cells in the row.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param htmlElementTranslator translator
@return this to allow chaining
|
[
"Sets",
"the",
"HTML",
"entity",
"translator",
"for",
"all",
"cells",
"in",
"the",
"row",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L347-L354
|
162,862 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Row.java
|
AT_Row.setCharTranslator
|
public AT_Row setCharTranslator(CharacterTranslator charTranslator) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setCharTranslator(charTranslator);
}
}
return this;
}
|
java
|
public AT_Row setCharTranslator(CharacterTranslator charTranslator) {
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setCharTranslator(charTranslator);
}
}
return this;
}
|
[
"public",
"AT_Row",
"setCharTranslator",
"(",
"CharacterTranslator",
"charTranslator",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setCharTranslator",
"(",
"charTranslator",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the character translator for all cells in the row.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param charTranslator translator
@return this to allow chaining
|
[
"Sets",
"the",
"character",
"translator",
"for",
"all",
"cells",
"in",
"the",
"row",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L363-L370
|
162,863 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Context.java
|
AT_Context.setFrameLeftRightMargin
|
public AT_Context setFrameLeftRightMargin(int frameLeft, int frameRight){
if(frameRight>-1 && frameLeft>-1){
this.frameLeftMargin = frameLeft;
this.frameRightMargin = frameRight;
}
return this;
}
|
java
|
public AT_Context setFrameLeftRightMargin(int frameLeft, int frameRight){
if(frameRight>-1 && frameLeft>-1){
this.frameLeftMargin = frameLeft;
this.frameRightMargin = frameRight;
}
return this;
}
|
[
"public",
"AT_Context",
"setFrameLeftRightMargin",
"(",
"int",
"frameLeft",
",",
"int",
"frameRight",
")",
"{",
"if",
"(",
"frameRight",
">",
"-",
"1",
"&&",
"frameLeft",
">",
"-",
"1",
")",
"{",
"this",
".",
"frameLeftMargin",
"=",
"frameLeft",
";",
"this",
".",
"frameRightMargin",
"=",
"frameRight",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the left and right frame margin.
@param frameLeft margin
@param frameRight margin
@return this to allow chaining
|
[
"Sets",
"the",
"left",
"and",
"right",
"frame",
"margin",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Context.java#L243-L249
|
162,864 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AT_Context.java
|
AT_Context.setFrameTopBottomMargin
|
public AT_Context setFrameTopBottomMargin(int frameTop, int frameBottom){
if(frameTop>-1 && frameBottom>-1){
this.frameTopMargin = frameTop;
this.frameBottomMargin = frameBottom;
}
return this;
}
|
java
|
public AT_Context setFrameTopBottomMargin(int frameTop, int frameBottom){
if(frameTop>-1 && frameBottom>-1){
this.frameTopMargin = frameTop;
this.frameBottomMargin = frameBottom;
}
return this;
}
|
[
"public",
"AT_Context",
"setFrameTopBottomMargin",
"(",
"int",
"frameTop",
",",
"int",
"frameBottom",
")",
"{",
"if",
"(",
"frameTop",
">",
"-",
"1",
"&&",
"frameBottom",
">",
"-",
"1",
")",
"{",
"this",
".",
"frameTopMargin",
"=",
"frameTop",
";",
"this",
".",
"frameBottomMargin",
"=",
"frameBottom",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the top and bottom frame margin.
@param frameTop margin
@param frameBottom margin
@return this to allow chaining
|
[
"Sets",
"the",
"top",
"and",
"bottom",
"frame",
"margin",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Context.java#L294-L300
|
162,865 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.addRule
|
public final void addRule(TableRowStyle style){
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN, "cannot add a rule of unknown style");
this.rows.add(AT_Row.createRule(TableRowType.RULE, style));
}
|
java
|
public final void addRule(TableRowStyle style){
Validate.notNull(style);
Validate.validState(style!=TableRowStyle.UNKNOWN, "cannot add a rule of unknown style");
this.rows.add(AT_Row.createRule(TableRowType.RULE, style));
}
|
[
"public",
"final",
"void",
"addRule",
"(",
"TableRowStyle",
"style",
")",
"{",
"Validate",
".",
"notNull",
"(",
"style",
")",
";",
"Validate",
".",
"validState",
"(",
"style",
"!=",
"TableRowStyle",
".",
"UNKNOWN",
",",
"\"cannot add a rule of unknown style\"",
")",
";",
"this",
".",
"rows",
".",
"add",
"(",
"AT_Row",
".",
"createRule",
"(",
"TableRowType",
".",
"RULE",
",",
"style",
")",
")",
";",
"}"
] |
Adds a rule row to the table with a given style.
@param style the rule style, must not be null nor {@link TableRowStyle#UNKNOWN}
@throws {@link NullPointerException} if style was null
@throws {@link IllegalArgumentException} if style was {@link TableRowStyle#UNKNOWN}
|
[
"Adds",
"a",
"rule",
"row",
"to",
"the",
"table",
"with",
"a",
"given",
"style",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L130-L134
|
162,866 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingBottom
|
public AsciiTable setPaddingBottom(int paddingBottom) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingBottom(paddingBottom);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingBottom(int paddingBottom) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingBottom(paddingBottom);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingBottom",
"(",
"int",
"paddingBottom",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingBottom",
"(",
"paddingBottom",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the bottom padding for all cells in the table.
@param paddingBottom new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"bottom",
"padding",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L258-L265
|
162,867 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingBottomChar
|
public AsciiTable setPaddingBottomChar(Character paddingBottomChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingBottomChar(paddingBottomChar);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingBottomChar(Character paddingBottomChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingBottomChar(paddingBottomChar);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingBottomChar",
"(",
"Character",
"paddingBottomChar",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingBottomChar",
"(",
"paddingBottomChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the bottom padding character for all cells in the table.
@param paddingBottomChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"bottom",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L272-L279
|
162,868 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingLeft
|
public AsciiTable setPaddingLeft(int paddingLeft) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingLeft(paddingLeft);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingLeft(int paddingLeft) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingLeft(paddingLeft);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingLeft",
"(",
"int",
"paddingLeft",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingLeft",
"(",
"paddingLeft",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the left padding for all cells in the table.
@param paddingLeft new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"left",
"padding",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L286-L293
|
162,869 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingLeftChar
|
public AsciiTable setPaddingLeftChar(Character paddingLeftChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingLeftChar(paddingLeftChar);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingLeftChar(Character paddingLeftChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingLeftChar(paddingLeftChar);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingLeftChar",
"(",
"Character",
"paddingLeftChar",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingLeftChar",
"(",
"paddingLeftChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the left padding character for all cells in the table.
@param paddingLeftChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"left",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L300-L307
|
162,870 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingLeftRight
|
public AsciiTable setPaddingLeftRight(int padding){
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingLeftRight(padding);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingLeftRight(int padding){
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingLeftRight(padding);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingLeftRight",
"(",
"int",
"padding",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingLeftRight",
"(",
"padding",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets left and right padding for all cells in the table.
@param padding new padding for left and right, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"left",
"and",
"right",
"padding",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L314-L321
|
162,871 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingRight
|
public AsciiTable setPaddingRight(int paddingRight) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingRight(paddingRight);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingRight(int paddingRight) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingRight(paddingRight);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingRight",
"(",
"int",
"paddingRight",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingRight",
"(",
"paddingRight",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the right padding for all cells in the table.
@param paddingRight new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"right",
"padding",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L343-L350
|
162,872 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingRightChar
|
public AsciiTable setPaddingRightChar(Character paddingRightChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingRightChar(paddingRightChar);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingRightChar(Character paddingRightChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingRightChar(paddingRightChar);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingRightChar",
"(",
"Character",
"paddingRightChar",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingRightChar",
"(",
"paddingRightChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the right padding character for all cells in the table.
@param paddingRightChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"right",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L357-L364
|
162,873 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingTop
|
public AsciiTable setPaddingTop(int paddingTop) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingTop(paddingTop);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingTop(int paddingTop) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingTop(paddingTop);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingTop",
"(",
"int",
"paddingTop",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingTop",
"(",
"paddingTop",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the top padding for all cells in the table.
@param paddingTop new padding, ignored if smaller than 0
@return this to allow chaining
|
[
"Sets",
"the",
"top",
"padding",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L371-L378
|
162,874 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setPaddingTopChar
|
public AsciiTable setPaddingTopChar(Character paddingTopChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingTopChar(paddingTopChar);
}
}
return this;
}
|
java
|
public AsciiTable setPaddingTopChar(Character paddingTopChar) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setPaddingTopChar(paddingTopChar);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setPaddingTopChar",
"(",
"Character",
"paddingTopChar",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setPaddingTopChar",
"(",
"paddingTopChar",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the top padding character for all cells in the table.
@param paddingTopChar new padding character, ignored if null
@return this to allow chaining
|
[
"Sets",
"the",
"top",
"padding",
"character",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L414-L421
|
162,875 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setTextAlignment
|
public AsciiTable setTextAlignment(TextAlignment textAlignment){
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setTextAlignment(textAlignment);
}
}
return this;
}
|
java
|
public AsciiTable setTextAlignment(TextAlignment textAlignment){
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setTextAlignment(textAlignment);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setTextAlignment",
"(",
"TextAlignment",
"textAlignment",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setTextAlignment",
"(",
"textAlignment",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the text alignment for all cells in the table.
@param textAlignment new text alignment
@throws NullPointerException if the argument was null
@return this to allow chaining
@throws {@link NullPointerException} if the argument was null
|
[
"Sets",
"the",
"text",
"alignment",
"for",
"all",
"cells",
"in",
"the",
"table",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L430-L437
|
162,876 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setTargetTranslator
|
public AsciiTable setTargetTranslator(TargetTranslator targetTranslator) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setTargetTranslator(targetTranslator);
}
}
return this;
}
|
java
|
public AsciiTable setTargetTranslator(TargetTranslator targetTranslator) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setTargetTranslator(targetTranslator);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setTargetTranslator",
"(",
"TargetTranslator",
"targetTranslator",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setTargetTranslator",
"(",
"targetTranslator",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the target translator for all cells in the table.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param targetTranslator translator
@return this to allow chaining
|
[
"Sets",
"the",
"target",
"translator",
"for",
"all",
"cells",
"in",
"the",
"table",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L446-L453
|
162,877 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setHtmlElementTranslator
|
public AsciiTable setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setHtmlElementTranslator(htmlElementTranslator);
}
}
return this;
}
|
java
|
public AsciiTable setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setHtmlElementTranslator(htmlElementTranslator);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setHtmlElementTranslator",
"(",
"HtmlElementTranslator",
"htmlElementTranslator",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setHtmlElementTranslator",
"(",
"htmlElementTranslator",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the HTML entity translator for all cells in the table.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param htmlElementTranslator translator
@return this to allow chaining
|
[
"Sets",
"the",
"HTML",
"entity",
"translator",
"for",
"all",
"cells",
"in",
"the",
"table",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L462-L469
|
162,878 |
vdmeer/asciitable
|
src/main/java/de/vandermeer/asciitable/AsciiTable.java
|
AsciiTable.setCharTranslator
|
public AsciiTable setCharTranslator(CharacterTranslator charTranslator) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setCharTranslator(charTranslator);
}
}
return this;
}
|
java
|
public AsciiTable setCharTranslator(CharacterTranslator charTranslator) {
for(AT_Row row : this.rows){
if(row.getType()==TableRowType.CONTENT){
row.setCharTranslator(charTranslator);
}
}
return this;
}
|
[
"public",
"AsciiTable",
"setCharTranslator",
"(",
"CharacterTranslator",
"charTranslator",
")",
"{",
"for",
"(",
"AT_Row",
"row",
":",
"this",
".",
"rows",
")",
"{",
"if",
"(",
"row",
".",
"getType",
"(",
")",
"==",
"TableRowType",
".",
"CONTENT",
")",
"{",
"row",
".",
"setCharTranslator",
"(",
"charTranslator",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the character translator for all cells in the table.
It will also remove any other translator set.
Nothing will happen if the argument is null.
@param charTranslator translator
@return this to allow chaining
|
[
"Sets",
"the",
"character",
"translator",
"for",
"all",
"cells",
"in",
"the",
"table",
".",
"It",
"will",
"also",
"remove",
"any",
"other",
"translator",
"set",
".",
"Nothing",
"will",
"happen",
"if",
"the",
"argument",
"is",
"null",
"."
] |
b6a73710271c89f9c749603be856ba84a969ed5f
|
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L478-L485
|
162,879 |
square/pollexor
|
src/main/java/com/squareup/pollexor/Utilities.java
|
Utilities.base64Encode
|
public static String base64Encode(byte[] bytes) {
if (bytes == null) {
throw new IllegalArgumentException("Input bytes must not be null.");
}
if (bytes.length >= BASE64_UPPER_BOUND) {
throw new IllegalArgumentException(
"Input bytes length must not exceed " + BASE64_UPPER_BOUND);
}
// Every three bytes is encoded into four characters.
//
// Example:
// input |0 1 0 1 0 0 1 0|0 1 1 0 1 1 1 1|0 1 1 0 0 0 1 0|
// encode grouping |0 1 0 1 0 0|1 0 0 1 1 0|1 1 1 1 0 1|1 0 0 0 1 0|
// encoded ascii | U | m | 9 | i |
int triples = bytes.length / 3;
// If the number of input bytes is not a multiple of three, padding characters will be added.
if (bytes.length % 3 != 0) {
triples += 1;
}
// The encoded string will have four characters for every three bytes.
char[] encoding = new char[triples << 2];
for (int in = 0, out = 0; in < bytes.length; in += 3, out += 4) {
int triple = (bytes[in] & 0xff) << 16;
if (in + 1 < bytes.length) {
triple |= ((bytes[in + 1] & 0xff) << 8);
}
if (in + 2 < bytes.length) {
triple |= (bytes[in + 2] & 0xff);
}
encoding[out] = BASE64_CHARS.charAt((triple >> 18) & 0x3f);
encoding[out + 1] = BASE64_CHARS.charAt((triple >> 12) & 0x3f);
encoding[out + 2] = BASE64_CHARS.charAt((triple >> 6) & 0x3f);
encoding[out + 3] = BASE64_CHARS.charAt(triple & 0x3f);
}
// Add padding characters if needed.
for (int i = encoding.length - (triples * 3 - bytes.length); i < encoding.length; i++) {
encoding[i] = '=';
}
return String.valueOf(encoding);
}
|
java
|
public static String base64Encode(byte[] bytes) {
if (bytes == null) {
throw new IllegalArgumentException("Input bytes must not be null.");
}
if (bytes.length >= BASE64_UPPER_BOUND) {
throw new IllegalArgumentException(
"Input bytes length must not exceed " + BASE64_UPPER_BOUND);
}
// Every three bytes is encoded into four characters.
//
// Example:
// input |0 1 0 1 0 0 1 0|0 1 1 0 1 1 1 1|0 1 1 0 0 0 1 0|
// encode grouping |0 1 0 1 0 0|1 0 0 1 1 0|1 1 1 1 0 1|1 0 0 0 1 0|
// encoded ascii | U | m | 9 | i |
int triples = bytes.length / 3;
// If the number of input bytes is not a multiple of three, padding characters will be added.
if (bytes.length % 3 != 0) {
triples += 1;
}
// The encoded string will have four characters for every three bytes.
char[] encoding = new char[triples << 2];
for (int in = 0, out = 0; in < bytes.length; in += 3, out += 4) {
int triple = (bytes[in] & 0xff) << 16;
if (in + 1 < bytes.length) {
triple |= ((bytes[in + 1] & 0xff) << 8);
}
if (in + 2 < bytes.length) {
triple |= (bytes[in + 2] & 0xff);
}
encoding[out] = BASE64_CHARS.charAt((triple >> 18) & 0x3f);
encoding[out + 1] = BASE64_CHARS.charAt((triple >> 12) & 0x3f);
encoding[out + 2] = BASE64_CHARS.charAt((triple >> 6) & 0x3f);
encoding[out + 3] = BASE64_CHARS.charAt(triple & 0x3f);
}
// Add padding characters if needed.
for (int i = encoding.length - (triples * 3 - bytes.length); i < encoding.length; i++) {
encoding[i] = '=';
}
return String.valueOf(encoding);
}
|
[
"public",
"static",
"String",
"base64Encode",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input bytes must not be null.\"",
")",
";",
"}",
"if",
"(",
"bytes",
".",
"length",
">=",
"BASE64_UPPER_BOUND",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input bytes length must not exceed \"",
"+",
"BASE64_UPPER_BOUND",
")",
";",
"}",
"// Every three bytes is encoded into four characters.",
"//",
"// Example:",
"// input |0 1 0 1 0 0 1 0|0 1 1 0 1 1 1 1|0 1 1 0 0 0 1 0|",
"// encode grouping |0 1 0 1 0 0|1 0 0 1 1 0|1 1 1 1 0 1|1 0 0 0 1 0|",
"// encoded ascii | U | m | 9 | i |",
"int",
"triples",
"=",
"bytes",
".",
"length",
"/",
"3",
";",
"// If the number of input bytes is not a multiple of three, padding characters will be added.",
"if",
"(",
"bytes",
".",
"length",
"%",
"3",
"!=",
"0",
")",
"{",
"triples",
"+=",
"1",
";",
"}",
"// The encoded string will have four characters for every three bytes.",
"char",
"[",
"]",
"encoding",
"=",
"new",
"char",
"[",
"triples",
"<<",
"2",
"]",
";",
"for",
"(",
"int",
"in",
"=",
"0",
",",
"out",
"=",
"0",
";",
"in",
"<",
"bytes",
".",
"length",
";",
"in",
"+=",
"3",
",",
"out",
"+=",
"4",
")",
"{",
"int",
"triple",
"=",
"(",
"bytes",
"[",
"in",
"]",
"&",
"0xff",
")",
"<<",
"16",
";",
"if",
"(",
"in",
"+",
"1",
"<",
"bytes",
".",
"length",
")",
"{",
"triple",
"|=",
"(",
"(",
"bytes",
"[",
"in",
"+",
"1",
"]",
"&",
"0xff",
")",
"<<",
"8",
")",
";",
"}",
"if",
"(",
"in",
"+",
"2",
"<",
"bytes",
".",
"length",
")",
"{",
"triple",
"|=",
"(",
"bytes",
"[",
"in",
"+",
"2",
"]",
"&",
"0xff",
")",
";",
"}",
"encoding",
"[",
"out",
"]",
"=",
"BASE64_CHARS",
".",
"charAt",
"(",
"(",
"triple",
">>",
"18",
")",
"&",
"0x3f",
")",
";",
"encoding",
"[",
"out",
"+",
"1",
"]",
"=",
"BASE64_CHARS",
".",
"charAt",
"(",
"(",
"triple",
">>",
"12",
")",
"&",
"0x3f",
")",
";",
"encoding",
"[",
"out",
"+",
"2",
"]",
"=",
"BASE64_CHARS",
".",
"charAt",
"(",
"(",
"triple",
">>",
"6",
")",
"&",
"0x3f",
")",
";",
"encoding",
"[",
"out",
"+",
"3",
"]",
"=",
"BASE64_CHARS",
".",
"charAt",
"(",
"triple",
"&",
"0x3f",
")",
";",
"}",
"// Add padding characters if needed.",
"for",
"(",
"int",
"i",
"=",
"encoding",
".",
"length",
"-",
"(",
"triples",
"*",
"3",
"-",
"bytes",
".",
"length",
")",
";",
"i",
"<",
"encoding",
".",
"length",
";",
"i",
"++",
")",
"{",
"encoding",
"[",
"i",
"]",
"=",
"'",
"'",
";",
"}",
"return",
"String",
".",
"valueOf",
"(",
"encoding",
")",
";",
"}"
] |
Base64 encodes a byte array.
@param bytes Bytes to encode.
@return Encoded string.
@throws IllegalArgumentException if {@code bytes} is null or exceeds 3/4ths of {@code
Integer.MAX_VALUE}.
|
[
"Base64",
"encodes",
"a",
"byte",
"array",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L27-L73
|
162,880 |
square/pollexor
|
src/main/java/com/squareup/pollexor/Utilities.java
|
Utilities.md5
|
static String md5(String input) {
if (input == null || input.length() == 0) {
throw new IllegalArgumentException("Input string must not be blank.");
}
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] messageDigest = algorithm.digest();
StringBuilder hexString = new StringBuilder();
for (byte messageByte : messageDigest) {
hexString.append(Integer.toHexString((messageByte & 0xFF) | 0x100).substring(1, 3));
}
return hexString.toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
java
|
static String md5(String input) {
if (input == null || input.length() == 0) {
throw new IllegalArgumentException("Input string must not be blank.");
}
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(input.getBytes());
byte[] messageDigest = algorithm.digest();
StringBuilder hexString = new StringBuilder();
for (byte messageByte : messageDigest) {
hexString.append(Integer.toHexString((messageByte & 0xFF) | 0x100).substring(1, 3));
}
return hexString.toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
[
"static",
"String",
"md5",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input string must not be blank.\"",
")",
";",
"}",
"try",
"{",
"MessageDigest",
"algorithm",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"algorithm",
".",
"reset",
"(",
")",
";",
"algorithm",
".",
"update",
"(",
"input",
".",
"getBytes",
"(",
")",
")",
";",
"byte",
"[",
"]",
"messageDigest",
"=",
"algorithm",
".",
"digest",
"(",
")",
";",
"StringBuilder",
"hexString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"messageByte",
":",
"messageDigest",
")",
"{",
"hexString",
".",
"append",
"(",
"Integer",
".",
"toHexString",
"(",
"(",
"messageByte",
"&",
"0xFF",
")",
"|",
"0x100",
")",
".",
"substring",
"(",
"1",
",",
"3",
")",
")",
";",
"}",
"return",
"hexString",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Create an MD5 hash of a string.
@param input Input string.
@return Hash of input.
@throws IllegalArgumentException if {@code input} is blank.
|
[
"Create",
"an",
"MD5",
"hash",
"of",
"a",
"string",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L134-L152
|
162,881 |
square/pollexor
|
src/main/java/com/squareup/pollexor/Utilities.java
|
Utilities.hmacSha1
|
static byte[] hmacSha1(StringBuilder message, String key) {
try {
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(new SecretKeySpec(key.getBytes(), "HmacSHA1"));
return mac.doFinal(message.toString().getBytes());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
java
|
static byte[] hmacSha1(StringBuilder message, String key) {
try {
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(new SecretKeySpec(key.getBytes(), "HmacSHA1"));
return mac.doFinal(message.toString().getBytes());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
[
"static",
"byte",
"[",
"]",
"hmacSha1",
"(",
"StringBuilder",
"message",
",",
"String",
"key",
")",
"{",
"try",
"{",
"Mac",
"mac",
"=",
"Mac",
".",
"getInstance",
"(",
"\"HmacSHA1\"",
")",
";",
"mac",
".",
"init",
"(",
"new",
"SecretKeySpec",
"(",
"key",
".",
"getBytes",
"(",
")",
",",
"\"HmacSHA1\"",
")",
")",
";",
"return",
"mac",
".",
"doFinal",
"(",
"message",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Encrypt a string with HMAC-SHA1 using the specified key.
@param message Input string.
@param key Encryption key.
@return Encrypted output.
|
[
"Encrypt",
"a",
"string",
"with",
"HMAC",
"-",
"SHA1",
"using",
"the",
"specified",
"key",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L161-L169
|
162,882 |
square/pollexor
|
src/main/java/com/squareup/pollexor/Utilities.java
|
Utilities.aes128Encrypt
|
@SuppressWarnings("InsecureCryptoUsage") // Only used in known-weak crypto "legacy" mode.
static byte[] aes128Encrypt(StringBuilder message, String key) {
try {
key = normalizeString(key, 16);
rightPadString(message, '{', 16);
Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(), "AES"));
return cipher.doFinal(message.toString().getBytes());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
java
|
@SuppressWarnings("InsecureCryptoUsage") // Only used in known-weak crypto "legacy" mode.
static byte[] aes128Encrypt(StringBuilder message, String key) {
try {
key = normalizeString(key, 16);
rightPadString(message, '{', 16);
Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes(), "AES"));
return cipher.doFinal(message.toString().getBytes());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"InsecureCryptoUsage\"",
")",
"// Only used in known-weak crypto \"legacy\" mode.",
"static",
"byte",
"[",
"]",
"aes128Encrypt",
"(",
"StringBuilder",
"message",
",",
"String",
"key",
")",
"{",
"try",
"{",
"key",
"=",
"normalizeString",
"(",
"key",
",",
"16",
")",
";",
"rightPadString",
"(",
"message",
",",
"'",
"'",
",",
"16",
")",
";",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"\"AES/ECB/NoPadding\"",
")",
";",
"cipher",
".",
"init",
"(",
"Cipher",
".",
"ENCRYPT_MODE",
",",
"new",
"SecretKeySpec",
"(",
"key",
".",
"getBytes",
"(",
")",
",",
"\"AES\"",
")",
")",
";",
"return",
"cipher",
".",
"doFinal",
"(",
"message",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Encrypt a string with AES-128 using the specified key.
@param message Input string.
@param key Encryption key.
@return Encrypted output.
|
[
"Encrypt",
"a",
"string",
"with",
"AES",
"-",
"128",
"using",
"the",
"specified",
"key",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L178-L189
|
162,883 |
square/pollexor
|
src/main/java/com/squareup/pollexor/Thumbor.java
|
Thumbor.create
|
public static Thumbor create(String host, String key) {
if (key == null || key.length() == 0) {
throw new IllegalArgumentException("Key must not be blank.");
}
return new Thumbor(host, key);
}
|
java
|
public static Thumbor create(String host, String key) {
if (key == null || key.length() == 0) {
throw new IllegalArgumentException("Key must not be blank.");
}
return new Thumbor(host, key);
}
|
[
"public",
"static",
"Thumbor",
"create",
"(",
"String",
"host",
",",
"String",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"key",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Key must not be blank.\"",
")",
";",
"}",
"return",
"new",
"Thumbor",
"(",
"host",
",",
"key",
")",
";",
"}"
] |
Create a new instance for the specified host and encryption key.
@see #create(String)
|
[
"Create",
"a",
"new",
"instance",
"for",
"the",
"specified",
"host",
"and",
"encryption",
"key",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Thumbor.java#L23-L28
|
162,884 |
square/pollexor
|
src/main/java/com/squareup/pollexor/Thumbor.java
|
Thumbor.buildImage
|
public ThumborUrlBuilder buildImage(String image) {
if (image == null || image.length() == 0) {
throw new IllegalArgumentException("Image must not be blank.");
}
return new ThumborUrlBuilder(host, key, image);
}
|
java
|
public ThumborUrlBuilder buildImage(String image) {
if (image == null || image.length() == 0) {
throw new IllegalArgumentException("Image must not be blank.");
}
return new ThumborUrlBuilder(host, key, image);
}
|
[
"public",
"ThumborUrlBuilder",
"buildImage",
"(",
"String",
"image",
")",
"{",
"if",
"(",
"image",
"==",
"null",
"||",
"image",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image must not be blank.\"",
")",
";",
"}",
"return",
"new",
"ThumborUrlBuilder",
"(",
"host",
",",
"key",
",",
"image",
")",
";",
"}"
] |
Begin building a url for this host with the specified image.
|
[
"Begin",
"building",
"a",
"url",
"for",
"this",
"host",
"with",
"the",
"specified",
"image",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Thumbor.java#L53-L58
|
162,885 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.resize
|
public ThumborUrlBuilder resize(int width, int height) {
if (width < 0 && width != ORIGINAL_SIZE) {
throw new IllegalArgumentException("Width must be a positive number.");
}
if (height < 0 && height != ORIGINAL_SIZE) {
throw new IllegalArgumentException("Height must be a positive number.");
}
if (width == 0 && height == 0) {
throw new IllegalArgumentException("Both width and height must not be zero.");
}
hasResize = true;
resizeWidth = width;
resizeHeight = height;
return this;
}
|
java
|
public ThumborUrlBuilder resize(int width, int height) {
if (width < 0 && width != ORIGINAL_SIZE) {
throw new IllegalArgumentException("Width must be a positive number.");
}
if (height < 0 && height != ORIGINAL_SIZE) {
throw new IllegalArgumentException("Height must be a positive number.");
}
if (width == 0 && height == 0) {
throw new IllegalArgumentException("Both width and height must not be zero.");
}
hasResize = true;
resizeWidth = width;
resizeHeight = height;
return this;
}
|
[
"public",
"ThumborUrlBuilder",
"resize",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"if",
"(",
"width",
"<",
"0",
"&&",
"width",
"!=",
"ORIGINAL_SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Width must be a positive number.\"",
")",
";",
"}",
"if",
"(",
"height",
"<",
"0",
"&&",
"height",
"!=",
"ORIGINAL_SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Height must be a positive number.\"",
")",
";",
"}",
"if",
"(",
"width",
"==",
"0",
"&&",
"height",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Both width and height must not be zero.\"",
")",
";",
"}",
"hasResize",
"=",
"true",
";",
"resizeWidth",
"=",
"width",
";",
"resizeHeight",
"=",
"height",
";",
"return",
"this",
";",
"}"
] |
Resize picture to desired size.
@param width Desired width.
@param height Desired height.
@throws IllegalArgumentException if {@code width} or {@code height} is less than 0 or both are
0.
|
[
"Resize",
"picture",
"to",
"desired",
"size",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L136-L150
|
162,886 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.crop
|
public ThumborUrlBuilder crop(int top, int left, int bottom, int right) {
if (top < 0) {
throw new IllegalArgumentException("Top must be greater or equal to zero.");
}
if (left < 0) {
throw new IllegalArgumentException("Left must be greater or equal to zero.");
}
if (bottom < 1 || bottom <= top) {
throw new IllegalArgumentException("Bottom must be greater than zero and top.");
}
if (right < 1 || right <= left) {
throw new IllegalArgumentException("Right must be greater than zero and left.");
}
hasCrop = true;
cropTop = top;
cropLeft = left;
cropBottom = bottom;
cropRight = right;
return this;
}
|
java
|
public ThumborUrlBuilder crop(int top, int left, int bottom, int right) {
if (top < 0) {
throw new IllegalArgumentException("Top must be greater or equal to zero.");
}
if (left < 0) {
throw new IllegalArgumentException("Left must be greater or equal to zero.");
}
if (bottom < 1 || bottom <= top) {
throw new IllegalArgumentException("Bottom must be greater than zero and top.");
}
if (right < 1 || right <= left) {
throw new IllegalArgumentException("Right must be greater than zero and left.");
}
hasCrop = true;
cropTop = top;
cropLeft = left;
cropBottom = bottom;
cropRight = right;
return this;
}
|
[
"public",
"ThumborUrlBuilder",
"crop",
"(",
"int",
"top",
",",
"int",
"left",
",",
"int",
"bottom",
",",
"int",
"right",
")",
"{",
"if",
"(",
"top",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Top must be greater or equal to zero.\"",
")",
";",
"}",
"if",
"(",
"left",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Left must be greater or equal to zero.\"",
")",
";",
"}",
"if",
"(",
"bottom",
"<",
"1",
"||",
"bottom",
"<=",
"top",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bottom must be greater than zero and top.\"",
")",
";",
"}",
"if",
"(",
"right",
"<",
"1",
"||",
"right",
"<=",
"left",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Right must be greater than zero and left.\"",
")",
";",
"}",
"hasCrop",
"=",
"true",
";",
"cropTop",
"=",
"top",
";",
"cropLeft",
"=",
"left",
";",
"cropBottom",
"=",
"bottom",
";",
"cropRight",
"=",
"right",
";",
"return",
"this",
";",
"}"
] |
Crop the image between two points.
@param top Top bound.
@param left Left bound.
@param bottom Bottom bound.
@param right Right bound.
@throws IllegalArgumentException if {@code top} or {@code left} are less than zero or {@code
bottom} or {@code right} are less than one or less than {@code top} or {@code left},
respectively.
|
[
"Crop",
"the",
"image",
"between",
"two",
"points",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L211-L230
|
162,887 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.align
|
public ThumborUrlBuilder align(VerticalAlign valign, HorizontalAlign halign) {
return align(valign).align(halign);
}
|
java
|
public ThumborUrlBuilder align(VerticalAlign valign, HorizontalAlign halign) {
return align(valign).align(halign);
}
|
[
"public",
"ThumborUrlBuilder",
"align",
"(",
"VerticalAlign",
"valign",
",",
"HorizontalAlign",
"halign",
")",
"{",
"return",
"align",
"(",
"valign",
")",
".",
"align",
"(",
"halign",
")",
";",
"}"
] |
Set the horizontal and vertical alignment for the image when image gets cropped by resizing.
@param valign Vertical alignment.
@param halign Horizontal alignment.
@throws IllegalStateException if image has not been marked for resize.
|
[
"Set",
"the",
"horizontal",
"and",
"vertical",
"alignment",
"for",
"the",
"image",
"when",
"image",
"gets",
"cropped",
"by",
"resizing",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L267-L269
|
162,888 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.trim
|
public ThumborUrlBuilder trim(TrimPixelColor value, int colorTolerance) {
if (colorTolerance < 0 || colorTolerance > 442) {
throw new IllegalArgumentException("Color tolerance must be between 0 and 442.");
}
if (colorTolerance > 0 && value == null) {
throw new IllegalArgumentException("Trim pixel color value must not be null.");
}
isTrim = true;
trimPixelColor = value;
trimColorTolerance = colorTolerance;
return this;
}
|
java
|
public ThumborUrlBuilder trim(TrimPixelColor value, int colorTolerance) {
if (colorTolerance < 0 || colorTolerance > 442) {
throw new IllegalArgumentException("Color tolerance must be between 0 and 442.");
}
if (colorTolerance > 0 && value == null) {
throw new IllegalArgumentException("Trim pixel color value must not be null.");
}
isTrim = true;
trimPixelColor = value;
trimColorTolerance = colorTolerance;
return this;
}
|
[
"public",
"ThumborUrlBuilder",
"trim",
"(",
"TrimPixelColor",
"value",
",",
"int",
"colorTolerance",
")",
"{",
"if",
"(",
"colorTolerance",
"<",
"0",
"||",
"colorTolerance",
">",
"442",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Color tolerance must be between 0 and 442.\"",
")",
";",
"}",
"if",
"(",
"colorTolerance",
">",
"0",
"&&",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Trim pixel color value must not be null.\"",
")",
";",
"}",
"isTrim",
"=",
"true",
";",
"trimPixelColor",
"=",
"value",
";",
"trimColorTolerance",
"=",
"colorTolerance",
";",
"return",
"this",
";",
"}"
] |
Removing surrounding space in image. Get trim color from specified pixel.
@param value orientation from where to get the pixel color.
@param colorTolerance 0 - 442. This is the euclidian distance
between the colors of the reference pixel and the surrounding pixels is used.
If the distance is within the tolerance they'll get trimmed.
|
[
"Removing",
"surrounding",
"space",
"in",
"image",
".",
"Get",
"trim",
"color",
"from",
"specified",
"pixel",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L306-L317
|
162,889 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.assembleConfig
|
StringBuilder assembleConfig(boolean meta) {
StringBuilder builder = new StringBuilder();
if (meta) {
builder.append(PREFIX_META);
}
if (isTrim) {
builder.append(PART_TRIM);
if (trimPixelColor != null) {
builder.append(":").append(trimPixelColor.value);
if (trimColorTolerance > 0) {
builder.append(":").append(trimColorTolerance);
}
}
builder.append("/");
}
if (hasCrop) {
builder.append(cropLeft).append("x").append(cropTop) //
.append(":").append(cropRight).append("x").append(cropBottom);
builder.append("/");
}
if (hasResize) {
if (fitInStyle != null) {
builder.append(fitInStyle.value).append("/");
}
if (flipHorizontally) {
builder.append("-");
}
if (resizeWidth == ORIGINAL_SIZE) {
builder.append("orig");
} else {
builder.append(resizeWidth);
}
builder.append("x");
if (flipVertically) {
builder.append("-");
}
if (resizeHeight == ORIGINAL_SIZE) {
builder.append("orig");
} else {
builder.append(resizeHeight);
}
if (isSmart) {
builder.append("/").append(PART_SMART);
} else {
if (cropHorizontalAlign != null) {
builder.append("/").append(cropHorizontalAlign.value);
}
if (cropVerticalAlign != null) {
builder.append("/").append(cropVerticalAlign.value);
}
}
builder.append("/");
}
if (filters != null) {
builder.append(PART_FILTERS);
for (String filter : filters) {
builder.append(":").append(filter);
}
builder.append("/");
}
builder.append(isLegacy ? md5(image) : image);
return builder;
}
|
java
|
StringBuilder assembleConfig(boolean meta) {
StringBuilder builder = new StringBuilder();
if (meta) {
builder.append(PREFIX_META);
}
if (isTrim) {
builder.append(PART_TRIM);
if (trimPixelColor != null) {
builder.append(":").append(trimPixelColor.value);
if (trimColorTolerance > 0) {
builder.append(":").append(trimColorTolerance);
}
}
builder.append("/");
}
if (hasCrop) {
builder.append(cropLeft).append("x").append(cropTop) //
.append(":").append(cropRight).append("x").append(cropBottom);
builder.append("/");
}
if (hasResize) {
if (fitInStyle != null) {
builder.append(fitInStyle.value).append("/");
}
if (flipHorizontally) {
builder.append("-");
}
if (resizeWidth == ORIGINAL_SIZE) {
builder.append("orig");
} else {
builder.append(resizeWidth);
}
builder.append("x");
if (flipVertically) {
builder.append("-");
}
if (resizeHeight == ORIGINAL_SIZE) {
builder.append("orig");
} else {
builder.append(resizeHeight);
}
if (isSmart) {
builder.append("/").append(PART_SMART);
} else {
if (cropHorizontalAlign != null) {
builder.append("/").append(cropHorizontalAlign.value);
}
if (cropVerticalAlign != null) {
builder.append("/").append(cropVerticalAlign.value);
}
}
builder.append("/");
}
if (filters != null) {
builder.append(PART_FILTERS);
for (String filter : filters) {
builder.append(":").append(filter);
}
builder.append("/");
}
builder.append(isLegacy ? md5(image) : image);
return builder;
}
|
[
"StringBuilder",
"assembleConfig",
"(",
"boolean",
"meta",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"meta",
")",
"{",
"builder",
".",
"append",
"(",
"PREFIX_META",
")",
";",
"}",
"if",
"(",
"isTrim",
")",
"{",
"builder",
".",
"append",
"(",
"PART_TRIM",
")",
";",
"if",
"(",
"trimPixelColor",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"trimPixelColor",
".",
"value",
")",
";",
"if",
"(",
"trimColorTolerance",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"trimColorTolerance",
")",
";",
"}",
"}",
"builder",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"if",
"(",
"hasCrop",
")",
"{",
"builder",
".",
"append",
"(",
"cropLeft",
")",
".",
"append",
"(",
"\"x\"",
")",
".",
"append",
"(",
"cropTop",
")",
"//",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"cropRight",
")",
".",
"append",
"(",
"\"x\"",
")",
".",
"append",
"(",
"cropBottom",
")",
";",
"builder",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"if",
"(",
"hasResize",
")",
"{",
"if",
"(",
"fitInStyle",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"fitInStyle",
".",
"value",
")",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"if",
"(",
"flipHorizontally",
")",
"{",
"builder",
".",
"append",
"(",
"\"-\"",
")",
";",
"}",
"if",
"(",
"resizeWidth",
"==",
"ORIGINAL_SIZE",
")",
"{",
"builder",
".",
"append",
"(",
"\"orig\"",
")",
";",
"}",
"else",
"{",
"builder",
".",
"append",
"(",
"resizeWidth",
")",
";",
"}",
"builder",
".",
"append",
"(",
"\"x\"",
")",
";",
"if",
"(",
"flipVertically",
")",
"{",
"builder",
".",
"append",
"(",
"\"-\"",
")",
";",
"}",
"if",
"(",
"resizeHeight",
"==",
"ORIGINAL_SIZE",
")",
"{",
"builder",
".",
"append",
"(",
"\"orig\"",
")",
";",
"}",
"else",
"{",
"builder",
".",
"append",
"(",
"resizeHeight",
")",
";",
"}",
"if",
"(",
"isSmart",
")",
"{",
"builder",
".",
"append",
"(",
"\"/\"",
")",
".",
"append",
"(",
"PART_SMART",
")",
";",
"}",
"else",
"{",
"if",
"(",
"cropHorizontalAlign",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"\"/\"",
")",
".",
"append",
"(",
"cropHorizontalAlign",
".",
"value",
")",
";",
"}",
"if",
"(",
"cropVerticalAlign",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"\"/\"",
")",
".",
"append",
"(",
"cropVerticalAlign",
".",
"value",
")",
";",
"}",
"}",
"builder",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"if",
"(",
"filters",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"PART_FILTERS",
")",
";",
"for",
"(",
"String",
"filter",
":",
"filters",
")",
"{",
"builder",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"filter",
")",
";",
"}",
"builder",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"builder",
".",
"append",
"(",
"isLegacy",
"?",
"md5",
"(",
"image",
")",
":",
"image",
")",
";",
"return",
"builder",
";",
"}"
] |
Assemble the configuration section of the URL.
|
[
"Assemble",
"the",
"configuration",
"section",
"of",
"the",
"URL",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L427-L497
|
162,890 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.rgb
|
public static String rgb(int r, int g, int b) {
if (r < -100 || r > 100) {
throw new IllegalArgumentException("Red value must be between -100 and 100, inclusive.");
}
if (g < -100 || g > 100) {
throw new IllegalArgumentException("Green value must be between -100 and 100, inclusive.");
}
if (b < -100 || b > 100) {
throw new IllegalArgumentException("Blue value must be between -100 and 100, inclusive.");
}
return FILTER_RGB + "(" + r + "," + g + "," + b + ")";
}
|
java
|
public static String rgb(int r, int g, int b) {
if (r < -100 || r > 100) {
throw new IllegalArgumentException("Red value must be between -100 and 100, inclusive.");
}
if (g < -100 || g > 100) {
throw new IllegalArgumentException("Green value must be between -100 and 100, inclusive.");
}
if (b < -100 || b > 100) {
throw new IllegalArgumentException("Blue value must be between -100 and 100, inclusive.");
}
return FILTER_RGB + "(" + r + "," + g + "," + b + ")";
}
|
[
"public",
"static",
"String",
"rgb",
"(",
"int",
"r",
",",
"int",
"g",
",",
"int",
"b",
")",
"{",
"if",
"(",
"r",
"<",
"-",
"100",
"||",
"r",
">",
"100",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Red value must be between -100 and 100, inclusive.\"",
")",
";",
"}",
"if",
"(",
"g",
"<",
"-",
"100",
"||",
"g",
">",
"100",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Green value must be between -100 and 100, inclusive.\"",
")",
";",
"}",
"if",
"(",
"b",
"<",
"-",
"100",
"||",
"b",
">",
"100",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Blue value must be between -100 and 100, inclusive.\"",
")",
";",
"}",
"return",
"FILTER_RGB",
"+",
"\"(\"",
"+",
"r",
"+",
"\",\"",
"+",
"g",
"+",
"\",\"",
"+",
"b",
"+",
"\")\"",
";",
"}"
] |
This filter changes the amount of color in each of the three channels.
@param r The amount of redness in the picture. Can range from -100 to 100 in percentage.
@param g The amount of greenness in the picture. Can range from -100 to 100 in percentage.
@param b The amount of blueness in the picture. Can range from -100 to 100 in percentage.
@throws IllegalArgumentException if {@code r}, {@code g}, or {@code b} are outside of bounds.
|
[
"This",
"filter",
"changes",
"the",
"amount",
"of",
"color",
"in",
"each",
"of",
"the",
"three",
"channels",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L561-L572
|
162,891 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.roundCorner
|
public static String roundCorner(int radiusInner, int radiusOuter, int color) {
if (radiusInner < 1) {
throw new IllegalArgumentException("Radius must be greater than zero.");
}
if (radiusOuter < 0) {
throw new IllegalArgumentException("Outer radius must be greater than or equal to zero.");
}
StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append("(").append(radiusInner);
if (radiusOuter > 0) {
builder.append("|").append(radiusOuter);
}
final int r = (color & 0xFF0000) >>> 16;
final int g = (color & 0xFF00) >>> 8;
final int b = color & 0xFF;
return builder.append(",") //
.append(r).append(",") //
.append(g).append(",") //
.append(b).append(")") //
.toString();
}
|
java
|
public static String roundCorner(int radiusInner, int radiusOuter, int color) {
if (radiusInner < 1) {
throw new IllegalArgumentException("Radius must be greater than zero.");
}
if (radiusOuter < 0) {
throw new IllegalArgumentException("Outer radius must be greater than or equal to zero.");
}
StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append("(").append(radiusInner);
if (radiusOuter > 0) {
builder.append("|").append(radiusOuter);
}
final int r = (color & 0xFF0000) >>> 16;
final int g = (color & 0xFF00) >>> 8;
final int b = color & 0xFF;
return builder.append(",") //
.append(r).append(",") //
.append(g).append(",") //
.append(b).append(")") //
.toString();
}
|
[
"public",
"static",
"String",
"roundCorner",
"(",
"int",
"radiusInner",
",",
"int",
"radiusOuter",
",",
"int",
"color",
")",
"{",
"if",
"(",
"radiusInner",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Radius must be greater than zero.\"",
")",
";",
"}",
"if",
"(",
"radiusOuter",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Outer radius must be greater than or equal to zero.\"",
")",
";",
"}",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"FILTER_ROUND_CORNER",
")",
".",
"append",
"(",
"\"(\"",
")",
".",
"append",
"(",
"radiusInner",
")",
";",
"if",
"(",
"radiusOuter",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"\"|\"",
")",
".",
"append",
"(",
"radiusOuter",
")",
";",
"}",
"final",
"int",
"r",
"=",
"(",
"color",
"&",
"0xFF0000",
")",
">>>",
"16",
";",
"final",
"int",
"g",
"=",
"(",
"color",
"&",
"0xFF00",
")",
">>>",
"8",
";",
"final",
"int",
"b",
"=",
"color",
"&",
"0xFF",
";",
"return",
"builder",
".",
"append",
"(",
"\",\"",
")",
"//",
".",
"append",
"(",
"r",
")",
".",
"append",
"(",
"\",\"",
")",
"//",
".",
"append",
"(",
"g",
")",
".",
"append",
"(",
"\",\"",
")",
"//",
".",
"append",
"(",
"b",
")",
".",
"append",
"(",
"\")\"",
")",
"//",
".",
"toString",
"(",
")",
";",
"}"
] |
This filter adds rounded corners to the image using the specified color as the background.
@param radiusInner amount of pixels to use as radius.
@param radiusOuter specifies the second value for the ellipse used for the radius. Use 0 for
no value.
@param color fill color for clipped region.
|
[
"This",
"filter",
"adds",
"rounded",
"corners",
"to",
"the",
"image",
"using",
"the",
"specified",
"color",
"as",
"the",
"background",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L601-L620
|
162,892 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.fill
|
public static String fill(int color) {
final String colorCode = Integer.toHexString(color & 0xFFFFFF); // Strip alpha
return FILTER_FILL + "(" + colorCode + ")";
}
|
java
|
public static String fill(int color) {
final String colorCode = Integer.toHexString(color & 0xFFFFFF); // Strip alpha
return FILTER_FILL + "(" + colorCode + ")";
}
|
[
"public",
"static",
"String",
"fill",
"(",
"int",
"color",
")",
"{",
"final",
"String",
"colorCode",
"=",
"Integer",
".",
"toHexString",
"(",
"color",
"&",
"0xFFFFFF",
")",
";",
"// Strip alpha",
"return",
"FILTER_FILL",
"+",
"\"(\"",
"+",
"colorCode",
"+",
"\")\"",
";",
"}"
] |
This filter permit to return an image sized exactly as requested wherever is its ratio by
filling with chosen color the missing parts. Usually used with "fit-in" or "adaptive-fit-in"
@param color integer representation of color.
|
[
"This",
"filter",
"permit",
"to",
"return",
"an",
"image",
"sized",
"exactly",
"as",
"requested",
"wherever",
"is",
"its",
"ratio",
"by",
"filling",
"with",
"chosen",
"color",
"the",
"missing",
"parts",
".",
"Usually",
"used",
"with",
"fit",
"-",
"in",
"or",
"adaptive",
"-",
"fit",
"-",
"in"
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L740-L743
|
162,893 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.format
|
public static String format(ImageFormat format) {
if (format == null) {
throw new IllegalArgumentException("You must specify an image format.");
}
return FILTER_FORMAT + "(" + format.value + ")";
}
|
java
|
public static String format(ImageFormat format) {
if (format == null) {
throw new IllegalArgumentException("You must specify an image format.");
}
return FILTER_FORMAT + "(" + format.value + ")";
}
|
[
"public",
"static",
"String",
"format",
"(",
"ImageFormat",
"format",
")",
"{",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"You must specify an image format.\"",
")",
";",
"}",
"return",
"FILTER_FORMAT",
"+",
"\"(\"",
"+",
"format",
".",
"value",
"+",
"\")\"",
";",
"}"
] |
Specify the output format of the image.
@see ImageFormat
|
[
"Specify",
"the",
"output",
"format",
"of",
"the",
"image",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L750-L755
|
162,894 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.frame
|
public static String frame(String imageUrl) {
if (imageUrl == null || imageUrl.length() == 0) {
throw new IllegalArgumentException("Image URL must not be blank.");
}
return FILTER_FRAME + "(" + imageUrl + ")";
}
|
java
|
public static String frame(String imageUrl) {
if (imageUrl == null || imageUrl.length() == 0) {
throw new IllegalArgumentException("Image URL must not be blank.");
}
return FILTER_FRAME + "(" + imageUrl + ")";
}
|
[
"public",
"static",
"String",
"frame",
"(",
"String",
"imageUrl",
")",
"{",
"if",
"(",
"imageUrl",
"==",
"null",
"||",
"imageUrl",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image URL must not be blank.\"",
")",
";",
"}",
"return",
"FILTER_FRAME",
"+",
"\"(\"",
"+",
"imageUrl",
"+",
"\")\"",
";",
"}"
] |
This filter uses a 9-patch to overlay the image.
@param imageUrl Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.
|
[
"This",
"filter",
"uses",
"a",
"9",
"-",
"patch",
"to",
"overlay",
"the",
"image",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L763-L768
|
162,895 |
square/pollexor
|
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
|
ThumborUrlBuilder.blur
|
public static String blur(int radius, int sigma) {
if (radius < 1) {
throw new IllegalArgumentException("Radius must be greater than zero.");
}
if (radius > 150) {
throw new IllegalArgumentException("Radius must be lower or equal than 150.");
}
if (sigma < 0) {
throw new IllegalArgumentException("Sigma must be greater than zero.");
}
return FILTER_BLUR + "(" + radius + "," + sigma + ")";
}
|
java
|
public static String blur(int radius, int sigma) {
if (radius < 1) {
throw new IllegalArgumentException("Radius must be greater than zero.");
}
if (radius > 150) {
throw new IllegalArgumentException("Radius must be lower or equal than 150.");
}
if (sigma < 0) {
throw new IllegalArgumentException("Sigma must be greater than zero.");
}
return FILTER_BLUR + "(" + radius + "," + sigma + ")";
}
|
[
"public",
"static",
"String",
"blur",
"(",
"int",
"radius",
",",
"int",
"sigma",
")",
"{",
"if",
"(",
"radius",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Radius must be greater than zero.\"",
")",
";",
"}",
"if",
"(",
"radius",
">",
"150",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Radius must be lower or equal than 150.\"",
")",
";",
"}",
"if",
"(",
"sigma",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sigma must be greater than zero.\"",
")",
";",
"}",
"return",
"FILTER_BLUR",
"+",
"\"(\"",
"+",
"radius",
"+",
"\",\"",
"+",
"sigma",
"+",
"\")\"",
";",
"}"
] |
This filter adds a blur effect to the image using the specified radius and sigma.
@param radius Radius used in the gaussian function to generate a matrix, maximum value is 150.
The bigger the radius more blurred will be the image.
@param sigma Sigma used in the gaussian function.
|
[
"This",
"filter",
"adds",
"a",
"blur",
"effect",
"to",
"the",
"image",
"using",
"the",
"specified",
"radius",
"and",
"sigma",
"."
] |
b72430d2799f617f7fcbb2d3ceb27810c9c6d38f
|
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L801-L812
|
162,896 |
square/seismic
|
library/src/main/java/com/squareup/seismic/ShakeDetector.java
|
ShakeDetector.start
|
public boolean start(SensorManager sensorManager) {
// Already started?
if (accelerometer != null) {
return true;
}
accelerometer = sensorManager.getDefaultSensor(
Sensor.TYPE_ACCELEROMETER);
// If this phone has an accelerometer, listen to it.
if (accelerometer != null) {
this.sensorManager = sensorManager;
sensorManager.registerListener(this, accelerometer,
SensorManager.SENSOR_DELAY_FASTEST);
}
return accelerometer != null;
}
|
java
|
public boolean start(SensorManager sensorManager) {
// Already started?
if (accelerometer != null) {
return true;
}
accelerometer = sensorManager.getDefaultSensor(
Sensor.TYPE_ACCELEROMETER);
// If this phone has an accelerometer, listen to it.
if (accelerometer != null) {
this.sensorManager = sensorManager;
sensorManager.registerListener(this, accelerometer,
SensorManager.SENSOR_DELAY_FASTEST);
}
return accelerometer != null;
}
|
[
"public",
"boolean",
"start",
"(",
"SensorManager",
"sensorManager",
")",
"{",
"// Already started?",
"if",
"(",
"accelerometer",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"accelerometer",
"=",
"sensorManager",
".",
"getDefaultSensor",
"(",
"Sensor",
".",
"TYPE_ACCELEROMETER",
")",
";",
"// If this phone has an accelerometer, listen to it.",
"if",
"(",
"accelerometer",
"!=",
"null",
")",
"{",
"this",
".",
"sensorManager",
"=",
"sensorManager",
";",
"sensorManager",
".",
"registerListener",
"(",
"this",
",",
"accelerometer",
",",
"SensorManager",
".",
"SENSOR_DELAY_FASTEST",
")",
";",
"}",
"return",
"accelerometer",
"!=",
"null",
";",
"}"
] |
Starts listening for shakes on devices with appropriate hardware.
@return true if the device supports shake detection.
|
[
"Starts",
"listening",
"for",
"shakes",
"on",
"devices",
"with",
"appropriate",
"hardware",
"."
] |
58660ff81c60d92bd0b863375665857df4c1e5fe
|
https://github.com/square/seismic/blob/58660ff81c60d92bd0b863375665857df4c1e5fe/library/src/main/java/com/squareup/seismic/ShakeDetector.java#L54-L70
|
162,897 |
square/seismic
|
library/src/main/java/com/squareup/seismic/ShakeDetector.java
|
ShakeDetector.stop
|
public void stop() {
if (accelerometer != null) {
queue.clear();
sensorManager.unregisterListener(this, accelerometer);
sensorManager = null;
accelerometer = null;
}
}
|
java
|
public void stop() {
if (accelerometer != null) {
queue.clear();
sensorManager.unregisterListener(this, accelerometer);
sensorManager = null;
accelerometer = null;
}
}
|
[
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"accelerometer",
"!=",
"null",
")",
"{",
"queue",
".",
"clear",
"(",
")",
";",
"sensorManager",
".",
"unregisterListener",
"(",
"this",
",",
"accelerometer",
")",
";",
"sensorManager",
"=",
"null",
";",
"accelerometer",
"=",
"null",
";",
"}",
"}"
] |
Stops listening. Safe to call when already stopped. Ignored on devices
without appropriate hardware.
|
[
"Stops",
"listening",
".",
"Safe",
"to",
"call",
"when",
"already",
"stopped",
".",
"Ignored",
"on",
"devices",
"without",
"appropriate",
"hardware",
"."
] |
58660ff81c60d92bd0b863375665857df4c1e5fe
|
https://github.com/square/seismic/blob/58660ff81c60d92bd0b863375665857df4c1e5fe/library/src/main/java/com/squareup/seismic/ShakeDetector.java#L76-L83
|
162,898 |
Asana/java-asana
|
src/main/java/com/asana/resources/gen/TasksBase.java
|
TasksBase.findById
|
public ItemRequest<Task> findById(String task) {
String path = String.format("/tasks/%s", task);
return new ItemRequest<Task>(this, Task.class, path, "GET");
}
|
java
|
public ItemRequest<Task> findById(String task) {
String path = String.format("/tasks/%s", task);
return new ItemRequest<Task>(this, Task.class, path, "GET");
}
|
[
"public",
"ItemRequest",
"<",
"Task",
">",
"findById",
"(",
"String",
"task",
")",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"\"/tasks/%s\"",
",",
"task",
")",
";",
"return",
"new",
"ItemRequest",
"<",
"Task",
">",
"(",
"this",
",",
"Task",
".",
"class",
",",
"path",
",",
"\"GET\"",
")",
";",
"}"
] |
Returns the complete task record for a single task.
@param task The task to get.
@return Request object
|
[
"Returns",
"the",
"complete",
"task",
"record",
"for",
"a",
"single",
"task",
"."
] |
abeea92fd5a71260a5d804db4da94e52fd7a15a7
|
https://github.com/Asana/java-asana/blob/abeea92fd5a71260a5d804db4da94e52fd7a15a7/src/main/java/com/asana/resources/gen/TasksBase.java#L66-L70
|
162,899 |
Asana/java-asana
|
src/main/java/com/asana/resources/gen/TasksBase.java
|
TasksBase.update
|
public ItemRequest<Task> update(String task) {
String path = String.format("/tasks/%s", task);
return new ItemRequest<Task>(this, Task.class, path, "PUT");
}
|
java
|
public ItemRequest<Task> update(String task) {
String path = String.format("/tasks/%s", task);
return new ItemRequest<Task>(this, Task.class, path, "PUT");
}
|
[
"public",
"ItemRequest",
"<",
"Task",
">",
"update",
"(",
"String",
"task",
")",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"\"/tasks/%s\"",
",",
"task",
")",
";",
"return",
"new",
"ItemRequest",
"<",
"Task",
">",
"(",
"this",
",",
"Task",
".",
"class",
",",
"path",
",",
"\"PUT\"",
")",
";",
"}"
] |
A specific, existing task can be updated by making a PUT request on the
URL for that task. Only the fields provided in the `data` block will be
updated; any unspecified fields will remain unchanged.
When using this method, it is best to specify only those fields you wish
to change, or else you may overwrite changes made by another user since
you last retrieved the task.
Returns the complete updated task record.
@param task The task to update.
@return Request object
|
[
"A",
"specific",
"existing",
"task",
"can",
"be",
"updated",
"by",
"making",
"a",
"PUT",
"request",
"on",
"the",
"URL",
"for",
"that",
"task",
".",
"Only",
"the",
"fields",
"provided",
"in",
"the",
"data",
"block",
"will",
"be",
"updated",
";",
"any",
"unspecified",
"fields",
"will",
"remain",
"unchanged",
"."
] |
abeea92fd5a71260a5d804db4da94e52fd7a15a7
|
https://github.com/Asana/java-asana/blob/abeea92fd5a71260a5d804db4da94e52fd7a15a7/src/main/java/com/asana/resources/gen/TasksBase.java#L86-L90
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.