repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ResourceBundle.java | ResourceBundle.getBundle | public static ResourceBundle getBundle(String baseName, ResourceBundle.Control control) {
"""
Finds the named resource bundle for the specified base name and control.
@param baseName
the base name of a resource bundle
@param control
the control that control the access sequence
@return the named resource bundle
@since 1.6
"""
return getBundle(baseName, Locale.getDefault(), getLoader(), control);
} | java | public static ResourceBundle getBundle(String baseName, ResourceBundle.Control control) {
return getBundle(baseName, Locale.getDefault(), getLoader(), control);
} | [
"public",
"static",
"ResourceBundle",
"getBundle",
"(",
"String",
"baseName",
",",
"ResourceBundle",
".",
"Control",
"control",
")",
"{",
"return",
"getBundle",
"(",
"baseName",
",",
"Locale",
".",
"getDefault",
"(",
")",
",",
"getLoader",
"(",
")",
",",
"control",
")",
";",
"}"
]
| Finds the named resource bundle for the specified base name and control.
@param baseName
the base name of a resource bundle
@param control
the control that control the access sequence
@return the named resource bundle
@since 1.6 | [
"Finds",
"the",
"named",
"resource",
"bundle",
"for",
"the",
"specified",
"base",
"name",
"and",
"control",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ResourceBundle.java#L252-L254 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/concurrent/TaskExecutor.java | TaskExecutor.waitForAny | public T waitForAny(List<Future<T>> futures, @SuppressWarnings("unchecked") TaskObserver<T>... observers) throws InterruptedException, ExecutionException {
"""
Waits until the first task completes, then calls the (optional) observers
to notify the completion and returns the result.
@param futures
the list of futures to wait for.
@param observers
an optional set of observers.
@return
the result of the first task to complete.
@throws InterruptedException
@throws ExecutionException
"""
int count = futures.size();
while(count-- > 0) {
int id = queue.take();
logger.debug("task '{}' complete (count: {}, queue: {})", id, count, queue.size());
T result = futures.get(id).get();
for(TaskObserver<T> observer : observers) {
observer.onTaskComplete(tasks.get(id), result);
}
return result;
}
return null;
} | java | public T waitForAny(List<Future<T>> futures, @SuppressWarnings("unchecked") TaskObserver<T>... observers) throws InterruptedException, ExecutionException {
int count = futures.size();
while(count-- > 0) {
int id = queue.take();
logger.debug("task '{}' complete (count: {}, queue: {})", id, count, queue.size());
T result = futures.get(id).get();
for(TaskObserver<T> observer : observers) {
observer.onTaskComplete(tasks.get(id), result);
}
return result;
}
return null;
} | [
"public",
"T",
"waitForAny",
"(",
"List",
"<",
"Future",
"<",
"T",
">",
">",
"futures",
",",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"TaskObserver",
"<",
"T",
">",
"...",
"observers",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"int",
"count",
"=",
"futures",
".",
"size",
"(",
")",
";",
"while",
"(",
"count",
"--",
">",
"0",
")",
"{",
"int",
"id",
"=",
"queue",
".",
"take",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"task '{}' complete (count: {}, queue: {})\"",
",",
"id",
",",
"count",
",",
"queue",
".",
"size",
"(",
")",
")",
";",
"T",
"result",
"=",
"futures",
".",
"get",
"(",
"id",
")",
".",
"get",
"(",
")",
";",
"for",
"(",
"TaskObserver",
"<",
"T",
">",
"observer",
":",
"observers",
")",
"{",
"observer",
".",
"onTaskComplete",
"(",
"tasks",
".",
"get",
"(",
"id",
")",
",",
"result",
")",
";",
"}",
"return",
"result",
";",
"}",
"return",
"null",
";",
"}"
]
| Waits until the first task completes, then calls the (optional) observers
to notify the completion and returns the result.
@param futures
the list of futures to wait for.
@param observers
an optional set of observers.
@return
the result of the first task to complete.
@throws InterruptedException
@throws ExecutionException | [
"Waits",
"until",
"the",
"first",
"task",
"completes",
"then",
"calls",
"the",
"(",
"optional",
")",
"observers",
"to",
"notify",
"the",
"completion",
"and",
"returns",
"the",
"result",
"."
]
| train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/concurrent/TaskExecutor.java#L210-L222 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java | TemplateTypeMapReplacer.isRecursive | private boolean isRecursive(TemplateType currentType, JSType replacementType) {
"""
Returns whether the replacement type is a templatized type which contains the current type.
e.g. current type T is being replaced with Foo<T>
"""
TemplatizedType replacementTemplatizedType =
replacementType.restrictByNotNullOrUndefined().toMaybeTemplatizedType();
if (replacementTemplatizedType == null) {
return false;
}
Iterable<JSType> replacementTemplateTypes = replacementTemplatizedType.getTemplateTypes();
for (JSType replacementTemplateType : replacementTemplateTypes) {
if (replacementTemplateType.isTemplateType()
&& isSameType(currentType, replacementTemplateType.toMaybeTemplateType())) {
return true;
}
}
return false;
} | java | private boolean isRecursive(TemplateType currentType, JSType replacementType) {
TemplatizedType replacementTemplatizedType =
replacementType.restrictByNotNullOrUndefined().toMaybeTemplatizedType();
if (replacementTemplatizedType == null) {
return false;
}
Iterable<JSType> replacementTemplateTypes = replacementTemplatizedType.getTemplateTypes();
for (JSType replacementTemplateType : replacementTemplateTypes) {
if (replacementTemplateType.isTemplateType()
&& isSameType(currentType, replacementTemplateType.toMaybeTemplateType())) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isRecursive",
"(",
"TemplateType",
"currentType",
",",
"JSType",
"replacementType",
")",
"{",
"TemplatizedType",
"replacementTemplatizedType",
"=",
"replacementType",
".",
"restrictByNotNullOrUndefined",
"(",
")",
".",
"toMaybeTemplatizedType",
"(",
")",
";",
"if",
"(",
"replacementTemplatizedType",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Iterable",
"<",
"JSType",
">",
"replacementTemplateTypes",
"=",
"replacementTemplatizedType",
".",
"getTemplateTypes",
"(",
")",
";",
"for",
"(",
"JSType",
"replacementTemplateType",
":",
"replacementTemplateTypes",
")",
"{",
"if",
"(",
"replacementTemplateType",
".",
"isTemplateType",
"(",
")",
"&&",
"isSameType",
"(",
"currentType",
",",
"replacementTemplateType",
".",
"toMaybeTemplateType",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| Returns whether the replacement type is a templatized type which contains the current type.
e.g. current type T is being replaced with Foo<T> | [
"Returns",
"whether",
"the",
"replacement",
"type",
"is",
"a",
"templatized",
"type",
"which",
"contains",
"the",
"current",
"type",
".",
"e",
".",
"g",
".",
"current",
"type",
"T",
"is",
"being",
"replaced",
"with",
"Foo<T",
">"
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java#L116-L132 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | TypeUtils.mapTypeVariablesToArguments | private static <T> void mapTypeVariablesToArguments(final Class<T> cls,
final ParameterizedType parameterizedType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
"""
<p>Performs a mapping of type variables.</p>
@param <T> the generic type of the class in question
@param cls the class in question
@param parameterizedType the parameterized type
@param typeVarAssigns the map to be filled
"""
// capture the type variables from the owner type that have assignments
final Type ownerType = parameterizedType.getOwnerType();
if (ownerType instanceof ParameterizedType) {
// recursion to make sure the owner's owner type gets processed
mapTypeVariablesToArguments(cls, (ParameterizedType) ownerType, typeVarAssigns);
}
// parameterizedType is a generic interface/class (or it's in the owner
// hierarchy of said interface/class) implemented/extended by the class
// cls. Find out which type variables of cls are type arguments of
// parameterizedType:
final Type[] typeArgs = parameterizedType.getActualTypeArguments();
// of the cls's type variables that are arguments of parameterizedType,
// find out which ones can be determined from the super type's arguments
final TypeVariable<?>[] typeVars = getRawType(parameterizedType).getTypeParameters();
// use List view of type parameters of cls so the contains() method can be used:
final List<TypeVariable<Class<T>>> typeVarList = Arrays.asList(cls
.getTypeParameters());
for (int i = 0; i < typeArgs.length; i++) {
final TypeVariable<?> typeVar = typeVars[i];
final Type typeArg = typeArgs[i];
// argument of parameterizedType is a type variable of cls
if (typeVarList.contains(typeArg)
// type variable of parameterizedType has an assignment in
// the super type.
&& typeVarAssigns.containsKey(typeVar)) {
// map the assignment to the cls's type variable
typeVarAssigns.put((TypeVariable<?>) typeArg, typeVarAssigns.get(typeVar));
}
}
} | java | private static <T> void mapTypeVariablesToArguments(final Class<T> cls,
final ParameterizedType parameterizedType, final Map<TypeVariable<?>, Type> typeVarAssigns) {
// capture the type variables from the owner type that have assignments
final Type ownerType = parameterizedType.getOwnerType();
if (ownerType instanceof ParameterizedType) {
// recursion to make sure the owner's owner type gets processed
mapTypeVariablesToArguments(cls, (ParameterizedType) ownerType, typeVarAssigns);
}
// parameterizedType is a generic interface/class (or it's in the owner
// hierarchy of said interface/class) implemented/extended by the class
// cls. Find out which type variables of cls are type arguments of
// parameterizedType:
final Type[] typeArgs = parameterizedType.getActualTypeArguments();
// of the cls's type variables that are arguments of parameterizedType,
// find out which ones can be determined from the super type's arguments
final TypeVariable<?>[] typeVars = getRawType(parameterizedType).getTypeParameters();
// use List view of type parameters of cls so the contains() method can be used:
final List<TypeVariable<Class<T>>> typeVarList = Arrays.asList(cls
.getTypeParameters());
for (int i = 0; i < typeArgs.length; i++) {
final TypeVariable<?> typeVar = typeVars[i];
final Type typeArg = typeArgs[i];
// argument of parameterizedType is a type variable of cls
if (typeVarList.contains(typeArg)
// type variable of parameterizedType has an assignment in
// the super type.
&& typeVarAssigns.containsKey(typeVar)) {
// map the assignment to the cls's type variable
typeVarAssigns.put((TypeVariable<?>) typeArg, typeVarAssigns.get(typeVar));
}
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"mapTypeVariablesToArguments",
"(",
"final",
"Class",
"<",
"T",
">",
"cls",
",",
"final",
"ParameterizedType",
"parameterizedType",
",",
"final",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"typeVarAssigns",
")",
"{",
"// capture the type variables from the owner type that have assignments",
"final",
"Type",
"ownerType",
"=",
"parameterizedType",
".",
"getOwnerType",
"(",
")",
";",
"if",
"(",
"ownerType",
"instanceof",
"ParameterizedType",
")",
"{",
"// recursion to make sure the owner's owner type gets processed",
"mapTypeVariablesToArguments",
"(",
"cls",
",",
"(",
"ParameterizedType",
")",
"ownerType",
",",
"typeVarAssigns",
")",
";",
"}",
"// parameterizedType is a generic interface/class (or it's in the owner",
"// hierarchy of said interface/class) implemented/extended by the class",
"// cls. Find out which type variables of cls are type arguments of",
"// parameterizedType:",
"final",
"Type",
"[",
"]",
"typeArgs",
"=",
"parameterizedType",
".",
"getActualTypeArguments",
"(",
")",
";",
"// of the cls's type variables that are arguments of parameterizedType,",
"// find out which ones can be determined from the super type's arguments",
"final",
"TypeVariable",
"<",
"?",
">",
"[",
"]",
"typeVars",
"=",
"getRawType",
"(",
"parameterizedType",
")",
".",
"getTypeParameters",
"(",
")",
";",
"// use List view of type parameters of cls so the contains() method can be used:",
"final",
"List",
"<",
"TypeVariable",
"<",
"Class",
"<",
"T",
">",
">",
">",
"typeVarList",
"=",
"Arrays",
".",
"asList",
"(",
"cls",
".",
"getTypeParameters",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeArgs",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"TypeVariable",
"<",
"?",
">",
"typeVar",
"=",
"typeVars",
"[",
"i",
"]",
";",
"final",
"Type",
"typeArg",
"=",
"typeArgs",
"[",
"i",
"]",
";",
"// argument of parameterizedType is a type variable of cls",
"if",
"(",
"typeVarList",
".",
"contains",
"(",
"typeArg",
")",
"// type variable of parameterizedType has an assignment in",
"// the super type.",
"&&",
"typeVarAssigns",
".",
"containsKey",
"(",
"typeVar",
")",
")",
"{",
"// map the assignment to the cls's type variable",
"typeVarAssigns",
".",
"put",
"(",
"(",
"TypeVariable",
"<",
"?",
">",
")",
"typeArg",
",",
"typeVarAssigns",
".",
"get",
"(",
"typeVar",
")",
")",
";",
"}",
"}",
"}"
]
| <p>Performs a mapping of type variables.</p>
@param <T> the generic type of the class in question
@param cls the class in question
@param parameterizedType the parameterized type
@param typeVarAssigns the map to be filled | [
"<p",
">",
"Performs",
"a",
"mapping",
"of",
"type",
"variables",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java#L1006-L1043 |
LMAX-Exchange/disruptor | src/main/java/com/lmax/disruptor/dsl/Disruptor.java | Disruptor.publishEvents | public <A> void publishEvents(final EventTranslatorOneArg<T, A> eventTranslator, final A[] arg) {
"""
Publish a batch of events to the ring buffer.
@param <A> Class of the user supplied argument.
@param eventTranslator the translator that will load data into the event.
@param arg An array single arguments to load into the events. One Per event.
"""
ringBuffer.publishEvents(eventTranslator, arg);
} | java | public <A> void publishEvents(final EventTranslatorOneArg<T, A> eventTranslator, final A[] arg)
{
ringBuffer.publishEvents(eventTranslator, arg);
} | [
"public",
"<",
"A",
">",
"void",
"publishEvents",
"(",
"final",
"EventTranslatorOneArg",
"<",
"T",
",",
"A",
">",
"eventTranslator",
",",
"final",
"A",
"[",
"]",
"arg",
")",
"{",
"ringBuffer",
".",
"publishEvents",
"(",
"eventTranslator",
",",
"arg",
")",
";",
"}"
]
| Publish a batch of events to the ring buffer.
@param <A> Class of the user supplied argument.
@param eventTranslator the translator that will load data into the event.
@param arg An array single arguments to load into the events. One Per event. | [
"Publish",
"a",
"batch",
"of",
"events",
"to",
"the",
"ring",
"buffer",
"."
]
| train | https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/dsl/Disruptor.java#L353-L356 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java | DeployerResolverOverriderConverter.credentialsMigration | public void credentialsMigration(T overrider, Class overriderClass) {
"""
Migrate to Jenkins "Credentials" plugin from the old credential implementation
"""
try {
deployerMigration(overrider, overriderClass);
resolverMigration(overrider, overriderClass);
} catch (NoSuchFieldException | IllegalAccessException | IOException e) {
converterErrors.add(getConversionErrorMessage(overrider, e));
}
} | java | public void credentialsMigration(T overrider, Class overriderClass) {
try {
deployerMigration(overrider, overriderClass);
resolverMigration(overrider, overriderClass);
} catch (NoSuchFieldException | IllegalAccessException | IOException e) {
converterErrors.add(getConversionErrorMessage(overrider, e));
}
} | [
"public",
"void",
"credentialsMigration",
"(",
"T",
"overrider",
",",
"Class",
"overriderClass",
")",
"{",
"try",
"{",
"deployerMigration",
"(",
"overrider",
",",
"overriderClass",
")",
";",
"resolverMigration",
"(",
"overrider",
",",
"overriderClass",
")",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"|",
"IllegalAccessException",
"|",
"IOException",
"e",
")",
"{",
"converterErrors",
".",
"add",
"(",
"getConversionErrorMessage",
"(",
"overrider",
",",
"e",
")",
")",
";",
"}",
"}"
]
| Migrate to Jenkins "Credentials" plugin from the old credential implementation | [
"Migrate",
"to",
"Jenkins",
"Credentials",
"plugin",
"from",
"the",
"old",
"credential",
"implementation"
]
| train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L72-L79 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java | StreamSegmentReadIndex.getLengthUntilNextEntry | @GuardedBy("lock")
private int getLengthUntilNextEntry(long startOffset, int maxLength) {
"""
Returns the length from the given offset until the beginning of the next index entry. If no such entry exists, or
if the length is greater than maxLength, then maxLength is returned.
@param startOffset The offset to search from.
@param maxLength The maximum allowed length.
@return The result.
"""
ReadIndexEntry ceilingEntry = this.indexEntries.getCeiling(startOffset);
if (ceilingEntry != null) {
maxLength = (int) Math.min(maxLength, ceilingEntry.getStreamSegmentOffset() - startOffset);
}
return maxLength;
} | java | @GuardedBy("lock")
private int getLengthUntilNextEntry(long startOffset, int maxLength) {
ReadIndexEntry ceilingEntry = this.indexEntries.getCeiling(startOffset);
if (ceilingEntry != null) {
maxLength = (int) Math.min(maxLength, ceilingEntry.getStreamSegmentOffset() - startOffset);
}
return maxLength;
} | [
"@",
"GuardedBy",
"(",
"\"lock\"",
")",
"private",
"int",
"getLengthUntilNextEntry",
"(",
"long",
"startOffset",
",",
"int",
"maxLength",
")",
"{",
"ReadIndexEntry",
"ceilingEntry",
"=",
"this",
".",
"indexEntries",
".",
"getCeiling",
"(",
"startOffset",
")",
";",
"if",
"(",
"ceilingEntry",
"!=",
"null",
")",
"{",
"maxLength",
"=",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"maxLength",
",",
"ceilingEntry",
".",
"getStreamSegmentOffset",
"(",
")",
"-",
"startOffset",
")",
";",
"}",
"return",
"maxLength",
";",
"}"
]
| Returns the length from the given offset until the beginning of the next index entry. If no such entry exists, or
if the length is greater than maxLength, then maxLength is returned.
@param startOffset The offset to search from.
@param maxLength The maximum allowed length.
@return The result. | [
"Returns",
"the",
"length",
"from",
"the",
"given",
"offset",
"until",
"the",
"beginning",
"of",
"the",
"next",
"index",
"entry",
".",
"If",
"no",
"such",
"entry",
"exists",
"or",
"if",
"the",
"length",
"is",
"greater",
"than",
"maxLength",
"then",
"maxLength",
"is",
"returned",
"."
]
| train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L1009-L1017 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/core/Operations.java | Operations.getOperationsFor | public Operations getOperationsFor(final PMContext ctx, Object instance, Operation operation) throws PMException {
"""
Returns the Operations for a given operation. That is the operations that
are different to the given one, enabled and visible in it.
@param operation The operation
@return The operations
"""
final Operations result = new Operations();
final List<Operation> r = new ArrayList<Operation>();
if (operation != null) {
for (Operation op : getOperations()) {
if (op.isDisplayed(operation.getId()) && op.isEnabled() && !op.equals(operation)) {
if (op.getCondition() == null || op.getCondition().check(ctx, instance, op, operation.getId())) {
if (instance != null || OperationScope.GENERAL.is(op.getScope()) || OperationScope.SELECTED.is(op.getScope())) {
r.add(op);
}
}
}
}
}
result.setOperations(r);
return result;
} | java | public Operations getOperationsFor(final PMContext ctx, Object instance, Operation operation) throws PMException {
final Operations result = new Operations();
final List<Operation> r = new ArrayList<Operation>();
if (operation != null) {
for (Operation op : getOperations()) {
if (op.isDisplayed(operation.getId()) && op.isEnabled() && !op.equals(operation)) {
if (op.getCondition() == null || op.getCondition().check(ctx, instance, op, operation.getId())) {
if (instance != null || OperationScope.GENERAL.is(op.getScope()) || OperationScope.SELECTED.is(op.getScope())) {
r.add(op);
}
}
}
}
}
result.setOperations(r);
return result;
} | [
"public",
"Operations",
"getOperationsFor",
"(",
"final",
"PMContext",
"ctx",
",",
"Object",
"instance",
",",
"Operation",
"operation",
")",
"throws",
"PMException",
"{",
"final",
"Operations",
"result",
"=",
"new",
"Operations",
"(",
")",
";",
"final",
"List",
"<",
"Operation",
">",
"r",
"=",
"new",
"ArrayList",
"<",
"Operation",
">",
"(",
")",
";",
"if",
"(",
"operation",
"!=",
"null",
")",
"{",
"for",
"(",
"Operation",
"op",
":",
"getOperations",
"(",
")",
")",
"{",
"if",
"(",
"op",
".",
"isDisplayed",
"(",
"operation",
".",
"getId",
"(",
")",
")",
"&&",
"op",
".",
"isEnabled",
"(",
")",
"&&",
"!",
"op",
".",
"equals",
"(",
"operation",
")",
")",
"{",
"if",
"(",
"op",
".",
"getCondition",
"(",
")",
"==",
"null",
"||",
"op",
".",
"getCondition",
"(",
")",
".",
"check",
"(",
"ctx",
",",
"instance",
",",
"op",
",",
"operation",
".",
"getId",
"(",
")",
")",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
"||",
"OperationScope",
".",
"GENERAL",
".",
"is",
"(",
"op",
".",
"getScope",
"(",
")",
")",
"||",
"OperationScope",
".",
"SELECTED",
".",
"is",
"(",
"op",
".",
"getScope",
"(",
")",
")",
")",
"{",
"r",
".",
"add",
"(",
"op",
")",
";",
"}",
"}",
"}",
"}",
"}",
"result",
".",
"setOperations",
"(",
"r",
")",
";",
"return",
"result",
";",
"}"
]
| Returns the Operations for a given operation. That is the operations that
are different to the given one, enabled and visible in it.
@param operation The operation
@return The operations | [
"Returns",
"the",
"Operations",
"for",
"a",
"given",
"operation",
".",
"That",
"is",
"the",
"operations",
"that",
"are",
"different",
"to",
"the",
"given",
"one",
"enabled",
"and",
"visible",
"in",
"it",
"."
]
| train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Operations.java#L45-L61 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java | MCAAuthorizationManager.createInstance | public static synchronized MCAAuthorizationManager createInstance(Context context, String tenantId) {
"""
Init singleton instance with context and tenantId
@param context Application context
@param tenantId the unique tenant id of the MCA service instance that the application connects to.
@return The singleton instance
"""
instance = createInstance(context);
if (null != tenantId) {
instance.tenantId = tenantId;
}
return instance;
} | java | public static synchronized MCAAuthorizationManager createInstance(Context context, String tenantId) {
instance = createInstance(context);
if (null != tenantId) {
instance.tenantId = tenantId;
}
return instance;
} | [
"public",
"static",
"synchronized",
"MCAAuthorizationManager",
"createInstance",
"(",
"Context",
"context",
",",
"String",
"tenantId",
")",
"{",
"instance",
"=",
"createInstance",
"(",
"context",
")",
";",
"if",
"(",
"null",
"!=",
"tenantId",
")",
"{",
"instance",
".",
"tenantId",
"=",
"tenantId",
";",
"}",
"return",
"instance",
";",
"}"
]
| Init singleton instance with context and tenantId
@param context Application context
@param tenantId the unique tenant id of the MCA service instance that the application connects to.
@return The singleton instance | [
"Init",
"singleton",
"instance",
"with",
"context",
"and",
"tenantId"
]
| train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java#L100-L107 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java | InstructionView.updateDataFromBannerText | private void updateDataFromBannerText(@NonNull BannerText primaryBannerText, BannerText secondaryBannerText) {
"""
Looks to see if we have a new instruction text.
Sets new instruction text if found.
"""
if (secondaryBannerText == null) {
loadPrimary(primaryBannerText);
return;
}
loadPrimaryAndSecondary(primaryBannerText, secondaryBannerText);
} | java | private void updateDataFromBannerText(@NonNull BannerText primaryBannerText, BannerText secondaryBannerText) {
if (secondaryBannerText == null) {
loadPrimary(primaryBannerText);
return;
}
loadPrimaryAndSecondary(primaryBannerText, secondaryBannerText);
} | [
"private",
"void",
"updateDataFromBannerText",
"(",
"@",
"NonNull",
"BannerText",
"primaryBannerText",
",",
"BannerText",
"secondaryBannerText",
")",
"{",
"if",
"(",
"secondaryBannerText",
"==",
"null",
")",
"{",
"loadPrimary",
"(",
"primaryBannerText",
")",
";",
"return",
";",
"}",
"loadPrimaryAndSecondary",
"(",
"primaryBannerText",
",",
"secondaryBannerText",
")",
";",
"}"
]
| Looks to see if we have a new instruction text.
Sets new instruction text if found. | [
"Looks",
"to",
"see",
"if",
"we",
"have",
"a",
"new",
"instruction",
"text",
".",
"Sets",
"new",
"instruction",
"text",
"if",
"found",
"."
]
| train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L749-L755 |
square/phrase | src/main/java/com/squareup/phrase/Phrase.java | Phrase.from | public static Phrase from(Context c, @StringRes int patternResourceId) {
"""
Entry point into this API.
@throws IllegalArgumentException if pattern contains any syntax errors.
"""
return from(c.getResources(), patternResourceId);
} | java | public static Phrase from(Context c, @StringRes int patternResourceId) {
return from(c.getResources(), patternResourceId);
} | [
"public",
"static",
"Phrase",
"from",
"(",
"Context",
"c",
",",
"@",
"StringRes",
"int",
"patternResourceId",
")",
"{",
"return",
"from",
"(",
"c",
".",
"getResources",
"(",
")",
",",
"patternResourceId",
")",
";",
"}"
]
| Entry point into this API.
@throws IllegalArgumentException if pattern contains any syntax errors. | [
"Entry",
"point",
"into",
"this",
"API",
"."
]
| train | https://github.com/square/phrase/blob/d91f18e80790832db11b811c462f8e5cd492d97e/src/main/java/com/squareup/phrase/Phrase.java#L96-L98 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ValidIdentifiers.java | ValidIdentifiers.isValid | public static Datasubtype isValid(Datatype datatype, Set<Datasubtype> datasubtypes, String code) {
"""
Returns the Datasubtype containing the code, or null if there is none.
"""
Map<Datasubtype, ValiditySet> subtable = ValidityData.data.get(datatype);
if (subtable != null) {
for (Datasubtype datasubtype : datasubtypes) {
ValiditySet validitySet = subtable.get(datasubtype);
if (validitySet != null) {
if (validitySet.contains(AsciiUtil.toLowerString(code))) {
return datasubtype;
}
}
}
}
return null;
} | java | public static Datasubtype isValid(Datatype datatype, Set<Datasubtype> datasubtypes, String code) {
Map<Datasubtype, ValiditySet> subtable = ValidityData.data.get(datatype);
if (subtable != null) {
for (Datasubtype datasubtype : datasubtypes) {
ValiditySet validitySet = subtable.get(datasubtype);
if (validitySet != null) {
if (validitySet.contains(AsciiUtil.toLowerString(code))) {
return datasubtype;
}
}
}
}
return null;
} | [
"public",
"static",
"Datasubtype",
"isValid",
"(",
"Datatype",
"datatype",
",",
"Set",
"<",
"Datasubtype",
">",
"datasubtypes",
",",
"String",
"code",
")",
"{",
"Map",
"<",
"Datasubtype",
",",
"ValiditySet",
">",
"subtable",
"=",
"ValidityData",
".",
"data",
".",
"get",
"(",
"datatype",
")",
";",
"if",
"(",
"subtable",
"!=",
"null",
")",
"{",
"for",
"(",
"Datasubtype",
"datasubtype",
":",
"datasubtypes",
")",
"{",
"ValiditySet",
"validitySet",
"=",
"subtable",
".",
"get",
"(",
"datasubtype",
")",
";",
"if",
"(",
"validitySet",
"!=",
"null",
")",
"{",
"if",
"(",
"validitySet",
".",
"contains",
"(",
"AsciiUtil",
".",
"toLowerString",
"(",
"code",
")",
")",
")",
"{",
"return",
"datasubtype",
";",
"}",
"}",
"}",
"}",
"return",
"null",
";",
"}"
]
| Returns the Datasubtype containing the code, or null if there is none. | [
"Returns",
"the",
"Datasubtype",
"containing",
"the",
"code",
"or",
"null",
"if",
"there",
"is",
"none",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ValidIdentifiers.java#L172-L185 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/LinearRing.java | LinearRing.getBestOffset | private void getBestOffset(final Projection pProjection, final PointL pOffset) {
"""
Compute the pixel offset so that a list of pixel segments display in the best possible way:
the center of all pixels is as close to the screen center as possible
This notion of pixel offset only has a meaning on very low zoom level,
when a GeoPoint can be projected on different places on the screen.
"""
final double powerDifference = pProjection.getProjectedPowerDifference();
final PointL center = pProjection.getLongPixelsFromProjected(
mProjectedCenter, powerDifference, false, null);
final Rect screenRect = pProjection.getIntrinsicScreenRect();
final double screenCenterX = (screenRect.left + screenRect.right) / 2.;
final double screenCenterY = (screenRect.top + screenRect.bottom) / 2.;
final double worldSize = TileSystem.MapSize(pProjection.getZoomLevel());
getBestOffset(center.x, center.y, screenCenterX, screenCenterY, worldSize, pOffset);
} | java | private void getBestOffset(final Projection pProjection, final PointL pOffset) {
final double powerDifference = pProjection.getProjectedPowerDifference();
final PointL center = pProjection.getLongPixelsFromProjected(
mProjectedCenter, powerDifference, false, null);
final Rect screenRect = pProjection.getIntrinsicScreenRect();
final double screenCenterX = (screenRect.left + screenRect.right) / 2.;
final double screenCenterY = (screenRect.top + screenRect.bottom) / 2.;
final double worldSize = TileSystem.MapSize(pProjection.getZoomLevel());
getBestOffset(center.x, center.y, screenCenterX, screenCenterY, worldSize, pOffset);
} | [
"private",
"void",
"getBestOffset",
"(",
"final",
"Projection",
"pProjection",
",",
"final",
"PointL",
"pOffset",
")",
"{",
"final",
"double",
"powerDifference",
"=",
"pProjection",
".",
"getProjectedPowerDifference",
"(",
")",
";",
"final",
"PointL",
"center",
"=",
"pProjection",
".",
"getLongPixelsFromProjected",
"(",
"mProjectedCenter",
",",
"powerDifference",
",",
"false",
",",
"null",
")",
";",
"final",
"Rect",
"screenRect",
"=",
"pProjection",
".",
"getIntrinsicScreenRect",
"(",
")",
";",
"final",
"double",
"screenCenterX",
"=",
"(",
"screenRect",
".",
"left",
"+",
"screenRect",
".",
"right",
")",
"/",
"2.",
";",
"final",
"double",
"screenCenterY",
"=",
"(",
"screenRect",
".",
"top",
"+",
"screenRect",
".",
"bottom",
")",
"/",
"2.",
";",
"final",
"double",
"worldSize",
"=",
"TileSystem",
".",
"MapSize",
"(",
"pProjection",
".",
"getZoomLevel",
"(",
")",
")",
";",
"getBestOffset",
"(",
"center",
".",
"x",
",",
"center",
".",
"y",
",",
"screenCenterX",
",",
"screenCenterY",
",",
"worldSize",
",",
"pOffset",
")",
";",
"}"
]
| Compute the pixel offset so that a list of pixel segments display in the best possible way:
the center of all pixels is as close to the screen center as possible
This notion of pixel offset only has a meaning on very low zoom level,
when a GeoPoint can be projected on different places on the screen. | [
"Compute",
"the",
"pixel",
"offset",
"so",
"that",
"a",
"list",
"of",
"pixel",
"segments",
"display",
"in",
"the",
"best",
"possible",
"way",
":",
"the",
"center",
"of",
"all",
"pixels",
"is",
"as",
"close",
"to",
"the",
"screen",
"center",
"as",
"possible",
"This",
"notion",
"of",
"pixel",
"offset",
"only",
"has",
"a",
"meaning",
"on",
"very",
"low",
"zoom",
"level",
"when",
"a",
"GeoPoint",
"can",
"be",
"projected",
"on",
"different",
"places",
"on",
"the",
"screen",
"."
]
| train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/LinearRing.java#L235-L244 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.deleteDataPoints | public Result<Void> deleteDataPoints(Series series, Interval interval) {
"""
Deletes a range of datapoints for a Series specified by key.
@param series The series
@param interval The start/end datetime interval to delete.
@return Void
@since 1.0.0
"""
checkNotNull(series);
checkNotNull(interval);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s", series.getKey(), interval);
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.DELETE);
Result<Void> result = execute(request, Void.class);
return result;
} | java | public Result<Void> deleteDataPoints(Series series, Interval interval) {
checkNotNull(series);
checkNotNull(interval);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s", series.getKey(), interval);
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.DELETE);
Result<Void> result = execute(request, Void.class);
return result;
} | [
"public",
"Result",
"<",
"Void",
">",
"deleteDataPoints",
"(",
"Series",
"series",
",",
"Interval",
"interval",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"interval",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/data/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"series",
".",
"getKey",
"(",
")",
")",
")",
")",
";",
"addIntervalToURI",
"(",
"builder",
",",
"interval",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s, interval: %s\"",
",",
"series",
".",
"getKey",
"(",
")",
",",
"interval",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"HttpRequest",
"request",
"=",
"buildRequest",
"(",
"uri",
".",
"toString",
"(",
")",
",",
"HttpMethod",
".",
"DELETE",
")",
";",
"Result",
"<",
"Void",
">",
"result",
"=",
"execute",
"(",
"request",
",",
"Void",
".",
"class",
")",
";",
"return",
"result",
";",
"}"
]
| Deletes a range of datapoints for a Series specified by key.
@param series The series
@param interval The start/end datetime interval to delete.
@return Void
@since 1.0.0 | [
"Deletes",
"a",
"range",
"of",
"datapoints",
"for",
"a",
"Series",
"specified",
"by",
"key",
"."
]
| train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L195-L212 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java | JmxUtil.unregisterMBeans | public static int unregisterMBeans(String filter, MBeanServer mBeanServer) {
"""
Unregister all mbeans whose object names match a given filter.
@param filter ObjectName-style formatted filter
@param mBeanServer mbean server from which to unregister mbeans
@return number of mbeans unregistered
"""
try {
ObjectName filterObjName = new ObjectName(filter);
Set<ObjectInstance> mbeans = mBeanServer.queryMBeans(filterObjName, null);
for (ObjectInstance mbean : mbeans) {
ObjectName name = mbean.getObjectName();
if (trace)
log.trace("Unregistering mbean with name: " + name);
SecurityActions.unregisterMBean(name, mBeanServer);
}
return mbeans.size();
} catch (Exception e) {
throw new CacheException(
"Unable to register mbeans with filter=" + filter, e);
}
} | java | public static int unregisterMBeans(String filter, MBeanServer mBeanServer) {
try {
ObjectName filterObjName = new ObjectName(filter);
Set<ObjectInstance> mbeans = mBeanServer.queryMBeans(filterObjName, null);
for (ObjectInstance mbean : mbeans) {
ObjectName name = mbean.getObjectName();
if (trace)
log.trace("Unregistering mbean with name: " + name);
SecurityActions.unregisterMBean(name, mBeanServer);
}
return mbeans.size();
} catch (Exception e) {
throw new CacheException(
"Unable to register mbeans with filter=" + filter, e);
}
} | [
"public",
"static",
"int",
"unregisterMBeans",
"(",
"String",
"filter",
",",
"MBeanServer",
"mBeanServer",
")",
"{",
"try",
"{",
"ObjectName",
"filterObjName",
"=",
"new",
"ObjectName",
"(",
"filter",
")",
";",
"Set",
"<",
"ObjectInstance",
">",
"mbeans",
"=",
"mBeanServer",
".",
"queryMBeans",
"(",
"filterObjName",
",",
"null",
")",
";",
"for",
"(",
"ObjectInstance",
"mbean",
":",
"mbeans",
")",
"{",
"ObjectName",
"name",
"=",
"mbean",
".",
"getObjectName",
"(",
")",
";",
"if",
"(",
"trace",
")",
"log",
".",
"trace",
"(",
"\"Unregistering mbean with name: \"",
"+",
"name",
")",
";",
"SecurityActions",
".",
"unregisterMBean",
"(",
"name",
",",
"mBeanServer",
")",
";",
"}",
"return",
"mbeans",
".",
"size",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"CacheException",
"(",
"\"Unable to register mbeans with filter=\"",
"+",
"filter",
",",
"e",
")",
";",
"}",
"}"
]
| Unregister all mbeans whose object names match a given filter.
@param filter ObjectName-style formatted filter
@param mBeanServer mbean server from which to unregister mbeans
@return number of mbeans unregistered | [
"Unregister",
"all",
"mbeans",
"whose",
"object",
"names",
"match",
"a",
"given",
"filter",
"."
]
| train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java#L94-L110 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java | TypeHandlerUtils.createBlob | public static Object createBlob(Connection conn) throws MjdbcSQLException {
"""
Creates new {@link java.sql.Blob} instance.
Can be invoked only for JDBC4 driver
@param conn SQL connection
@return new {@link java.sql.Blob} instance
@throws org.midao.jdbc.core.exception.MjdbcSQLException
"""
Object result = null;
try {
result = MappingUtils.invokeFunction(conn, "createBlob", new Class[]{}, new Object[]{});
} catch (MjdbcException ex) {
throw new MjdbcSQLException("createBlob is not supported by JDBC Driver", ex);
}
return result;
} | java | public static Object createBlob(Connection conn) throws MjdbcSQLException {
Object result = null;
try {
result = MappingUtils.invokeFunction(conn, "createBlob", new Class[]{}, new Object[]{});
} catch (MjdbcException ex) {
throw new MjdbcSQLException("createBlob is not supported by JDBC Driver", ex);
}
return result;
} | [
"public",
"static",
"Object",
"createBlob",
"(",
"Connection",
"conn",
")",
"throws",
"MjdbcSQLException",
"{",
"Object",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"MappingUtils",
".",
"invokeFunction",
"(",
"conn",
",",
"\"createBlob\"",
",",
"new",
"Class",
"[",
"]",
"{",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"}",
")",
";",
"}",
"catch",
"(",
"MjdbcException",
"ex",
")",
"{",
"throw",
"new",
"MjdbcSQLException",
"(",
"\"createBlob is not supported by JDBC Driver\"",
",",
"ex",
")",
";",
"}",
"return",
"result",
";",
"}"
]
| Creates new {@link java.sql.Blob} instance.
Can be invoked only for JDBC4 driver
@param conn SQL connection
@return new {@link java.sql.Blob} instance
@throws org.midao.jdbc.core.exception.MjdbcSQLException | [
"Creates",
"new",
"{",
"@link",
"java",
".",
"sql",
".",
"Blob",
"}",
"instance",
".",
"Can",
"be",
"invoked",
"only",
"for",
"JDBC4",
"driver"
]
| train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L608-L618 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java | AptMethod.getDefaultReturnValue | public String getDefaultReturnValue(HashMap<String,TypeMirror> typeBinding) {
"""
Returns a default return value string for the method, based upon bound return type
"""
String returnType = getReturnType(typeBinding);
if (_defaultReturnValues.containsKey(returnType))
return _defaultReturnValues.get(returnType);
return "null";
} | java | public String getDefaultReturnValue(HashMap<String,TypeMirror> typeBinding)
{
String returnType = getReturnType(typeBinding);
if (_defaultReturnValues.containsKey(returnType))
return _defaultReturnValues.get(returnType);
return "null";
} | [
"public",
"String",
"getDefaultReturnValue",
"(",
"HashMap",
"<",
"String",
",",
"TypeMirror",
">",
"typeBinding",
")",
"{",
"String",
"returnType",
"=",
"getReturnType",
"(",
"typeBinding",
")",
";",
"if",
"(",
"_defaultReturnValues",
".",
"containsKey",
"(",
"returnType",
")",
")",
"return",
"_defaultReturnValues",
".",
"get",
"(",
"returnType",
")",
";",
"return",
"\"null\"",
";",
"}"
]
| Returns a default return value string for the method, based upon bound return type | [
"Returns",
"a",
"default",
"return",
"value",
"string",
"for",
"the",
"method",
"based",
"upon",
"bound",
"return",
"type"
]
| train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L324-L330 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java | RpcWrapper.callRpcNaked | public void callRpcNaked(S request, T response) throws IOException {
"""
Make the call using the Request ip key to determine the IP address for
communication.
@param request
The request to send.
@param response
A response to hold the returned data.
@throws IOException
"""
callRpcNaked(request, response, chooseIP(request.getIpKey()));
} | java | public void callRpcNaked(S request, T response) throws IOException {
callRpcNaked(request, response, chooseIP(request.getIpKey()));
} | [
"public",
"void",
"callRpcNaked",
"(",
"S",
"request",
",",
"T",
"response",
")",
"throws",
"IOException",
"{",
"callRpcNaked",
"(",
"request",
",",
"response",
",",
"chooseIP",
"(",
"request",
".",
"getIpKey",
"(",
")",
")",
")",
";",
"}"
]
| Make the call using the Request ip key to determine the IP address for
communication.
@param request
The request to send.
@param response
A response to hold the returned data.
@throws IOException | [
"Make",
"the",
"call",
"using",
"the",
"Request",
"ip",
"key",
"to",
"determine",
"the",
"IP",
"address",
"for",
"communication",
"."
]
| train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java#L189-L191 |
jnr/jnr-x86asm | src/main/java/com/kenai/jnr/x86asm/TrampolineWriter.java | TrampolineWriter.writeTrampoline | static void writeTrampoline(ByteBuffer buf, long target) {
"""
Write trampoline into code at address @a code that will jump to @a target.
"""
// Jmp.
buf.put((byte) 0xFF);
// ModM (RIP addressing).
buf.put((byte) 0x25);
// Offset (zero).
buf.putInt(0);
// Absolute address.
buf.putLong(target);
} | java | static void writeTrampoline(ByteBuffer buf, long target) {
// Jmp.
buf.put((byte) 0xFF);
// ModM (RIP addressing).
buf.put((byte) 0x25);
// Offset (zero).
buf.putInt(0);
// Absolute address.
buf.putLong(target);
} | [
"static",
"void",
"writeTrampoline",
"(",
"ByteBuffer",
"buf",
",",
"long",
"target",
")",
"{",
"// Jmp.",
"buf",
".",
"put",
"(",
"(",
"byte",
")",
"0xFF",
")",
";",
"// ModM (RIP addressing).",
"buf",
".",
"put",
"(",
"(",
"byte",
")",
"0x25",
")",
";",
"// Offset (zero).",
"buf",
".",
"putInt",
"(",
"0",
")",
";",
"// Absolute address.",
"buf",
".",
"putLong",
"(",
"target",
")",
";",
"}"
]
| Write trampoline into code at address @a code that will jump to @a target. | [
"Write",
"trampoline",
"into",
"code",
"at",
"address"
]
| train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/com/kenai/jnr/x86asm/TrampolineWriter.java#L42-L52 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java | DfuServiceInitiator.setInitFile | @Deprecated
public DfuServiceInitiator setInitFile(@Nullable final Uri initFileUri, @Nullable final String initFilePath) {
"""
Sets the URI or path to the Init file. The init file for DFU Bootloader version pre-0.5
(SDK 4.3, 6.0, 6.1) contains only the CRC-16 of the firmware. Bootloader version 0.5 or newer
requires the Extended Init Packet. If the URI and path are not null the URI will be used.
@param initFileUri the URI of the init file
@param initFilePath the path of the init file
@return the builder
"""
return init(initFileUri, initFilePath, 0);
} | java | @Deprecated
public DfuServiceInitiator setInitFile(@Nullable final Uri initFileUri, @Nullable final String initFilePath) {
return init(initFileUri, initFilePath, 0);
} | [
"@",
"Deprecated",
"public",
"DfuServiceInitiator",
"setInitFile",
"(",
"@",
"Nullable",
"final",
"Uri",
"initFileUri",
",",
"@",
"Nullable",
"final",
"String",
"initFilePath",
")",
"{",
"return",
"init",
"(",
"initFileUri",
",",
"initFilePath",
",",
"0",
")",
";",
"}"
]
| Sets the URI or path to the Init file. The init file for DFU Bootloader version pre-0.5
(SDK 4.3, 6.0, 6.1) contains only the CRC-16 of the firmware. Bootloader version 0.5 or newer
requires the Extended Init Packet. If the URI and path are not null the URI will be used.
@param initFileUri the URI of the init file
@param initFilePath the path of the init file
@return the builder | [
"Sets",
"the",
"URI",
"or",
"path",
"to",
"the",
"Init",
"file",
".",
"The",
"init",
"file",
"for",
"DFU",
"Bootloader",
"version",
"pre",
"-",
"0",
".",
"5",
"(",
"SDK",
"4",
".",
"3",
"6",
".",
"0",
"6",
".",
"1",
")",
"contains",
"only",
"the",
"CRC",
"-",
"16",
"of",
"the",
"firmware",
".",
"Bootloader",
"version",
"0",
".",
"5",
"or",
"newer",
"requires",
"the",
"Extended",
"Init",
"Packet",
".",
"If",
"the",
"URI",
"and",
"path",
"are",
"not",
"null",
"the",
"URI",
"will",
"be",
"used",
"."
]
| train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L727-L730 |
eyp/serfj | src/main/java/net/sf/serfj/RestController.java | RestController.renderPage | public void renderPage(String resource, String page) throws IOException {
"""
Renders a page from a resource.
@param resource
The name of the resource (bank, account, etc...). It must
exists below /views directory.
@param page
The page can have an extension or not. If it doesn't have an
extension, the framework first looks for page.jsp, then with
.html or .htm extension.
@throws IOException
if the page doesn't exist.
"""
this.response.renderPage(resource, page);
} | java | public void renderPage(String resource, String page) throws IOException {
this.response.renderPage(resource, page);
} | [
"public",
"void",
"renderPage",
"(",
"String",
"resource",
",",
"String",
"page",
")",
"throws",
"IOException",
"{",
"this",
".",
"response",
".",
"renderPage",
"(",
"resource",
",",
"page",
")",
";",
"}"
]
| Renders a page from a resource.
@param resource
The name of the resource (bank, account, etc...). It must
exists below /views directory.
@param page
The page can have an extension or not. If it doesn't have an
extension, the framework first looks for page.jsp, then with
.html or .htm extension.
@throws IOException
if the page doesn't exist. | [
"Renders",
"a",
"page",
"from",
"a",
"resource",
"."
]
| train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/RestController.java#L176-L178 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java | AudioChannel.getPacketSize | private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
"""
Get the best stanza size for a given codec and a codec rate
@param codecFormat
@param milliseconds
@return the best stanza size
@throws IllegalArgumentException
"""
String encoding = codecFormat.getEncoding();
if (encoding.equalsIgnoreCase(AudioFormat.GSM) ||
encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) {
return milliseconds * 4; // 1 byte per millisec
}
else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) ||
encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) {
return milliseconds * 8;
}
else {
throw new IllegalArgumentException("Unknown codec type");
}
} | java | private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
String encoding = codecFormat.getEncoding();
if (encoding.equalsIgnoreCase(AudioFormat.GSM) ||
encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) {
return milliseconds * 4; // 1 byte per millisec
}
else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) ||
encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) {
return milliseconds * 8;
}
else {
throw new IllegalArgumentException("Unknown codec type");
}
} | [
"private",
"int",
"getPacketSize",
"(",
"Format",
"codecFormat",
",",
"int",
"milliseconds",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"encoding",
"=",
"codecFormat",
".",
"getEncoding",
"(",
")",
";",
"if",
"(",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"GSM",
")",
"||",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"GSM_RTP",
")",
")",
"{",
"return",
"milliseconds",
"*",
"4",
";",
"// 1 byte per millisec",
"}",
"else",
"if",
"(",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"ULAW",
")",
"||",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"ULAW_RTP",
")",
")",
"{",
"return",
"milliseconds",
"*",
"8",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown codec type\"",
")",
";",
"}",
"}"
]
| Get the best stanza size for a given codec and a codec rate
@param codecFormat
@param milliseconds
@return the best stanza size
@throws IllegalArgumentException | [
"Get",
"the",
"best",
"stanza",
"size",
"for",
"a",
"given",
"codec",
"and",
"a",
"codec",
"rate"
]
| train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L320-L333 |
Ashok-Varma/BottomNavigation | bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationHelper.java | BottomNavigationHelper.bindTabWithData | static void bindTabWithData(BottomNavigationItem bottomNavigationItem, BottomNavigationTab bottomNavigationTab, BottomNavigationBar bottomNavigationBar) {
"""
Used to get set data to the Tab views from navigation items
@param bottomNavigationItem holds all the data
@param bottomNavigationTab view to which data need to be set
@param bottomNavigationBar view which holds all the tabs
"""
Context context = bottomNavigationBar.getContext();
bottomNavigationTab.setLabel(bottomNavigationItem.getTitle(context));
bottomNavigationTab.setIcon(bottomNavigationItem.getIcon(context));
int activeColor = bottomNavigationItem.getActiveColor(context);
int inActiveColor = bottomNavigationItem.getInActiveColor(context);
if (activeColor != Utils.NO_COLOR) {
bottomNavigationTab.setActiveColor(activeColor);
} else {
bottomNavigationTab.setActiveColor(bottomNavigationBar.getActiveColor());
}
if (inActiveColor != Utils.NO_COLOR) {
bottomNavigationTab.setInactiveColor(inActiveColor);
} else {
bottomNavigationTab.setInactiveColor(bottomNavigationBar.getInActiveColor());
}
if (bottomNavigationItem.isInActiveIconAvailable()) {
Drawable inactiveDrawable = bottomNavigationItem.getInactiveIcon(context);
if (inactiveDrawable != null) {
bottomNavigationTab.setInactiveIcon(inactiveDrawable);
}
}
bottomNavigationTab.setItemBackgroundColor(bottomNavigationBar.getBackgroundColor());
BadgeItem badgeItem = bottomNavigationItem.getBadgeItem();
if (badgeItem != null) {
badgeItem.bindToBottomTab(bottomNavigationTab);
}
} | java | static void bindTabWithData(BottomNavigationItem bottomNavigationItem, BottomNavigationTab bottomNavigationTab, BottomNavigationBar bottomNavigationBar) {
Context context = bottomNavigationBar.getContext();
bottomNavigationTab.setLabel(bottomNavigationItem.getTitle(context));
bottomNavigationTab.setIcon(bottomNavigationItem.getIcon(context));
int activeColor = bottomNavigationItem.getActiveColor(context);
int inActiveColor = bottomNavigationItem.getInActiveColor(context);
if (activeColor != Utils.NO_COLOR) {
bottomNavigationTab.setActiveColor(activeColor);
} else {
bottomNavigationTab.setActiveColor(bottomNavigationBar.getActiveColor());
}
if (inActiveColor != Utils.NO_COLOR) {
bottomNavigationTab.setInactiveColor(inActiveColor);
} else {
bottomNavigationTab.setInactiveColor(bottomNavigationBar.getInActiveColor());
}
if (bottomNavigationItem.isInActiveIconAvailable()) {
Drawable inactiveDrawable = bottomNavigationItem.getInactiveIcon(context);
if (inactiveDrawable != null) {
bottomNavigationTab.setInactiveIcon(inactiveDrawable);
}
}
bottomNavigationTab.setItemBackgroundColor(bottomNavigationBar.getBackgroundColor());
BadgeItem badgeItem = bottomNavigationItem.getBadgeItem();
if (badgeItem != null) {
badgeItem.bindToBottomTab(bottomNavigationTab);
}
} | [
"static",
"void",
"bindTabWithData",
"(",
"BottomNavigationItem",
"bottomNavigationItem",
",",
"BottomNavigationTab",
"bottomNavigationTab",
",",
"BottomNavigationBar",
"bottomNavigationBar",
")",
"{",
"Context",
"context",
"=",
"bottomNavigationBar",
".",
"getContext",
"(",
")",
";",
"bottomNavigationTab",
".",
"setLabel",
"(",
"bottomNavigationItem",
".",
"getTitle",
"(",
"context",
")",
")",
";",
"bottomNavigationTab",
".",
"setIcon",
"(",
"bottomNavigationItem",
".",
"getIcon",
"(",
"context",
")",
")",
";",
"int",
"activeColor",
"=",
"bottomNavigationItem",
".",
"getActiveColor",
"(",
"context",
")",
";",
"int",
"inActiveColor",
"=",
"bottomNavigationItem",
".",
"getInActiveColor",
"(",
"context",
")",
";",
"if",
"(",
"activeColor",
"!=",
"Utils",
".",
"NO_COLOR",
")",
"{",
"bottomNavigationTab",
".",
"setActiveColor",
"(",
"activeColor",
")",
";",
"}",
"else",
"{",
"bottomNavigationTab",
".",
"setActiveColor",
"(",
"bottomNavigationBar",
".",
"getActiveColor",
"(",
")",
")",
";",
"}",
"if",
"(",
"inActiveColor",
"!=",
"Utils",
".",
"NO_COLOR",
")",
"{",
"bottomNavigationTab",
".",
"setInactiveColor",
"(",
"inActiveColor",
")",
";",
"}",
"else",
"{",
"bottomNavigationTab",
".",
"setInactiveColor",
"(",
"bottomNavigationBar",
".",
"getInActiveColor",
"(",
")",
")",
";",
"}",
"if",
"(",
"bottomNavigationItem",
".",
"isInActiveIconAvailable",
"(",
")",
")",
"{",
"Drawable",
"inactiveDrawable",
"=",
"bottomNavigationItem",
".",
"getInactiveIcon",
"(",
"context",
")",
";",
"if",
"(",
"inactiveDrawable",
"!=",
"null",
")",
"{",
"bottomNavigationTab",
".",
"setInactiveIcon",
"(",
"inactiveDrawable",
")",
";",
"}",
"}",
"bottomNavigationTab",
".",
"setItemBackgroundColor",
"(",
"bottomNavigationBar",
".",
"getBackgroundColor",
"(",
")",
")",
";",
"BadgeItem",
"badgeItem",
"=",
"bottomNavigationItem",
".",
"getBadgeItem",
"(",
")",
";",
"if",
"(",
"badgeItem",
"!=",
"null",
")",
"{",
"badgeItem",
".",
"bindToBottomTab",
"(",
"bottomNavigationTab",
")",
";",
"}",
"}"
]
| Used to get set data to the Tab views from navigation items
@param bottomNavigationItem holds all the data
@param bottomNavigationTab view to which data need to be set
@param bottomNavigationBar view which holds all the tabs | [
"Used",
"to",
"get",
"set",
"data",
"to",
"the",
"Tab",
"views",
"from",
"navigation",
"items"
]
| train | https://github.com/Ashok-Varma/BottomNavigation/blob/a5c486a6dfa1ebe7049e2e025e0d967111ecfd0b/bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationHelper.java#L115-L150 |
grpc/grpc-java | netty/src/main/java/io/grpc/netty/NettyClientHandler.java | NettyClientHandler.onRstStreamRead | private void onRstStreamRead(int streamId, long errorCode) {
"""
Handler for an inbound HTTP/2 RST_STREAM frame, terminating a stream.
"""
NettyClientStream.TransportState stream = clientStream(connection().stream(streamId));
if (stream != null) {
Status status = GrpcUtil.Http2Error.statusForCode((int) errorCode)
.augmentDescription("Received Rst Stream");
stream.transportReportStatus(
status,
errorCode == Http2Error.REFUSED_STREAM.code()
? RpcProgress.REFUSED : RpcProgress.PROCESSED,
false /*stop delivery*/,
new Metadata());
if (keepAliveManager != null) {
keepAliveManager.onDataReceived();
}
}
} | java | private void onRstStreamRead(int streamId, long errorCode) {
NettyClientStream.TransportState stream = clientStream(connection().stream(streamId));
if (stream != null) {
Status status = GrpcUtil.Http2Error.statusForCode((int) errorCode)
.augmentDescription("Received Rst Stream");
stream.transportReportStatus(
status,
errorCode == Http2Error.REFUSED_STREAM.code()
? RpcProgress.REFUSED : RpcProgress.PROCESSED,
false /*stop delivery*/,
new Metadata());
if (keepAliveManager != null) {
keepAliveManager.onDataReceived();
}
}
} | [
"private",
"void",
"onRstStreamRead",
"(",
"int",
"streamId",
",",
"long",
"errorCode",
")",
"{",
"NettyClientStream",
".",
"TransportState",
"stream",
"=",
"clientStream",
"(",
"connection",
"(",
")",
".",
"stream",
"(",
"streamId",
")",
")",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"Status",
"status",
"=",
"GrpcUtil",
".",
"Http2Error",
".",
"statusForCode",
"(",
"(",
"int",
")",
"errorCode",
")",
".",
"augmentDescription",
"(",
"\"Received Rst Stream\"",
")",
";",
"stream",
".",
"transportReportStatus",
"(",
"status",
",",
"errorCode",
"==",
"Http2Error",
".",
"REFUSED_STREAM",
".",
"code",
"(",
")",
"?",
"RpcProgress",
".",
"REFUSED",
":",
"RpcProgress",
".",
"PROCESSED",
",",
"false",
"/*stop delivery*/",
",",
"new",
"Metadata",
"(",
")",
")",
";",
"if",
"(",
"keepAliveManager",
"!=",
"null",
")",
"{",
"keepAliveManager",
".",
"onDataReceived",
"(",
")",
";",
"}",
"}",
"}"
]
| Handler for an inbound HTTP/2 RST_STREAM frame, terminating a stream. | [
"Handler",
"for",
"an",
"inbound",
"HTTP",
"/",
"2",
"RST_STREAM",
"frame",
"terminating",
"a",
"stream",
"."
]
| train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyClientHandler.java#L381-L396 |
hal/elemento | core/src/main/java/org/jboss/gwt/elemento/core/Elements.java | Elements.lazyInsertBefore | public static void lazyInsertBefore(Element parent, Element child, Element before) {
"""
Inserts the specified element into the parent element if not already present. If parent already contains child,
this method does nothing.
"""
if (!parent.contains(child)) {
parent.insertBefore(child, before);
}
} | java | public static void lazyInsertBefore(Element parent, Element child, Element before) {
if (!parent.contains(child)) {
parent.insertBefore(child, before);
}
} | [
"public",
"static",
"void",
"lazyInsertBefore",
"(",
"Element",
"parent",
",",
"Element",
"child",
",",
"Element",
"before",
")",
"{",
"if",
"(",
"!",
"parent",
".",
"contains",
"(",
"child",
")",
")",
"{",
"parent",
".",
"insertBefore",
"(",
"child",
",",
"before",
")",
";",
"}",
"}"
]
| Inserts the specified element into the parent element if not already present. If parent already contains child,
this method does nothing. | [
"Inserts",
"the",
"specified",
"element",
"into",
"the",
"parent",
"element",
"if",
"not",
"already",
"present",
".",
"If",
"parent",
"already",
"contains",
"child",
"this",
"method",
"does",
"nothing",
"."
]
| train | https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L698-L702 |
vdurmont/semver4j | src/main/java/com/vdurmont/semver4j/Requirement.java | Requirement.removeFalsePositiveVersionRanges | private static List<Token> removeFalsePositiveVersionRanges(List<Token> tokens) {
"""
Some requirements may contain versions that look like version ranges. For example ' 0.0.1-SNASHOT ' could be
interpreted incorrectly as a version range from 0.0.1 to SNAPSHOT. This method parses all tokens and looks for
groups of three tokens that are respectively of type [VERSION, HYPHEN, VERSION] and validates that the token
after the hyphen is a valid version string. If it isn't the, three tokens are merged into one (thus creating a
single version token, in which the third token is the build information).
@param tokens the tokens contained in the requirement string
@return the tokens with any false positive version ranges replaced with version strings
"""
List<Token> result = new ArrayList<Token>();
for (int i = 0; i < tokens.size(); i++) {
Token token = tokens.get(i);
if (thereIsFalsePositiveVersionRange(tokens, i)) {
token = new Token(TokenType.VERSION, token.value + '-' + tokens.get(i + 2).value);
i += 2;
}
result.add(token);
}
return result;
} | java | private static List<Token> removeFalsePositiveVersionRanges(List<Token> tokens) {
List<Token> result = new ArrayList<Token>();
for (int i = 0; i < tokens.size(); i++) {
Token token = tokens.get(i);
if (thereIsFalsePositiveVersionRange(tokens, i)) {
token = new Token(TokenType.VERSION, token.value + '-' + tokens.get(i + 2).value);
i += 2;
}
result.add(token);
}
return result;
} | [
"private",
"static",
"List",
"<",
"Token",
">",
"removeFalsePositiveVersionRanges",
"(",
"List",
"<",
"Token",
">",
"tokens",
")",
"{",
"List",
"<",
"Token",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Token",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tokens",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Token",
"token",
"=",
"tokens",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"thereIsFalsePositiveVersionRange",
"(",
"tokens",
",",
"i",
")",
")",
"{",
"token",
"=",
"new",
"Token",
"(",
"TokenType",
".",
"VERSION",
",",
"token",
".",
"value",
"+",
"'",
"'",
"+",
"tokens",
".",
"get",
"(",
"i",
"+",
"2",
")",
".",
"value",
")",
";",
"i",
"+=",
"2",
";",
"}",
"result",
".",
"add",
"(",
"token",
")",
";",
"}",
"return",
"result",
";",
"}"
]
| Some requirements may contain versions that look like version ranges. For example ' 0.0.1-SNASHOT ' could be
interpreted incorrectly as a version range from 0.0.1 to SNAPSHOT. This method parses all tokens and looks for
groups of three tokens that are respectively of type [VERSION, HYPHEN, VERSION] and validates that the token
after the hyphen is a valid version string. If it isn't the, three tokens are merged into one (thus creating a
single version token, in which the third token is the build information).
@param tokens the tokens contained in the requirement string
@return the tokens with any false positive version ranges replaced with version strings | [
"Some",
"requirements",
"may",
"contain",
"versions",
"that",
"look",
"like",
"version",
"ranges",
".",
"For",
"example",
"0",
".",
"0",
".",
"1",
"-",
"SNASHOT",
"could",
"be",
"interpreted",
"incorrectly",
"as",
"a",
"version",
"range",
"from",
"0",
".",
"0",
".",
"1",
"to",
"SNAPSHOT",
".",
"This",
"method",
"parses",
"all",
"tokens",
"and",
"looks",
"for",
"groups",
"of",
"three",
"tokens",
"that",
"are",
"respectively",
"of",
"type",
"[",
"VERSION",
"HYPHEN",
"VERSION",
"]",
"and",
"validates",
"that",
"the",
"token",
"after",
"the",
"hyphen",
"is",
"a",
"valid",
"version",
"string",
".",
"If",
"it",
"isn",
"t",
"the",
"three",
"tokens",
"are",
"merged",
"into",
"one",
"(",
"thus",
"creating",
"a",
"single",
"version",
"token",
"in",
"which",
"the",
"third",
"token",
"is",
"the",
"build",
"information",
")",
"."
]
| train | https://github.com/vdurmont/semver4j/blob/3f0266e4985ac29e9da482e04001ed15fad6c3e2/src/main/java/com/vdurmont/semver4j/Requirement.java#L221-L232 |
kaazing/gateway | resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResourceAddressFactorySpi.java | ResourceAddressFactorySpi.newResourceAddress0 | protected T newResourceAddress0(String original, String location, ResourceOptions options) {
"""
note: extra hook for tcp.bind / udp.bind which changes location
"""
final T address = newResourceAddress0(original, location);
setOptions(address, location, options, options.getOption(QUALIFIER));
return address;
} | java | protected T newResourceAddress0(String original, String location, ResourceOptions options) {
final T address = newResourceAddress0(original, location);
setOptions(address, location, options, options.getOption(QUALIFIER));
return address;
} | [
"protected",
"T",
"newResourceAddress0",
"(",
"String",
"original",
",",
"String",
"location",
",",
"ResourceOptions",
"options",
")",
"{",
"final",
"T",
"address",
"=",
"newResourceAddress0",
"(",
"original",
",",
"location",
")",
";",
"setOptions",
"(",
"address",
",",
"location",
",",
"options",
",",
"options",
".",
"getOption",
"(",
"QUALIFIER",
")",
")",
";",
"return",
"address",
";",
"}"
]
| note: extra hook for tcp.bind / udp.bind which changes location | [
"note",
":",
"extra",
"hook",
"for",
"tcp",
".",
"bind",
"/",
"udp",
".",
"bind",
"which",
"changes",
"location"
]
| train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResourceAddressFactorySpi.java#L254-L259 |
cloudiator/flexiant-client | src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java | FlexiantComputeClient.getSingleResource | @Nullable protected <T> T getSingleResource(final SearchFilter sf,
final ResourceType resourceType, final Class<T> type) throws FlexiantException {
"""
Retrieves a single resource using the given search filter and the
given resource type.
@param sf the search filter.
@param resourceType the resource type.
@param type the type of the resulting class.
@return the resource or null if not found.
@throws FlexiantException if multiple resources are returned or an error occurs while contacting the api.
"""
try {
ListResult result = this.getService().listResources(sf, null, resourceType);
if (result.getList().size() > 1) {
throw new FlexiantException("Found multiple resources, single resource expected.");
}
if (result.getList().isEmpty()) {
return null;
}
//noinspection unchecked
return (T) result.getList().get(0);
} catch (ExtilityException e) {
throw new FlexiantException("Error while retrieving resources", e);
}
} | java | @Nullable protected <T> T getSingleResource(final SearchFilter sf,
final ResourceType resourceType, final Class<T> type) throws FlexiantException {
try {
ListResult result = this.getService().listResources(sf, null, resourceType);
if (result.getList().size() > 1) {
throw new FlexiantException("Found multiple resources, single resource expected.");
}
if (result.getList().isEmpty()) {
return null;
}
//noinspection unchecked
return (T) result.getList().get(0);
} catch (ExtilityException e) {
throw new FlexiantException("Error while retrieving resources", e);
}
} | [
"@",
"Nullable",
"protected",
"<",
"T",
">",
"T",
"getSingleResource",
"(",
"final",
"SearchFilter",
"sf",
",",
"final",
"ResourceType",
"resourceType",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"FlexiantException",
"{",
"try",
"{",
"ListResult",
"result",
"=",
"this",
".",
"getService",
"(",
")",
".",
"listResources",
"(",
"sf",
",",
"null",
",",
"resourceType",
")",
";",
"if",
"(",
"result",
".",
"getList",
"(",
")",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"throw",
"new",
"FlexiantException",
"(",
"\"Found multiple resources, single resource expected.\"",
")",
";",
"}",
"if",
"(",
"result",
".",
"getList",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"//noinspection unchecked",
"return",
"(",
"T",
")",
"result",
".",
"getList",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"}",
"catch",
"(",
"ExtilityException",
"e",
")",
"{",
"throw",
"new",
"FlexiantException",
"(",
"\"Error while retrieving resources\"",
",",
"e",
")",
";",
"}",
"}"
]
| Retrieves a single resource using the given search filter and the
given resource type.
@param sf the search filter.
@param resourceType the resource type.
@param type the type of the resulting class.
@return the resource or null if not found.
@throws FlexiantException if multiple resources are returned or an error occurs while contacting the api. | [
"Retrieves",
"a",
"single",
"resource",
"using",
"the",
"given",
"search",
"filter",
"and",
"the",
"given",
"resource",
"type",
"."
]
| train | https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L535-L554 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java | RolesInner.beginCreateOrUpdateAsync | public Observable<RoleInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, RoleInner role) {
"""
Create or update a role.
@param deviceName The device name.
@param name The role name.
@param resourceGroupName The resource group name.
@param role The role properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleInner object
"""
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, role).map(new Func1<ServiceResponse<RoleInner>, RoleInner>() {
@Override
public RoleInner call(ServiceResponse<RoleInner> response) {
return response.body();
}
});
} | java | public Observable<RoleInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, RoleInner role) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, role).map(new Func1<ServiceResponse<RoleInner>, RoleInner>() {
@Override
public RoleInner call(ServiceResponse<RoleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RoleInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"RoleInner",
"role",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGroupName",
",",
"role",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"RoleInner",
">",
",",
"RoleInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"RoleInner",
"call",
"(",
"ServiceResponse",
"<",
"RoleInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Create or update a role.
@param deviceName The device name.
@param name The role name.
@param resourceGroupName The resource group name.
@param role The role properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleInner object | [
"Create",
"or",
"update",
"a",
"role",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java#L435-L442 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.getWorkplaceSettings | public static CmsWorkplaceSettings getWorkplaceSettings(CmsObject cms, HttpServletRequest req) {
"""
Returns the workplace settings of the current user.<p>
@param cms the cms context
@param req the request
@return the workplace settings or <code>null</code> if the user is not logged in
"""
HttpSession session = req.getSession(false);
CmsWorkplaceSettings workplaceSettings = null;
if (session != null) {
// all logged in user will have a session
workplaceSettings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
// ensure workplace settings attribute is set
if (workplaceSettings == null) {
// creating any instance of {@link org.opencms.workplace.CmsWorkplaceSettings} and store it
workplaceSettings = initWorkplaceSettings(cms, null, false);
storeSettings(session, workplaceSettings);
}
}
return workplaceSettings;
} | java | public static CmsWorkplaceSettings getWorkplaceSettings(CmsObject cms, HttpServletRequest req) {
HttpSession session = req.getSession(false);
CmsWorkplaceSettings workplaceSettings = null;
if (session != null) {
// all logged in user will have a session
workplaceSettings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
// ensure workplace settings attribute is set
if (workplaceSettings == null) {
// creating any instance of {@link org.opencms.workplace.CmsWorkplaceSettings} and store it
workplaceSettings = initWorkplaceSettings(cms, null, false);
storeSettings(session, workplaceSettings);
}
}
return workplaceSettings;
} | [
"public",
"static",
"CmsWorkplaceSettings",
"getWorkplaceSettings",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
")",
"{",
"HttpSession",
"session",
"=",
"req",
".",
"getSession",
"(",
"false",
")",
";",
"CmsWorkplaceSettings",
"workplaceSettings",
"=",
"null",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"// all logged in user will have a session",
"workplaceSettings",
"=",
"(",
"CmsWorkplaceSettings",
")",
"session",
".",
"getAttribute",
"(",
"CmsWorkplaceManager",
".",
"SESSION_WORKPLACE_SETTINGS",
")",
";",
"// ensure workplace settings attribute is set",
"if",
"(",
"workplaceSettings",
"==",
"null",
")",
"{",
"// creating any instance of {@link org.opencms.workplace.CmsWorkplaceSettings} and store it",
"workplaceSettings",
"=",
"initWorkplaceSettings",
"(",
"cms",
",",
"null",
",",
"false",
")",
";",
"storeSettings",
"(",
"session",
",",
"workplaceSettings",
")",
";",
"}",
"}",
"return",
"workplaceSettings",
";",
"}"
]
| Returns the workplace settings of the current user.<p>
@param cms the cms context
@param req the request
@return the workplace settings or <code>null</code> if the user is not logged in | [
"Returns",
"the",
"workplace",
"settings",
"of",
"the",
"current",
"user",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L824-L840 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/ClassLoaderUtil.java | ClassLoaderUtil.getOrCreate | public static <T> T getOrCreate(T instance, ClassLoader classLoader, String className) {
"""
Returns the {@code instance}, if not null, or constructs a new instance of the class using
{@link #newInstance(ClassLoader, String)}.
@param instance the instance of the class, can be null
@param classLoader the classloader used for class instantiation
@param className the name of the class being constructed. If null, null is returned.
@return the provided {@code instance} or a newly constructed instance of {@code className}
or null, if {@code className} was null
"""
if (instance != null) {
return instance;
} else if (className != null) {
try {
return ClassLoaderUtil.newInstance(classLoader, className);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
} else {
return null;
}
} | java | public static <T> T getOrCreate(T instance, ClassLoader classLoader, String className) {
if (instance != null) {
return instance;
} else if (className != null) {
try {
return ClassLoaderUtil.newInstance(classLoader, className);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
} else {
return null;
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getOrCreate",
"(",
"T",
"instance",
",",
"ClassLoader",
"classLoader",
",",
"String",
"className",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"return",
"instance",
";",
"}",
"else",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"ClassLoaderUtil",
".",
"newInstance",
"(",
"classLoader",
",",
"className",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"ExceptionUtil",
".",
"rethrow",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
]
| Returns the {@code instance}, if not null, or constructs a new instance of the class using
{@link #newInstance(ClassLoader, String)}.
@param instance the instance of the class, can be null
@param classLoader the classloader used for class instantiation
@param className the name of the class being constructed. If null, null is returned.
@return the provided {@code instance} or a newly constructed instance of {@code className}
or null, if {@code className} was null | [
"Returns",
"the",
"{",
"@code",
"instance",
"}",
"if",
"not",
"null",
"or",
"constructs",
"a",
"new",
"instance",
"of",
"the",
"class",
"using",
"{",
"@link",
"#newInstance",
"(",
"ClassLoader",
"String",
")",
"}",
"."
]
| train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/ClassLoaderUtil.java#L89-L101 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/support/i18n/message/AbstractMessageSource.java | AbstractMessageSource.getMessageFromParent | protected String getMessageFromParent(String code, Object[] args, Locale locale) {
"""
Try to retrieve the given message from the parent MessageSource, if any.
@param code the code to lookup up, such as 'calculator.noRateSet'
@param args array of arguments that will be filled in for params within the message
@param locale the Locale in which to do the lookup
@return the resolved message, or {@code null} if not found
@see #getParentMessageSource() #getParentMessageSource()
"""
MessageSource parent = getParentMessageSource();
if (parent != null) {
if (parent instanceof AbstractMessageSource) {
// Call internal method to avoid getting the default code back
// in case of "useCodeAsDefaultMessage" being activated.
return ((AbstractMessageSource) parent).getMessageInternal(code, args, locale);
} else {
// Check parent MessageSource, returning null if not found there.
return parent.getMessage(code, args, null, locale);
}
}
// Not found in parent either.
return null;
} | java | protected String getMessageFromParent(String code, Object[] args, Locale locale) {
MessageSource parent = getParentMessageSource();
if (parent != null) {
if (parent instanceof AbstractMessageSource) {
// Call internal method to avoid getting the default code back
// in case of "useCodeAsDefaultMessage" being activated.
return ((AbstractMessageSource) parent).getMessageInternal(code, args, locale);
} else {
// Check parent MessageSource, returning null if not found there.
return parent.getMessage(code, args, null, locale);
}
}
// Not found in parent either.
return null;
} | [
"protected",
"String",
"getMessageFromParent",
"(",
"String",
"code",
",",
"Object",
"[",
"]",
"args",
",",
"Locale",
"locale",
")",
"{",
"MessageSource",
"parent",
"=",
"getParentMessageSource",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
"instanceof",
"AbstractMessageSource",
")",
"{",
"// Call internal method to avoid getting the default code back",
"// in case of \"useCodeAsDefaultMessage\" being activated.",
"return",
"(",
"(",
"AbstractMessageSource",
")",
"parent",
")",
".",
"getMessageInternal",
"(",
"code",
",",
"args",
",",
"locale",
")",
";",
"}",
"else",
"{",
"// Check parent MessageSource, returning null if not found there.",
"return",
"parent",
".",
"getMessage",
"(",
"code",
",",
"args",
",",
"null",
",",
"locale",
")",
";",
"}",
"}",
"// Not found in parent either.",
"return",
"null",
";",
"}"
]
| Try to retrieve the given message from the parent MessageSource, if any.
@param code the code to lookup up, such as 'calculator.noRateSet'
@param args array of arguments that will be filled in for params within the message
@param locale the Locale in which to do the lookup
@return the resolved message, or {@code null} if not found
@see #getParentMessageSource() #getParentMessageSource() | [
"Try",
"to",
"retrieve",
"the",
"given",
"message",
"from",
"the",
"parent",
"MessageSource",
"if",
"any",
"."
]
| train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/AbstractMessageSource.java#L208-L222 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java | UserHandlerImpl.postSave | private void postSave(User user, boolean isNew) throws Exception {
"""
Notifying listeners after user creation.
@param user
the user which is used in create operation
@param isNew
true, if we have a deal with new user, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event
"""
for (UserEventListener listener : listeners)
{
listener.postSave(user, isNew);
}
} | java | private void postSave(User user, boolean isNew) throws Exception
{
for (UserEventListener listener : listeners)
{
listener.postSave(user, isNew);
}
} | [
"private",
"void",
"postSave",
"(",
"User",
"user",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"UserEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"postSave",
"(",
"user",
",",
"isNew",
")",
";",
"}",
"}"
]
| Notifying listeners after user creation.
@param user
the user which is used in create operation
@param isNew
true, if we have a deal with new user, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"after",
"user",
"creation",
"."
]
| train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java#L670-L676 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java | TaskLockbox.tryLock | public LockResult tryLock(
final TaskLockType lockType,
final Task task,
final Interval interval
) {
"""
Attempt to acquire a lock for a task, without removing it from the queue. Can safely be called multiple times on
the same task until the lock is preempted.
@param lockType type of lock to be acquired
@param task task that wants a lock
@param interval interval to lock
@return {@link LockResult} containing a new or an existing lock if succeeded. Otherwise, {@link LockResult} with a
{@link LockResult#revoked} flag.
@throws IllegalStateException if the task is not a valid active task
"""
giant.lock();
try {
if (!activeTasks.contains(task.getId())) {
throw new ISE("Unable to grant lock to inactive Task [%s]", task.getId());
}
Preconditions.checkArgument(interval.toDurationMillis() > 0, "interval empty");
final TaskLockPosse posseToUse = createOrFindLockPosse(task, interval, lockType);
if (posseToUse != null && !posseToUse.getTaskLock().isRevoked()) {
// Add to existing TaskLockPosse, if necessary
if (posseToUse.addTask(task)) {
log.info("Added task[%s] to TaskLock[%s]", task.getId(), posseToUse.getTaskLock().getGroupId());
// Update task storage facility. If it fails, revoke the lock.
try {
taskStorage.addLock(task.getId(), posseToUse.getTaskLock());
return LockResult.ok(posseToUse.getTaskLock());
}
catch (Exception e) {
log.makeAlert("Failed to persist lock in storage")
.addData("task", task.getId())
.addData("dataSource", posseToUse.getTaskLock().getDataSource())
.addData("interval", posseToUse.getTaskLock().getInterval())
.addData("version", posseToUse.getTaskLock().getVersion())
.emit();
unlock(task, interval);
return LockResult.fail(false);
}
} else {
log.info("Task[%s] already present in TaskLock[%s]", task.getId(), posseToUse.getTaskLock().getGroupId());
return LockResult.ok(posseToUse.getTaskLock());
}
} else {
final boolean lockRevoked = posseToUse != null && posseToUse.getTaskLock().isRevoked();
return LockResult.fail(lockRevoked);
}
}
finally {
giant.unlock();
}
} | java | public LockResult tryLock(
final TaskLockType lockType,
final Task task,
final Interval interval
)
{
giant.lock();
try {
if (!activeTasks.contains(task.getId())) {
throw new ISE("Unable to grant lock to inactive Task [%s]", task.getId());
}
Preconditions.checkArgument(interval.toDurationMillis() > 0, "interval empty");
final TaskLockPosse posseToUse = createOrFindLockPosse(task, interval, lockType);
if (posseToUse != null && !posseToUse.getTaskLock().isRevoked()) {
// Add to existing TaskLockPosse, if necessary
if (posseToUse.addTask(task)) {
log.info("Added task[%s] to TaskLock[%s]", task.getId(), posseToUse.getTaskLock().getGroupId());
// Update task storage facility. If it fails, revoke the lock.
try {
taskStorage.addLock(task.getId(), posseToUse.getTaskLock());
return LockResult.ok(posseToUse.getTaskLock());
}
catch (Exception e) {
log.makeAlert("Failed to persist lock in storage")
.addData("task", task.getId())
.addData("dataSource", posseToUse.getTaskLock().getDataSource())
.addData("interval", posseToUse.getTaskLock().getInterval())
.addData("version", posseToUse.getTaskLock().getVersion())
.emit();
unlock(task, interval);
return LockResult.fail(false);
}
} else {
log.info("Task[%s] already present in TaskLock[%s]", task.getId(), posseToUse.getTaskLock().getGroupId());
return LockResult.ok(posseToUse.getTaskLock());
}
} else {
final boolean lockRevoked = posseToUse != null && posseToUse.getTaskLock().isRevoked();
return LockResult.fail(lockRevoked);
}
}
finally {
giant.unlock();
}
} | [
"public",
"LockResult",
"tryLock",
"(",
"final",
"TaskLockType",
"lockType",
",",
"final",
"Task",
"task",
",",
"final",
"Interval",
"interval",
")",
"{",
"giant",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"activeTasks",
".",
"contains",
"(",
"task",
".",
"getId",
"(",
")",
")",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"Unable to grant lock to inactive Task [%s]\"",
",",
"task",
".",
"getId",
"(",
")",
")",
";",
"}",
"Preconditions",
".",
"checkArgument",
"(",
"interval",
".",
"toDurationMillis",
"(",
")",
">",
"0",
",",
"\"interval empty\"",
")",
";",
"final",
"TaskLockPosse",
"posseToUse",
"=",
"createOrFindLockPosse",
"(",
"task",
",",
"interval",
",",
"lockType",
")",
";",
"if",
"(",
"posseToUse",
"!=",
"null",
"&&",
"!",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"isRevoked",
"(",
")",
")",
"{",
"// Add to existing TaskLockPosse, if necessary",
"if",
"(",
"posseToUse",
".",
"addTask",
"(",
"task",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Added task[%s] to TaskLock[%s]\"",
",",
"task",
".",
"getId",
"(",
")",
",",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"getGroupId",
"(",
")",
")",
";",
"// Update task storage facility. If it fails, revoke the lock.",
"try",
"{",
"taskStorage",
".",
"addLock",
"(",
"task",
".",
"getId",
"(",
")",
",",
"posseToUse",
".",
"getTaskLock",
"(",
")",
")",
";",
"return",
"LockResult",
".",
"ok",
"(",
"posseToUse",
".",
"getTaskLock",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"makeAlert",
"(",
"\"Failed to persist lock in storage\"",
")",
".",
"addData",
"(",
"\"task\"",
",",
"task",
".",
"getId",
"(",
")",
")",
".",
"addData",
"(",
"\"dataSource\"",
",",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"getDataSource",
"(",
")",
")",
".",
"addData",
"(",
"\"interval\"",
",",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"getInterval",
"(",
")",
")",
".",
"addData",
"(",
"\"version\"",
",",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"getVersion",
"(",
")",
")",
".",
"emit",
"(",
")",
";",
"unlock",
"(",
"task",
",",
"interval",
")",
";",
"return",
"LockResult",
".",
"fail",
"(",
"false",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"info",
"(",
"\"Task[%s] already present in TaskLock[%s]\"",
",",
"task",
".",
"getId",
"(",
")",
",",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"getGroupId",
"(",
")",
")",
";",
"return",
"LockResult",
".",
"ok",
"(",
"posseToUse",
".",
"getTaskLock",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"final",
"boolean",
"lockRevoked",
"=",
"posseToUse",
"!=",
"null",
"&&",
"posseToUse",
".",
"getTaskLock",
"(",
")",
".",
"isRevoked",
"(",
")",
";",
"return",
"LockResult",
".",
"fail",
"(",
"lockRevoked",
")",
";",
"}",
"}",
"finally",
"{",
"giant",
".",
"unlock",
"(",
")",
";",
"}",
"}"
]
| Attempt to acquire a lock for a task, without removing it from the queue. Can safely be called multiple times on
the same task until the lock is preempted.
@param lockType type of lock to be acquired
@param task task that wants a lock
@param interval interval to lock
@return {@link LockResult} containing a new or an existing lock if succeeded. Otherwise, {@link LockResult} with a
{@link LockResult#revoked} flag.
@throws IllegalStateException if the task is not a valid active task | [
"Attempt",
"to",
"acquire",
"a",
"lock",
"for",
"a",
"task",
"without",
"removing",
"it",
"from",
"the",
"queue",
".",
"Can",
"safely",
"be",
"called",
"multiple",
"times",
"on",
"the",
"same",
"task",
"until",
"the",
"lock",
"is",
"preempted",
"."
]
| train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L275-L322 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsButtonBarHandler.java | CmsButtonBarHandler.setButtonBarVisibility | private void setButtonBarVisibility(Widget buttonBar, boolean visible) {
"""
Sets the button bar visibility.<p>
@param buttonBar the button bar
@param visible <code>true</code> to show the button bar
"""
String hoverStyle = I_CmsLayoutBundle.INSTANCE.form().hoverButton();
if (visible) {
buttonBar.addStyleName(hoverStyle);
} else {
buttonBar.removeStyleName(hoverStyle);
}
if (buttonBar instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar).setContentHighlightingVisible(visible);
}
if (buttonBar.getParent() instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar.getParent()).setContentHighlightingVisible(visible);
}
} | java | private void setButtonBarVisibility(Widget buttonBar, boolean visible) {
String hoverStyle = I_CmsLayoutBundle.INSTANCE.form().hoverButton();
if (visible) {
buttonBar.addStyleName(hoverStyle);
} else {
buttonBar.removeStyleName(hoverStyle);
}
if (buttonBar instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar).setContentHighlightingVisible(visible);
}
if (buttonBar.getParent() instanceof CmsInlineEntityWidget) {
((CmsInlineEntityWidget)buttonBar.getParent()).setContentHighlightingVisible(visible);
}
} | [
"private",
"void",
"setButtonBarVisibility",
"(",
"Widget",
"buttonBar",
",",
"boolean",
"visible",
")",
"{",
"String",
"hoverStyle",
"=",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"form",
"(",
")",
".",
"hoverButton",
"(",
")",
";",
"if",
"(",
"visible",
")",
"{",
"buttonBar",
".",
"addStyleName",
"(",
"hoverStyle",
")",
";",
"}",
"else",
"{",
"buttonBar",
".",
"removeStyleName",
"(",
"hoverStyle",
")",
";",
"}",
"if",
"(",
"buttonBar",
"instanceof",
"CmsInlineEntityWidget",
")",
"{",
"(",
"(",
"CmsInlineEntityWidget",
")",
"buttonBar",
")",
".",
"setContentHighlightingVisible",
"(",
"visible",
")",
";",
"}",
"if",
"(",
"buttonBar",
".",
"getParent",
"(",
")",
"instanceof",
"CmsInlineEntityWidget",
")",
"{",
"(",
"(",
"CmsInlineEntityWidget",
")",
"buttonBar",
".",
"getParent",
"(",
")",
")",
".",
"setContentHighlightingVisible",
"(",
"visible",
")",
";",
"}",
"}"
]
| Sets the button bar visibility.<p>
@param buttonBar the button bar
@param visible <code>true</code> to show the button bar | [
"Sets",
"the",
"button",
"bar",
"visibility",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsButtonBarHandler.java#L354-L368 |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/interceptor/InterceptorExecutor.java | InterceptorExecutor.executeAround | public void executeAround(Object interceptor, Method method) {
"""
<strong>note</strong>: Just for this case, method can receive DI.
@param interceptor to be executed
@param method that should be annotated with {@link AroundCall}.
"""
if (method != null) {
Object[] params = parametersResolver.parametersFor(method);
stepInvoker.tryToInvoke(interceptor, method, params);
} else {
simpleInterceptorStack.get().next();
}
} | java | public void executeAround(Object interceptor, Method method) {
if (method != null) {
Object[] params = parametersResolver.parametersFor(method);
stepInvoker.tryToInvoke(interceptor, method, params);
} else {
simpleInterceptorStack.get().next();
}
} | [
"public",
"void",
"executeAround",
"(",
"Object",
"interceptor",
",",
"Method",
"method",
")",
"{",
"if",
"(",
"method",
"!=",
"null",
")",
"{",
"Object",
"[",
"]",
"params",
"=",
"parametersResolver",
".",
"parametersFor",
"(",
"method",
")",
";",
"stepInvoker",
".",
"tryToInvoke",
"(",
"interceptor",
",",
"method",
",",
"params",
")",
";",
"}",
"else",
"{",
"simpleInterceptorStack",
".",
"get",
"(",
")",
".",
"next",
"(",
")",
";",
"}",
"}"
]
| <strong>note</strong>: Just for this case, method can receive DI.
@param interceptor to be executed
@param method that should be annotated with {@link AroundCall}. | [
"<strong",
">",
"note<",
"/",
"strong",
">",
":",
"Just",
"for",
"this",
"case",
"method",
"can",
"receive",
"DI",
"."
]
| train | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/interceptor/InterceptorExecutor.java#L72-L79 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_receivers_slotId_DELETE | public void serviceName_receivers_slotId_DELETE(String serviceName, Long slotId) throws IOException {
"""
Delete the document from the slot
REST: DELETE /sms/{serviceName}/receivers/{slotId}
@param serviceName [required] The internal name of your SMS offer
@param slotId [required] Slot number id
"""
String qPath = "/sms/{serviceName}/receivers/{slotId}";
StringBuilder sb = path(qPath, serviceName, slotId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_receivers_slotId_DELETE(String serviceName, Long slotId) throws IOException {
String qPath = "/sms/{serviceName}/receivers/{slotId}";
StringBuilder sb = path(qPath, serviceName, slotId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_receivers_slotId_DELETE",
"(",
"String",
"serviceName",
",",
"Long",
"slotId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/receivers/{slotId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"slotId",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
]
| Delete the document from the slot
REST: DELETE /sms/{serviceName}/receivers/{slotId}
@param serviceName [required] The internal name of your SMS offer
@param slotId [required] Slot number id | [
"Delete",
"the",
"document",
"from",
"the",
"slot"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L573-L577 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java | DescriptorRepository.discoverDescriptor | protected ClassDescriptor discoverDescriptor(String className) {
"""
Starts by looking to see if the <code>className</code> is
already mapped specifically to the descritpor repository.
If the <code>className</code> is not specifically mapped we
look at the <code>className</code>'s parent class for a mapping.
We do this until the parent class is of the type
<code>java.lang.Object</code>. If no mapping was found,
<code>null</code> is returned. Mappings successfuly discovered
through inheritence are added to the internal table of
class descriptors to improve performance on subsequent requests
for those classes.
<br/>
author <a href="mailto:[email protected]">Scott T. Weaver</a>
@param className name of class whose descriptor we need to find.
@return ClassDescriptor for <code>className</code> or <code>null</code>
if no ClassDescriptor could be located.
"""
ClassDescriptor result = (ClassDescriptor) descriptorTable.get(className);
if (result == null)
{
Class clazz;
try
{
clazz = ClassHelper.getClass(className, true);
}
catch (ClassNotFoundException e)
{
throw new OJBRuntimeException("Class, " + className + ", could not be found.", e);
}
result = discoverDescriptor(clazz);
}
return result;
} | java | protected ClassDescriptor discoverDescriptor(String className)
{
ClassDescriptor result = (ClassDescriptor) descriptorTable.get(className);
if (result == null)
{
Class clazz;
try
{
clazz = ClassHelper.getClass(className, true);
}
catch (ClassNotFoundException e)
{
throw new OJBRuntimeException("Class, " + className + ", could not be found.", e);
}
result = discoverDescriptor(clazz);
}
return result;
} | [
"protected",
"ClassDescriptor",
"discoverDescriptor",
"(",
"String",
"className",
")",
"{",
"ClassDescriptor",
"result",
"=",
"(",
"ClassDescriptor",
")",
"descriptorTable",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"Class",
"clazz",
";",
"try",
"{",
"clazz",
"=",
"ClassHelper",
".",
"getClass",
"(",
"className",
",",
"true",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"OJBRuntimeException",
"(",
"\"Class, \"",
"+",
"className",
"+",
"\", could not be found.\"",
",",
"e",
")",
";",
"}",
"result",
"=",
"discoverDescriptor",
"(",
"clazz",
")",
";",
"}",
"return",
"result",
";",
"}"
]
| Starts by looking to see if the <code>className</code> is
already mapped specifically to the descritpor repository.
If the <code>className</code> is not specifically mapped we
look at the <code>className</code>'s parent class for a mapping.
We do this until the parent class is of the type
<code>java.lang.Object</code>. If no mapping was found,
<code>null</code> is returned. Mappings successfuly discovered
through inheritence are added to the internal table of
class descriptors to improve performance on subsequent requests
for those classes.
<br/>
author <a href="mailto:[email protected]">Scott T. Weaver</a>
@param className name of class whose descriptor we need to find.
@return ClassDescriptor for <code>className</code> or <code>null</code>
if no ClassDescriptor could be located. | [
"Starts",
"by",
"looking",
"to",
"see",
"if",
"the",
"<code",
">",
"className<",
"/",
"code",
">",
"is",
"already",
"mapped",
"specifically",
"to",
"the",
"descritpor",
"repository",
".",
"If",
"the",
"<code",
">",
"className<",
"/",
"code",
">",
"is",
"not",
"specifically",
"mapped",
"we",
"look",
"at",
"the",
"<code",
">",
"className<",
"/",
"code",
">",
"s",
"parent",
"class",
"for",
"a",
"mapping",
".",
"We",
"do",
"this",
"until",
"the",
"parent",
"class",
"is",
"of",
"the",
"type",
"<code",
">",
"java",
".",
"lang",
".",
"Object<",
"/",
"code",
">",
".",
"If",
"no",
"mapping",
"was",
"found",
"<code",
">",
"null<",
"/",
"code",
">",
"is",
"returned",
".",
"Mappings",
"successfuly",
"discovered",
"through",
"inheritence",
"are",
"added",
"to",
"the",
"internal",
"table",
"of",
"class",
"descriptors",
"to",
"improve",
"performance",
"on",
"subsequent",
"requests",
"for",
"those",
"classes",
"."
]
| train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java#L627-L644 |
strator-dev/greenpepper | greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/container/PHPContainer.java | PHPContainer.createObject | public String createObject(PHPClassDescriptor desc, String ... params) throws PHPException {
"""
<p>createObject.</p>
@param desc a {@link com.greenpepper.phpsud.container.PHPClassDescriptor} object.
@param params a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
@throws com.greenpepper.phpsud.exceptions.PHPException if any.
"""
String cmd = PHPInterpeter.saveObject("new " + desc.getClassName() + "(" + Helper.formatParamList(params) + ")");
return get(cmd);
} | java | public String createObject(PHPClassDescriptor desc, String ... params) throws PHPException {
String cmd = PHPInterpeter.saveObject("new " + desc.getClassName() + "(" + Helper.formatParamList(params) + ")");
return get(cmd);
} | [
"public",
"String",
"createObject",
"(",
"PHPClassDescriptor",
"desc",
",",
"String",
"...",
"params",
")",
"throws",
"PHPException",
"{",
"String",
"cmd",
"=",
"PHPInterpeter",
".",
"saveObject",
"(",
"\"new \"",
"+",
"desc",
".",
"getClassName",
"(",
")",
"+",
"\"(\"",
"+",
"Helper",
".",
"formatParamList",
"(",
"params",
")",
"+",
"\")\"",
")",
";",
"return",
"get",
"(",
"cmd",
")",
";",
"}"
]
| <p>createObject.</p>
@param desc a {@link com.greenpepper.phpsud.container.PHPClassDescriptor} object.
@param params a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
@throws com.greenpepper.phpsud.exceptions.PHPException if any. | [
"<p",
">",
"createObject",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/container/PHPContainer.java#L210-L213 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java | CodedConstant.getWireFormatForFieldType | static int getWireFormatForFieldType(final WireFormat.FieldType type, boolean isPacked) {
"""
Given a field type, return the wire type.
@param type the type
@param isPacked the is packed
@return the wire format for field type
@returns One of the {@code WIRETYPE_} constants defined in {@link WireFormat}.
"""
if (isPacked) {
return WireFormat.WIRETYPE_LENGTH_DELIMITED;
} else {
return type.getWireType();
}
} | java | static int getWireFormatForFieldType(final WireFormat.FieldType type, boolean isPacked) {
if (isPacked) {
return WireFormat.WIRETYPE_LENGTH_DELIMITED;
} else {
return type.getWireType();
}
} | [
"static",
"int",
"getWireFormatForFieldType",
"(",
"final",
"WireFormat",
".",
"FieldType",
"type",
",",
"boolean",
"isPacked",
")",
"{",
"if",
"(",
"isPacked",
")",
"{",
"return",
"WireFormat",
".",
"WIRETYPE_LENGTH_DELIMITED",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getWireType",
"(",
")",
";",
"}",
"}"
]
| Given a field type, return the wire type.
@param type the type
@param isPacked the is packed
@return the wire format for field type
@returns One of the {@code WIRETYPE_} constants defined in {@link WireFormat}. | [
"Given",
"a",
"field",
"type",
"return",
"the",
"wire",
"type",
"."
]
| train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L1185-L1191 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/ActivityUtils.java | ActivityUtils.findViewById | @SuppressWarnings("unchecked") // we know that return value type is a child of view, and V is bound to a child of view.
public static <V extends View> V findViewById(Activity activity, int id) {
"""
Find the specific view from the activity.
Returning value type is bound to your variable type.
@param activity the activity.
@param id the view id.
@param <V> the view class type parameter.
@return the view, null if not found.
"""
return (V) activity.findViewById(id);
} | java | @SuppressWarnings("unchecked") // we know that return value type is a child of view, and V is bound to a child of view.
public static <V extends View> V findViewById(Activity activity, int id) {
return (V) activity.findViewById(id);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// we know that return value type is a child of view, and V is bound to a child of view.",
"public",
"static",
"<",
"V",
"extends",
"View",
">",
"V",
"findViewById",
"(",
"Activity",
"activity",
",",
"int",
"id",
")",
"{",
"return",
"(",
"V",
")",
"activity",
".",
"findViewById",
"(",
"id",
")",
";",
"}"
]
| Find the specific view from the activity.
Returning value type is bound to your variable type.
@param activity the activity.
@param id the view id.
@param <V> the view class type parameter.
@return the view, null if not found. | [
"Find",
"the",
"specific",
"view",
"from",
"the",
"activity",
".",
"Returning",
"value",
"type",
"is",
"bound",
"to",
"your",
"variable",
"type",
"."
]
| train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/ActivityUtils.java#L23-L26 |
raydac/netbeans-mmd-plugin | mind-map/mind-map-ide-common/src/main/java/com/igormaznitsa/mindmap/ide/commons/Misc.java | Misc.string2pattern | @Nonnull
public static Pattern string2pattern(@Nonnull final String text, final int patternFlags) {
"""
Create pattern from string.
@param text text to be converted into pattern.
@param patternFlags flags to be used
@return formed pattern
"""
final StringBuilder result = new StringBuilder();
for (final char c : text.toCharArray()) {
result.append("\\u"); //NOI18N
final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH);
result.append("0000", 0, 4 - code.length()).append(code); //NOI18N
}
return Pattern.compile(result.toString(), patternFlags);
} | java | @Nonnull
public static Pattern string2pattern(@Nonnull final String text, final int patternFlags) {
final StringBuilder result = new StringBuilder();
for (final char c : text.toCharArray()) {
result.append("\\u"); //NOI18N
final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH);
result.append("0000", 0, 4 - code.length()).append(code); //NOI18N
}
return Pattern.compile(result.toString(), patternFlags);
} | [
"@",
"Nonnull",
"public",
"static",
"Pattern",
"string2pattern",
"(",
"@",
"Nonnull",
"final",
"String",
"text",
",",
"final",
"int",
"patternFlags",
")",
"{",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"char",
"c",
":",
"text",
".",
"toCharArray",
"(",
")",
")",
"{",
"result",
".",
"append",
"(",
"\"\\\\u\"",
")",
";",
"//NOI18N",
"final",
"String",
"code",
"=",
"Integer",
".",
"toHexString",
"(",
"c",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"result",
".",
"append",
"(",
"\"0000\"",
",",
"0",
",",
"4",
"-",
"code",
".",
"length",
"(",
")",
")",
".",
"append",
"(",
"code",
")",
";",
"//NOI18N",
"}",
"return",
"Pattern",
".",
"compile",
"(",
"result",
".",
"toString",
"(",
")",
",",
"patternFlags",
")",
";",
"}"
]
| Create pattern from string.
@param text text to be converted into pattern.
@param patternFlags flags to be used
@return formed pattern | [
"Create",
"pattern",
"from",
"string",
"."
]
| train | https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-ide-common/src/main/java/com/igormaznitsa/mindmap/ide/commons/Misc.java#L54-L65 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLock | public <E> E updateWithOptimisticLock(E entity) {
"""
Updates the given entity with optimistic locking, if the entity is set up to support optimistic
locking. Otherwise, a normal update is performed.
@param entity
the entity to update
@return the updated entity which may be different than the given entity.
"""
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
if (versionMetadata == null) {
return update(entity);
} else {
return updateWithOptimisticLockingInternal(entity, versionMetadata);
}
} | java | public <E> E updateWithOptimisticLock(E entity) {
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entity);
if (versionMetadata == null) {
return update(entity);
} else {
return updateWithOptimisticLockingInternal(entity, versionMetadata);
}
} | [
"public",
"<",
"E",
">",
"E",
"updateWithOptimisticLock",
"(",
"E",
"entity",
")",
"{",
"PropertyMetadata",
"versionMetadata",
"=",
"EntityIntrospector",
".",
"getVersionMetadata",
"(",
"entity",
")",
";",
"if",
"(",
"versionMetadata",
"==",
"null",
")",
"{",
"return",
"update",
"(",
"entity",
")",
";",
"}",
"else",
"{",
"return",
"updateWithOptimisticLockingInternal",
"(",
"entity",
",",
"versionMetadata",
")",
";",
"}",
"}"
]
| Updates the given entity with optimistic locking, if the entity is set up to support optimistic
locking. Otherwise, a normal update is performed.
@param entity
the entity to update
@return the updated entity which may be different than the given entity. | [
"Updates",
"the",
"given",
"entity",
"with",
"optimistic",
"locking",
"if",
"the",
"entity",
"is",
"set",
"up",
"to",
"support",
"optimistic",
"locking",
".",
"Otherwise",
"a",
"normal",
"update",
"is",
"performed",
"."
]
| train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L217-L225 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/EmbedBuilder.java | EmbedBuilder.setAuthor | public EmbedBuilder setAuthor(String name, String url, String iconUrl) {
"""
Sets the Author of the embed. The author appears in the top left of the embed and can have a small
image beside it along with the author's name being made clickable by way of providing a url.
<p><b><a href="http://i.imgur.com/JgZtxIM.png">Example</a></b>
<p><b>Uploading images with Embeds</b>
<br>When uploading an <u>image</u>
(using {@link net.dv8tion.jda.core.entities.MessageChannel#sendFile(java.io.File, net.dv8tion.jda.core.entities.Message) MessageChannel.sendFile(...)})
you can reference said image using the specified filename as URI {@code attachment://filename.ext}.
<p><u>Example</u>
<pre><code>
MessageChannel channel; // = reference of a MessageChannel
MessageBuilder message = new MessageBuilder();
EmbedBuilder embed = new EmbedBuilder();
InputStream file = new URL("https://http.cat/500").openStream();
embed.setAuthor("Minn", null, "attachment://cat.png") // we specify this in sendFile as "cat.png"
.setDescription("This is a cute cat :3");
message.setEmbed(embed.build());
channel.sendFile(file, "cat.png", message.build()).queue();
</code></pre>
@param name
the name of the author of the embed. If this is not set, the author will not appear in the embed
@param url
the url of the author of the embed
@param iconUrl
the url of the icon for the author
@throws java.lang.IllegalArgumentException
<ul>
<li>If the length of {@code url} is longer than {@link net.dv8tion.jda.core.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
<li>If the provided {@code url} is not a properly formatted http or https url.</li>
<li>If the length of {@code iconUrl} is longer than {@link net.dv8tion.jda.core.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
<li>If the provided {@code iconUrl} is not a properly formatted http or https url.</li>
</ul>
@return the builder after the author has been set
"""
//We only check if the name is null because its presence is what determines if the
// the author will appear in the embed.
if (name == null)
{
this.author = null;
}
else
{
urlCheck(url);
urlCheck(iconUrl);
this.author = new MessageEmbed.AuthorInfo(name, url, iconUrl, null);
}
return this;
} | java | public EmbedBuilder setAuthor(String name, String url, String iconUrl)
{
//We only check if the name is null because its presence is what determines if the
// the author will appear in the embed.
if (name == null)
{
this.author = null;
}
else
{
urlCheck(url);
urlCheck(iconUrl);
this.author = new MessageEmbed.AuthorInfo(name, url, iconUrl, null);
}
return this;
} | [
"public",
"EmbedBuilder",
"setAuthor",
"(",
"String",
"name",
",",
"String",
"url",
",",
"String",
"iconUrl",
")",
"{",
"//We only check if the name is null because its presence is what determines if the",
"// the author will appear in the embed.",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"this",
".",
"author",
"=",
"null",
";",
"}",
"else",
"{",
"urlCheck",
"(",
"url",
")",
";",
"urlCheck",
"(",
"iconUrl",
")",
";",
"this",
".",
"author",
"=",
"new",
"MessageEmbed",
".",
"AuthorInfo",
"(",
"name",
",",
"url",
",",
"iconUrl",
",",
"null",
")",
";",
"}",
"return",
"this",
";",
"}"
]
| Sets the Author of the embed. The author appears in the top left of the embed and can have a small
image beside it along with the author's name being made clickable by way of providing a url.
<p><b><a href="http://i.imgur.com/JgZtxIM.png">Example</a></b>
<p><b>Uploading images with Embeds</b>
<br>When uploading an <u>image</u>
(using {@link net.dv8tion.jda.core.entities.MessageChannel#sendFile(java.io.File, net.dv8tion.jda.core.entities.Message) MessageChannel.sendFile(...)})
you can reference said image using the specified filename as URI {@code attachment://filename.ext}.
<p><u>Example</u>
<pre><code>
MessageChannel channel; // = reference of a MessageChannel
MessageBuilder message = new MessageBuilder();
EmbedBuilder embed = new EmbedBuilder();
InputStream file = new URL("https://http.cat/500").openStream();
embed.setAuthor("Minn", null, "attachment://cat.png") // we specify this in sendFile as "cat.png"
.setDescription("This is a cute cat :3");
message.setEmbed(embed.build());
channel.sendFile(file, "cat.png", message.build()).queue();
</code></pre>
@param name
the name of the author of the embed. If this is not set, the author will not appear in the embed
@param url
the url of the author of the embed
@param iconUrl
the url of the icon for the author
@throws java.lang.IllegalArgumentException
<ul>
<li>If the length of {@code url} is longer than {@link net.dv8tion.jda.core.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
<li>If the provided {@code url} is not a properly formatted http or https url.</li>
<li>If the length of {@code iconUrl} is longer than {@link net.dv8tion.jda.core.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
<li>If the provided {@code iconUrl} is not a properly formatted http or https url.</li>
</ul>
@return the builder after the author has been set | [
"Sets",
"the",
"Author",
"of",
"the",
"embed",
".",
"The",
"author",
"appears",
"in",
"the",
"top",
"left",
"of",
"the",
"embed",
"and",
"can",
"have",
"a",
"small",
"image",
"beside",
"it",
"along",
"with",
"the",
"author",
"s",
"name",
"being",
"made",
"clickable",
"by",
"way",
"of",
"providing",
"a",
"url",
"."
]
| train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/EmbedBuilder.java#L607-L622 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getNTLMv2Response | public static byte[] getNTLMv2Response(String target, String user,
String password, byte[] targetInformation, byte[] challenge,
byte[] clientNonce, long time) throws Exception {
"""
Calculates the NTLMv2 Response for the given challenge, using the
specified authentication target, username, password, target information
block, and client nonce.
@param target The authentication target (i.e., domain).
@param user The username.
@param password The user's password.
@param targetInformation The target information block from the Type 2
message.
@param challenge The Type 2 challenge from the server.
@param clientNonce The random 8-byte client nonce.
@param time The time stamp.
@return The NTLMv2 Response.
"""
byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
byte[] blob = createBlob(targetInformation, clientNonce, time);
return lmv2Response(ntlmv2Hash, blob, challenge);
} | java | public static byte[] getNTLMv2Response(String target, String user,
String password, byte[] targetInformation, byte[] challenge,
byte[] clientNonce, long time) throws Exception {
byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
byte[] blob = createBlob(targetInformation, clientNonce, time);
return lmv2Response(ntlmv2Hash, blob, challenge);
} | [
"public",
"static",
"byte",
"[",
"]",
"getNTLMv2Response",
"(",
"String",
"target",
",",
"String",
"user",
",",
"String",
"password",
",",
"byte",
"[",
"]",
"targetInformation",
",",
"byte",
"[",
"]",
"challenge",
",",
"byte",
"[",
"]",
"clientNonce",
",",
"long",
"time",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"ntlmv2Hash",
"=",
"ntlmv2Hash",
"(",
"target",
",",
"user",
",",
"password",
")",
";",
"byte",
"[",
"]",
"blob",
"=",
"createBlob",
"(",
"targetInformation",
",",
"clientNonce",
",",
"time",
")",
";",
"return",
"lmv2Response",
"(",
"ntlmv2Hash",
",",
"blob",
",",
"challenge",
")",
";",
"}"
]
| Calculates the NTLMv2 Response for the given challenge, using the
specified authentication target, username, password, target information
block, and client nonce.
@param target The authentication target (i.e., domain).
@param user The username.
@param password The user's password.
@param targetInformation The target information block from the Type 2
message.
@param challenge The Type 2 challenge from the server.
@param clientNonce The random 8-byte client nonce.
@param time The time stamp.
@return The NTLMv2 Response. | [
"Calculates",
"the",
"NTLMv2",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"authentication",
"target",
"username",
"password",
"target",
"information",
"block",
"and",
"client",
"nonce",
"."
]
| train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L121-L127 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java | Collator.getDisplayName | static public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {
"""
<strong>[icu]</strong> Returns the name of the collator for the objectLocale, localized for the
displayLocale.
@param objectLocale the locale of the collator
@param displayLocale the locale for the collator's display name
@return the display name
"""
return getShim().getDisplayName(objectLocale, displayLocale);
} | java | static public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {
return getShim().getDisplayName(objectLocale, displayLocale);
} | [
"static",
"public",
"String",
"getDisplayName",
"(",
"ULocale",
"objectLocale",
",",
"ULocale",
"displayLocale",
")",
"{",
"return",
"getShim",
"(",
")",
".",
"getDisplayName",
"(",
"objectLocale",
",",
"displayLocale",
")",
";",
"}"
]
| <strong>[icu]</strong> Returns the name of the collator for the objectLocale, localized for the
displayLocale.
@param objectLocale the locale of the collator
@param displayLocale the locale for the collator's display name
@return the display name | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"the",
"name",
"of",
"the",
"collator",
"for",
"the",
"objectLocale",
"localized",
"for",
"the",
"displayLocale",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L1072-L1074 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java | FATHelper.updateConfigDynamically | public static void updateConfigDynamically(LibertyServer server, ServerConfiguration config, boolean waitForAppToStart) throws Exception {
"""
This method will the reset the log and trace marks for log and trace searches, update the
configuration and then wait for the server to re-initialize. Optionally it will then wait for the application to start.
@param server The server to update.
@param config The configuration to use.
@param waitForAppToStart Wait for the application to start.
@throws Exception If there was an issue updating the server configuration.
"""
resetMarksInLogs(server);
server.updateServerConfiguration(config);
server.waitForStringInLogUsingMark("CWWKG001[7-8]I");
if (waitForAppToStart) {
server.waitForStringInLogUsingMark("CWWKZ0003I"); //CWWKZ0003I: The application **** updated in 0.020 seconds.
}
} | java | public static void updateConfigDynamically(LibertyServer server, ServerConfiguration config, boolean waitForAppToStart) throws Exception {
resetMarksInLogs(server);
server.updateServerConfiguration(config);
server.waitForStringInLogUsingMark("CWWKG001[7-8]I");
if (waitForAppToStart) {
server.waitForStringInLogUsingMark("CWWKZ0003I"); //CWWKZ0003I: The application **** updated in 0.020 seconds.
}
} | [
"public",
"static",
"void",
"updateConfigDynamically",
"(",
"LibertyServer",
"server",
",",
"ServerConfiguration",
"config",
",",
"boolean",
"waitForAppToStart",
")",
"throws",
"Exception",
"{",
"resetMarksInLogs",
"(",
"server",
")",
";",
"server",
".",
"updateServerConfiguration",
"(",
"config",
")",
";",
"server",
".",
"waitForStringInLogUsingMark",
"(",
"\"CWWKG001[7-8]I\"",
")",
";",
"if",
"(",
"waitForAppToStart",
")",
"{",
"server",
".",
"waitForStringInLogUsingMark",
"(",
"\"CWWKZ0003I\"",
")",
";",
"//CWWKZ0003I: The application **** updated in 0.020 seconds.",
"}",
"}"
]
| This method will the reset the log and trace marks for log and trace searches, update the
configuration and then wait for the server to re-initialize. Optionally it will then wait for the application to start.
@param server The server to update.
@param config The configuration to use.
@param waitForAppToStart Wait for the application to start.
@throws Exception If there was an issue updating the server configuration. | [
"This",
"method",
"will",
"the",
"reset",
"the",
"log",
"and",
"trace",
"marks",
"for",
"log",
"and",
"trace",
"searches",
"update",
"the",
"configuration",
"and",
"then",
"wait",
"for",
"the",
"server",
"to",
"re",
"-",
"initialize",
".",
"Optionally",
"it",
"will",
"then",
"wait",
"for",
"the",
"application",
"to",
"start",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java#L61-L68 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newCancellationPanel | protected Component newCancellationPanel(final String id,
final IModel<HeaderContentListModelBean> model) {
"""
Factory method for creating the new {@link Component} for the cancellation. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new {@link Component} for the cancellation.
@param id
the id
@param model
the model
@return the new {@link Component} for the cancellation
"""
return new CancellationPanel(id, Model.of(model.getObject()));
} | java | protected Component newCancellationPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new CancellationPanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newCancellationPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"CancellationPanel",
"(",
"id",
",",
"Model",
".",
"of",
"(",
"model",
".",
"getObject",
"(",
")",
")",
")",
";",
"}"
]
| Factory method for creating the new {@link Component} for the cancellation. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new {@link Component} for the cancellation.
@param id
the id
@param model
the model
@return the new {@link Component} for the cancellation | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"cancellation",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"cancellation",
"."
]
| train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L174-L178 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java | DateFormatSymbols.getLeapMonthPattern | @Deprecated
public String getLeapMonthPattern(int context, int width) {
"""
Returns the appropriate leapMonthPattern if the calendar has them,
for example: "{0}bis"
@param context The usage context: FORMAT, STANDALONE, NUMERIC.
@param width The requested pattern width: WIDE, ABBREVIATED, SHORT, NARROW.
@return The leapMonthPattern, or null if not available for
this calendar.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android
"""
if (leapMonthPatterns != null) {
int leapMonthPatternIndex = -1;
switch (context) {
case FORMAT :
switch(width) {
case WIDE :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_WIDE;
break;
case ABBREVIATED :
case SHORT : // no month data for this, defaults to ABBREVIATED
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV;
break;
case NARROW :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_NARROW;
break;
}
break;
case STANDALONE :
switch(width) {
case WIDE :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE;
break;
case ABBREVIATED :
case SHORT : // no month data for this, defaults to ABBREVIATED
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV;
break;
case NARROW :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW;
break;
}
break;
case NUMERIC :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_NUMERIC;
break;
}
if (leapMonthPatternIndex < 0) {
throw new IllegalArgumentException("Bad context or width argument");
}
return leapMonthPatterns[leapMonthPatternIndex];
}
return null;
} | java | @Deprecated
public String getLeapMonthPattern(int context, int width) {
if (leapMonthPatterns != null) {
int leapMonthPatternIndex = -1;
switch (context) {
case FORMAT :
switch(width) {
case WIDE :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_WIDE;
break;
case ABBREVIATED :
case SHORT : // no month data for this, defaults to ABBREVIATED
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV;
break;
case NARROW :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_NARROW;
break;
}
break;
case STANDALONE :
switch(width) {
case WIDE :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE;
break;
case ABBREVIATED :
case SHORT : // no month data for this, defaults to ABBREVIATED
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV;
break;
case NARROW :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW;
break;
}
break;
case NUMERIC :
leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_NUMERIC;
break;
}
if (leapMonthPatternIndex < 0) {
throw new IllegalArgumentException("Bad context or width argument");
}
return leapMonthPatterns[leapMonthPatternIndex];
}
return null;
} | [
"@",
"Deprecated",
"public",
"String",
"getLeapMonthPattern",
"(",
"int",
"context",
",",
"int",
"width",
")",
"{",
"if",
"(",
"leapMonthPatterns",
"!=",
"null",
")",
"{",
"int",
"leapMonthPatternIndex",
"=",
"-",
"1",
";",
"switch",
"(",
"context",
")",
"{",
"case",
"FORMAT",
":",
"switch",
"(",
"width",
")",
"{",
"case",
"WIDE",
":",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_FORMAT_WIDE",
";",
"break",
";",
"case",
"ABBREVIATED",
":",
"case",
"SHORT",
":",
"// no month data for this, defaults to ABBREVIATED",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV",
";",
"break",
";",
"case",
"NARROW",
":",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_FORMAT_NARROW",
";",
"break",
";",
"}",
"break",
";",
"case",
"STANDALONE",
":",
"switch",
"(",
"width",
")",
"{",
"case",
"WIDE",
":",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE",
";",
"break",
";",
"case",
"ABBREVIATED",
":",
"case",
"SHORT",
":",
"// no month data for this, defaults to ABBREVIATED",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV",
";",
"break",
";",
"case",
"NARROW",
":",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW",
";",
"break",
";",
"}",
"break",
";",
"case",
"NUMERIC",
":",
"leapMonthPatternIndex",
"=",
"DT_LEAP_MONTH_PATTERN_NUMERIC",
";",
"break",
";",
"}",
"if",
"(",
"leapMonthPatternIndex",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bad context or width argument\"",
")",
";",
"}",
"return",
"leapMonthPatterns",
"[",
"leapMonthPatternIndex",
"]",
";",
"}",
"return",
"null",
";",
"}"
]
| Returns the appropriate leapMonthPattern if the calendar has them,
for example: "{0}bis"
@param context The usage context: FORMAT, STANDALONE, NUMERIC.
@param width The requested pattern width: WIDE, ABBREVIATED, SHORT, NARROW.
@return The leapMonthPattern, or null if not available for
this calendar.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"the",
"appropriate",
"leapMonthPattern",
"if",
"the",
"calendar",
"has",
"them",
"for",
"example",
":",
"{",
"0",
"}",
"bis"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1165-L1208 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java | ImageDeformPointMLS_F32.setDistorted | public void setDistorted( int which , float x , float y ) {
"""
Sets the distorted location of a specific control point
@param which Which control point
@param x distorted coordinate x-axis in image pixels
@param y distorted coordinate y-axis in image pixels
"""
controls.get(which).q.set(x,y);
} | java | public void setDistorted( int which , float x , float y ) {
controls.get(which).q.set(x,y);
} | [
"public",
"void",
"setDistorted",
"(",
"int",
"which",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"controls",
".",
"get",
"(",
"which",
")",
".",
"q",
".",
"set",
"(",
"x",
",",
"y",
")",
";",
"}"
]
| Sets the distorted location of a specific control point
@param which Which control point
@param x distorted coordinate x-axis in image pixels
@param y distorted coordinate y-axis in image pixels | [
"Sets",
"the",
"distorted",
"location",
"of",
"a",
"specific",
"control",
"point"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L177-L179 |
dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java | ScopeExtractorMethodVisitor.getTryFixedEndLabel | private Label getTryFixedEndLabel(LocalVariableScopeData scope, TryCatchBlockLabels enclosingTry) {
"""
The initially recorded variable scopes in try blocks has wrong end line numbers.
They are pointing to the end of the catch blocks, even if they were declared in
the try block. This method calculates the correct end Label for a variable scope.
Fix for issue #14.
"""
if (enclosingTry == null) {
return scope.labels.end;
} else {
if (getIndex(enclosingTry.handler) < getIndex(scope.labels.end)) {
return enclosingTry.handler;
} else {
return scope.labels.end;
}
}
} | java | private Label getTryFixedEndLabel(LocalVariableScopeData scope, TryCatchBlockLabels enclosingTry) {
if (enclosingTry == null) {
return scope.labels.end;
} else {
if (getIndex(enclosingTry.handler) < getIndex(scope.labels.end)) {
return enclosingTry.handler;
} else {
return scope.labels.end;
}
}
} | [
"private",
"Label",
"getTryFixedEndLabel",
"(",
"LocalVariableScopeData",
"scope",
",",
"TryCatchBlockLabels",
"enclosingTry",
")",
"{",
"if",
"(",
"enclosingTry",
"==",
"null",
")",
"{",
"return",
"scope",
".",
"labels",
".",
"end",
";",
"}",
"else",
"{",
"if",
"(",
"getIndex",
"(",
"enclosingTry",
".",
"handler",
")",
"<",
"getIndex",
"(",
"scope",
".",
"labels",
".",
"end",
")",
")",
"{",
"return",
"enclosingTry",
".",
"handler",
";",
"}",
"else",
"{",
"return",
"scope",
".",
"labels",
".",
"end",
";",
"}",
"}",
"}"
]
| The initially recorded variable scopes in try blocks has wrong end line numbers.
They are pointing to the end of the catch blocks, even if they were declared in
the try block. This method calculates the correct end Label for a variable scope.
Fix for issue #14. | [
"The",
"initially",
"recorded",
"variable",
"scopes",
"in",
"try",
"blocks",
"has",
"wrong",
"end",
"line",
"numbers",
".",
"They",
"are",
"pointing",
"to",
"the",
"end",
"of",
"the",
"catch",
"blocks",
"even",
"if",
"they",
"were",
"declared",
"in",
"the",
"try",
"block",
".",
"This",
"method",
"calculates",
"the",
"correct",
"end",
"Label",
"for",
"a",
"variable",
"scope",
".",
"Fix",
"for",
"issue",
"#14",
"."
]
| train | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java#L208-L218 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/QueryRecord.java | QueryRecord.addSortParams | public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey) {
"""
Setup the SQL Sort String.
@param bIncludeFileName If true, include the filename with the fieldname in the string.
@param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end.
@return The SQL sort string.
"""
String strSort = super.addSortParams(bIncludeFileName, bForceUniqueKey);
if (strSort.length() > 0)
return strSort; // Sort string was specified for this "QueryRecord"
Record stmtTable = this.getRecordlistAt(0);
if (stmtTable != null)
strSort += stmtTable.addSortParams(bIncludeFileName, bForceUniqueKey);
return strSort;
} | java | public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey)
{
String strSort = super.addSortParams(bIncludeFileName, bForceUniqueKey);
if (strSort.length() > 0)
return strSort; // Sort string was specified for this "QueryRecord"
Record stmtTable = this.getRecordlistAt(0);
if (stmtTable != null)
strSort += stmtTable.addSortParams(bIncludeFileName, bForceUniqueKey);
return strSort;
} | [
"public",
"String",
"addSortParams",
"(",
"boolean",
"bIncludeFileName",
",",
"boolean",
"bForceUniqueKey",
")",
"{",
"String",
"strSort",
"=",
"super",
".",
"addSortParams",
"(",
"bIncludeFileName",
",",
"bForceUniqueKey",
")",
";",
"if",
"(",
"strSort",
".",
"length",
"(",
")",
">",
"0",
")",
"return",
"strSort",
";",
"// Sort string was specified for this \"QueryRecord\"",
"Record",
"stmtTable",
"=",
"this",
".",
"getRecordlistAt",
"(",
"0",
")",
";",
"if",
"(",
"stmtTable",
"!=",
"null",
")",
"strSort",
"+=",
"stmtTable",
".",
"addSortParams",
"(",
"bIncludeFileName",
",",
"bForceUniqueKey",
")",
";",
"return",
"strSort",
";",
"}"
]
| Setup the SQL Sort String.
@param bIncludeFileName If true, include the filename with the fieldname in the string.
@param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end.
@return The SQL sort string. | [
"Setup",
"the",
"SQL",
"Sort",
"String",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L210-L219 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionI | public static int checkPostconditionI(
final int value,
final IntPredicate predicate,
final IntFunction<String> describer) {
"""
An {@code int} specialized version of {@link #checkPostcondition(Object,
ContractConditionType)}.
@param value The value
@param predicate The predicate
@param describer The describer for the predicate
@return value
@throws PostconditionViolationException If the predicate is false
"""
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(
e,
Integer.valueOf(value),
singleViolation(failedPredicate(e)));
}
return innerCheckI(value, ok, describer);
} | java | public static int checkPostconditionI(
final int value,
final IntPredicate predicate,
final IntFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(
e,
Integer.valueOf(value),
singleViolation(failedPredicate(e)));
}
return innerCheckI(value, ok, describer);
} | [
"public",
"static",
"int",
"checkPostconditionI",
"(",
"final",
"int",
"value",
",",
"final",
"IntPredicate",
"predicate",
",",
"final",
"IntFunction",
"<",
"String",
">",
"describer",
")",
"{",
"final",
"boolean",
"ok",
";",
"try",
"{",
"ok",
"=",
"predicate",
".",
"test",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"final",
"Throwable",
"e",
")",
"{",
"throw",
"failed",
"(",
"e",
",",
"Integer",
".",
"valueOf",
"(",
"value",
")",
",",
"singleViolation",
"(",
"failedPredicate",
"(",
"e",
")",
")",
")",
";",
"}",
"return",
"innerCheckI",
"(",
"value",
",",
"ok",
",",
"describer",
")",
";",
"}"
]
| An {@code int} specialized version of {@link #checkPostcondition(Object,
ContractConditionType)}.
@param value The value
@param predicate The predicate
@param describer The describer for the predicate
@return value
@throws PostconditionViolationException If the predicate is false | [
"An",
"{",
"@code",
"int",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostcondition",
"(",
"Object",
"ContractConditionType",
")",
"}",
"."
]
| train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L372-L388 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.scaleToRatio | public static void scaleToRatio( Rectangle2D fixed, Rectangle2D toScale, boolean doShrink ) {
"""
Extends or shrinks a rectangle following the ration of a fixed one.
<p>This keeps the center point of the rectangle fixed.</p>
@param fixed the fixed {@link Rectangle2D} to use for the ratio.
@param toScale the {@link Rectangle2D} to adapt to the ratio of the fixed one.
@param doShrink if <code>true</code>, the adapted rectangle is shrinked as
opposed to extended.
"""
double origWidth = fixed.getWidth();
double origHeight = fixed.getHeight();
double toAdaptWidth = toScale.getWidth();
double toAdaptHeight = toScale.getHeight();
double scaleWidth = 0;
double scaleHeight = 0;
scaleWidth = toAdaptWidth / origWidth;
scaleHeight = toAdaptHeight / origHeight;
double scaleFactor;
if (doShrink) {
scaleFactor = Math.min(scaleWidth, scaleHeight);
} else {
scaleFactor = Math.max(scaleWidth, scaleHeight);
}
double newWidth = origWidth * scaleFactor;
double newHeight = origHeight * scaleFactor;
double dw = (toAdaptWidth - newWidth) / 2.0;
double dh = (toAdaptHeight - newHeight) / 2.0;
double newX = toScale.getX() + dw;
double newY = toScale.getY() + dh;
double newW = toAdaptWidth - 2 * dw;
double newH = toAdaptHeight - 2 * dh;
toScale.setRect(newX, newY, newW, newH);
} | java | public static void scaleToRatio( Rectangle2D fixed, Rectangle2D toScale, boolean doShrink ) {
double origWidth = fixed.getWidth();
double origHeight = fixed.getHeight();
double toAdaptWidth = toScale.getWidth();
double toAdaptHeight = toScale.getHeight();
double scaleWidth = 0;
double scaleHeight = 0;
scaleWidth = toAdaptWidth / origWidth;
scaleHeight = toAdaptHeight / origHeight;
double scaleFactor;
if (doShrink) {
scaleFactor = Math.min(scaleWidth, scaleHeight);
} else {
scaleFactor = Math.max(scaleWidth, scaleHeight);
}
double newWidth = origWidth * scaleFactor;
double newHeight = origHeight * scaleFactor;
double dw = (toAdaptWidth - newWidth) / 2.0;
double dh = (toAdaptHeight - newHeight) / 2.0;
double newX = toScale.getX() + dw;
double newY = toScale.getY() + dh;
double newW = toAdaptWidth - 2 * dw;
double newH = toAdaptHeight - 2 * dh;
toScale.setRect(newX, newY, newW, newH);
} | [
"public",
"static",
"void",
"scaleToRatio",
"(",
"Rectangle2D",
"fixed",
",",
"Rectangle2D",
"toScale",
",",
"boolean",
"doShrink",
")",
"{",
"double",
"origWidth",
"=",
"fixed",
".",
"getWidth",
"(",
")",
";",
"double",
"origHeight",
"=",
"fixed",
".",
"getHeight",
"(",
")",
";",
"double",
"toAdaptWidth",
"=",
"toScale",
".",
"getWidth",
"(",
")",
";",
"double",
"toAdaptHeight",
"=",
"toScale",
".",
"getHeight",
"(",
")",
";",
"double",
"scaleWidth",
"=",
"0",
";",
"double",
"scaleHeight",
"=",
"0",
";",
"scaleWidth",
"=",
"toAdaptWidth",
"/",
"origWidth",
";",
"scaleHeight",
"=",
"toAdaptHeight",
"/",
"origHeight",
";",
"double",
"scaleFactor",
";",
"if",
"(",
"doShrink",
")",
"{",
"scaleFactor",
"=",
"Math",
".",
"min",
"(",
"scaleWidth",
",",
"scaleHeight",
")",
";",
"}",
"else",
"{",
"scaleFactor",
"=",
"Math",
".",
"max",
"(",
"scaleWidth",
",",
"scaleHeight",
")",
";",
"}",
"double",
"newWidth",
"=",
"origWidth",
"*",
"scaleFactor",
";",
"double",
"newHeight",
"=",
"origHeight",
"*",
"scaleFactor",
";",
"double",
"dw",
"=",
"(",
"toAdaptWidth",
"-",
"newWidth",
")",
"/",
"2.0",
";",
"double",
"dh",
"=",
"(",
"toAdaptHeight",
"-",
"newHeight",
")",
"/",
"2.0",
";",
"double",
"newX",
"=",
"toScale",
".",
"getX",
"(",
")",
"+",
"dw",
";",
"double",
"newY",
"=",
"toScale",
".",
"getY",
"(",
")",
"+",
"dh",
";",
"double",
"newW",
"=",
"toAdaptWidth",
"-",
"2",
"*",
"dw",
";",
"double",
"newH",
"=",
"toAdaptHeight",
"-",
"2",
"*",
"dh",
";",
"toScale",
".",
"setRect",
"(",
"newX",
",",
"newY",
",",
"newW",
",",
"newH",
")",
";",
"}"
]
| Extends or shrinks a rectangle following the ration of a fixed one.
<p>This keeps the center point of the rectangle fixed.</p>
@param fixed the fixed {@link Rectangle2D} to use for the ratio.
@param toScale the {@link Rectangle2D} to adapt to the ratio of the fixed one.
@param doShrink if <code>true</code>, the adapted rectangle is shrinked as
opposed to extended. | [
"Extends",
"or",
"shrinks",
"a",
"rectangle",
"following",
"the",
"ration",
"of",
"a",
"fixed",
"one",
"."
]
| train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L679-L708 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java | DistributedFileSystem.concat | public void concat(Path trg, Path [] psrcs, boolean restricted) throws IOException {
"""
THIS IS DFS only operations, it is not part of FileSystem
move blocks from srcs to trg
and delete srcs afterwards
@param trg existing file to append to
@param psrcs list of files (same block size, same replication)
@param restricted - should the equal block sizes be enforced
@throws IOException
"""
String [] srcs = new String [psrcs.length];
for(int i=0; i<psrcs.length; i++) {
srcs[i] = getPathName(psrcs[i]);
}
dfs.concat(getPathName(trg), srcs, restricted);
} | java | public void concat(Path trg, Path [] psrcs, boolean restricted) throws IOException {
String [] srcs = new String [psrcs.length];
for(int i=0; i<psrcs.length; i++) {
srcs[i] = getPathName(psrcs[i]);
}
dfs.concat(getPathName(trg), srcs, restricted);
} | [
"public",
"void",
"concat",
"(",
"Path",
"trg",
",",
"Path",
"[",
"]",
"psrcs",
",",
"boolean",
"restricted",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"srcs",
"=",
"new",
"String",
"[",
"psrcs",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"psrcs",
".",
"length",
";",
"i",
"++",
")",
"{",
"srcs",
"[",
"i",
"]",
"=",
"getPathName",
"(",
"psrcs",
"[",
"i",
"]",
")",
";",
"}",
"dfs",
".",
"concat",
"(",
"getPathName",
"(",
"trg",
")",
",",
"srcs",
",",
"restricted",
")",
";",
"}"
]
| THIS IS DFS only operations, it is not part of FileSystem
move blocks from srcs to trg
and delete srcs afterwards
@param trg existing file to append to
@param psrcs list of files (same block size, same replication)
@param restricted - should the equal block sizes be enforced
@throws IOException | [
"THIS",
"IS",
"DFS",
"only",
"operations",
"it",
"is",
"not",
"part",
"of",
"FileSystem",
"move",
"blocks",
"from",
"srcs",
"to",
"trg",
"and",
"delete",
"srcs",
"afterwards"
]
| train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java#L406-L412 |
banq/jdonframework | JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/LazyUtil.java | LazyUtil.checkInitialize | private static boolean checkInitialize(Method method, Object obj) {
"""
Check is current property was initialized
@param method - hibernate static method, which check
is initilized property
@param obj - object which need for lazy check
@return boolean value
"""
boolean isInitialized = true;
try {
isInitialized = (Boolean) method.invoke(null, new Object[] {obj});
} catch (IllegalArgumentException e) {
// do nothing
} catch (IllegalAccessException e) {
// do nothing
} catch (InvocationTargetException e) {
// do nothing
}
return isInitialized;
} | java | private static boolean checkInitialize(Method method, Object obj) {
boolean isInitialized = true;
try {
isInitialized = (Boolean) method.invoke(null, new Object[] {obj});
} catch (IllegalArgumentException e) {
// do nothing
} catch (IllegalAccessException e) {
// do nothing
} catch (InvocationTargetException e) {
// do nothing
}
return isInitialized;
} | [
"private",
"static",
"boolean",
"checkInitialize",
"(",
"Method",
"method",
",",
"Object",
"obj",
")",
"{",
"boolean",
"isInitialized",
"=",
"true",
";",
"try",
"{",
"isInitialized",
"=",
"(",
"Boolean",
")",
"method",
".",
"invoke",
"(",
"null",
",",
"new",
"Object",
"[",
"]",
"{",
"obj",
"}",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"// do nothing\r",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// do nothing\r",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"// do nothing\r",
"}",
"return",
"isInitialized",
";",
"}"
]
| Check is current property was initialized
@param method - hibernate static method, which check
is initilized property
@param obj - object which need for lazy check
@return boolean value | [
"Check",
"is",
"current",
"property",
"was",
"initialized"
]
| train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/LazyUtil.java#L78-L91 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.logProbabilityOf | public Counter<L> logProbabilityOf(Datum<L, F> example) {
"""
Returns a counter mapping from each class name to the log probability of
that class for a certain example.
Looking at the the sum of e^v for each count v, should be 1.0.
"""
if(example instanceof RVFDatum<?, ?>)return logProbabilityOfRVFDatum((RVFDatum<L,F>)example);
Counter<L> scores = scoresOf(example);
Counters.logNormalizeInPlace(scores);
return scores;
} | java | public Counter<L> logProbabilityOf(Datum<L, F> example) {
if(example instanceof RVFDatum<?, ?>)return logProbabilityOfRVFDatum((RVFDatum<L,F>)example);
Counter<L> scores = scoresOf(example);
Counters.logNormalizeInPlace(scores);
return scores;
} | [
"public",
"Counter",
"<",
"L",
">",
"logProbabilityOf",
"(",
"Datum",
"<",
"L",
",",
"F",
">",
"example",
")",
"{",
"if",
"(",
"example",
"instanceof",
"RVFDatum",
"<",
"?",
",",
"?",
">",
")",
"return",
"logProbabilityOfRVFDatum",
"(",
"(",
"RVFDatum",
"<",
"L",
",",
"F",
">",
")",
"example",
")",
";",
"Counter",
"<",
"L",
">",
"scores",
"=",
"scoresOf",
"(",
"example",
")",
";",
"Counters",
".",
"logNormalizeInPlace",
"(",
"scores",
")",
";",
"return",
"scores",
";",
"}"
]
| Returns a counter mapping from each class name to the log probability of
that class for a certain example.
Looking at the the sum of e^v for each count v, should be 1.0. | [
"Returns",
"a",
"counter",
"mapping",
"from",
"each",
"class",
"name",
"to",
"the",
"log",
"probability",
"of",
"that",
"class",
"for",
"a",
"certain",
"example",
".",
"Looking",
"at",
"the",
"the",
"sum",
"of",
"e^v",
"for",
"each",
"count",
"v",
"should",
"be",
"1",
".",
"0",
"."
]
| train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L294-L299 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelFormatter.java | HpelFormatter.formatUnlocalized | protected String formatUnlocalized(String traceString, Object[] parms) {
"""
Used for WsLogRecords or CommonBaseEventLogRecords that specify REQUIRES_NO_LOCALIZATION,
tries to format, and if unsuccessful in using any parameters appends them per unusedParmHandling.
@return the formatted trace
""" // added for LIDB2667.13
//
// handle messages that require no localization (essentially trace)
//
// get ready to append parameters
Object[] newParms = convertParameters(parms); //D233515.1
if (newParms == null)
return traceString;
else {
String formattedTrace;
if (traceString.indexOf('{') >= 0) {
formattedTrace = Messages.getFormattedMessageFromLocalizedMessage(traceString, newParms, true);
} else {
formattedTrace = traceString;
}
if (formattedTrace.equals(traceString)) {
// parms weren't used -- append them so they aren't lost
return appendUnusedParms(traceString, newParms);
} else
return formattedTrace;
}
} | java | protected String formatUnlocalized(String traceString, Object[] parms) { // added for LIDB2667.13
//
// handle messages that require no localization (essentially trace)
//
// get ready to append parameters
Object[] newParms = convertParameters(parms); //D233515.1
if (newParms == null)
return traceString;
else {
String formattedTrace;
if (traceString.indexOf('{') >= 0) {
formattedTrace = Messages.getFormattedMessageFromLocalizedMessage(traceString, newParms, true);
} else {
formattedTrace = traceString;
}
if (formattedTrace.equals(traceString)) {
// parms weren't used -- append them so they aren't lost
return appendUnusedParms(traceString, newParms);
} else
return formattedTrace;
}
} | [
"protected",
"String",
"formatUnlocalized",
"(",
"String",
"traceString",
",",
"Object",
"[",
"]",
"parms",
")",
"{",
"// added for LIDB2667.13",
"//",
"// handle messages that require no localization (essentially trace)",
"//",
"// get ready to append parameters",
"Object",
"[",
"]",
"newParms",
"=",
"convertParameters",
"(",
"parms",
")",
";",
"//D233515.1",
"if",
"(",
"newParms",
"==",
"null",
")",
"return",
"traceString",
";",
"else",
"{",
"String",
"formattedTrace",
";",
"if",
"(",
"traceString",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"formattedTrace",
"=",
"Messages",
".",
"getFormattedMessageFromLocalizedMessage",
"(",
"traceString",
",",
"newParms",
",",
"true",
")",
";",
"}",
"else",
"{",
"formattedTrace",
"=",
"traceString",
";",
"}",
"if",
"(",
"formattedTrace",
".",
"equals",
"(",
"traceString",
")",
")",
"{",
"// parms weren't used -- append them so they aren't lost",
"return",
"appendUnusedParms",
"(",
"traceString",
",",
"newParms",
")",
";",
"}",
"else",
"return",
"formattedTrace",
";",
"}",
"}"
]
| Used for WsLogRecords or CommonBaseEventLogRecords that specify REQUIRES_NO_LOCALIZATION,
tries to format, and if unsuccessful in using any parameters appends them per unusedParmHandling.
@return the formatted trace | [
"Used",
"for",
"WsLogRecords",
"or",
"CommonBaseEventLogRecords",
"that",
"specify",
"REQUIRES_NO_LOCALIZATION"
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelFormatter.java#L432-L457 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_http_route_routeId_GET | public OvhRouteHttp serviceName_http_route_routeId_GET(String serviceName, Long routeId) throws IOException {
"""
Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/http/route/{routeId}
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route
"""
String qPath = "/ipLoadbalancing/{serviceName}/http/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteHttp.class);
} | java | public OvhRouteHttp serviceName_http_route_routeId_GET(String serviceName, Long routeId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteHttp.class);
} | [
"public",
"OvhRouteHttp",
"serviceName_http_route_routeId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"routeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/http/route/{routeId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"routeId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhRouteHttp",
".",
"class",
")",
";",
"}"
]
| Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/http/route/{routeId}
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route | [
"Get",
"this",
"object",
"properties"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L225-L230 |
lagom/lagom | service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java | Descriptor.replaceAllPathParamSerializers | public Descriptor replaceAllPathParamSerializers(PMap<Type, PathParamSerializer<?>> pathParamSerializers) {
"""
Replace all the path param serializers registered with this descriptor with the the given path param serializers.
@param pathParamSerializers The path param serializers to replace the existing ones with.
@return A copy of this descriptor with the new path param serializers.
"""
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | java | public Descriptor replaceAllPathParamSerializers(PMap<Type, PathParamSerializer<?>> pathParamSerializers) {
return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);
} | [
"public",
"Descriptor",
"replaceAllPathParamSerializers",
"(",
"PMap",
"<",
"Type",
",",
"PathParamSerializer",
"<",
"?",
">",
">",
"pathParamSerializers",
")",
"{",
"return",
"new",
"Descriptor",
"(",
"name",
",",
"calls",
",",
"pathParamSerializers",
",",
"messageSerializers",
",",
"serializerFactory",
",",
"exceptionSerializer",
",",
"autoAcl",
",",
"acls",
",",
"headerFilter",
",",
"locatableService",
",",
"circuitBreaker",
",",
"topicCalls",
")",
";",
"}"
]
| Replace all the path param serializers registered with this descriptor with the the given path param serializers.
@param pathParamSerializers The path param serializers to replace the existing ones with.
@return A copy of this descriptor with the new path param serializers. | [
"Replace",
"all",
"the",
"path",
"param",
"serializers",
"registered",
"with",
"this",
"descriptor",
"with",
"the",
"the",
"given",
"path",
"param",
"serializers",
"."
]
| train | https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java#L730-L732 |
box/box-java-sdk | src/main/java/com/box/sdk/MetadataTemplate.java | MetadataTemplate.getMetadataTemplate | public static MetadataTemplate getMetadataTemplate(BoxAPIConnection api, String templateName) {
"""
Gets the metadata template of specified template type.
@param api the API connection to be used.
@param templateName the metadata template type name.
@return the metadata template returned from the server.
"""
String scope = scopeBasedOnType(templateName);
return getMetadataTemplate(api, templateName, scope);
} | java | public static MetadataTemplate getMetadataTemplate(BoxAPIConnection api, String templateName) {
String scope = scopeBasedOnType(templateName);
return getMetadataTemplate(api, templateName, scope);
} | [
"public",
"static",
"MetadataTemplate",
"getMetadataTemplate",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"templateName",
")",
"{",
"String",
"scope",
"=",
"scopeBasedOnType",
"(",
"templateName",
")",
";",
"return",
"getMetadataTemplate",
"(",
"api",
",",
"templateName",
",",
"scope",
")",
";",
"}"
]
| Gets the metadata template of specified template type.
@param api the API connection to be used.
@param templateName the metadata template type name.
@return the metadata template returned from the server. | [
"Gets",
"the",
"metadata",
"template",
"of",
"specified",
"template",
"type",
"."
]
| train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/MetadataTemplate.java#L428-L431 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/StaticContentDispatcher.java | StaticContentDispatcher.onGet | @RequestHandler(dynamic = true)
public void onGet(Request.In.Get event, IOSubchannel channel)
throws ParseException, IOException {
"""
Handles a `GET` request.
@param event the event
@param channel the channel
@throws ParseException the parse exception
@throws IOException Signals that an I/O exception has occurred.
"""
int prefixSegs = resourcePattern.matches(event.requestUri());
if (prefixSegs < 0) {
return;
}
if (contentDirectory == null) {
getFromUri(event, channel, prefixSegs);
} else {
getFromFileSystem(event, channel, prefixSegs);
}
} | java | @RequestHandler(dynamic = true)
public void onGet(Request.In.Get event, IOSubchannel channel)
throws ParseException, IOException {
int prefixSegs = resourcePattern.matches(event.requestUri());
if (prefixSegs < 0) {
return;
}
if (contentDirectory == null) {
getFromUri(event, channel, prefixSegs);
} else {
getFromFileSystem(event, channel, prefixSegs);
}
} | [
"@",
"RequestHandler",
"(",
"dynamic",
"=",
"true",
")",
"public",
"void",
"onGet",
"(",
"Request",
".",
"In",
".",
"Get",
"event",
",",
"IOSubchannel",
"channel",
")",
"throws",
"ParseException",
",",
"IOException",
"{",
"int",
"prefixSegs",
"=",
"resourcePattern",
".",
"matches",
"(",
"event",
".",
"requestUri",
"(",
")",
")",
";",
"if",
"(",
"prefixSegs",
"<",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"contentDirectory",
"==",
"null",
")",
"{",
"getFromUri",
"(",
"event",
",",
"channel",
",",
"prefixSegs",
")",
";",
"}",
"else",
"{",
"getFromFileSystem",
"(",
"event",
",",
"channel",
",",
"prefixSegs",
")",
";",
"}",
"}"
]
| Handles a `GET` request.
@param event the event
@param channel the channel
@throws ParseException the parse exception
@throws IOException Signals that an I/O exception has occurred. | [
"Handles",
"a",
"GET",
"request",
"."
]
| train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/StaticContentDispatcher.java#L135-L147 |
ksoichiro/Android-ObservableScrollView | library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java | ScrollUtils.mixColors | public static int mixColors(int fromColor, int toColor, float toAlpha) {
"""
Mix two colors.
<p>{@code toColor} will be {@code toAlpha/1} percent,
and {@code fromColor} will be {@code (1-toAlpha)/1} percent.</p>
@param fromColor First color to be mixed.
@param toColor Second color to be mixed.
@param toAlpha Alpha value of toColor, 0.0f to 1.0f.
@return Mixed color value in ARGB. Alpha is fixed value (255).
"""
float[] fromCmyk = ScrollUtils.cmykFromRgb(fromColor);
float[] toCmyk = ScrollUtils.cmykFromRgb(toColor);
float[] result = new float[4];
for (int i = 0; i < 4; i++) {
result[i] = Math.min(1, fromCmyk[i] * (1 - toAlpha) + toCmyk[i] * toAlpha);
}
return 0xff000000 + (0x00ffffff & ScrollUtils.rgbFromCmyk(result));
} | java | public static int mixColors(int fromColor, int toColor, float toAlpha) {
float[] fromCmyk = ScrollUtils.cmykFromRgb(fromColor);
float[] toCmyk = ScrollUtils.cmykFromRgb(toColor);
float[] result = new float[4];
for (int i = 0; i < 4; i++) {
result[i] = Math.min(1, fromCmyk[i] * (1 - toAlpha) + toCmyk[i] * toAlpha);
}
return 0xff000000 + (0x00ffffff & ScrollUtils.rgbFromCmyk(result));
} | [
"public",
"static",
"int",
"mixColors",
"(",
"int",
"fromColor",
",",
"int",
"toColor",
",",
"float",
"toAlpha",
")",
"{",
"float",
"[",
"]",
"fromCmyk",
"=",
"ScrollUtils",
".",
"cmykFromRgb",
"(",
"fromColor",
")",
";",
"float",
"[",
"]",
"toCmyk",
"=",
"ScrollUtils",
".",
"cmykFromRgb",
"(",
"toColor",
")",
";",
"float",
"[",
"]",
"result",
"=",
"new",
"float",
"[",
"4",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"Math",
".",
"min",
"(",
"1",
",",
"fromCmyk",
"[",
"i",
"]",
"*",
"(",
"1",
"-",
"toAlpha",
")",
"+",
"toCmyk",
"[",
"i",
"]",
"*",
"toAlpha",
")",
";",
"}",
"return",
"0xff000000",
"+",
"(",
"0x00ffffff",
"&",
"ScrollUtils",
".",
"rgbFromCmyk",
"(",
"result",
")",
")",
";",
"}"
]
| Mix two colors.
<p>{@code toColor} will be {@code toAlpha/1} percent,
and {@code fromColor} will be {@code (1-toAlpha)/1} percent.</p>
@param fromColor First color to be mixed.
@param toColor Second color to be mixed.
@param toAlpha Alpha value of toColor, 0.0f to 1.0f.
@return Mixed color value in ARGB. Alpha is fixed value (255). | [
"Mix",
"two",
"colors",
".",
"<p",
">",
"{",
"@code",
"toColor",
"}",
"will",
"be",
"{",
"@code",
"toAlpha",
"/",
"1",
"}",
"percent",
"and",
"{",
"@code",
"fromColor",
"}",
"will",
"be",
"{",
"@code",
"(",
"1",
"-",
"toAlpha",
")",
"/",
"1",
"}",
"percent",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/ksoichiro/Android-ObservableScrollView/blob/47a5fb2db5e93d923a8c6772cde48bbb7d932345/library/src/main/java/com/github/ksoichiro/android/observablescrollview/ScrollUtils.java#L93-L101 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deleteAllProperties | public void deleteAllProperties(CmsDbContext dbc, String resourcename) throws CmsException {
"""
Deletes all property values of a file or folder.<p>
If there are no other siblings than the specified resource,
both the structure and resource property values get deleted.
If the specified resource has siblings, only the structure
property values get deleted.<p>
@param dbc the current database context
@param resourcename the name of the resource for which all properties should be deleted
@throws CmsException if operation was not successful
"""
CmsResource resource = null;
List<CmsResource> resources = new ArrayList<CmsResource>();
try {
// read the resource
resource = readResource(dbc, resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
// check the security
m_securityManager.checkPermissions(
dbc,
resource,
CmsPermissionSet.ACCESS_WRITE,
false,
CmsResourceFilter.ALL);
// delete the property values
if (resource.getSiblingCount() > 1) {
// the resource has siblings- delete only the (structure) properties of this sibling
getVfsDriver(dbc).deletePropertyObjects(
dbc,
dbc.currentProject().getUuid(),
resource,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_VALUES);
resources.addAll(readSiblings(dbc, resource, CmsResourceFilter.ALL));
} else {
// the resource has no other siblings- delete all (structure+resource) properties
getVfsDriver(dbc).deletePropertyObjects(
dbc,
dbc.currentProject().getUuid(),
resource,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
resources.add(resource);
}
} finally {
// clear the driver manager cache
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROPERTY, CmsMemoryMonitor.CacheType.PROPERTY_LIST);
// fire an event that all properties of a resource have been deleted
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCES_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCES, resources)));
}
} | java | public void deleteAllProperties(CmsDbContext dbc, String resourcename) throws CmsException {
CmsResource resource = null;
List<CmsResource> resources = new ArrayList<CmsResource>();
try {
// read the resource
resource = readResource(dbc, resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
// check the security
m_securityManager.checkPermissions(
dbc,
resource,
CmsPermissionSet.ACCESS_WRITE,
false,
CmsResourceFilter.ALL);
// delete the property values
if (resource.getSiblingCount() > 1) {
// the resource has siblings- delete only the (structure) properties of this sibling
getVfsDriver(dbc).deletePropertyObjects(
dbc,
dbc.currentProject().getUuid(),
resource,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_VALUES);
resources.addAll(readSiblings(dbc, resource, CmsResourceFilter.ALL));
} else {
// the resource has no other siblings- delete all (structure+resource) properties
getVfsDriver(dbc).deletePropertyObjects(
dbc,
dbc.currentProject().getUuid(),
resource,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
resources.add(resource);
}
} finally {
// clear the driver manager cache
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROPERTY, CmsMemoryMonitor.CacheType.PROPERTY_LIST);
// fire an event that all properties of a resource have been deleted
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCES_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCES, resources)));
}
} | [
"public",
"void",
"deleteAllProperties",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"resourcename",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"null",
";",
"List",
"<",
"CmsResource",
">",
"resources",
"=",
"new",
"ArrayList",
"<",
"CmsResource",
">",
"(",
")",
";",
"try",
"{",
"// read the resource",
"resource",
"=",
"readResource",
"(",
"dbc",
",",
"resourcename",
",",
"CmsResourceFilter",
".",
"IGNORE_EXPIRATION",
")",
";",
"// check the security",
"m_securityManager",
".",
"checkPermissions",
"(",
"dbc",
",",
"resource",
",",
"CmsPermissionSet",
".",
"ACCESS_WRITE",
",",
"false",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"// delete the property values",
"if",
"(",
"resource",
".",
"getSiblingCount",
"(",
")",
">",
"1",
")",
"{",
"// the resource has siblings- delete only the (structure) properties of this sibling",
"getVfsDriver",
"(",
"dbc",
")",
".",
"deletePropertyObjects",
"(",
"dbc",
",",
"dbc",
".",
"currentProject",
"(",
")",
".",
"getUuid",
"(",
")",
",",
"resource",
",",
"CmsProperty",
".",
"DELETE_OPTION_DELETE_STRUCTURE_VALUES",
")",
";",
"resources",
".",
"addAll",
"(",
"readSiblings",
"(",
"dbc",
",",
"resource",
",",
"CmsResourceFilter",
".",
"ALL",
")",
")",
";",
"}",
"else",
"{",
"// the resource has no other siblings- delete all (structure+resource) properties",
"getVfsDriver",
"(",
"dbc",
")",
".",
"deletePropertyObjects",
"(",
"dbc",
",",
"dbc",
".",
"currentProject",
"(",
")",
".",
"getUuid",
"(",
")",
",",
"resource",
",",
"CmsProperty",
".",
"DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES",
")",
";",
"resources",
".",
"add",
"(",
"resource",
")",
";",
"}",
"}",
"finally",
"{",
"// clear the driver manager cache",
"m_monitor",
".",
"flushCache",
"(",
"CmsMemoryMonitor",
".",
"CacheType",
".",
"PROPERTY",
",",
"CmsMemoryMonitor",
".",
"CacheType",
".",
"PROPERTY_LIST",
")",
";",
"// fire an event that all properties of a resource have been deleted",
"OpenCms",
".",
"fireCmsEvent",
"(",
"new",
"CmsEvent",
"(",
"I_CmsEventListener",
".",
"EVENT_RESOURCES_AND_PROPERTIES_MODIFIED",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
">",
"singletonMap",
"(",
"I_CmsEventListener",
".",
"KEY_RESOURCES",
",",
"resources",
")",
")",
")",
";",
"}",
"}"
]
| Deletes all property values of a file or folder.<p>
If there are no other siblings than the specified resource,
both the structure and resource property values get deleted.
If the specified resource has siblings, only the structure
property values get deleted.<p>
@param dbc the current database context
@param resourcename the name of the resource for which all properties should be deleted
@throws CmsException if operation was not successful | [
"Deletes",
"all",
"property",
"values",
"of",
"a",
"file",
"or",
"folder",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2252-L2298 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java | MapMessage.putAll | public void putAll(final Map<String, String> map) {
"""
Adds all the elements from the specified Map.
@param map The Map to add.
"""
for (final Map.Entry<String, ?> entry : map.entrySet()) {
data.putValue(entry.getKey(), entry.getValue());
}
} | java | public void putAll(final Map<String, String> map) {
for (final Map.Entry<String, ?> entry : map.entrySet()) {
data.putValue(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"putAll",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"data",
".",
"putValue",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
]
| Adds all the elements from the specified Map.
@param map The Map to add. | [
"Adds",
"all",
"the",
"elements",
"from",
"the",
"specified",
"Map",
"."
]
| train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L202-L206 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.getTimeZoneID | private String getTimeZoneID(String tzID, String mzID) {
"""
Private method returns a time zone ID. If tzID is not null, the value of tzID is returned.
If tzID is null, then this method look up a time zone ID for the current region. This is a
small helper method used by the parse implementation method
@param tzID
the time zone ID or null
@param mzID
the meta zone ID or null
@return A time zone ID
@throws IllegalArgumentException
when both tzID and mzID are null
"""
String id = tzID;
if (id == null) {
assert (mzID != null);
id = _tznames.getReferenceZoneID(mzID, getTargetRegion());
if (id == null) {
throw new IllegalArgumentException("Invalid mzID: " + mzID);
}
}
return id;
} | java | private String getTimeZoneID(String tzID, String mzID) {
String id = tzID;
if (id == null) {
assert (mzID != null);
id = _tznames.getReferenceZoneID(mzID, getTargetRegion());
if (id == null) {
throw new IllegalArgumentException("Invalid mzID: " + mzID);
}
}
return id;
} | [
"private",
"String",
"getTimeZoneID",
"(",
"String",
"tzID",
",",
"String",
"mzID",
")",
"{",
"String",
"id",
"=",
"tzID",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"assert",
"(",
"mzID",
"!=",
"null",
")",
";",
"id",
"=",
"_tznames",
".",
"getReferenceZoneID",
"(",
"mzID",
",",
"getTargetRegion",
"(",
")",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid mzID: \"",
"+",
"mzID",
")",
";",
"}",
"}",
"return",
"id",
";",
"}"
]
| Private method returns a time zone ID. If tzID is not null, the value of tzID is returned.
If tzID is null, then this method look up a time zone ID for the current region. This is a
small helper method used by the parse implementation method
@param tzID
the time zone ID or null
@param mzID
the meta zone ID or null
@return A time zone ID
@throws IllegalArgumentException
when both tzID and mzID are null | [
"Private",
"method",
"returns",
"a",
"time",
"zone",
"ID",
".",
"If",
"tzID",
"is",
"not",
"null",
"the",
"value",
"of",
"tzID",
"is",
"returned",
".",
"If",
"tzID",
"is",
"null",
"then",
"this",
"method",
"look",
"up",
"a",
"time",
"zone",
"ID",
"for",
"the",
"current",
"region",
".",
"This",
"is",
"a",
"small",
"helper",
"method",
"used",
"by",
"the",
"parse",
"implementation",
"method"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1758-L1768 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.isTrue | public static void isTrue(final boolean expression, final String message, final Object... values) {
"""
<p>Validate that the argument condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
<pre>
Validate.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);
Validate.isTrue(myObject.isOk(), "The object is not okay");
</pre>
@param expression
the boolean expression to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@throws IllegalArgumentValidationException
if expression is {@code false}
@see #isTrue(boolean)
@see #isTrue(boolean, String, long)
@see #isTrue(boolean, String, double)
"""
INSTANCE.isTrue(expression, message, values);
} | java | public static void isTrue(final boolean expression, final String message, final Object... values) {
INSTANCE.isTrue(expression, message, values);
} | [
"public",
"static",
"void",
"isTrue",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"INSTANCE",
".",
"isTrue",
"(",
"expression",
",",
"message",
",",
"values",
")",
";",
"}"
]
| <p>Validate that the argument condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
<pre>
Validate.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);
Validate.isTrue(myObject.isOk(), "The object is not okay");
</pre>
@param expression
the boolean expression to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@throws IllegalArgumentValidationException
if expression is {@code false}
@see #isTrue(boolean)
@see #isTrue(boolean, String, long)
@see #isTrue(boolean, String, double) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
"to",
"an",
"arbitrary",
"boolean",
"expression",
"such",
"as",
"validating",
"a",
"primitive",
"number",
"or",
"using",
"your",
"own",
"custom",
"validation",
"expression",
".",
"<",
"/",
"p",
">",
"<pre",
">",
"Validate",
".",
"isTrue",
"(",
"i",
">",
";",
"=",
"min",
"&",
";",
"&",
";",
"i",
"<",
";",
"=",
"max",
"The",
"value",
"must",
"be",
"between",
"%",
";",
"d",
"and",
"%",
";",
"d",
"min",
"max",
")",
";",
"Validate",
".",
"isTrue",
"(",
"myObject",
".",
"isOk",
"()",
"The",
"object",
"is",
"not",
"okay",
")",
";",
"<",
"/",
"pre",
">"
]
| train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L720-L722 |
alkacon/opencms-core | src/org/opencms/db/CmsLoginManager.java | CmsLoginManager.unlockUser | public void unlockUser(CmsObject cms, CmsUser user) throws CmsRoleViolationException {
"""
Unlocks a user who has exceeded his number of failed login attempts so that he can try to log in again.<p>
This requires the "account manager" role.
@param cms the current CMS context
@param user the user to unlock
@throws CmsRoleViolationException if the permission check fails
"""
OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(cms.getRequestContext().getOuFqn()));
Set<String> keysToRemove = getKeysForUser(user);
for (String keyToRemove : keysToRemove) {
m_storage.remove(keyToRemove);
}
} | java | public void unlockUser(CmsObject cms, CmsUser user) throws CmsRoleViolationException {
OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(cms.getRequestContext().getOuFqn()));
Set<String> keysToRemove = getKeysForUser(user);
for (String keyToRemove : keysToRemove) {
m_storage.remove(keyToRemove);
}
} | [
"public",
"void",
"unlockUser",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
")",
"throws",
"CmsRoleViolationException",
"{",
"OpenCms",
".",
"getRoleManager",
"(",
")",
".",
"checkRole",
"(",
"cms",
",",
"CmsRole",
".",
"ACCOUNT_MANAGER",
".",
"forOrgUnit",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getOuFqn",
"(",
")",
")",
")",
";",
"Set",
"<",
"String",
">",
"keysToRemove",
"=",
"getKeysForUser",
"(",
"user",
")",
";",
"for",
"(",
"String",
"keyToRemove",
":",
"keysToRemove",
")",
"{",
"m_storage",
".",
"remove",
"(",
"keyToRemove",
")",
";",
"}",
"}"
]
| Unlocks a user who has exceeded his number of failed login attempts so that he can try to log in again.<p>
This requires the "account manager" role.
@param cms the current CMS context
@param user the user to unlock
@throws CmsRoleViolationException if the permission check fails | [
"Unlocks",
"a",
"user",
"who",
"has",
"exceeded",
"his",
"number",
"of",
"failed",
"login",
"attempts",
"so",
"that",
"he",
"can",
"try",
"to",
"log",
"in",
"again",
".",
"<p",
">",
"This",
"requires",
"the",
"account",
"manager",
"role",
"."
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L700-L707 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/FactoryFinder.java | FactoryFinder.injectAndPostConstruct | private static Object injectAndPostConstruct(Object injectionProvider, Class Klass, List injectedBeanStorage) {
"""
injectANDPostConstruct based on a class added for CDI 1.2 support.
"""
Object instance = null;
if (injectionProvider != null)
{
try
{
Object managedObject = _FactoryFinderProviderFactory.INJECTION_PROVIDER_INJECT_CLASS_METHOD.invoke(injectionProvider, Klass);
instance = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_OBJECT_METHOD.invoke(managedObject, null);
if (instance != null) {
Object creationMetaData = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD.invoke
(managedObject, CreationalContext.class);
addBeanEntry(instance, creationMetaData, injectedBeanStorage);
_FactoryFinderProviderFactory.INJECTION_PROVIDER_POST_CONSTRUCT_METHOD.invoke(
injectionProvider, instance, creationMetaData);
}
} catch (Exception ex)
{
throw new FacesException(ex);
}
}
return instance;
} | java | private static Object injectAndPostConstruct(Object injectionProvider, Class Klass, List injectedBeanStorage)
{
Object instance = null;
if (injectionProvider != null)
{
try
{
Object managedObject = _FactoryFinderProviderFactory.INJECTION_PROVIDER_INJECT_CLASS_METHOD.invoke(injectionProvider, Klass);
instance = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_OBJECT_METHOD.invoke(managedObject, null);
if (instance != null) {
Object creationMetaData = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD.invoke
(managedObject, CreationalContext.class);
addBeanEntry(instance, creationMetaData, injectedBeanStorage);
_FactoryFinderProviderFactory.INJECTION_PROVIDER_POST_CONSTRUCT_METHOD.invoke(
injectionProvider, instance, creationMetaData);
}
} catch (Exception ex)
{
throw new FacesException(ex);
}
}
return instance;
} | [
"private",
"static",
"Object",
"injectAndPostConstruct",
"(",
"Object",
"injectionProvider",
",",
"Class",
"Klass",
",",
"List",
"injectedBeanStorage",
")",
"{",
"Object",
"instance",
"=",
"null",
";",
"if",
"(",
"injectionProvider",
"!=",
"null",
")",
"{",
"try",
"{",
"Object",
"managedObject",
"=",
"_FactoryFinderProviderFactory",
".",
"INJECTION_PROVIDER_INJECT_CLASS_METHOD",
".",
"invoke",
"(",
"injectionProvider",
",",
"Klass",
")",
";",
"instance",
"=",
"_FactoryFinderProviderFactory",
".",
"MANAGED_OBJECT_GET_OBJECT_METHOD",
".",
"invoke",
"(",
"managedObject",
",",
"null",
")",
";",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"Object",
"creationMetaData",
"=",
"_FactoryFinderProviderFactory",
".",
"MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD",
".",
"invoke",
"(",
"managedObject",
",",
"CreationalContext",
".",
"class",
")",
";",
"addBeanEntry",
"(",
"instance",
",",
"creationMetaData",
",",
"injectedBeanStorage",
")",
";",
"_FactoryFinderProviderFactory",
".",
"INJECTION_PROVIDER_POST_CONSTRUCT_METHOD",
".",
"invoke",
"(",
"injectionProvider",
",",
"instance",
",",
"creationMetaData",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"ex",
")",
";",
"}",
"}",
"return",
"instance",
";",
"}"
]
| injectANDPostConstruct based on a class added for CDI 1.2 support. | [
"injectANDPostConstruct",
"based",
"on",
"a",
"class",
"added",
"for",
"CDI",
"1",
".",
"2",
"support",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/FactoryFinder.java#L427-L455 |
icode/ameba | src/main/java/ameba/mvc/template/internal/Viewables.java | Viewables.newProtected | public static Viewable newProtected(String name, Object model) {
"""
<p>newProtected.</p>
@param name a {@link java.lang.String} object.
@param model a {@link java.lang.Object} object.
@return a {@link org.glassfish.jersey.server.mvc.Viewable} object.
"""
return new Viewable(PROTECTED_DIR_PATH + getPath(name), model);
} | java | public static Viewable newProtected(String name, Object model) {
return new Viewable(PROTECTED_DIR_PATH + getPath(name), model);
} | [
"public",
"static",
"Viewable",
"newProtected",
"(",
"String",
"name",
",",
"Object",
"model",
")",
"{",
"return",
"new",
"Viewable",
"(",
"PROTECTED_DIR_PATH",
"+",
"getPath",
"(",
"name",
")",
",",
"model",
")",
";",
"}"
]
| <p>newProtected.</p>
@param name a {@link java.lang.String} object.
@param model a {@link java.lang.Object} object.
@return a {@link org.glassfish.jersey.server.mvc.Viewable} object. | [
"<p",
">",
"newProtected",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/Viewables.java#L90-L92 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/code/Scope.java | Scope.dup | public Scope dup(Symbol newOwner) {
"""
Construct a fresh scope within this scope, with new owner,
which shares its table with the outer scope. Used in connection with
method leave if scope access is stack-like in order to avoid allocation
of fresh tables.
"""
Scope result = new Scope(this, newOwner, this.table, this.nelems);
shared++;
// System.out.println("====> duping scope " + this.hashCode() + " owned by " + newOwner + " to " + result.hashCode());
// new Error().printStackTrace(System.out);
return result;
} | java | public Scope dup(Symbol newOwner) {
Scope result = new Scope(this, newOwner, this.table, this.nelems);
shared++;
// System.out.println("====> duping scope " + this.hashCode() + " owned by " + newOwner + " to " + result.hashCode());
// new Error().printStackTrace(System.out);
return result;
} | [
"public",
"Scope",
"dup",
"(",
"Symbol",
"newOwner",
")",
"{",
"Scope",
"result",
"=",
"new",
"Scope",
"(",
"this",
",",
"newOwner",
",",
"this",
".",
"table",
",",
"this",
".",
"nelems",
")",
";",
"shared",
"++",
";",
"// System.out.println(\"====> duping scope \" + this.hashCode() + \" owned by \" + newOwner + \" to \" + result.hashCode());",
"// new Error().printStackTrace(System.out);",
"return",
"result",
";",
"}"
]
| Construct a fresh scope within this scope, with new owner,
which shares its table with the outer scope. Used in connection with
method leave if scope access is stack-like in order to avoid allocation
of fresh tables. | [
"Construct",
"a",
"fresh",
"scope",
"within",
"this",
"scope",
"with",
"new",
"owner",
"which",
"shares",
"its",
"table",
"with",
"the",
"outer",
"scope",
".",
"Used",
"in",
"connection",
"with",
"method",
"leave",
"if",
"scope",
"access",
"is",
"stack",
"-",
"like",
"in",
"order",
"to",
"avoid",
"allocation",
"of",
"fresh",
"tables",
"."
]
| train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Scope.java#L131-L137 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java | DOM3TreeWalker.isXMLName | protected boolean isXMLName(String s, boolean xml11Version) {
"""
Taken from org.apache.xerces.dom.CoreDocumentImpl
Check the string against XML's definition of acceptable names for
elements and attributes and so on using the XMLCharacterProperties
utility class
"""
if (s == null) {
return false;
}
if (!xml11Version)
return XMLChar.isValidName(s);
else
return XML11Char.isXML11ValidName(s);
} | java | protected boolean isXMLName(String s, boolean xml11Version) {
if (s == null) {
return false;
}
if (!xml11Version)
return XMLChar.isValidName(s);
else
return XML11Char.isXML11ValidName(s);
} | [
"protected",
"boolean",
"isXMLName",
"(",
"String",
"s",
",",
"boolean",
"xml11Version",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"xml11Version",
")",
"return",
"XMLChar",
".",
"isValidName",
"(",
"s",
")",
";",
"else",
"return",
"XML11Char",
".",
"isXML11ValidName",
"(",
"s",
")",
";",
"}"
]
| Taken from org.apache.xerces.dom.CoreDocumentImpl
Check the string against XML's definition of acceptable names for
elements and attributes and so on using the XMLCharacterProperties
utility class | [
"Taken",
"from",
"org",
".",
"apache",
".",
"xerces",
".",
"dom",
".",
"CoreDocumentImpl"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1108-L1117 |
square/dagger | core/src/main/java/dagger/internal/Keys.java | Keys.extractKey | private static String extractKey(String key, int start, String delegatePrefix, String prefix) {
"""
Returns an unwrapped key (the key for T from a Provider<T> for example),
removing all wrapping key information, but preserving annotations or known
prefixes.
@param key the key from which the delegate key should be extracted.
@param start
an index into the key representing the key's "real" start after
any annotations.
@param delegatePrefix
key prefix elements extracted from the underlying delegate
(annotations, "members/", etc.)
@param prefix the prefix to strip.
"""
return delegatePrefix + key.substring(start + prefix.length(), key.length() - 1);
} | java | private static String extractKey(String key, int start, String delegatePrefix, String prefix) {
return delegatePrefix + key.substring(start + prefix.length(), key.length() - 1);
} | [
"private",
"static",
"String",
"extractKey",
"(",
"String",
"key",
",",
"int",
"start",
",",
"String",
"delegatePrefix",
",",
"String",
"prefix",
")",
"{",
"return",
"delegatePrefix",
"+",
"key",
".",
"substring",
"(",
"start",
"+",
"prefix",
".",
"length",
"(",
")",
",",
"key",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}"
]
| Returns an unwrapped key (the key for T from a Provider<T> for example),
removing all wrapping key information, but preserving annotations or known
prefixes.
@param key the key from which the delegate key should be extracted.
@param start
an index into the key representing the key's "real" start after
any annotations.
@param delegatePrefix
key prefix elements extracted from the underlying delegate
(annotations, "members/", etc.)
@param prefix the prefix to strip. | [
"Returns",
"an",
"unwrapped",
"key",
"(",
"the",
"key",
"for",
"T",
"from",
"a",
"Provider<T",
">",
"for",
"example",
")",
"removing",
"all",
"wrapping",
"key",
"information",
"but",
"preserving",
"annotations",
"or",
"known",
"prefixes",
"."
]
| train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Keys.java#L227-L229 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getCommitSessionRequest | public BoxRequestsFile.CommitUploadSession getCommitSessionRequest(List<BoxUploadSessionPart> uploadedParts, BoxUploadSession uploadSession) {
"""
Commit an upload session after all parts have been uploaded, creating the new file or the version
@param uploadedParts the list of uploaded parts to be committed.
@param uploadSession the BoxUploadSession
@return the created file instance.
"""
return new BoxRequestsFile.CommitUploadSession(uploadedParts, null, null, null, uploadSession, mSession);
} | java | public BoxRequestsFile.CommitUploadSession getCommitSessionRequest(List<BoxUploadSessionPart> uploadedParts, BoxUploadSession uploadSession) {
return new BoxRequestsFile.CommitUploadSession(uploadedParts, null, null, null, uploadSession, mSession);
} | [
"public",
"BoxRequestsFile",
".",
"CommitUploadSession",
"getCommitSessionRequest",
"(",
"List",
"<",
"BoxUploadSessionPart",
">",
"uploadedParts",
",",
"BoxUploadSession",
"uploadSession",
")",
"{",
"return",
"new",
"BoxRequestsFile",
".",
"CommitUploadSession",
"(",
"uploadedParts",
",",
"null",
",",
"null",
",",
"null",
",",
"uploadSession",
",",
"mSession",
")",
";",
"}"
]
| Commit an upload session after all parts have been uploaded, creating the new file or the version
@param uploadedParts the list of uploaded parts to be committed.
@param uploadSession the BoxUploadSession
@return the created file instance. | [
"Commit",
"an",
"upload",
"session",
"after",
"all",
"parts",
"have",
"been",
"uploaded",
"creating",
"the",
"new",
"file",
"or",
"the",
"version"
]
| train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L670-L672 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendTextBlocking | public static void sendTextBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
"""
Sends a complete text message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
"""
sendBlockingInternal(pooledData, WebSocketFrameType.TEXT, wsChannel);
} | java | public static void sendTextBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(pooledData, WebSocketFrameType.TEXT, wsChannel);
} | [
"public",
"static",
"void",
"sendTextBlocking",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"sendBlockingInternal",
"(",
"pooledData",
",",
"WebSocketFrameType",
".",
"TEXT",
",",
"wsChannel",
")",
";",
"}"
]
| Sends a complete text message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"text",
"message",
"invoking",
"the",
"callback",
"when",
"complete",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
]
| train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L220-L222 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java | InputMapTemplate.uninstall | public static <S, N extends Node, E extends Event> void uninstall(InputMapTemplate<S, E> imt, S target, Function<? super S, ? extends N> getNode) {
"""
Removes the input map template's instance from the given node.
"""
Nodes.removeInputMap(getNode.apply(target), imt.instantiate(target));
} | java | public static <S, N extends Node, E extends Event> void uninstall(InputMapTemplate<S, E> imt, S target, Function<? super S, ? extends N> getNode) {
Nodes.removeInputMap(getNode.apply(target), imt.instantiate(target));
} | [
"public",
"static",
"<",
"S",
",",
"N",
"extends",
"Node",
",",
"E",
"extends",
"Event",
">",
"void",
"uninstall",
"(",
"InputMapTemplate",
"<",
"S",
",",
"E",
">",
"imt",
",",
"S",
"target",
",",
"Function",
"<",
"?",
"super",
"S",
",",
"?",
"extends",
"N",
">",
"getNode",
")",
"{",
"Nodes",
".",
"removeInputMap",
"(",
"getNode",
".",
"apply",
"(",
"target",
")",
",",
"imt",
".",
"instantiate",
"(",
"target",
")",
")",
";",
"}"
]
| Removes the input map template's instance from the given node. | [
"Removes",
"the",
"input",
"map",
"template",
"s",
"instance",
"from",
"the",
"given",
"node",
"."
]
| train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L406-L408 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.isSupportedPropertyType | public boolean isSupportedPropertyType(int sqlTypeId, String sqlTypeName) throws SQLException {
"""
Return true is the SQL type is supported by the GeoJSON driver.
@param sqlTypeId
@param sqlTypeName
@return
@throws SQLException
"""
switch (sqlTypeId) {
case Types.BOOLEAN:
case Types.DOUBLE:
case Types.FLOAT:
case Types.INTEGER:
case Types.BIGINT:
case Types.SMALLINT:
case Types.DATE:
case Types.VARCHAR:
case Types.NCHAR:
case Types.CHAR:
case Types.ARRAY:
case Types.OTHER:
case Types.DECIMAL:
case Types.REAL:
case Types.TINYINT:
case Types.NUMERIC:
case Types.NULL:
return true;
default:
throw new SQLException("Field type not supported by GeoJSON driver: " + sqlTypeName);
}
} | java | public boolean isSupportedPropertyType(int sqlTypeId, String sqlTypeName) throws SQLException {
switch (sqlTypeId) {
case Types.BOOLEAN:
case Types.DOUBLE:
case Types.FLOAT:
case Types.INTEGER:
case Types.BIGINT:
case Types.SMALLINT:
case Types.DATE:
case Types.VARCHAR:
case Types.NCHAR:
case Types.CHAR:
case Types.ARRAY:
case Types.OTHER:
case Types.DECIMAL:
case Types.REAL:
case Types.TINYINT:
case Types.NUMERIC:
case Types.NULL:
return true;
default:
throw new SQLException("Field type not supported by GeoJSON driver: " + sqlTypeName);
}
} | [
"public",
"boolean",
"isSupportedPropertyType",
"(",
"int",
"sqlTypeId",
",",
"String",
"sqlTypeName",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"sqlTypeId",
")",
"{",
"case",
"Types",
".",
"BOOLEAN",
":",
"case",
"Types",
".",
"DOUBLE",
":",
"case",
"Types",
".",
"FLOAT",
":",
"case",
"Types",
".",
"INTEGER",
":",
"case",
"Types",
".",
"BIGINT",
":",
"case",
"Types",
".",
"SMALLINT",
":",
"case",
"Types",
".",
"DATE",
":",
"case",
"Types",
".",
"VARCHAR",
":",
"case",
"Types",
".",
"NCHAR",
":",
"case",
"Types",
".",
"CHAR",
":",
"case",
"Types",
".",
"ARRAY",
":",
"case",
"Types",
".",
"OTHER",
":",
"case",
"Types",
".",
"DECIMAL",
":",
"case",
"Types",
".",
"REAL",
":",
"case",
"Types",
".",
"TINYINT",
":",
"case",
"Types",
".",
"NUMERIC",
":",
"case",
"Types",
".",
"NULL",
":",
"return",
"true",
";",
"default",
":",
"throw",
"new",
"SQLException",
"(",
"\"Field type not supported by GeoJSON driver: \"",
"+",
"sqlTypeName",
")",
";",
"}",
"}"
]
| Return true is the SQL type is supported by the GeoJSON driver.
@param sqlTypeId
@param sqlTypeName
@return
@throws SQLException | [
"Return",
"true",
"is",
"the",
"SQL",
"type",
"is",
"supported",
"by",
"the",
"GeoJSON",
"driver",
"."
]
| train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L598-L621 |
redkale/redkale | src/org/redkale/net/AsyncConnection.java | AsyncConnection.createTCP | public static CompletableFuture<AsyncConnection> createTCP(final Supplier<ByteBuffer> bufferSupplier, Consumer<ByteBuffer> bufferConsumer, final AsynchronousChannelGroup group, final SSLContext sslContext,
final SocketAddress address, final int readTimeoutSeconds, final int writeTimeoutSeconds) {
"""
创建TCP协议客户端连接
@param bufferSupplier ByteBuffer生产器
@param bufferConsumer ByteBuffer回收器
@param address 连接点子
@param sslContext SSLContext
@param group 连接AsynchronousChannelGroup
@param readTimeoutSeconds 读取超时秒数
@param writeTimeoutSeconds 写入超时秒数
@return 连接CompletableFuture
"""
final CompletableFuture<AsyncConnection> future = new CompletableFuture<>();
try {
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
try {
channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
} catch (IOException e) {
}
channel.connect(address, null, new CompletionHandler<Void, Void>() {
@Override
public void completed(Void result, Void attachment) {
future.complete(new TcpAioAsyncConnection(bufferSupplier, bufferConsumer, channel, sslContext, address, readTimeoutSeconds, writeTimeoutSeconds, null, null));
}
@Override
public void failed(Throwable exc, Void attachment) {
future.completeExceptionally(exc);
}
});
} catch (IOException e) {
future.completeExceptionally(e);
}
return future;
} | java | public static CompletableFuture<AsyncConnection> createTCP(final Supplier<ByteBuffer> bufferSupplier, Consumer<ByteBuffer> bufferConsumer, final AsynchronousChannelGroup group, final SSLContext sslContext,
final SocketAddress address, final int readTimeoutSeconds, final int writeTimeoutSeconds) {
final CompletableFuture<AsyncConnection> future = new CompletableFuture<>();
try {
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
try {
channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
} catch (IOException e) {
}
channel.connect(address, null, new CompletionHandler<Void, Void>() {
@Override
public void completed(Void result, Void attachment) {
future.complete(new TcpAioAsyncConnection(bufferSupplier, bufferConsumer, channel, sslContext, address, readTimeoutSeconds, writeTimeoutSeconds, null, null));
}
@Override
public void failed(Throwable exc, Void attachment) {
future.completeExceptionally(exc);
}
});
} catch (IOException e) {
future.completeExceptionally(e);
}
return future;
} | [
"public",
"static",
"CompletableFuture",
"<",
"AsyncConnection",
">",
"createTCP",
"(",
"final",
"Supplier",
"<",
"ByteBuffer",
">",
"bufferSupplier",
",",
"Consumer",
"<",
"ByteBuffer",
">",
"bufferConsumer",
",",
"final",
"AsynchronousChannelGroup",
"group",
",",
"final",
"SSLContext",
"sslContext",
",",
"final",
"SocketAddress",
"address",
",",
"final",
"int",
"readTimeoutSeconds",
",",
"final",
"int",
"writeTimeoutSeconds",
")",
"{",
"final",
"CompletableFuture",
"<",
"AsyncConnection",
">",
"future",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"try",
"{",
"final",
"AsynchronousSocketChannel",
"channel",
"=",
"AsynchronousSocketChannel",
".",
"open",
"(",
"group",
")",
";",
"try",
"{",
"channel",
".",
"setOption",
"(",
"StandardSocketOptions",
".",
"TCP_NODELAY",
",",
"true",
")",
";",
"channel",
".",
"setOption",
"(",
"StandardSocketOptions",
".",
"SO_KEEPALIVE",
",",
"true",
")",
";",
"channel",
".",
"setOption",
"(",
"StandardSocketOptions",
".",
"SO_REUSEADDR",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"channel",
".",
"connect",
"(",
"address",
",",
"null",
",",
"new",
"CompletionHandler",
"<",
"Void",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"completed",
"(",
"Void",
"result",
",",
"Void",
"attachment",
")",
"{",
"future",
".",
"complete",
"(",
"new",
"TcpAioAsyncConnection",
"(",
"bufferSupplier",
",",
"bufferConsumer",
",",
"channel",
",",
"sslContext",
",",
"address",
",",
"readTimeoutSeconds",
",",
"writeTimeoutSeconds",
",",
"null",
",",
"null",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"failed",
"(",
"Throwable",
"exc",
",",
"Void",
"attachment",
")",
"{",
"future",
".",
"completeExceptionally",
"(",
"exc",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"future",
".",
"completeExceptionally",
"(",
"e",
")",
";",
"}",
"return",
"future",
";",
"}"
]
| 创建TCP协议客户端连接
@param bufferSupplier ByteBuffer生产器
@param bufferConsumer ByteBuffer回收器
@param address 连接点子
@param sslContext SSLContext
@param group 连接AsynchronousChannelGroup
@param readTimeoutSeconds 读取超时秒数
@param writeTimeoutSeconds 写入超时秒数
@return 连接CompletableFuture | [
"创建TCP协议客户端连接"
]
| train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/AsyncConnection.java#L294-L320 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.createOrUpdate | public NetworkInterfaceInner createOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner parameters) {
"""
Creates or updates a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param parameters Parameters supplied to the create or update network interface operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkInterfaceInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, parameters).toBlocking().last().body();
} | java | public NetworkInterfaceInner createOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, parameters).toBlocking().last().body();
} | [
"public",
"NetworkInterfaceInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
",",
"NetworkInterfaceInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkInterfaceName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Creates or updates a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param parameters Parameters supplied to the create or update network interface operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkInterfaceInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"network",
"interface",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L493-L495 |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java | XmlStreamReaderUtils.optionalFloatAttribute | public static float optionalFloatAttribute(
final XMLStreamReader reader,
final String localName,
final float defaultValue) {
"""
Returns the value of an attribute as a float. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty.
"""
return optionalFloatAttribute(reader, null, localName, defaultValue);
} | java | public static float optionalFloatAttribute(
final XMLStreamReader reader,
final String localName,
final float defaultValue) {
return optionalFloatAttribute(reader, null, localName, defaultValue);
} | [
"public",
"static",
"float",
"optionalFloatAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"String",
"localName",
",",
"final",
"float",
"defaultValue",
")",
"{",
"return",
"optionalFloatAttribute",
"(",
"reader",
",",
"null",
",",
"localName",
",",
"defaultValue",
")",
";",
"}"
]
| Returns the value of an attribute as a float. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty. | [
"Returns",
"the",
"value",
"of",
"an",
"attribute",
"as",
"a",
"float",
".",
"If",
"the",
"attribute",
"is",
"empty",
"this",
"method",
"returns",
"the",
"default",
"value",
"provided",
"."
]
| train | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L752-L757 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/HandshakeReader.java | HandshakeReader.validateUpgrade | private void validateUpgrade(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException {
"""
Validate the value of {@code Upgrade} header.
<blockquote>
<p>From RFC 6455, p19.</p>
<p><i>
If the response lacks an {@code Upgrade} header field or the {@code Upgrade}
header field contains a value that is not an ASCII case-insensitive match for
the value "websocket", the client MUST Fail the WebSocket Connection.
</i></p>
</blockquote>
"""
// Get the values of Upgrade.
List<String> values = headers.get("Upgrade");
if (values == null || values.size() == 0)
{
// The opening handshake response does not contain 'Upgrade' header.
throw new OpeningHandshakeException(
WebSocketError.NO_UPGRADE_HEADER,
"The opening handshake response does not contain 'Upgrade' header.",
statusLine, headers);
}
for (String value : values)
{
// Split the value of Upgrade header into elements.
String[] elements = value.split("\\s*,\\s*");
for (String element : elements)
{
if ("websocket".equalsIgnoreCase(element))
{
// Found 'websocket' in Upgrade header.
return;
}
}
}
// 'websocket' was not found in 'Upgrade' header.
throw new OpeningHandshakeException(
WebSocketError.NO_WEBSOCKET_IN_UPGRADE_HEADER,
"'websocket' was not found in 'Upgrade' header.",
statusLine, headers);
} | java | private void validateUpgrade(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException
{
// Get the values of Upgrade.
List<String> values = headers.get("Upgrade");
if (values == null || values.size() == 0)
{
// The opening handshake response does not contain 'Upgrade' header.
throw new OpeningHandshakeException(
WebSocketError.NO_UPGRADE_HEADER,
"The opening handshake response does not contain 'Upgrade' header.",
statusLine, headers);
}
for (String value : values)
{
// Split the value of Upgrade header into elements.
String[] elements = value.split("\\s*,\\s*");
for (String element : elements)
{
if ("websocket".equalsIgnoreCase(element))
{
// Found 'websocket' in Upgrade header.
return;
}
}
}
// 'websocket' was not found in 'Upgrade' header.
throw new OpeningHandshakeException(
WebSocketError.NO_WEBSOCKET_IN_UPGRADE_HEADER,
"'websocket' was not found in 'Upgrade' header.",
statusLine, headers);
} | [
"private",
"void",
"validateUpgrade",
"(",
"StatusLine",
"statusLine",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
")",
"throws",
"WebSocketException",
"{",
"// Get the values of Upgrade.",
"List",
"<",
"String",
">",
"values",
"=",
"headers",
".",
"get",
"(",
"\"Upgrade\"",
")",
";",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"// The opening handshake response does not contain 'Upgrade' header.",
"throw",
"new",
"OpeningHandshakeException",
"(",
"WebSocketError",
".",
"NO_UPGRADE_HEADER",
",",
"\"The opening handshake response does not contain 'Upgrade' header.\"",
",",
"statusLine",
",",
"headers",
")",
";",
"}",
"for",
"(",
"String",
"value",
":",
"values",
")",
"{",
"// Split the value of Upgrade header into elements.",
"String",
"[",
"]",
"elements",
"=",
"value",
".",
"split",
"(",
"\"\\\\s*,\\\\s*\"",
")",
";",
"for",
"(",
"String",
"element",
":",
"elements",
")",
"{",
"if",
"(",
"\"websocket\"",
".",
"equalsIgnoreCase",
"(",
"element",
")",
")",
"{",
"// Found 'websocket' in Upgrade header.",
"return",
";",
"}",
"}",
"}",
"// 'websocket' was not found in 'Upgrade' header.",
"throw",
"new",
"OpeningHandshakeException",
"(",
"WebSocketError",
".",
"NO_WEBSOCKET_IN_UPGRADE_HEADER",
",",
"\"'websocket' was not found in 'Upgrade' header.\"",
",",
"statusLine",
",",
"headers",
")",
";",
"}"
]
| Validate the value of {@code Upgrade} header.
<blockquote>
<p>From RFC 6455, p19.</p>
<p><i>
If the response lacks an {@code Upgrade} header field or the {@code Upgrade}
header field contains a value that is not an ASCII case-insensitive match for
the value "websocket", the client MUST Fail the WebSocket Connection.
</i></p>
</blockquote> | [
"Validate",
"the",
"value",
"of",
"{",
"@code",
"Upgrade",
"}",
"header",
"."
]
| train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/HandshakeReader.java#L300-L334 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/SegwitAddress.java | SegwitAddress.fromKey | public static SegwitAddress fromKey(NetworkParameters params, ECKey key) {
"""
Construct a {@link SegwitAddress} that represents the public part of the given {@link ECKey}. Note that an
address is derived from a hash of the public key and is not the public key itself.
@param params
network this address is valid for
@param key
only the public part is used
@return constructed address
"""
checkArgument(key.isCompressed(), "only compressed keys allowed");
return fromHash(params, key.getPubKeyHash());
} | java | public static SegwitAddress fromKey(NetworkParameters params, ECKey key) {
checkArgument(key.isCompressed(), "only compressed keys allowed");
return fromHash(params, key.getPubKeyHash());
} | [
"public",
"static",
"SegwitAddress",
"fromKey",
"(",
"NetworkParameters",
"params",
",",
"ECKey",
"key",
")",
"{",
"checkArgument",
"(",
"key",
".",
"isCompressed",
"(",
")",
",",
"\"only compressed keys allowed\"",
")",
";",
"return",
"fromHash",
"(",
"params",
",",
"key",
".",
"getPubKeyHash",
"(",
")",
")",
";",
"}"
]
| Construct a {@link SegwitAddress} that represents the public part of the given {@link ECKey}. Note that an
address is derived from a hash of the public key and is not the public key itself.
@param params
network this address is valid for
@param key
only the public part is used
@return constructed address | [
"Construct",
"a",
"{",
"@link",
"SegwitAddress",
"}",
"that",
"represents",
"the",
"public",
"part",
"of",
"the",
"given",
"{",
"@link",
"ECKey",
"}",
".",
"Note",
"that",
"an",
"address",
"is",
"derived",
"from",
"a",
"hash",
"of",
"the",
"public",
"key",
"and",
"is",
"not",
"the",
"public",
"key",
"itself",
"."
]
| train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/SegwitAddress.java#L205-L208 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaDispatchEndpointActivation.java | SibRaDispatchEndpointActivation.closeConnection | protected void closeConnection(final String meUuid, boolean alreadyClosed) {
"""
Closes the connection for the given messaging engine if there is one
open. Removes any corresponding sessions from the maps.
@param meUuid
the UUID for the messaging engine to close the connection for
"""
final String methodName = "closeConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, meUuid);
}
synchronized (_sessionsByMeUuid) {
super.closeConnection(meUuid, alreadyClosed);
_sessionsByMeUuid.remove(meUuid);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | java | protected void closeConnection(final String meUuid, boolean alreadyClosed) {
final String methodName = "closeConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, meUuid);
}
synchronized (_sessionsByMeUuid) {
super.closeConnection(meUuid, alreadyClosed);
_sessionsByMeUuid.remove(meUuid);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} | [
"protected",
"void",
"closeConnection",
"(",
"final",
"String",
"meUuid",
",",
"boolean",
"alreadyClosed",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"closeConnection\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"this",
",",
"TRACE",
",",
"methodName",
",",
"meUuid",
")",
";",
"}",
"synchronized",
"(",
"_sessionsByMeUuid",
")",
"{",
"super",
".",
"closeConnection",
"(",
"meUuid",
",",
"alreadyClosed",
")",
";",
"_sessionsByMeUuid",
".",
"remove",
"(",
"meUuid",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"TRACE",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"exit",
"(",
"this",
",",
"TRACE",
",",
"methodName",
")",
";",
"}",
"}"
]
| Closes the connection for the given messaging engine if there is one
open. Removes any corresponding sessions from the maps.
@param meUuid
the UUID for the messaging engine to close the connection for | [
"Closes",
"the",
"connection",
"for",
"the",
"given",
"messaging",
"engine",
"if",
"there",
"is",
"one",
"open",
".",
"Removes",
"any",
"corresponding",
"sessions",
"from",
"the",
"maps",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaDispatchEndpointActivation.java#L427-L446 |
bohnman/squiggly-java | src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java | SquigglyUtils.objectify | public static <T> T objectify(ObjectMapper mapper, Object source, Class<T> targetType) {
"""
Converts an object to an instance of the target type. Unlike {@link ObjectMapper#convertValue(Object, Class)},
this method will apply Squiggly filters. It does so by first converting the source to bytes and then re-reading
it.
@param mapper the object mapper
@param source the source to convert
@param targetType the target class type
@return target instance
"""
return objectify(mapper, source, mapper.getTypeFactory().constructType(targetType));
} | java | public static <T> T objectify(ObjectMapper mapper, Object source, Class<T> targetType) {
return objectify(mapper, source, mapper.getTypeFactory().constructType(targetType));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"objectify",
"(",
"ObjectMapper",
"mapper",
",",
"Object",
"source",
",",
"Class",
"<",
"T",
">",
"targetType",
")",
"{",
"return",
"objectify",
"(",
"mapper",
",",
"source",
",",
"mapper",
".",
"getTypeFactory",
"(",
")",
".",
"constructType",
"(",
"targetType",
")",
")",
";",
"}"
]
| Converts an object to an instance of the target type. Unlike {@link ObjectMapper#convertValue(Object, Class)},
this method will apply Squiggly filters. It does so by first converting the source to bytes and then re-reading
it.
@param mapper the object mapper
@param source the source to convert
@param targetType the target class type
@return target instance | [
"Converts",
"an",
"object",
"to",
"an",
"instance",
"of",
"the",
"target",
"type",
".",
"Unlike",
"{",
"@link",
"ObjectMapper#convertValue",
"(",
"Object",
"Class",
")",
"}",
"this",
"method",
"will",
"apply",
"Squiggly",
"filters",
".",
"It",
"does",
"so",
"by",
"first",
"converting",
"the",
"source",
"to",
"bytes",
"and",
"then",
"re",
"-",
"reading",
"it",
"."
]
| train | https://github.com/bohnman/squiggly-java/blob/ba0c0b924ab718225d1ad180273ee63ea6c4f55a/src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java#L162-L164 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java | AbstractMySQLQuery.calcFoundRows | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C calcFoundRows() {
"""
SQL_CALC_FOUND_ROWS tells MySQL to calculate how many rows there would be in the result set,
disregarding any LIMIT clause. The number of rows can then be retrieved with SELECT FOUND_ROWS().
@return the current object
"""
return addFlag(Position.AFTER_SELECT, SQL_CALC_FOUND_ROWS);
} | java | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C calcFoundRows() {
return addFlag(Position.AFTER_SELECT, SQL_CALC_FOUND_ROWS);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"MySQLQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"calcFoundRows",
"(",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"AFTER_SELECT",
",",
"SQL_CALC_FOUND_ROWS",
")",
";",
"}"
]
| SQL_CALC_FOUND_ROWS tells MySQL to calculate how many rows there would be in the result set,
disregarding any LIMIT clause. The number of rows can then be retrieved with SELECT FOUND_ROWS().
@return the current object | [
"SQL_CALC_FOUND_ROWS",
"tells",
"MySQL",
"to",
"calculate",
"how",
"many",
"rows",
"there",
"would",
"be",
"in",
"the",
"result",
"set",
"disregarding",
"any",
"LIMIT",
"clause",
".",
"The",
"number",
"of",
"rows",
"can",
"then",
"be",
"retrieved",
"with",
"SELECT",
"FOUND_ROWS",
"()",
"."
]
| train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L111-L114 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java | AnnotationUtility.extractAsEnumerationValue | public static String extractAsEnumerationValue(ModelProperty property, ModelAnnotation annotationClass, AnnotationAttributeType attribute) {
"""
Estract from an annotation of a property the attribute value specified.
@param property property to analyze
@param annotationClass annotation to analyze
@param attribute the attribute
@return attribute value as list of string
"""
final Elements elementUtils=BaseProcessor.elementUtils;
final One<String> result = new One<String>();
extractAttributeValue(elementUtils, property.getElement(), annotationClass.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = value.substring(value.lastIndexOf(".") + 1);
}
});
return result.value0;
} | java | public static String extractAsEnumerationValue(ModelProperty property, ModelAnnotation annotationClass, AnnotationAttributeType attribute) {
final Elements elementUtils=BaseProcessor.elementUtils;
final One<String> result = new One<String>();
extractAttributeValue(elementUtils, property.getElement(), annotationClass.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = value.substring(value.lastIndexOf(".") + 1);
}
});
return result.value0;
} | [
"public",
"static",
"String",
"extractAsEnumerationValue",
"(",
"ModelProperty",
"property",
",",
"ModelAnnotation",
"annotationClass",
",",
"AnnotationAttributeType",
"attribute",
")",
"{",
"final",
"Elements",
"elementUtils",
"=",
"BaseProcessor",
".",
"elementUtils",
";",
"final",
"One",
"<",
"String",
">",
"result",
"=",
"new",
"One",
"<",
"String",
">",
"(",
")",
";",
"extractAttributeValue",
"(",
"elementUtils",
",",
"property",
".",
"getElement",
"(",
")",
",",
"annotationClass",
".",
"getName",
"(",
")",
",",
"attribute",
",",
"new",
"OnAttributeFoundListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onFound",
"(",
"String",
"value",
")",
"{",
"result",
".",
"value0",
"=",
"value",
".",
"substring",
"(",
"value",
".",
"lastIndexOf",
"(",
"\".\"",
")",
"+",
"1",
")",
";",
"}",
"}",
")",
";",
"return",
"result",
".",
"value0",
";",
"}"
]
| Estract from an annotation of a property the attribute value specified.
@param property property to analyze
@param annotationClass annotation to analyze
@param attribute the attribute
@return attribute value as list of string | [
"Estract",
"from",
"an",
"annotation",
"of",
"a",
"property",
"the",
"attribute",
"value",
"specified",
"."
]
| train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L398-L412 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java | QueueContainer.txnRollbackPoll | public boolean txnRollbackPoll(long itemId, boolean backup) {
"""
Rolls back the effects of the {@link #txnPollReserve(long, String)}.
The {@code backup} parameter defines whether this item was stored
on a backup queue or a primary queue.
It will return the item to the queue or backup map if it wasn't
offered as a part of the transaction.
Cancels the queue eviction if one is scheduled.
@param itemId the ID of the item which was polled in a transaction
@param backup if this is the primary or the backup replica for this queue
@return if there was any polled item with the {@code itemId} inside a transaction
"""
TxQueueItem item = txMap.remove(itemId);
if (item == null) {
return false;
}
if (backup) {
getBackupMap().put(itemId, item);
} else {
addTxItemOrdered(item);
}
cancelEvictionIfExists();
return true;
} | java | public boolean txnRollbackPoll(long itemId, boolean backup) {
TxQueueItem item = txMap.remove(itemId);
if (item == null) {
return false;
}
if (backup) {
getBackupMap().put(itemId, item);
} else {
addTxItemOrdered(item);
}
cancelEvictionIfExists();
return true;
} | [
"public",
"boolean",
"txnRollbackPoll",
"(",
"long",
"itemId",
",",
"boolean",
"backup",
")",
"{",
"TxQueueItem",
"item",
"=",
"txMap",
".",
"remove",
"(",
"itemId",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"backup",
")",
"{",
"getBackupMap",
"(",
")",
".",
"put",
"(",
"itemId",
",",
"item",
")",
";",
"}",
"else",
"{",
"addTxItemOrdered",
"(",
"item",
")",
";",
"}",
"cancelEvictionIfExists",
"(",
")",
";",
"return",
"true",
";",
"}"
]
| Rolls back the effects of the {@link #txnPollReserve(long, String)}.
The {@code backup} parameter defines whether this item was stored
on a backup queue or a primary queue.
It will return the item to the queue or backup map if it wasn't
offered as a part of the transaction.
Cancels the queue eviction if one is scheduled.
@param itemId the ID of the item which was polled in a transaction
@param backup if this is the primary or the backup replica for this queue
@return if there was any polled item with the {@code itemId} inside a transaction | [
"Rolls",
"back",
"the",
"effects",
"of",
"the",
"{",
"@link",
"#txnPollReserve",
"(",
"long",
"String",
")",
"}",
".",
"The",
"{",
"@code",
"backup",
"}",
"parameter",
"defines",
"whether",
"this",
"item",
"was",
"stored",
"on",
"a",
"backup",
"queue",
"or",
"a",
"primary",
"queue",
".",
"It",
"will",
"return",
"the",
"item",
"to",
"the",
"queue",
"or",
"backup",
"map",
"if",
"it",
"wasn",
"t",
"offered",
"as",
"a",
"part",
"of",
"the",
"transaction",
".",
"Cancels",
"the",
"queue",
"eviction",
"if",
"one",
"is",
"scheduled",
"."
]
| train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L269-L282 |
VueGWT/vue-gwt | processors/src/main/java/com/axellience/vuegwt/processors/component/factory/AbstractVueComponentFactoryGenerator.java | AbstractVueComponentFactoryGenerator.createFactoryBuilderClass | private Builder createFactoryBuilderClass(TypeElement component, ClassName vueFactoryClassName) {
"""
Create the builder to build our {@link VueComponentFactory} class.
@param component The Component we generate for
@param vueFactoryClassName The type name of our generated {@link VueComponentFactory}
@return A Class Builder
"""
return TypeSpec
.classBuilder(vueFactoryClassName)
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.superclass(ParameterizedTypeName.get(ClassName.get(VueComponentFactory.class),
ClassName.get(component)))
.addAnnotation(Singleton.class)
.addJavadoc("VueComponentFactory for Component {@link $L}",
component.getQualifiedName().toString())
.addAnnotation(AnnotationSpec
.builder(Generated.class)
.addMember("value", "$S", this.getClass().getCanonicalName())
.addMember("date", "$S", new Date().toString())
.addMember("comments", "$S", "https://github.com/Axellience/vue-gwt")
.build());
} | java | private Builder createFactoryBuilderClass(TypeElement component, ClassName vueFactoryClassName) {
return TypeSpec
.classBuilder(vueFactoryClassName)
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.superclass(ParameterizedTypeName.get(ClassName.get(VueComponentFactory.class),
ClassName.get(component)))
.addAnnotation(Singleton.class)
.addJavadoc("VueComponentFactory for Component {@link $L}",
component.getQualifiedName().toString())
.addAnnotation(AnnotationSpec
.builder(Generated.class)
.addMember("value", "$S", this.getClass().getCanonicalName())
.addMember("date", "$S", new Date().toString())
.addMember("comments", "$S", "https://github.com/Axellience/vue-gwt")
.build());
} | [
"private",
"Builder",
"createFactoryBuilderClass",
"(",
"TypeElement",
"component",
",",
"ClassName",
"vueFactoryClassName",
")",
"{",
"return",
"TypeSpec",
".",
"classBuilder",
"(",
"vueFactoryClassName",
")",
".",
"addModifiers",
"(",
"Modifier",
".",
"PUBLIC",
",",
"Modifier",
".",
"FINAL",
")",
".",
"superclass",
"(",
"ParameterizedTypeName",
".",
"get",
"(",
"ClassName",
".",
"get",
"(",
"VueComponentFactory",
".",
"class",
")",
",",
"ClassName",
".",
"get",
"(",
"component",
")",
")",
")",
".",
"addAnnotation",
"(",
"Singleton",
".",
"class",
")",
".",
"addJavadoc",
"(",
"\"VueComponentFactory for Component {@link $L}\"",
",",
"component",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")",
")",
".",
"addAnnotation",
"(",
"AnnotationSpec",
".",
"builder",
"(",
"Generated",
".",
"class",
")",
".",
"addMember",
"(",
"\"value\"",
",",
"\"$S\"",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
".",
"addMember",
"(",
"\"date\"",
",",
"\"$S\"",
",",
"new",
"Date",
"(",
")",
".",
"toString",
"(",
")",
")",
".",
"addMember",
"(",
"\"comments\"",
",",
"\"$S\"",
",",
"\"https://github.com/Axellience/vue-gwt\"",
")",
".",
"build",
"(",
")",
")",
";",
"}"
]
| Create the builder to build our {@link VueComponentFactory} class.
@param component The Component we generate for
@param vueFactoryClassName The type name of our generated {@link VueComponentFactory}
@return A Class Builder | [
"Create",
"the",
"builder",
"to",
"build",
"our",
"{",
"@link",
"VueComponentFactory",
"}",
"class",
"."
]
| train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/factory/AbstractVueComponentFactoryGenerator.java#L115-L130 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/collect/FluentCloseableIterable.java | FluentCloseableIterable.filter | public final FluentCloseableIterable<T> filter(Predicate<? super T> predicate) {
"""
Returns the elements from this fluent iterable that satisfy a predicate. The
resulting fluent iterable's iterator does not support {@code remove()}.
"""
return from(CloseableIterables.filter(this, predicate));
} | java | public final FluentCloseableIterable<T> filter(Predicate<? super T> predicate) {
return from(CloseableIterables.filter(this, predicate));
} | [
"public",
"final",
"FluentCloseableIterable",
"<",
"T",
">",
"filter",
"(",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"return",
"from",
"(",
"CloseableIterables",
".",
"filter",
"(",
"this",
",",
"predicate",
")",
")",
";",
"}"
]
| Returns the elements from this fluent iterable that satisfy a predicate. The
resulting fluent iterable's iterator does not support {@code remove()}. | [
"Returns",
"the",
"elements",
"from",
"this",
"fluent",
"iterable",
"that",
"satisfy",
"a",
"predicate",
".",
"The",
"resulting",
"fluent",
"iterable",
"s",
"iterator",
"does",
"not",
"support",
"{"
]
| train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/FluentCloseableIterable.java#L143-L145 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/juel/Builder.java | Builder.main | public static void main(String[] args) {
"""
Dump out abstract syntax tree for a given expression
@param args array with one element, containing the expression string
"""
if (args.length != 1) {
System.err.println("usage: java " + Builder.class.getName() + " <expression string>");
System.exit(1);
}
PrintWriter out = new PrintWriter(System.out);
Tree tree = null;
try {
tree = new Builder(Feature.METHOD_INVOCATIONS).build(args[0]);
} catch (TreeBuilderException e) {
System.out.println(e.getMessage());
System.exit(0);
}
NodePrinter.dump(out, tree.getRoot());
if (!tree.getFunctionNodes().iterator().hasNext() && !tree.getIdentifierNodes().iterator().hasNext()) {
ELContext context = new ELContext() {
@Override
public VariableMapper getVariableMapper() {
return null;
}
@Override
public FunctionMapper getFunctionMapper() {
return null;
}
@Override
public ELResolver getELResolver() {
return null;
}
};
out.print(">> ");
try {
out.println(tree.getRoot().getValue(new Bindings(null, null), context, null));
} catch (ELException e) {
out.println(e.getMessage());
}
}
out.flush();
} | java | public static void main(String[] args) {
if (args.length != 1) {
System.err.println("usage: java " + Builder.class.getName() + " <expression string>");
System.exit(1);
}
PrintWriter out = new PrintWriter(System.out);
Tree tree = null;
try {
tree = new Builder(Feature.METHOD_INVOCATIONS).build(args[0]);
} catch (TreeBuilderException e) {
System.out.println(e.getMessage());
System.exit(0);
}
NodePrinter.dump(out, tree.getRoot());
if (!tree.getFunctionNodes().iterator().hasNext() && !tree.getIdentifierNodes().iterator().hasNext()) {
ELContext context = new ELContext() {
@Override
public VariableMapper getVariableMapper() {
return null;
}
@Override
public FunctionMapper getFunctionMapper() {
return null;
}
@Override
public ELResolver getELResolver() {
return null;
}
};
out.print(">> ");
try {
out.println(tree.getRoot().getValue(new Bindings(null, null), context, null));
} catch (ELException e) {
out.println(e.getMessage());
}
}
out.flush();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"usage: java \"",
"+",
"Builder",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\" <expression string>\"",
")",
";",
"System",
".",
"exit",
"(",
"1",
")",
";",
"}",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"System",
".",
"out",
")",
";",
"Tree",
"tree",
"=",
"null",
";",
"try",
"{",
"tree",
"=",
"new",
"Builder",
"(",
"Feature",
".",
"METHOD_INVOCATIONS",
")",
".",
"build",
"(",
"args",
"[",
"0",
"]",
")",
";",
"}",
"catch",
"(",
"TreeBuilderException",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"NodePrinter",
".",
"dump",
"(",
"out",
",",
"tree",
".",
"getRoot",
"(",
")",
")",
";",
"if",
"(",
"!",
"tree",
".",
"getFunctionNodes",
"(",
")",
".",
"iterator",
"(",
")",
".",
"hasNext",
"(",
")",
"&&",
"!",
"tree",
".",
"getIdentifierNodes",
"(",
")",
".",
"iterator",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"ELContext",
"context",
"=",
"new",
"ELContext",
"(",
")",
"{",
"@",
"Override",
"public",
"VariableMapper",
"getVariableMapper",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"FunctionMapper",
"getFunctionMapper",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"ELResolver",
"getELResolver",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
";",
"out",
".",
"print",
"(",
"\">> \"",
")",
";",
"try",
"{",
"out",
".",
"println",
"(",
"tree",
".",
"getRoot",
"(",
")",
".",
"getValue",
"(",
"new",
"Bindings",
"(",
"null",
",",
"null",
")",
",",
"context",
",",
"null",
")",
")",
";",
"}",
"catch",
"(",
"ELException",
"e",
")",
"{",
"out",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"out",
".",
"flush",
"(",
")",
";",
"}"
]
| Dump out abstract syntax tree for a given expression
@param args array with one element, containing the expression string | [
"Dump",
"out",
"abstract",
"syntax",
"tree",
"for",
"a",
"given",
"expression"
]
| train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/juel/Builder.java#L125-L162 |
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/AbstractMTreeNode.java | AbstractMTreeNode.coveringRadiusFromEntries | public double coveringRadiusFromEntries(DBID routingObjectID, AbstractMTree<O, N, E, ?> mTree) {
"""
Determines and returns the covering radius of this node.
@param routingObjectID the object id of the routing object of this node
@param mTree the M-Tree
@return the covering radius of this node
"""
double coveringRadius = 0.;
for(int i = 0; i < getNumEntries(); i++) {
E entry = getEntry(i);
final double cover = entry.getParentDistance() + entry.getCoveringRadius();
coveringRadius = coveringRadius < cover ? cover : coveringRadius;
}
return coveringRadius;
} | java | public double coveringRadiusFromEntries(DBID routingObjectID, AbstractMTree<O, N, E, ?> mTree) {
double coveringRadius = 0.;
for(int i = 0; i < getNumEntries(); i++) {
E entry = getEntry(i);
final double cover = entry.getParentDistance() + entry.getCoveringRadius();
coveringRadius = coveringRadius < cover ? cover : coveringRadius;
}
return coveringRadius;
} | [
"public",
"double",
"coveringRadiusFromEntries",
"(",
"DBID",
"routingObjectID",
",",
"AbstractMTree",
"<",
"O",
",",
"N",
",",
"E",
",",
"?",
">",
"mTree",
")",
"{",
"double",
"coveringRadius",
"=",
"0.",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getNumEntries",
"(",
")",
";",
"i",
"++",
")",
"{",
"E",
"entry",
"=",
"getEntry",
"(",
"i",
")",
";",
"final",
"double",
"cover",
"=",
"entry",
".",
"getParentDistance",
"(",
")",
"+",
"entry",
".",
"getCoveringRadius",
"(",
")",
";",
"coveringRadius",
"=",
"coveringRadius",
"<",
"cover",
"?",
"cover",
":",
"coveringRadius",
";",
"}",
"return",
"coveringRadius",
";",
"}"
]
| Determines and returns the covering radius of this node.
@param routingObjectID the object id of the routing object of this node
@param mTree the M-Tree
@return the covering radius of this node | [
"Determines",
"and",
"returns",
"the",
"covering",
"radius",
"of",
"this",
"node",
"."
]
| train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/AbstractMTreeNode.java#L86-L94 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFolder.java | BoxFolder.collaborate | public BoxCollaboration.Info collaborate(String email, BoxCollaboration.Role role) {
"""
Adds a collaborator to this folder. An email will be sent to the collaborator if they don't already have a Box
account.
@param email the email address of the collaborator to add.
@param role the role of the collaborator.
@return info about the new collaboration.
"""
JsonObject accessibleByField = new JsonObject();
accessibleByField.add("login", email);
accessibleByField.add("type", "user");
return this.collaborate(accessibleByField, role, null, null);
} | java | public BoxCollaboration.Info collaborate(String email, BoxCollaboration.Role role) {
JsonObject accessibleByField = new JsonObject();
accessibleByField.add("login", email);
accessibleByField.add("type", "user");
return this.collaborate(accessibleByField, role, null, null);
} | [
"public",
"BoxCollaboration",
".",
"Info",
"collaborate",
"(",
"String",
"email",
",",
"BoxCollaboration",
".",
"Role",
"role",
")",
"{",
"JsonObject",
"accessibleByField",
"=",
"new",
"JsonObject",
"(",
")",
";",
"accessibleByField",
".",
"add",
"(",
"\"login\"",
",",
"email",
")",
";",
"accessibleByField",
".",
"add",
"(",
"\"type\"",
",",
"\"user\"",
")",
";",
"return",
"this",
".",
"collaborate",
"(",
"accessibleByField",
",",
"role",
",",
"null",
",",
"null",
")",
";",
"}"
]
| Adds a collaborator to this folder. An email will be sent to the collaborator if they don't already have a Box
account.
@param email the email address of the collaborator to add.
@param role the role of the collaborator.
@return info about the new collaboration. | [
"Adds",
"a",
"collaborator",
"to",
"this",
"folder",
".",
"An",
"email",
"will",
"be",
"sent",
"to",
"the",
"collaborator",
"if",
"they",
"don",
"t",
"already",
"have",
"a",
"Box",
"account",
"."
]
| train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L160-L166 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/Util.java | Util.setBitmapRangeAndCardinalityChange | @Deprecated
public static int setBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) {
"""
set bits at start, start+1,..., end-1 and report the
cardinality change
@param bitmap array of words to be modified
@param start first index to be modified (inclusive)
@param end last index to be modified (exclusive)
@return cardinality change
"""
int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end);
setBitmapRange(bitmap, start,end);
int cardafter = cardinalityInBitmapWordRange(bitmap, start, end);
return cardafter - cardbefore;
} | java | @Deprecated
public static int setBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) {
int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end);
setBitmapRange(bitmap, start,end);
int cardafter = cardinalityInBitmapWordRange(bitmap, start, end);
return cardafter - cardbefore;
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"setBitmapRangeAndCardinalityChange",
"(",
"long",
"[",
"]",
"bitmap",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"cardbefore",
"=",
"cardinalityInBitmapWordRange",
"(",
"bitmap",
",",
"start",
",",
"end",
")",
";",
"setBitmapRange",
"(",
"bitmap",
",",
"start",
",",
"end",
")",
";",
"int",
"cardafter",
"=",
"cardinalityInBitmapWordRange",
"(",
"bitmap",
",",
"start",
",",
"end",
")",
";",
"return",
"cardafter",
"-",
"cardbefore",
";",
"}"
]
| set bits at start, start+1,..., end-1 and report the
cardinality change
@param bitmap array of words to be modified
@param start first index to be modified (inclusive)
@param end last index to be modified (exclusive)
@return cardinality change | [
"set",
"bits",
"at",
"start",
"start",
"+",
"1",
"...",
"end",
"-",
"1",
"and",
"report",
"the",
"cardinality",
"change"
]
| train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L527-L533 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.appendValue | public DateTimeFormatterBuilder appendValue(TemporalField field) {
"""
Appends the value of a date-time field to the formatter using a normal
output style.
<p>
The value of the field will be output during a print.
If the value cannot be obtained then an exception will be thrown.
<p>
The value will be printed as per the normal print of an integer value.
Only negative numbers will be signed. No padding will be added.
<p>
The parser for a variable width value such as this normally behaves greedily,
requiring one digit, but accepting as many digits as possible.
This behavior can be affected by 'adjacent value parsing'.
See {@link #appendValue(TemporalField, int)} for full details.
@param field the field to append, not null
@return this, for chaining, not null
"""
Jdk8Methods.requireNonNull(field, "field");
appendValue(new NumberPrinterParser(field, 1, 19, SignStyle.NORMAL));
return this;
} | java | public DateTimeFormatterBuilder appendValue(TemporalField field) {
Jdk8Methods.requireNonNull(field, "field");
appendValue(new NumberPrinterParser(field, 1, 19, SignStyle.NORMAL));
return this;
} | [
"public",
"DateTimeFormatterBuilder",
"appendValue",
"(",
"TemporalField",
"field",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"field",
",",
"\"field\"",
")",
";",
"appendValue",
"(",
"new",
"NumberPrinterParser",
"(",
"field",
",",
"1",
",",
"19",
",",
"SignStyle",
".",
"NORMAL",
")",
")",
";",
"return",
"this",
";",
"}"
]
| Appends the value of a date-time field to the formatter using a normal
output style.
<p>
The value of the field will be output during a print.
If the value cannot be obtained then an exception will be thrown.
<p>
The value will be printed as per the normal print of an integer value.
Only negative numbers will be signed. No padding will be added.
<p>
The parser for a variable width value such as this normally behaves greedily,
requiring one digit, but accepting as many digits as possible.
This behavior can be affected by 'adjacent value parsing'.
See {@link #appendValue(TemporalField, int)} for full details.
@param field the field to append, not null
@return this, for chaining, not null | [
"Appends",
"the",
"value",
"of",
"a",
"date",
"-",
"time",
"field",
"to",
"the",
"formatter",
"using",
"a",
"normal",
"output",
"style",
".",
"<p",
">",
"The",
"value",
"of",
"the",
"field",
"will",
"be",
"output",
"during",
"a",
"print",
".",
"If",
"the",
"value",
"cannot",
"be",
"obtained",
"then",
"an",
"exception",
"will",
"be",
"thrown",
".",
"<p",
">",
"The",
"value",
"will",
"be",
"printed",
"as",
"per",
"the",
"normal",
"print",
"of",
"an",
"integer",
"value",
".",
"Only",
"negative",
"numbers",
"will",
"be",
"signed",
".",
"No",
"padding",
"will",
"be",
"added",
".",
"<p",
">",
"The",
"parser",
"for",
"a",
"variable",
"width",
"value",
"such",
"as",
"this",
"normally",
"behaves",
"greedily",
"requiring",
"one",
"digit",
"but",
"accepting",
"as",
"many",
"digits",
"as",
"possible",
".",
"This",
"behavior",
"can",
"be",
"affected",
"by",
"adjacent",
"value",
"parsing",
".",
"See",
"{",
"@link",
"#appendValue",
"(",
"TemporalField",
"int",
")",
"}",
"for",
"full",
"details",
"."
]
| train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L347-L351 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java | ProjectiveInitializeAllCommon.selectInitialTriplet | boolean selectInitialTriplet( View seed , GrowQueue_I32 motions , int selected[] ) {
"""
Exhaustively look at all triplets that connect with the seed view
"""
double bestScore = 0;
for (int i = 0; i < motions.size; i++) {
View viewB = seed.connections.get(i).other(seed);
for (int j = i+1; j < motions.size; j++) {
View viewC = seed.connections.get(j).other(seed);
double s = scoreTripleView(seed,viewB,viewC);
if( s > bestScore ) {
bestScore = s;
selected[0] = i;
selected[1] = j;
}
}
}
return bestScore != 0;
} | java | boolean selectInitialTriplet( View seed , GrowQueue_I32 motions , int selected[] ) {
double bestScore = 0;
for (int i = 0; i < motions.size; i++) {
View viewB = seed.connections.get(i).other(seed);
for (int j = i+1; j < motions.size; j++) {
View viewC = seed.connections.get(j).other(seed);
double s = scoreTripleView(seed,viewB,viewC);
if( s > bestScore ) {
bestScore = s;
selected[0] = i;
selected[1] = j;
}
}
}
return bestScore != 0;
} | [
"boolean",
"selectInitialTriplet",
"(",
"View",
"seed",
",",
"GrowQueue_I32",
"motions",
",",
"int",
"selected",
"[",
"]",
")",
"{",
"double",
"bestScore",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"motions",
".",
"size",
";",
"i",
"++",
")",
"{",
"View",
"viewB",
"=",
"seed",
".",
"connections",
".",
"get",
"(",
"i",
")",
".",
"other",
"(",
"seed",
")",
";",
"for",
"(",
"int",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"motions",
".",
"size",
";",
"j",
"++",
")",
"{",
"View",
"viewC",
"=",
"seed",
".",
"connections",
".",
"get",
"(",
"j",
")",
".",
"other",
"(",
"seed",
")",
";",
"double",
"s",
"=",
"scoreTripleView",
"(",
"seed",
",",
"viewB",
",",
"viewC",
")",
";",
"if",
"(",
"s",
">",
"bestScore",
")",
"{",
"bestScore",
"=",
"s",
";",
"selected",
"[",
"0",
"]",
"=",
"i",
";",
"selected",
"[",
"1",
"]",
"=",
"j",
";",
"}",
"}",
"}",
"return",
"bestScore",
"!=",
"0",
";",
"}"
]
| Exhaustively look at all triplets that connect with the seed view | [
"Exhaustively",
"look",
"at",
"all",
"triplets",
"that",
"connect",
"with",
"the",
"seed",
"view"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java#L185-L202 |
raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java | ClassByExtensionBenchmark.benchmarkCglib | @Benchmark
public ExampleClass benchmarkCglib() {
"""
Performs a benchmark of a class extension using cglib.
@return The created instance, in order to avoid JIT removal.
"""
Enhancer enhancer = new Enhancer();
enhancer.setUseCache(false);
enhancer.setUseFactory(false);
enhancer.setInterceptDuringConstruction(true);
enhancer.setClassLoader(newClassLoader());
enhancer.setSuperclass(baseClass);
CallbackHelper callbackHelper = new CallbackHelper(baseClass, new Class[0]) {
protected Object getCallback(Method method) {
if (method.getDeclaringClass() == baseClass) {
return new MethodInterceptor() {
public Object intercept(Object object,
Method method,
Object[] arguments,
MethodProxy methodProxy) throws Throwable {
return methodProxy.invokeSuper(object, arguments);
}
};
} else {
return NoOp.INSTANCE;
}
}
};
enhancer.setCallbackFilter(callbackHelper);
enhancer.setCallbacks(callbackHelper.getCallbacks());
return (ExampleClass) enhancer.create();
} | java | @Benchmark
public ExampleClass benchmarkCglib() {
Enhancer enhancer = new Enhancer();
enhancer.setUseCache(false);
enhancer.setUseFactory(false);
enhancer.setInterceptDuringConstruction(true);
enhancer.setClassLoader(newClassLoader());
enhancer.setSuperclass(baseClass);
CallbackHelper callbackHelper = new CallbackHelper(baseClass, new Class[0]) {
protected Object getCallback(Method method) {
if (method.getDeclaringClass() == baseClass) {
return new MethodInterceptor() {
public Object intercept(Object object,
Method method,
Object[] arguments,
MethodProxy methodProxy) throws Throwable {
return methodProxy.invokeSuper(object, arguments);
}
};
} else {
return NoOp.INSTANCE;
}
}
};
enhancer.setCallbackFilter(callbackHelper);
enhancer.setCallbacks(callbackHelper.getCallbacks());
return (ExampleClass) enhancer.create();
} | [
"@",
"Benchmark",
"public",
"ExampleClass",
"benchmarkCglib",
"(",
")",
"{",
"Enhancer",
"enhancer",
"=",
"new",
"Enhancer",
"(",
")",
";",
"enhancer",
".",
"setUseCache",
"(",
"false",
")",
";",
"enhancer",
".",
"setUseFactory",
"(",
"false",
")",
";",
"enhancer",
".",
"setInterceptDuringConstruction",
"(",
"true",
")",
";",
"enhancer",
".",
"setClassLoader",
"(",
"newClassLoader",
"(",
")",
")",
";",
"enhancer",
".",
"setSuperclass",
"(",
"baseClass",
")",
";",
"CallbackHelper",
"callbackHelper",
"=",
"new",
"CallbackHelper",
"(",
"baseClass",
",",
"new",
"Class",
"[",
"0",
"]",
")",
"{",
"protected",
"Object",
"getCallback",
"(",
"Method",
"method",
")",
"{",
"if",
"(",
"method",
".",
"getDeclaringClass",
"(",
")",
"==",
"baseClass",
")",
"{",
"return",
"new",
"MethodInterceptor",
"(",
")",
"{",
"public",
"Object",
"intercept",
"(",
"Object",
"object",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"arguments",
",",
"MethodProxy",
"methodProxy",
")",
"throws",
"Throwable",
"{",
"return",
"methodProxy",
".",
"invokeSuper",
"(",
"object",
",",
"arguments",
")",
";",
"}",
"}",
";",
"}",
"else",
"{",
"return",
"NoOp",
".",
"INSTANCE",
";",
"}",
"}",
"}",
";",
"enhancer",
".",
"setCallbackFilter",
"(",
"callbackHelper",
")",
";",
"enhancer",
".",
"setCallbacks",
"(",
"callbackHelper",
".",
"getCallbacks",
"(",
")",
")",
";",
"return",
"(",
"ExampleClass",
")",
"enhancer",
".",
"create",
"(",
")",
";",
"}"
]
| Performs a benchmark of a class extension using cglib.
@return The created instance, in order to avoid JIT removal. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"class",
"extension",
"using",
"cglib",
"."
]
| train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java#L448-L475 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/http/HttpRequest.java | HttpRequest.withHeader | public HttpRequest withHeader(String header, String value) {
"""
Sets the value of the given header, replacing whatever was already
in there; if the value is null or empty, the header is dropped
altogether.
@param header
the name of the header to set.
@param value
the new value for the header.
@return
the object itself, for method chaining.
"""
if(Strings.isValid(header)) {
if(Strings.isValid(value)) {
headers.put(header, value);
} else {
withoutHeader(header);
}
}
return this;
} | java | public HttpRequest withHeader(String header, String value) {
if(Strings.isValid(header)) {
if(Strings.isValid(value)) {
headers.put(header, value);
} else {
withoutHeader(header);
}
}
return this;
} | [
"public",
"HttpRequest",
"withHeader",
"(",
"String",
"header",
",",
"String",
"value",
")",
"{",
"if",
"(",
"Strings",
".",
"isValid",
"(",
"header",
")",
")",
"{",
"if",
"(",
"Strings",
".",
"isValid",
"(",
"value",
")",
")",
"{",
"headers",
".",
"put",
"(",
"header",
",",
"value",
")",
";",
"}",
"else",
"{",
"withoutHeader",
"(",
"header",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
]
| Sets the value of the given header, replacing whatever was already
in there; if the value is null or empty, the header is dropped
altogether.
@param header
the name of the header to set.
@param value
the new value for the header.
@return
the object itself, for method chaining. | [
"Sets",
"the",
"value",
"of",
"the",
"given",
"header",
"replacing",
"whatever",
"was",
"already",
"in",
"there",
";",
"if",
"the",
"value",
"is",
"null",
"or",
"empty",
"the",
"header",
"is",
"dropped",
"altogether",
"."
]
| train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/http/HttpRequest.java#L151-L160 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setEnterpriseCustomField | public void setEnterpriseCustomField(int index, String value) {
"""
Set an enterprise custom field value.
@param index field index
@param value field value
"""
set(selectField(AssignmentFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value);
} | java | public void setEnterpriseCustomField(int index, String value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value);
} | [
"public",
"void",
"setEnterpriseCustomField",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_CUSTOM_FIELD",
",",
"index",
")",
",",
"value",
")",
";",
"}"
]
| Set an enterprise custom field value.
@param index field index
@param value field value | [
"Set",
"an",
"enterprise",
"custom",
"field",
"value",
"."
]
| train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1837-L1840 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.updateAsync | public Observable<DataBoxEdgeDeviceInner> updateAsync(String deviceName, String resourceGroupName, Map<String, String> tags) {
"""
Modifies a Data Box Edge/Gateway resource.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param tags The tags attached to the Data Box Edge/Gateway resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataBoxEdgeDeviceInner object
"""
return updateWithServiceResponseAsync(deviceName, resourceGroupName, tags).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() {
@Override
public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) {
return response.body();
}
});
} | java | public Observable<DataBoxEdgeDeviceInner> updateAsync(String deviceName, String resourceGroupName, Map<String, String> tags) {
return updateWithServiceResponseAsync(deviceName, resourceGroupName, tags).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() {
@Override
public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataBoxEdgeDeviceInner",
">",
"updateAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
",",
"tags",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"DataBoxEdgeDeviceInner",
">",
",",
"DataBoxEdgeDeviceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DataBoxEdgeDeviceInner",
"call",
"(",
"ServiceResponse",
"<",
"DataBoxEdgeDeviceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Modifies a Data Box Edge/Gateway resource.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param tags The tags attached to the Data Box Edge/Gateway resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataBoxEdgeDeviceInner object | [
"Modifies",
"a",
"Data",
"Box",
"Edge",
"/",
"Gateway",
"resource",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1138-L1145 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/StringHelper.java | StringHelper.escapeWithBackslash | public static String escapeWithBackslash(String value, String metachars) {
"""
Escape meta characters with backslash.
@param value original string
@param metachars characters that need to be escaped
@return modified string with meta characters escaped with backslashes
"""
StringBuffer sb = new StringBuffer();
int i, n = value.length();
char ch;
for (i=0; i<n; i++) {
ch = value.charAt(i);
if (ch=='\\' || metachars.indexOf(ch)>=0) {
sb.append('\\');
}
sb.append(ch);
}
return sb.toString();
} | java | public static String escapeWithBackslash(String value, String metachars) {
StringBuffer sb = new StringBuffer();
int i, n = value.length();
char ch;
for (i=0; i<n; i++) {
ch = value.charAt(i);
if (ch=='\\' || metachars.indexOf(ch)>=0) {
sb.append('\\');
}
sb.append(ch);
}
return sb.toString();
} | [
"public",
"static",
"String",
"escapeWithBackslash",
"(",
"String",
"value",
",",
"String",
"metachars",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"i",
",",
"n",
"=",
"value",
".",
"length",
"(",
")",
";",
"char",
"ch",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"ch",
"=",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"ch",
"==",
"'",
"'",
"||",
"metachars",
".",
"indexOf",
"(",
"ch",
")",
">=",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"ch",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
]
| Escape meta characters with backslash.
@param value original string
@param metachars characters that need to be escaped
@return modified string with meta characters escaped with backslashes | [
"Escape",
"meta",
"characters",
"with",
"backslash",
"."
]
| train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L1109-L1121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.