repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
zaproxy/zaproxy | src/org/zaproxy/zap/extension/httpsessions/HttpSession.java | HttpSession.matchesToken | public boolean matchesToken(String tokenName, HttpCookie cookie) {
// Check if the cookie is null
if (cookie == null) {
return tokenValues.containsKey(tokenName) ? false : true;
}
// Check the value of the token from the cookie
String tokenValue = getTokenValue(tokenName);
if (tokenValue != null && tokenValue.equals(cookie.getValue())) {
return true;
}
return false;
} | java | public boolean matchesToken(String tokenName, HttpCookie cookie) {
// Check if the cookie is null
if (cookie == null) {
return tokenValues.containsKey(tokenName) ? false : true;
}
// Check the value of the token from the cookie
String tokenValue = getTokenValue(tokenName);
if (tokenValue != null && tokenValue.equals(cookie.getValue())) {
return true;
}
return false;
} | [
"public",
"boolean",
"matchesToken",
"(",
"String",
"tokenName",
",",
"HttpCookie",
"cookie",
")",
"{",
"// Check if the cookie is null",
"if",
"(",
"cookie",
"==",
"null",
")",
"{",
"return",
"tokenValues",
".",
"containsKey",
"(",
"tokenName",
")",
"?",
"false... | Checks if a particular cookie has the same value as one of the token values in the HTTP
session. If the {@literal cookie} parameter is null, the session matches the token if it does
not have a value for the corresponding token.
@param tokenName the token name
@param cookie the cookie
@return true, if true | [
"Checks",
"if",
"a",
"particular",
"cookie",
"has",
"the",
"same",
"value",
"as",
"one",
"of",
"the",
"token",
"values",
"in",
"the",
"HTTP",
"session",
".",
"If",
"the",
"{",
"@literal",
"cookie",
"}",
"parameter",
"is",
"null",
"the",
"session",
"match... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/HttpSession.java#L147-L159 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java | SimpleDateFormat.subParse | protected int subParse(String text, int start, char ch, int count,
boolean obeyCount, boolean allowNegative,
boolean[] ambiguousYear, Calendar cal)
{
return subParse(text, start, ch, count, obeyCount, allowNegative, ambiguousYear, cal, null, null);
} | java | protected int subParse(String text, int start, char ch, int count,
boolean obeyCount, boolean allowNegative,
boolean[] ambiguousYear, Calendar cal)
{
return subParse(text, start, ch, count, obeyCount, allowNegative, ambiguousYear, cal, null, null);
} | [
"protected",
"int",
"subParse",
"(",
"String",
"text",
",",
"int",
"start",
",",
"char",
"ch",
",",
"int",
"count",
",",
"boolean",
"obeyCount",
",",
"boolean",
"allowNegative",
",",
"boolean",
"[",
"]",
"ambiguousYear",
",",
"Calendar",
"cal",
")",
"{",
... | Protected method that converts one field of the input string into a
numeric field value in <code>cal</code>. Returns -start (for
ParsePosition) if failed. Subclasses may override this method to
modify or add parsing capabilities.
@param text the time text to be parsed.
@param start where to start parsing.
@param ch the pattern character for the date field text to be parsed.
@param count the count of a pattern character.
@param obeyCount if true, then the next field directly abuts this one,
and we should use the count to know when to stop parsing.
@param ambiguousYear return parameter; upon return, if ambiguousYear[0]
is true, then a two-digit year was parsed and may need to be readjusted.
@param cal
@return the new start position if matching succeeded; a negative
number indicating matching failure, otherwise. As a side effect,
set the appropriate field of <code>cal</code> with the parsed
value. | [
"Protected",
"method",
"that",
"converts",
"one",
"field",
"of",
"the",
"input",
"string",
"into",
"a",
"numeric",
"field",
"value",
"in",
"<code",
">",
"cal<",
"/",
"code",
">",
".",
"Returns",
"-",
"start",
"(",
"for",
"ParsePosition",
")",
"if",
"fail... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3038-L3043 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.getNumberedName | protected String getNumberedName(String name, int number) {
if (number == 0) {
return name;
}
PrintfFormat fmt = new PrintfFormat("%0.6d");
return name + "_" + fmt.sprintf(number);
} | java | protected String getNumberedName(String name, int number) {
if (number == 0) {
return name;
}
PrintfFormat fmt = new PrintfFormat("%0.6d");
return name + "_" + fmt.sprintf(number);
} | [
"protected",
"String",
"getNumberedName",
"(",
"String",
"name",
",",
"int",
"number",
")",
"{",
"if",
"(",
"number",
"==",
"0",
")",
"{",
"return",
"name",
";",
"}",
"PrintfFormat",
"fmt",
"=",
"new",
"PrintfFormat",
"(",
"\"%0.6d\"",
")",
";",
"return"... | Adds a numeric suffix to the end of a string, unless the number passed as a parameter is 0.<p>
@param name the base name
@param number the number from which to form the suffix
@return the concatenation of the base name and possibly the numeric suffix | [
"Adds",
"a",
"numeric",
"suffix",
"to",
"the",
"end",
"of",
"a",
"string",
"unless",
"the",
"number",
"passed",
"as",
"a",
"parameter",
"is",
"0",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10503-L10510 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.getValueForField | @SuppressWarnings("WeakerAccess")
@Internal
@UsedByGeneratedCode
protected final Object getValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) {
FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex);
BeanResolutionContext.Path path = resolutionContext.getPath();
path.pushFieldResolve(this, injectionPoint);
try {
if (context instanceof PropertyResolver) {
final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata();
String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null);
Class<?> fieldType = injectionPoint.getType();
if (isInnerConfiguration(fieldType)) {
Qualifier qualifier = resolveQualifier(resolutionContext, injectionPoint.asArgument(), true);
return ((DefaultBeanContext) context).getBean(resolutionContext, fieldType, qualifier);
} else {
String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata);
Argument fieldArgument = injectionPoint.asArgument();
ArgumentConversionContext conversionContext = ConversionContext.of(fieldArgument);
Optional value = resolveValue((ApplicationContext) context, conversionContext, valueAnnVal != null, valString);
if (fieldType == Optional.class) {
return resolveOptionalObject(value);
} else {
if (value.isPresent()) {
return value.get();
} else {
if (fieldArgument.isDeclaredAnnotationPresent(Nullable.class)) {
return null;
}
throw new DependencyInjectionException(resolutionContext, injectionPoint, "Error resolving field value [" + valString + "]. Property doesn't exist or cannot be converted");
}
}
}
} else {
throw new DependencyInjectionException(resolutionContext, injectionPoint, "@Value requires a BeanContext that implements PropertyResolver");
}
} finally {
path.pop();
}
} | java | @SuppressWarnings("WeakerAccess")
@Internal
@UsedByGeneratedCode
protected final Object getValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) {
FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex);
BeanResolutionContext.Path path = resolutionContext.getPath();
path.pushFieldResolve(this, injectionPoint);
try {
if (context instanceof PropertyResolver) {
final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata();
String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null);
Class<?> fieldType = injectionPoint.getType();
if (isInnerConfiguration(fieldType)) {
Qualifier qualifier = resolveQualifier(resolutionContext, injectionPoint.asArgument(), true);
return ((DefaultBeanContext) context).getBean(resolutionContext, fieldType, qualifier);
} else {
String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata);
Argument fieldArgument = injectionPoint.asArgument();
ArgumentConversionContext conversionContext = ConversionContext.of(fieldArgument);
Optional value = resolveValue((ApplicationContext) context, conversionContext, valueAnnVal != null, valString);
if (fieldType == Optional.class) {
return resolveOptionalObject(value);
} else {
if (value.isPresent()) {
return value.get();
} else {
if (fieldArgument.isDeclaredAnnotationPresent(Nullable.class)) {
return null;
}
throw new DependencyInjectionException(resolutionContext, injectionPoint, "Error resolving field value [" + valString + "]. Property doesn't exist or cannot be converted");
}
}
}
} else {
throw new DependencyInjectionException(resolutionContext, injectionPoint, "@Value requires a BeanContext that implements PropertyResolver");
}
} finally {
path.pop();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"@",
"Internal",
"@",
"UsedByGeneratedCode",
"protected",
"final",
"Object",
"getValueForField",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"int",
"fieldIndex",
")",
"{",
... | Obtains a value for the given field from the bean context
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param fieldIndex The index of the field
@return The resolved bean | [
"Obtains",
"a",
"value",
"for",
"the",
"given",
"field",
"from",
"the",
"bean",
"context",
"<p",
">",
"Warning",
":",
"this",
"method",
"is",
"used",
"by",
"internal",
"generated",
"code",
"and",
"should",
"not",
"be",
"called",
"by",
"user",
"code",
"."... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1161-L1200 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-tracker/src/main/java/org/ops4j/pax/swissbox/tracker/ServiceLookup.java | ServiceLookup.getService | public static <T> T getService( BundleContext bc, Class<T> type, long timeout, String filter )
{
return ServiceLookup.<T> getService( bc, type.getName(), timeout, filter );
} | java | public static <T> T getService( BundleContext bc, Class<T> type, long timeout, String filter )
{
return ServiceLookup.<T> getService( bc, type.getName(), timeout, filter );
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getService",
"(",
"BundleContext",
"bc",
",",
"Class",
"<",
"T",
">",
"type",
",",
"long",
"timeout",
",",
"String",
"filter",
")",
"{",
"return",
"ServiceLookup",
".",
"<",
"T",
">",
"getService",
"(",
"bc",
... | Returns a service matching the given criteria.
@param <T> class implemented or extended by the service
@param bc bundle context for accessing the OSGi registry
@param type class implemented or extended by the service
@param timeout maximum wait period in milliseconds
@param filter LDAP filter to be matched by the service. The class name will be added to the
filter.
@return matching service (not null)
@throws ServiceLookupException when no matching service has been found after the timeout | [
"Returns",
"a",
"service",
"matching",
"the",
"given",
"criteria",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-tracker/src/main/java/org/ops4j/pax/swissbox/tracker/ServiceLookup.java#L134-L137 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/fit/OurColumnFixture.java | OurColumnFixture.getStringArg | protected String getStringArg(int index, String defaultValue) {
String result = defaultValue;
String[] arg = getArgs();
if (arg != null) {
if (arg.length > index) {
result = arg[index];
}
}
return result;
} | java | protected String getStringArg(int index, String defaultValue) {
String result = defaultValue;
String[] arg = getArgs();
if (arg != null) {
if (arg.length > index) {
result = arg[index];
}
}
return result;
} | [
"protected",
"String",
"getStringArg",
"(",
"int",
"index",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"defaultValue",
";",
"String",
"[",
"]",
"arg",
"=",
"getArgs",
"(",
")",
";",
"if",
"(",
"arg",
"!=",
"null",
")",
"{",
"if",... | Gets fixture parameter (i.e. extra column in header row).
Please note this can not be called from a constructor, as the parameters will not have been initialized yet!
@param index index (zero based) to get value from.
@param defaultValue value to use if parameter is not present.
@return parameter value, if present, defaultValue otherwise. | [
"Gets",
"fixture",
"parameter",
"(",
"i",
".",
"e",
".",
"extra",
"column",
"in",
"header",
"row",
")",
".",
"Please",
"note",
"this",
"can",
"not",
"be",
"called",
"from",
"a",
"constructor",
"as",
"the",
"parameters",
"will",
"not",
"have",
"been",
"... | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/OurColumnFixture.java#L75-L84 |
blackducksoftware/blackduck-common | src/main/java/com/synopsys/integration/blackduck/service/PolicyRuleService.java | PolicyRuleService.createPolicyRuleForExternalId | public String createPolicyRuleForExternalId(ComponentService componentService, ExternalId externalId, String policyName) throws IntegrationException {
Optional<ComponentVersionView> componentVersionView = componentService.getComponentVersion(externalId);
if (!componentVersionView.isPresent()) {
throw new BlackDuckIntegrationException(String.format("The external id (%s) provided could not be found, so no policy can be created for it.", externalId.createExternalId()));
}
PolicyRuleExpressionSetBuilder builder = new PolicyRuleExpressionSetBuilder();
builder.addComponentVersionCondition(PolicyRuleConditionOperatorType.EQ, componentVersionView.get());
PolicyRuleExpressionSetView expressionSet = builder.createPolicyRuleExpressionSetView();
PolicyRuleView policyRuleView = new PolicyRuleView();
policyRuleView.setName(policyName);
policyRuleView.setEnabled(true);
policyRuleView.setOverridable(true);
policyRuleView.setExpression(expressionSet);
return createPolicyRule(policyRuleView);
} | java | public String createPolicyRuleForExternalId(ComponentService componentService, ExternalId externalId, String policyName) throws IntegrationException {
Optional<ComponentVersionView> componentVersionView = componentService.getComponentVersion(externalId);
if (!componentVersionView.isPresent()) {
throw new BlackDuckIntegrationException(String.format("The external id (%s) provided could not be found, so no policy can be created for it.", externalId.createExternalId()));
}
PolicyRuleExpressionSetBuilder builder = new PolicyRuleExpressionSetBuilder();
builder.addComponentVersionCondition(PolicyRuleConditionOperatorType.EQ, componentVersionView.get());
PolicyRuleExpressionSetView expressionSet = builder.createPolicyRuleExpressionSetView();
PolicyRuleView policyRuleView = new PolicyRuleView();
policyRuleView.setName(policyName);
policyRuleView.setEnabled(true);
policyRuleView.setOverridable(true);
policyRuleView.setExpression(expressionSet);
return createPolicyRule(policyRuleView);
} | [
"public",
"String",
"createPolicyRuleForExternalId",
"(",
"ComponentService",
"componentService",
",",
"ExternalId",
"externalId",
",",
"String",
"policyName",
")",
"throws",
"IntegrationException",
"{",
"Optional",
"<",
"ComponentVersionView",
">",
"componentVersionView",
... | This will create a policy rule that will be violated by the existence of a matching external id in the project's BOM. | [
"This",
"will",
"create",
"a",
"policy",
"rule",
"that",
"will",
"be",
"violated",
"by",
"the",
"existence",
"of",
"a",
"matching",
"external",
"id",
"in",
"the",
"project",
"s",
"BOM",
"."
] | train | https://github.com/blackducksoftware/blackduck-common/blob/4ea4e90b52b75470b71c597b65cf4e2d73887bcc/src/main/java/com/synopsys/integration/blackduck/service/PolicyRuleService.java#L62-L79 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java | ChunkedIntArray.appendSlot | int appendSlot(int w0, int w1, int w2, int w3)
{
/*
try
{
int newoffset = (lastUsed+1)*slotsize;
fastArray[newoffset] = w0;
fastArray[newoffset+1] = w1;
fastArray[newoffset+2] = w2;
fastArray[newoffset+3] = w3;
return ++lastUsed;
}
catch(ArrayIndexOutOfBoundsException aioobe)
*/
{
final int slotsize=4;
int newoffset = (lastUsed+1)*slotsize;
int chunkpos = newoffset >> lowbits;
int slotpos = (newoffset & lowmask);
// Grow if needed
if (chunkpos > chunks.size() - 1)
chunks.addElement(new int[chunkalloc]);
int[] chunk = chunks.elementAt(chunkpos);
chunk[slotpos] = w0;
chunk[slotpos+1] = w1;
chunk[slotpos+2] = w2;
chunk[slotpos+3] = w3;
return ++lastUsed;
}
} | java | int appendSlot(int w0, int w1, int w2, int w3)
{
/*
try
{
int newoffset = (lastUsed+1)*slotsize;
fastArray[newoffset] = w0;
fastArray[newoffset+1] = w1;
fastArray[newoffset+2] = w2;
fastArray[newoffset+3] = w3;
return ++lastUsed;
}
catch(ArrayIndexOutOfBoundsException aioobe)
*/
{
final int slotsize=4;
int newoffset = (lastUsed+1)*slotsize;
int chunkpos = newoffset >> lowbits;
int slotpos = (newoffset & lowmask);
// Grow if needed
if (chunkpos > chunks.size() - 1)
chunks.addElement(new int[chunkalloc]);
int[] chunk = chunks.elementAt(chunkpos);
chunk[slotpos] = w0;
chunk[slotpos+1] = w1;
chunk[slotpos+2] = w2;
chunk[slotpos+3] = w3;
return ++lastUsed;
}
} | [
"int",
"appendSlot",
"(",
"int",
"w0",
",",
"int",
"w1",
",",
"int",
"w2",
",",
"int",
"w3",
")",
"{",
"/*\n try\n {\n int newoffset = (lastUsed+1)*slotsize;\n fastArray[newoffset] = w0;\n fastArray[newoffset+1] = w1;\n fastArray[newoffset+2] = w2;\n fa... | Append a 4-integer record to the CIA, starting with record 1. (Since
arrays are initialized to all-0, 0 has been reserved as the "unknown"
value in DTM.)
@return the index at which this record was inserted. | [
"Append",
"a",
"4",
"-",
"integer",
"record",
"to",
"the",
"CIA",
"starting",
"with",
"record",
"1",
".",
"(",
"Since",
"arrays",
"are",
"initialized",
"to",
"all",
"-",
"0",
"0",
"has",
"been",
"reserved",
"as",
"the",
"unknown",
"value",
"in",
"DTM",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java#L71-L102 |
modelmapper/modelmapper | core/src/main/java/org/modelmapper/Conditions.java | Conditions.isType | public static Condition<?, ?> isType(final Class<?> type) {
return new Condition<Object, Object>() {
public boolean applies(MappingContext<Object, Object> context) {
return type.isAssignableFrom(context.getSourceType());
}
};
} | java | public static Condition<?, ?> isType(final Class<?> type) {
return new Condition<Object, Object>() {
public boolean applies(MappingContext<Object, Object> context) {
return type.isAssignableFrom(context.getSourceType());
}
};
} | [
"public",
"static",
"Condition",
"<",
"?",
",",
"?",
">",
"isType",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"new",
"Condition",
"<",
"Object",
",",
"Object",
">",
"(",
")",
"{",
"public",
"boolean",
"applies",
"(",
"MappingC... | Returns a condition that applies when the mapping source is of the type {@code type}. | [
"Returns",
"a",
"condition",
"that",
"applies",
"when",
"the",
"mapping",
"source",
"is",
"of",
"the",
"type",
"{"
] | train | https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/Conditions.java#L175-L181 |
icode/ameba | src/main/java/ameba/lib/Strands.java | Strands.printStackTrace | public static void printStackTrace(StackTraceElement[] trace, java.io.PrintStream out) {
Strand.printStackTrace(trace, out);
} | java | public static void printStackTrace(StackTraceElement[] trace, java.io.PrintStream out) {
Strand.printStackTrace(trace, out);
} | [
"public",
"static",
"void",
"printStackTrace",
"(",
"StackTraceElement",
"[",
"]",
"trace",
",",
"java",
".",
"io",
".",
"PrintStream",
"out",
")",
"{",
"Strand",
".",
"printStackTrace",
"(",
"trace",
",",
"out",
")",
";",
"}"
] | This utility method prints a stack-trace into a {@link java.io.PrintStream}
@param trace a stack trace (such as returned from {@link Strand#getStackTrace()}.
@param out the {@link java.io.PrintStream} into which the stack trace will be printed. | [
"This",
"utility",
"method",
"prints",
"a",
"stack",
"-",
"trace",
"into",
"a",
"{",
"@link",
"java",
".",
"io",
".",
"PrintStream",
"}"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Strands.java#L527-L529 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.findNodeByLabel | public static <V> Node<V> findNodeByLabel(List<Node<V>> parents, String labelPrefix) {
return findNode(parents, new LabelPrefixPredicate<V>(labelPrefix));
} | java | public static <V> Node<V> findNodeByLabel(List<Node<V>> parents, String labelPrefix) {
return findNode(parents, new LabelPrefixPredicate<V>(labelPrefix));
} | [
"public",
"static",
"<",
"V",
">",
"Node",
"<",
"V",
">",
"findNodeByLabel",
"(",
"List",
"<",
"Node",
"<",
"V",
">",
">",
"parents",
",",
"String",
"labelPrefix",
")",
"{",
"return",
"findNode",
"(",
"parents",
",",
"new",
"LabelPrefixPredicate",
"<",
... | Returns the first node underneath the given parents which matches the given label prefix.
If parents is null or empty or no node is found the method returns null.
@param parents the parent Nodes to look through
@param labelPrefix the label prefix to look for
@return the Node if found or null if not found | [
"Returns",
"the",
"first",
"node",
"underneath",
"the",
"given",
"parents",
"which",
"matches",
"the",
"given",
"label",
"prefix",
".",
"If",
"parents",
"is",
"null",
"or",
"empty",
"or",
"no",
"node",
"is",
"found",
"the",
"method",
"returns",
"null",
"."... | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L194-L196 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementManager.java | StatementManager.bindDelete | public void bindDelete(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws SQLException
{
if (cld.getDeleteProcedure() != null)
{
this.bindProcedure(stmt, cld, obj, cld.getDeleteProcedure());
}
else
{
int index = 1;
ValueContainer[] values, currentLockingValues;
currentLockingValues = cld.getCurrentLockingValues(obj);
// parameters for WHERE-clause pk
values = getKeyValues(m_broker, cld, obj);
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());
index++;
}
// parameters for WHERE-clause locking
values = currentLockingValues;
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());
index++;
}
}
} | java | public void bindDelete(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws SQLException
{
if (cld.getDeleteProcedure() != null)
{
this.bindProcedure(stmt, cld, obj, cld.getDeleteProcedure());
}
else
{
int index = 1;
ValueContainer[] values, currentLockingValues;
currentLockingValues = cld.getCurrentLockingValues(obj);
// parameters for WHERE-clause pk
values = getKeyValues(m_broker, cld, obj);
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());
index++;
}
// parameters for WHERE-clause locking
values = currentLockingValues;
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());
index++;
}
}
} | [
"public",
"void",
"bindDelete",
"(",
"PreparedStatement",
"stmt",
",",
"ClassDescriptor",
"cld",
",",
"Object",
"obj",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"cld",
".",
"getDeleteProcedure",
"(",
")",
"!=",
"null",
")",
"{",
"this",
".",
"bindProced... | binds the objects primary key and locking values to the statement, BRJ | [
"binds",
"the",
"objects",
"primary",
"key",
"and",
"locking",
"values",
"to",
"the",
"statement",
"BRJ"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L149-L177 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/decisiontables/DecisionTableImpl.java | DecisionTableImpl.matches | private boolean matches(EvaluationContext ctx, Object[] params, DTDecisionRule rule) {
for( int i = 0; i < params.length; i++ ) {
CompiledExpression compiledInput = inputs.get(i).getCompiledInput();
if ( compiledInput instanceof CompiledFEELExpression) {
ctx.setValue("?", ((CompiledFEELExpression) compiledInput).apply(ctx));
}
if( ! satisfies( ctx, params[i], rule.getInputEntry().get( i ) ) ) {
return false;
}
}
return true;
} | java | private boolean matches(EvaluationContext ctx, Object[] params, DTDecisionRule rule) {
for( int i = 0; i < params.length; i++ ) {
CompiledExpression compiledInput = inputs.get(i).getCompiledInput();
if ( compiledInput instanceof CompiledFEELExpression) {
ctx.setValue("?", ((CompiledFEELExpression) compiledInput).apply(ctx));
}
if( ! satisfies( ctx, params[i], rule.getInputEntry().get( i ) ) ) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"matches",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"[",
"]",
"params",
",",
"DTDecisionRule",
"rule",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"{",
"Compile... | Checks if the parameters match a single rule
@param ctx
@param params
@param rule
@return | [
"Checks",
"if",
"the",
"parameters",
"match",
"a",
"single",
"rule"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/decisiontables/DecisionTableImpl.java#L269-L280 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java | ImageBandMath.stdDev | public static void stdDev(Planar<GrayF32> input, GrayF32 output, @Nullable GrayF32 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | java | public static void stdDev(Planar<GrayF32> input, GrayF32 output, @Nullable GrayF32 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | [
"public",
"static",
"void",
"stdDev",
"(",
"Planar",
"<",
"GrayF32",
">",
"input",
",",
"GrayF32",
"output",
",",
"@",
"Nullable",
"GrayF32",
"avg",
")",
"{",
"stdDev",
"(",
"input",
",",
"output",
",",
"avg",
",",
"0",
",",
"input",
".",
"getNumBands"... | Computes the standard deviation for each pixel across all bands in the {@link Planar}
image.
@param input Planar image - not modified
@param output Gray scale image containing average pixel values - modified
@param avg Input Gray scale image containing average image. Can be null | [
"Computes",
"the",
"standard",
"deviation",
"for",
"each",
"pixel",
"across",
"all",
"bands",
"in",
"the",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L1025-L1027 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java | WebDriverHelper.isValuePresentInDropDown | public boolean isValuePresentInDropDown(final By by, final String value) {
WebElement element = driver.findElement(by);
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder
.toString()));
return options != null && !options.isEmpty();
} | java | public boolean isValuePresentInDropDown(final By by, final String value) {
WebElement element = driver.findElement(by);
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder
.toString()));
return options != null && !options.isEmpty();
} | [
"public",
"boolean",
"isValuePresentInDropDown",
"(",
"final",
"By",
"by",
",",
"final",
"String",
"value",
")",
"{",
"WebElement",
"element",
"=",
"driver",
".",
"findElement",
"(",
"by",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",... | Checks if the VALUE is present in the drop-down. This considers the VALUE
attribute of the option, not the actual display text. <br/>
For example if we have the following situation: <select id="test">
<option value="4">June</option> </select> we will call
the method as follows: isValuePresentInDropDown(By.id("test"), "4");
@param by
he method of identifying the drop-down
@param value
the value to search for
@return true if the value is present in the drop-down or false otherwise | [
"Checks",
"if",
"the",
"VALUE",
"is",
"present",
"in",
"the",
"drop",
"-",
"down",
".",
"This",
"considers",
"the",
"VALUE",
"attribute",
"of",
"the",
"option",
"not",
"the",
"actual",
"display",
"text",
".",
"<br",
"/",
">",
"For",
"example",
"if",
"w... | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L583-L593 |
samskivert/samskivert | src/main/java/com/samskivert/util/PrefsConfig.java | PrefsConfig.setValue | public void setValue (String name, float value)
{
Float oldValue = null;
if (_prefs.get(name, null) != null || _props.getProperty(name) != null) {
oldValue = Float.valueOf(_prefs.getFloat(name, super.getValue(name, 0f)));
}
_prefs.putFloat(name, value);
_propsup.firePropertyChange(name, oldValue, Float.valueOf(value));
} | java | public void setValue (String name, float value)
{
Float oldValue = null;
if (_prefs.get(name, null) != null || _props.getProperty(name) != null) {
oldValue = Float.valueOf(_prefs.getFloat(name, super.getValue(name, 0f)));
}
_prefs.putFloat(name, value);
_propsup.firePropertyChange(name, oldValue, Float.valueOf(value));
} | [
"public",
"void",
"setValue",
"(",
"String",
"name",
",",
"float",
"value",
")",
"{",
"Float",
"oldValue",
"=",
"null",
";",
"if",
"(",
"_prefs",
".",
"get",
"(",
"name",
",",
"null",
")",
"!=",
"null",
"||",
"_props",
".",
"getProperty",
"(",
"name"... | Sets the value of the specified preference, overriding the value defined in the
configuration files shipped with the application. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"preference",
"overriding",
"the",
"value",
"defined",
"in",
"the",
"configuration",
"files",
"shipped",
"with",
"the",
"application",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PrefsConfig.java#L99-L108 |
remkop/picocli | src/main/java/picocli/CommandLine.java | CommandLine.setHelpSectionMap | public CommandLine setHelpSectionMap(Map<String, IHelpSectionRenderer> map) {
getCommandSpec().usageMessage().sectionMap(map);
for (CommandLine command : getCommandSpec().subcommands().values()) {
command.setHelpSectionMap(map);
}
return this;
} | java | public CommandLine setHelpSectionMap(Map<String, IHelpSectionRenderer> map) {
getCommandSpec().usageMessage().sectionMap(map);
for (CommandLine command : getCommandSpec().subcommands().values()) {
command.setHelpSectionMap(map);
}
return this;
} | [
"public",
"CommandLine",
"setHelpSectionMap",
"(",
"Map",
"<",
"String",
",",
"IHelpSectionRenderer",
">",
"map",
")",
"{",
"getCommandSpec",
"(",
")",
".",
"usageMessage",
"(",
")",
".",
"sectionMap",
"(",
"map",
")",
";",
"for",
"(",
"CommandLine",
"comman... | Sets the map of section keys and renderers used to construct the usage help message.
<p>The specified setting will be registered with this {@code CommandLine} and the full hierarchy of its
subcommands and nested sub-subcommands <em>at the moment this method is called</em>. Subcommands added
later will have the default setting. To ensure a setting is applied to all
subcommands, call the setter last, after adding subcommands.</p>
<p>Use {@link UsageMessageSpec#sectionMap(Map)} to customize a command without affecting its subcommands.</p>
@see #getHelpSectionMap
@since 3.9 | [
"Sets",
"the",
"map",
"of",
"section",
"keys",
"and",
"renderers",
"used",
"to",
"construct",
"the",
"usage",
"help",
"message",
".",
"<p",
">",
"The",
"specified",
"setting",
"will",
"be",
"registered",
"with",
"this",
"{"
] | train | https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L448-L454 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java | XMLCharHelper.isInvalidXMLCDATAChar | public static boolean isInvalidXMLCDATAChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c)
{
switch (eXMLVersion)
{
case XML_10:
return INVALID_VALUE_CHAR_XML10.get (c);
case XML_11:
return INVALID_CDATA_VALUE_CHAR_XML11.get (c);
case HTML:
return INVALID_CHAR_HTML.get (c);
default:
throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!");
}
} | java | public static boolean isInvalidXMLCDATAChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c)
{
switch (eXMLVersion)
{
case XML_10:
return INVALID_VALUE_CHAR_XML10.get (c);
case XML_11:
return INVALID_CDATA_VALUE_CHAR_XML11.get (c);
case HTML:
return INVALID_CHAR_HTML.get (c);
default:
throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!");
}
} | [
"public",
"static",
"boolean",
"isInvalidXMLCDATAChar",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeVersion",
"eXMLVersion",
",",
"final",
"int",
"c",
")",
"{",
"switch",
"(",
"eXMLVersion",
")",
"{",
"case",
"XML_10",
":",
"return",
"INVALID_VALUE_CHAR_XML10",
".... | Check if the passed character is invalid for a CDATA node.
@param eXMLVersion
XML version to be used. May not be <code>null</code>.
@param c
char to check
@return <code>true</code> if the char is invalid | [
"Check",
"if",
"the",
"passed",
"character",
"is",
"invalid",
"for",
"a",
"CDATA",
"node",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java#L867-L880 |
twitter/cloudhopper-commons | ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/PropertiesReplacementUtil.java | PropertiesReplacementUtil.loadProperties | static public Properties loadProperties(Properties base, File file) throws IOException {
FileReader reader = new FileReader(file);
Properties props = new Properties();
props.load(reader);
if (base != null) props.putAll(base);
reader.close();
return props;
} | java | static public Properties loadProperties(Properties base, File file) throws IOException {
FileReader reader = new FileReader(file);
Properties props = new Properties();
props.load(reader);
if (base != null) props.putAll(base);
reader.close();
return props;
} | [
"static",
"public",
"Properties",
"loadProperties",
"(",
"Properties",
"base",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileReader",
"reader",
"=",
"new",
"FileReader",
"(",
"file",
")",
";",
"Properties",
"props",
"=",
"new",
"Properties",
"("... | Loads the given file into a Properties object.
@param base Properties that should override those loaded from the file
@param file The file to load
@return Properties loaded from the file | [
"Loads",
"the",
"given",
"file",
"into",
"a",
"Properties",
"object",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/PropertiesReplacementUtil.java#L170-L177 |
gondor/kbop | src/main/java/org/pacesys/kbop/internal/AbstractKeyedObjectPool.java | AbstractKeyedObjectPool.createFuture | protected PoolWaitFuture<E> createFuture(final PoolKey<K> key) {
return new PoolWaitFuture<E>(lock) {
protected E getPoolObject(long timeout, TimeUnit unit) throws IOException, InterruptedException, TimeoutException {
return getBlockingUntilAvailableOrTimeout(key, timeout, unit, this);
}
};
} | java | protected PoolWaitFuture<E> createFuture(final PoolKey<K> key) {
return new PoolWaitFuture<E>(lock) {
protected E getPoolObject(long timeout, TimeUnit unit) throws IOException, InterruptedException, TimeoutException {
return getBlockingUntilAvailableOrTimeout(key, timeout, unit, this);
}
};
} | [
"protected",
"PoolWaitFuture",
"<",
"E",
">",
"createFuture",
"(",
"final",
"PoolKey",
"<",
"K",
">",
"key",
")",
"{",
"return",
"new",
"PoolWaitFuture",
"<",
"E",
">",
"(",
"lock",
")",
"{",
"protected",
"E",
"getPoolObject",
"(",
"long",
"timeout",
","... | Creates a Future which will wait for the Keyed Object to become available or timeout
@param key the Pool Key
@return PoolWaitFuture | [
"Creates",
"a",
"Future",
"which",
"will",
"wait",
"for",
"the",
"Keyed",
"Object",
"to",
"become",
"available",
"or",
"timeout"
] | train | https://github.com/gondor/kbop/blob/a176fd845f1e146610f03a1cb3cb0d661ebf4faa/src/main/java/org/pacesys/kbop/internal/AbstractKeyedObjectPool.java#L89-L95 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setMultiMapConfigs | public Config setMultiMapConfigs(Map<String, MultiMapConfig> multiMapConfigs) {
this.multiMapConfigs.clear();
this.multiMapConfigs.putAll(multiMapConfigs);
for (final Entry<String, MultiMapConfig> entry : this.multiMapConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setMultiMapConfigs(Map<String, MultiMapConfig> multiMapConfigs) {
this.multiMapConfigs.clear();
this.multiMapConfigs.putAll(multiMapConfigs);
for (final Entry<String, MultiMapConfig> entry : this.multiMapConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setMultiMapConfigs",
"(",
"Map",
"<",
"String",
",",
"MultiMapConfig",
">",
"multiMapConfigs",
")",
"{",
"this",
".",
"multiMapConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"multiMapConfigs",
".",
"putAll",
"(",
"multiMapConfigs",
")... | Sets the map of {@link com.hazelcast.core.MultiMap} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param multiMapConfigs the multimap configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"core",
".",
"MultiMap",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1098-L1105 |
sprylab/texturevideoview | library/src/main/java/com/sprylab/android/widget/TextureVideoView.java | TextureVideoView.setVideoURI | public void setVideoURI(Uri uri, Map<String, String> headers) {
mUri = uri;
mHeaders = headers;
mSeekWhenPrepared = 0;
openVideo();
requestLayout();
invalidate();
} | java | public void setVideoURI(Uri uri, Map<String, String> headers) {
mUri = uri;
mHeaders = headers;
mSeekWhenPrepared = 0;
openVideo();
requestLayout();
invalidate();
} | [
"public",
"void",
"setVideoURI",
"(",
"Uri",
"uri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"mUri",
"=",
"uri",
";",
"mHeaders",
"=",
"headers",
";",
"mSeekWhenPrepared",
"=",
"0",
";",
"openVideo",
"(",
")",
";",
"requestLa... | Sets video URI using specific headers.
@param uri the URI of the video.
@param headers the headers for the URI request.
Note that the cross domain redirection is allowed by default, but that can be
changed with key/value pairs through the headers parameter with
"android-allow-cross-domain-redirect" as the key and "0" or "1" as the value
to disallow or allow cross domain redirection. | [
"Sets",
"video",
"URI",
"using",
"specific",
"headers",
"."
] | train | https://github.com/sprylab/texturevideoview/blob/4c3665b8342f1d7c13f84acd1d628db88a2bedf6/library/src/main/java/com/sprylab/android/widget/TextureVideoView.java#L252-L259 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/CompletionKey.java | CompletionKey.setBuffer | public void setBuffer(long address, long length, int index) {
if ((index < 0) || (index >= this.bufferCount)) {
throw new IllegalArgumentException();
}
this.stagingByteBuffer.putLong((FIRST_BUFFER_INDEX + (2 * index)) * 8, address);
this.stagingByteBuffer.putLong((FIRST_BUFFER_INDEX + (2 * index) + 1) * 8, length);
} | java | public void setBuffer(long address, long length, int index) {
if ((index < 0) || (index >= this.bufferCount)) {
throw new IllegalArgumentException();
}
this.stagingByteBuffer.putLong((FIRST_BUFFER_INDEX + (2 * index)) * 8, address);
this.stagingByteBuffer.putLong((FIRST_BUFFER_INDEX + (2 * index) + 1) * 8, length);
} | [
"public",
"void",
"setBuffer",
"(",
"long",
"address",
",",
"long",
"length",
",",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"index",
">=",
"this",
".",
"bufferCount",
")",
")",
"{",
"throw",
"new",
"IllegalArgument... | Sets the address and length of a buffer with a specified index.
@param address of the buffer
@param length of the buffer in bytes
@param index of the buffer to set, where 0 is the first buffer
@throws IllegalArgumentException if the index value is <0 or >= bufferCount | [
"Sets",
"the",
"address",
"and",
"length",
"of",
"a",
"buffer",
"with",
"a",
"specified",
"index",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/CompletionKey.java#L182-L189 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Token.java | Token.setDepRel | public void setDepRel(int i, DependencyRelation v) {
if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_depRel == null)
jcasType.jcas.throwFeatMissing("depRel", "de.julielab.jules.types.Token");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_depRel), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_depRel), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setDepRel(int i, DependencyRelation v) {
if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_depRel == null)
jcasType.jcas.throwFeatMissing("depRel", "de.julielab.jules.types.Token");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_depRel), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_depRel), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setDepRel",
"(",
"int",
"i",
",",
"DependencyRelation",
"v",
")",
"{",
"if",
"(",
"Token_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Token_Type",
")",
"jcasType",
")",
".",
"casFeat_depRel",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".... | indexed setter for depRel - sets an indexed value - Contains a list of syntactical dependencies, see DependencyRelation, O
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"depRel",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"Contains",
"a",
"list",
"of",
"syntactical",
"dependencies",
"see",
"DependencyRelation",
"O"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Token.java#L248-L252 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/ClassHelper.java | ClassHelper.getMethod | public static Method getMethod(Object object, String methodName, Class[] params)
{
return getMethod(object.getClass(), methodName, params);
} | java | public static Method getMethod(Object object, String methodName, Class[] params)
{
return getMethod(object.getClass(), methodName, params);
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Class",
"[",
"]",
"params",
")",
"{",
"return",
"getMethod",
"(",
"object",
".",
"getClass",
"(",
")",
",",
"methodName",
",",
"params",
")",
";",
"}"
... | Determines the method with the specified signature via reflection look-up.
@param object The instance whose class is searched for the method
@param methodName The method's name
@param params The parameter types
@return A method object or <code>null</code> if no matching method was found | [
"Determines",
"the",
"method",
"with",
"the",
"specified",
"signature",
"via",
"reflection",
"look",
"-",
"up",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L358-L361 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java | TypeScriptCompilerMojo.processDirectory | protected void processDirectory(File input, File destination) throws WatchingException {
if (! input.isDirectory()) {
return;
}
if (! destination.isDirectory()) {
destination.mkdirs();
}
// Now execute the compiler
// We compute the set of argument according to the Mojo's configuration.
try {
Collection<File> files = FileUtils.listFiles(input, new String[]{"ts"}, true);
if (files.isEmpty()) {
return;
}
List<String> arguments = typescript.createTypeScriptCompilerArgumentList(input, destination, files);
getLog().info("Invoking the TypeScript compiler with " + arguments);
npm.registerOutputStream(true);
int exit = npm.execute(TYPE_SCRIPT_COMMAND,
arguments.toArray(new String[arguments.size()]));
getLog().debug("TypeScript Compiler execution exiting with status: " + exit);
} catch (MojoExecutionException e) {
// If the NPM execution has caught an error stream, try to create the associated watching exception.
if (!Strings.isNullOrEmpty(npm.getLastOutputStream())) {
throw build(npm.getLastOutputStream());
} else {
throw new WatchingException(ERROR_TITLE, "Error while compiling " + input
.getAbsolutePath(), input, e);
}
}
} | java | protected void processDirectory(File input, File destination) throws WatchingException {
if (! input.isDirectory()) {
return;
}
if (! destination.isDirectory()) {
destination.mkdirs();
}
// Now execute the compiler
// We compute the set of argument according to the Mojo's configuration.
try {
Collection<File> files = FileUtils.listFiles(input, new String[]{"ts"}, true);
if (files.isEmpty()) {
return;
}
List<String> arguments = typescript.createTypeScriptCompilerArgumentList(input, destination, files);
getLog().info("Invoking the TypeScript compiler with " + arguments);
npm.registerOutputStream(true);
int exit = npm.execute(TYPE_SCRIPT_COMMAND,
arguments.toArray(new String[arguments.size()]));
getLog().debug("TypeScript Compiler execution exiting with status: " + exit);
} catch (MojoExecutionException e) {
// If the NPM execution has caught an error stream, try to create the associated watching exception.
if (!Strings.isNullOrEmpty(npm.getLastOutputStream())) {
throw build(npm.getLastOutputStream());
} else {
throw new WatchingException(ERROR_TITLE, "Error while compiling " + input
.getAbsolutePath(), input, e);
}
}
} | [
"protected",
"void",
"processDirectory",
"(",
"File",
"input",
",",
"File",
"destination",
")",
"throws",
"WatchingException",
"{",
"if",
"(",
"!",
"input",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"destination",
".",
"... | Process all typescripts file from the given directory. Output files are generated in the given destination.
@param input the input directory
@param destination the output directory
@throws WatchingException if the compilation failed | [
"Process",
"all",
"typescripts",
"file",
"from",
"the",
"given",
"directory",
".",
"Output",
"files",
"are",
"generated",
"in",
"the",
"given",
"destination",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/TypeScriptCompilerMojo.java#L167-L199 |
omadahealth/CircularBarPager | library/src/main/java/com/github/omadahealth/circularbarpager/library/viewpager/FadeViewPagerTransformer.java | FadeViewPagerTransformer.transformPage | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void transformPage(View view, float position) {
//Calculate real position (with padding)
position -= (float) ((ViewPager) view.getParent()).getPaddingRight() / (float) view.getWidth();
if (position <= -1.0f || position >= 1.0f) {
view.setAlpha(0);
view.setTranslationX(0);
} else if (position < 0.0001f && position > -0.0001f) {
view.setAlpha(1);
view.setTranslationX(1);
} else if (position <= 0.0f || position <= 1.0f) {
//Get the page margin to calculate the alpha relatively to it
float pageMargin = -(float) ((ViewPager) view.getParent()).getPageMargin() / (float) view.getWidth();
float alpha = position / (1.0f - pageMargin);
alpha = (alpha <= 0) ? alpha + 1 : 1 - alpha;
view.setAlpha(alpha);
//Reduce the translation by factor 2
view.setTranslationX(-position * ((float) view.getWidth() / 1.5f));
}
} | java | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void transformPage(View view, float position) {
//Calculate real position (with padding)
position -= (float) ((ViewPager) view.getParent()).getPaddingRight() / (float) view.getWidth();
if (position <= -1.0f || position >= 1.0f) {
view.setAlpha(0);
view.setTranslationX(0);
} else if (position < 0.0001f && position > -0.0001f) {
view.setAlpha(1);
view.setTranslationX(1);
} else if (position <= 0.0f || position <= 1.0f) {
//Get the page margin to calculate the alpha relatively to it
float pageMargin = -(float) ((ViewPager) view.getParent()).getPageMargin() / (float) view.getWidth();
float alpha = position / (1.0f - pageMargin);
alpha = (alpha <= 0) ? alpha + 1 : 1 - alpha;
view.setAlpha(alpha);
//Reduce the translation by factor 2
view.setTranslationX(-position * ((float) view.getWidth() / 1.5f));
}
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"void",
"transformPage",
"(",
"View",
"view",
",",
"float",
"position",
")",
"{",
"//Calculate real position (with padding)",
"position",
"-=",
"(",
"float",
")",
"(",
"(",
... | Used for adding a fadein/fadeout animation in the ViewPager transition.
Must be used with {@link android.support.v4.view.ViewPager#setPageTransformer(boolean, android.support.v4.view.ViewPager.PageTransformer)} | [
"Used",
"for",
"adding",
"a",
"fadein",
"/",
"fadeout",
"animation",
"in",
"the",
"ViewPager",
"transition",
".",
"Must",
"be",
"used",
"with",
"{"
] | train | https://github.com/omadahealth/CircularBarPager/blob/3a43e8828849da727fd13345e83b8432f7271155/library/src/main/java/com/github/omadahealth/circularbarpager/library/viewpager/FadeViewPagerTransformer.java#L40-L59 |
devcon5io/common | passwords/src/main/java/io/devcon5/password/Passwords.java | Passwords.validatePassword | public static boolean validatePassword(char[] password, String goodHash) throws NoSuchAlgorithmException, InvalidKeySpecException {
final String[] params = goodHash.split(":");
final int iterations = Integer.parseInt(params[ITERATION_INDEX]);
final byte[] salt = fromHex(params[SALT_INDEX]);
final byte[] hash = fromHex(params[PBKDF2_INDEX]);
// Compute the hash of the provided password, using the same salt,
// iteration count, and hash length
final byte[] testHash = pbkdf2(password, salt, iterations, hash.length);
// Compare the hashes in constant time. The password is correct if
// both hashes match.
return slowEquals(hash, testHash);
} | java | public static boolean validatePassword(char[] password, String goodHash) throws NoSuchAlgorithmException, InvalidKeySpecException {
final String[] params = goodHash.split(":");
final int iterations = Integer.parseInt(params[ITERATION_INDEX]);
final byte[] salt = fromHex(params[SALT_INDEX]);
final byte[] hash = fromHex(params[PBKDF2_INDEX]);
// Compute the hash of the provided password, using the same salt,
// iteration count, and hash length
final byte[] testHash = pbkdf2(password, salt, iterations, hash.length);
// Compare the hashes in constant time. The password is correct if
// both hashes match.
return slowEquals(hash, testHash);
} | [
"public",
"static",
"boolean",
"validatePassword",
"(",
"char",
"[",
"]",
"password",
",",
"String",
"goodHash",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
"{",
"final",
"String",
"[",
"]",
"params",
"=",
"goodHash",
".",
"split",
... | Validates a password using a hash.
@param password
the password to check
@param goodHash
the hash of the valid password
@return true if the password is correct, false if not | [
"Validates",
"a",
"password",
"using",
"a",
"hash",
"."
] | train | https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/passwords/src/main/java/io/devcon5/password/Passwords.java#L107-L119 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriQueryParam | public static void escapeUriQueryParam(final Reader reader, final Writer writer)
throws IOException {
escapeUriQueryParam(reader, writer, DEFAULT_ENCODING);
} | java | public static void escapeUriQueryParam(final Reader reader, final Writer writer)
throws IOException {
escapeUriQueryParam(reader, writer, DEFAULT_ENCODING);
} | [
"public",
"static",
"void",
"escapeUriQueryParam",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeUriQueryParam",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_ENCODING",
")",
";",
"}"
] | <p>
Perform am URI query parameter (name or value) <strong>escape</strong> operation
on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding,
writing results to a <tt>Writer</tt>.
</p>
<p>
The following are the only allowed chars in an URI query parameter (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ ' ( ) * , ;</tt></li>
<li><tt>: @</tt></li>
<li><tt>/ ?</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the <tt>UTF-8</tt> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"query",
"parameter",
"(",
"name",
"or",
"value",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"using",
"<tt",
">",
"UTF",
"-",
"8<",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L969-L972 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java | JsonSerializationContext.traceError | public JsonSerializationException traceError( Object value, String message, JsonWriter writer ) {
JsonSerializationException exception = traceError( value, message );
traceWriterInfo( value, writer );
return exception;
} | java | public JsonSerializationException traceError( Object value, String message, JsonWriter writer ) {
JsonSerializationException exception = traceError( value, message );
traceWriterInfo( value, writer );
return exception;
} | [
"public",
"JsonSerializationException",
"traceError",
"(",
"Object",
"value",
",",
"String",
"message",
",",
"JsonWriter",
"writer",
")",
"{",
"JsonSerializationException",
"exception",
"=",
"traceError",
"(",
"value",
",",
"message",
")",
";",
"traceWriterInfo",
"(... | Trace an error with current writer state and returns a corresponding exception.
@param value current value
@param message error message
@param writer current writer
@return a {@link JsonSerializationException} with the given message | [
"Trace",
"an",
"error",
"with",
"current",
"writer",
"state",
"and",
"returns",
"a",
"corresponding",
"exception",
"."
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java#L519-L523 |
structurizr/java | structurizr-core/src/com/structurizr/view/ViewSet.java | ViewSet.createDeploymentView | public DeploymentView createDeploymentView(String key, String description) {
assertThatTheViewKeyIsSpecifiedAndUnique(key);
DeploymentView view = new DeploymentView(model, key, description);
view.setViewSet(this);
deploymentViews.add(view);
return view;
} | java | public DeploymentView createDeploymentView(String key, String description) {
assertThatTheViewKeyIsSpecifiedAndUnique(key);
DeploymentView view = new DeploymentView(model, key, description);
view.setViewSet(this);
deploymentViews.add(view);
return view;
} | [
"public",
"DeploymentView",
"createDeploymentView",
"(",
"String",
"key",
",",
"String",
"description",
")",
"{",
"assertThatTheViewKeyIsSpecifiedAndUnique",
"(",
"key",
")",
";",
"DeploymentView",
"view",
"=",
"new",
"DeploymentView",
"(",
"model",
",",
"key",
",",... | Creates a deployment view.
@param key the key for the deployment view (must be unique)
@param description a description of the view
@return a DeploymentView object
@throws IllegalArgumentException if the key is not unique | [
"Creates",
"a",
"deployment",
"view",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L197-L204 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DatabaseSpec.java | DatabaseSpec.insertOnMongoTable | @Given("^I insert into MongoDB database '(.+?)' and collection '(.+?)' the document from schema '(.+?)'$")
public void insertOnMongoTable(String dataBase, String collection, String document) throws Exception {
String retrievedDoc = commonspec.retrieveData(document, "json");
commonspec.getMongoDBClient().connectToMongoDBDataBase(dataBase);
commonspec.getMongoDBClient().insertDocIntoMongoDBCollection(collection, retrievedDoc);
} | java | @Given("^I insert into MongoDB database '(.+?)' and collection '(.+?)' the document from schema '(.+?)'$")
public void insertOnMongoTable(String dataBase, String collection, String document) throws Exception {
String retrievedDoc = commonspec.retrieveData(document, "json");
commonspec.getMongoDBClient().connectToMongoDBDataBase(dataBase);
commonspec.getMongoDBClient().insertDocIntoMongoDBCollection(collection, retrievedDoc);
} | [
"@",
"Given",
"(",
"\"^I insert into MongoDB database '(.+?)' and collection '(.+?)' the document from schema '(.+?)'$\"",
")",
"public",
"void",
"insertOnMongoTable",
"(",
"String",
"dataBase",
",",
"String",
"collection",
",",
"String",
"document",
")",
"throws",
"Exception",... | Insert document in a MongoDB table.
@param dataBase Mongo database
@param collection Mongo collection
@param document document used for schema | [
"Insert",
"document",
"in",
"a",
"MongoDB",
"table",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L338-L343 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public View setTypeface(Context context, @LayoutRes int layoutRes, ViewGroup parent, @StringRes int strResId) {
return setTypeface(context, layoutRes, parent, mApplication.getString(strResId));
} | java | public View setTypeface(Context context, @LayoutRes int layoutRes, ViewGroup parent, @StringRes int strResId) {
return setTypeface(context, layoutRes, parent, mApplication.getString(strResId));
} | [
"public",
"View",
"setTypeface",
"(",
"Context",
"context",
",",
"@",
"LayoutRes",
"int",
"layoutRes",
",",
"ViewGroup",
"parent",
",",
"@",
"StringRes",
"int",
"strResId",
")",
"{",
"return",
"setTypeface",
"(",
"context",
",",
"layoutRes",
",",
"parent",
"... | Set the typeface to the all text views belong to the view group.
@param context the context.
@param layoutRes the layout resource id.
@param parent the parent view group to attach the layout.
@param strResId string resource containing typeface name.
@return the view. | [
"Set",
"the",
"typeface",
"to",
"the",
"all",
"text",
"views",
"belong",
"to",
"the",
"view",
"group",
"."
] | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L253-L255 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java | MimeMessageHelper.setTexts | static void setTexts(final Email email, final MimePart messagePart)
throws MessagingException {
if (email.getPlainText() != null) {
messagePart.setText(email.getPlainText(), CHARACTER_ENCODING);
}
if (email.getHTMLText() != null) {
messagePart.setContent(email.getHTMLText(), "text/html; charset=\"" + CHARACTER_ENCODING + "\"");
}
if (email.getCalendarText() != null && email.getCalendarMethod() != null) {
messagePart.setContent(email.getCalendarText(), "text/calendar; charset=\"" + CHARACTER_ENCODING + "\"; method=\"" + email.getCalendarMethod().toString() + "\"");
}
} | java | static void setTexts(final Email email, final MimePart messagePart)
throws MessagingException {
if (email.getPlainText() != null) {
messagePart.setText(email.getPlainText(), CHARACTER_ENCODING);
}
if (email.getHTMLText() != null) {
messagePart.setContent(email.getHTMLText(), "text/html; charset=\"" + CHARACTER_ENCODING + "\"");
}
if (email.getCalendarText() != null && email.getCalendarMethod() != null) {
messagePart.setContent(email.getCalendarText(), "text/calendar; charset=\"" + CHARACTER_ENCODING + "\"; method=\"" + email.getCalendarMethod().toString() + "\"");
}
} | [
"static",
"void",
"setTexts",
"(",
"final",
"Email",
"email",
",",
"final",
"MimePart",
"messagePart",
")",
"throws",
"MessagingException",
"{",
"if",
"(",
"email",
".",
"getPlainText",
"(",
")",
"!=",
"null",
")",
"{",
"messagePart",
".",
"setText",
"(",
... | Fills the {@link MimeBodyPart} instance with the content body content (text, html and calendar).
@param email The message in which the content is defined.
@param messagePart The {@link MimeBodyPart} that will contain the body content (either plain text, HTML text or iCalendar text)
@throws MessagingException See {@link BodyPart#setText(String)}, {@link BodyPart#setContent(Object, String)}. | [
"Fills",
"the",
"{",
"@link",
"MimeBodyPart",
"}",
"instance",
"with",
"the",
"content",
"body",
"content",
"(",
"text",
"html",
"and",
"calendar",
")",
"."
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java#L124-L135 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkSwitch | private Environment checkSwitch(Stmt.Switch stmt, Environment environment, EnclosingScope scope)
throws IOException {
// Type check the expression being switched upon
checkExpression(stmt.getCondition(), environment);
// The final environment determines what flow continues after the switch
// statement
Environment finalEnv = null;
// The record is whether a default case is given or not is important. If
// not, then final environment always matches initial environment.
boolean hasDefault = false;
//
for (Stmt.Case c : stmt.getCases()) {
// Resolve the constants
for (Expr e : c.getConditions()) {
checkExpression(e, environment);
}
// Check case block
Environment localEnv = environment;
localEnv = checkBlock(c.getBlock(), localEnv, scope);
// Merge resulting environment
if (finalEnv == null) {
finalEnv = localEnv;
} else {
finalEnv = FlowTypeUtils.union(finalEnv, localEnv);
}
// Keep track of whether a default
hasDefault |= (c.getConditions().size() == 0);
}
if (!hasDefault) {
// in this case, there is no default case in the switch. We must
// therefore assume that there are values which will fall right
// through the switch statement without hitting a case. Therefore,
// we must include the original environment to accound for this.
finalEnv = FlowTypeUtils.union(finalEnv, environment);
}
return finalEnv;
} | java | private Environment checkSwitch(Stmt.Switch stmt, Environment environment, EnclosingScope scope)
throws IOException {
// Type check the expression being switched upon
checkExpression(stmt.getCondition(), environment);
// The final environment determines what flow continues after the switch
// statement
Environment finalEnv = null;
// The record is whether a default case is given or not is important. If
// not, then final environment always matches initial environment.
boolean hasDefault = false;
//
for (Stmt.Case c : stmt.getCases()) {
// Resolve the constants
for (Expr e : c.getConditions()) {
checkExpression(e, environment);
}
// Check case block
Environment localEnv = environment;
localEnv = checkBlock(c.getBlock(), localEnv, scope);
// Merge resulting environment
if (finalEnv == null) {
finalEnv = localEnv;
} else {
finalEnv = FlowTypeUtils.union(finalEnv, localEnv);
}
// Keep track of whether a default
hasDefault |= (c.getConditions().size() == 0);
}
if (!hasDefault) {
// in this case, there is no default case in the switch. We must
// therefore assume that there are values which will fall right
// through the switch statement without hitting a case. Therefore,
// we must include the original environment to accound for this.
finalEnv = FlowTypeUtils.union(finalEnv, environment);
}
return finalEnv;
} | [
"private",
"Environment",
"checkSwitch",
"(",
"Stmt",
".",
"Switch",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"throws",
"IOException",
"{",
"// Type check the expression being switched upon",
"checkExpression",
"(",
"stmt",
".",
"g... | Type check a <code>switch</code> statement. This is similar, in some ways, to
the handling of if-statements except that we have n code blocks instead of
just two. Therefore, we check type information through each block, which
produces n potentially different environments and these are all joined
together to produce the environment which holds after this statement. For
example:
<pre>
// Environment
function f(int x) -> int|null:
int|null y
// {x : int, y : void}
switch x:
case 0:
// {x : int, y : void}
return 0
// { }
case 1,2,3:
// {x : int, y : void}
y = x
// {x : int, y : int}
default:
// {x : int, y : void}
y = null
// {x : int, y : null}
// --------------------------------------------------
// {} o
// {x : int, y : int} o
// {x : int, y : null}
// => {x : int, y : int|null}
return y
</pre>
Here, the environment after the declaration of <code>y</code> has its actual
type as <code>void</code> since no value has been assigned yet. For each of
the case blocks, this initial environment is (separately) updated to produce
three different environments. Finally, each of these is joined back together
to produce the environment going into the <code>return</code> statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"<code",
">",
"switch<",
"/",
"code",
">",
"statement",
".",
"This",
"is",
"similar",
"in",
"some",
"ways",
"to",
"the",
"handling",
"of",
"if",
"-",
"statements",
"except",
"that",
"we",
"have",
"n",
"code",
"blocks",
"instead",
... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L684-L722 |
tianjing/tgtools.web.develop | src/main/java/tgtools/web/develop/util/ValidHelper.java | ValidHelper.validDate | public static void validDate(Long pContent, String pParamName) throws APPErrorException {
if(null==pContent||pContent.longValue()<minDate)
{
throw new APPErrorException(pParamName + " 错误的时间值");
}
} | java | public static void validDate(Long pContent, String pParamName) throws APPErrorException {
if(null==pContent||pContent.longValue()<minDate)
{
throw new APPErrorException(pParamName + " 错误的时间值");
}
} | [
"public",
"static",
"void",
"validDate",
"(",
"Long",
"pContent",
",",
"String",
"pParamName",
")",
"throws",
"APPErrorException",
"{",
"if",
"(",
"null",
"==",
"pContent",
"||",
"pContent",
".",
"longValue",
"(",
")",
"<",
"minDate",
")",
"{",
"throw",
"n... | 验证日期格式 不能为空和必须正值最小值
@param pContent 文本
@param pParamName 参数名称
@throws APPErrorException | [
"验证日期格式",
"不能为空和必须正值最小值"
] | train | https://github.com/tianjing/tgtools.web.develop/blob/a18567f3ccf877249f2e33028d1e7c479900e4eb/src/main/java/tgtools/web/develop/util/ValidHelper.java#L48-L53 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/ops4j/pax/logging/service/internal/PaxLoggingServiceImpl.java | PaxLoggingServiceImpl.setJULLevel | private static void setJULLevel( java.util.logging.Logger logger, String log4jLevelConfig )
{
String crumb[] = log4jLevelConfig.split( "," );
if (crumb.length > 0)
{
Level level = log4jLevelToJULLevel( crumb[0].trim() );
logger.setLevel( level );
}
} | java | private static void setJULLevel( java.util.logging.Logger logger, String log4jLevelConfig )
{
String crumb[] = log4jLevelConfig.split( "," );
if (crumb.length > 0)
{
Level level = log4jLevelToJULLevel( crumb[0].trim() );
logger.setLevel( level );
}
} | [
"private",
"static",
"void",
"setJULLevel",
"(",
"java",
".",
"util",
".",
"logging",
".",
"Logger",
"logger",
",",
"String",
"log4jLevelConfig",
")",
"{",
"String",
"crumb",
"[",
"]",
"=",
"log4jLevelConfig",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
... | Set the log level to the specified JUL logger.
@param logger The logger to configure
@param log4jLevelConfig The value contained in the property file. (For example: "ERROR, file") | [
"Set",
"the",
"log",
"level",
"to",
"the",
"specified",
"JUL",
"logger",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/ops4j/pax/logging/service/internal/PaxLoggingServiceImpl.java#L483-L491 |
mailin-api/sendinblue-java-mvn | src/main/java/com/sendinblue/Sendinblue.java | Sendinblue.delete_users_list | public String delete_users_list(Map<String, Object> data) {
String id = data.get("id").toString();
Gson gson = new Gson();
String json = gson.toJson(data);
return delete("list/" + id + "/delusers", json);
} | java | public String delete_users_list(Map<String, Object> data) {
String id = data.get("id").toString();
Gson gson = new Gson();
String json = gson.toJson(data);
return delete("list/" + id + "/delusers", json);
} | [
"public",
"String",
"delete_users_list",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"String",
"id",
"=",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"toString",
"(",
")",
";",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";"... | /*
Delete already existing users in the SendinBlue contacts from the list.
@param {Object} data contains json objects as a key value pair from HashMap.
@options data {Integer} id: Id of list to unlink users from it [Mandatory]
@options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts to be modified. Example: "test@example.net". You can use commas to separate multiple users [Mandatory] | [
"/",
"*",
"Delete",
"already",
"existing",
"users",
"in",
"the",
"SendinBlue",
"contacts",
"from",
"the",
"list",
"."
] | train | https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L666-L671 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/ChatApi.java | ChatApi.consultByQueue | public ApiSuccessResponse consultByQueue(String id, ConsultData1 consultData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = consultByQueueWithHttpInfo(id, consultData);
return resp.getData();
} | java | public ApiSuccessResponse consultByQueue(String id, ConsultData1 consultData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = consultByQueueWithHttpInfo(id, consultData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"consultByQueue",
"(",
"String",
"id",
",",
"ConsultData1",
"consultData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"consultByQueueWithHttpInfo",
"(",
"id",
",",
"consultData",
")",... | Consult with another agent via a queue
Consult with another agent during a chat by sending an consult invitation to the specified queue. A consult occurs in the context of the specified chat, but the customer is not aware of the consulting agent. Messages and notifications from the consulting agent are only visible to other agents in the cat, not to the customer. After the consulting agent accepts the consultation, the originating agent can either transfer the chat to the consulting agent ([/media/{mediatype}/interactions/{id}/transfer-agent](/reference/workspace/Media/index.html#transferAgent)), add them in a conference ([/media/chat/interactions/{id}/invite](/reference/workspace/Media/index.html#invite)) or the consulting agent can leave the chat ([/media/chat/interactions/{id}/leave](/reference/workspace/Media/index.html#leaveChat)).
@param id The ID of the chat interaction. (required)
@param consultData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Consult",
"with",
"another",
"agent",
"via",
"a",
"queue",
"Consult",
"with",
"another",
"agent",
"during",
"a",
"chat",
"by",
"sending",
"an",
"consult",
"invitation",
"to",
"the",
"specified",
"queue",
".",
"A",
"consult",
"occurs",
"in",
"the",
"context"... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L795-L798 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/icon/provider/ConnectedIconsProvider.java | ConnectedIconsProvider.getConnections | private int getConnections(IBlockAccess world, BlockPos pos, EnumFacing facing)
{
Block block = world.getBlockState(pos).getBlock();
int connection = 0;
for (int i = 0; i < 4; i++)
{
if (world.getBlockState(pos.offset(sides[facing.getIndex()][i])).getBlock() == block)
connection |= (1 << i);
}
return ~connection & 15;
} | java | private int getConnections(IBlockAccess world, BlockPos pos, EnumFacing facing)
{
Block block = world.getBlockState(pos).getBlock();
int connection = 0;
for (int i = 0; i < 4; i++)
{
if (world.getBlockState(pos.offset(sides[facing.getIndex()][i])).getBlock() == block)
connection |= (1 << i);
}
return ~connection & 15;
} | [
"private",
"int",
"getConnections",
"(",
"IBlockAccess",
"world",
",",
"BlockPos",
"pos",
",",
"EnumFacing",
"facing",
")",
"{",
"Block",
"block",
"=",
"world",
".",
"getBlockState",
"(",
"pos",
")",
".",
"getBlock",
"(",
")",
";",
"int",
"connection",
"="... | Determines the connections available at this position for the specified <b>side</b>.
@param world the world
@param pos the pos
@param facing the facing
@return the connections | [
"Determines",
"the",
"connections",
"available",
"at",
"this",
"position",
"for",
"the",
"specified",
"<b",
">",
"side<",
"/",
"b",
">",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/icon/provider/ConnectedIconsProvider.java#L162-L172 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/config/ConfigParams.java | ConfigParams.addSection | public void addSection(String section, ConfigParams sectionParams) {
if (section == null)
throw new NullPointerException("Section name cannot be null");
if (sectionParams != null) {
for (Map.Entry<String, String> entry : sectionParams.entrySet()) {
String key = entry.getKey();
if (key.length() > 0 && section.length() > 0)
key = section + "." + key;
else if (key.length() == 0)
key = section;
String value = entry.getValue();
put(key, value);
}
}
} | java | public void addSection(String section, ConfigParams sectionParams) {
if (section == null)
throw new NullPointerException("Section name cannot be null");
if (sectionParams != null) {
for (Map.Entry<String, String> entry : sectionParams.entrySet()) {
String key = entry.getKey();
if (key.length() > 0 && section.length() > 0)
key = section + "." + key;
else if (key.length() == 0)
key = section;
String value = entry.getValue();
put(key, value);
}
}
} | [
"public",
"void",
"addSection",
"(",
"String",
"section",
",",
"ConfigParams",
"sectionParams",
")",
"{",
"if",
"(",
"section",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Section name cannot be null\"",
")",
";",
"if",
"(",
"sectionParams",... | Adds parameters into this ConfigParams under specified section. Keys for the
new parameters are appended with section dot prefix.
@param section name of the section where add new parameters
@param sectionParams new parameters to be added. | [
"Adds",
"parameters",
"into",
"this",
"ConfigParams",
"under",
"specified",
"section",
".",
"Keys",
"for",
"the",
"new",
"parameters",
"are",
"appended",
"with",
"section",
"dot",
"prefix",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/config/ConfigParams.java#L130-L148 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java | TiledMap.getObjectImage | public String getObjectImage(int groupID, int objectID) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
if (object == null) {
return null;
}
return object.image;
}
}
return null;
} | java | public String getObjectImage(int groupID, int objectID) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
if (object == null) {
return null;
}
return object.image;
}
}
return null;
} | [
"public",
"String",
"getObjectImage",
"(",
"int",
"groupID",
",",
"int",
"objectID",
")",
"{",
"if",
"(",
"groupID",
">=",
"0",
"&&",
"groupID",
"<",
"objectGroups",
".",
"size",
"(",
")",
")",
"{",
"ObjectGroup",
"grp",
"=",
"(",
"ObjectGroup",
")",
"... | Retrieve the image source property for a given object
@param groupID
Index of a group
@param objectID
Index of an object
@return The image source reference or null if one isn't defined | [
"Retrieve",
"the",
"image",
"source",
"property",
"for",
"a",
"given",
"object"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L926-L941 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/quality/AbstractKMeansQualityMeasure.java | AbstractKMeansQualityMeasure.logLikelihood | @Reference(authors = "D. Pelleg, A. Moore", //
title = "X-means: Extending K-means with Efficient Estimation on the Number of Clusters", //
booktitle = "Proc. 17th Int. Conf. on Machine Learning (ICML 2000)", //
url = "http://www.pelleg.org/shared/hp/download/xmeans.ps", //
bibkey = "DBLP:conf/icml/PellegM00")
public static <V extends NumberVector> double logLikelihood(Relation<V> relation, Clustering<? extends MeanModel> clustering, NumberVectorDistanceFunction<? super V> distanceFunction) {
List<? extends Cluster<? extends MeanModel>> clusters = clustering.getAllClusters();
// number of clusters
final int m = clusters.size();
// number of objects in the clustering
int n = 0;
// cluster sizes
int[] n_i = new int[m];
// total variance
double d = 0.;
// variances
double[] d_i = new double[m];
// Iterate over clusters:
Iterator<? extends Cluster<? extends MeanModel>> it = clusters.iterator();
for(int i = 0; it.hasNext(); ++i) {
Cluster<? extends MeanModel> cluster = it.next();
n += n_i[i] = cluster.size();
d += d_i[i] = varianceOfCluster(cluster, distanceFunction, relation);
}
// No remaining variance, if every point is on its own:
if(n <= m) {
return Double.NEGATIVE_INFINITY;
}
// Total variance (corrected for bias)
final double logv = FastMath.log(d / (n - m));
final int dim = RelationUtil.dimensionality(relation);
// log likelihood of this clustering
double logLikelihood = 0.;
// Aggregate
for(int i = 0; i < m; i++) {
logLikelihood += n_i[i] * FastMath.log(n_i[i]) // Post. entropy Rn log Rn
- n_i[i] * .5 * MathUtil.LOGTWOPI // Rn/2 log2pi
- n_i[i] * dim * .5 * logv // Rn M/2 log sigma^2
- (d_i[i] - m) * .5; // (Rn-K)/2
}
logLikelihood -= n * FastMath.log(n); // Prior entropy, sum_i Rn log R
return logLikelihood;
} | java | @Reference(authors = "D. Pelleg, A. Moore", //
title = "X-means: Extending K-means with Efficient Estimation on the Number of Clusters", //
booktitle = "Proc. 17th Int. Conf. on Machine Learning (ICML 2000)", //
url = "http://www.pelleg.org/shared/hp/download/xmeans.ps", //
bibkey = "DBLP:conf/icml/PellegM00")
public static <V extends NumberVector> double logLikelihood(Relation<V> relation, Clustering<? extends MeanModel> clustering, NumberVectorDistanceFunction<? super V> distanceFunction) {
List<? extends Cluster<? extends MeanModel>> clusters = clustering.getAllClusters();
// number of clusters
final int m = clusters.size();
// number of objects in the clustering
int n = 0;
// cluster sizes
int[] n_i = new int[m];
// total variance
double d = 0.;
// variances
double[] d_i = new double[m];
// Iterate over clusters:
Iterator<? extends Cluster<? extends MeanModel>> it = clusters.iterator();
for(int i = 0; it.hasNext(); ++i) {
Cluster<? extends MeanModel> cluster = it.next();
n += n_i[i] = cluster.size();
d += d_i[i] = varianceOfCluster(cluster, distanceFunction, relation);
}
// No remaining variance, if every point is on its own:
if(n <= m) {
return Double.NEGATIVE_INFINITY;
}
// Total variance (corrected for bias)
final double logv = FastMath.log(d / (n - m));
final int dim = RelationUtil.dimensionality(relation);
// log likelihood of this clustering
double logLikelihood = 0.;
// Aggregate
for(int i = 0; i < m; i++) {
logLikelihood += n_i[i] * FastMath.log(n_i[i]) // Post. entropy Rn log Rn
- n_i[i] * .5 * MathUtil.LOGTWOPI // Rn/2 log2pi
- n_i[i] * dim * .5 * logv // Rn M/2 log sigma^2
- (d_i[i] - m) * .5; // (Rn-K)/2
}
logLikelihood -= n * FastMath.log(n); // Prior entropy, sum_i Rn log R
return logLikelihood;
} | [
"@",
"Reference",
"(",
"authors",
"=",
"\"D. Pelleg, A. Moore\"",
",",
"//",
"title",
"=",
"\"X-means: Extending K-means with Efficient Estimation on the Number of Clusters\"",
",",
"//",
"booktitle",
"=",
"\"Proc. 17th Int. Conf. on Machine Learning (ICML 2000)\"",
",",
"//",
"u... | Computes log likelihood of an entire clustering.
<p>
Version as used in the X-means publication.
@param relation Data relation
@param clustering Clustering
@param distanceFunction Distance function
@param <V> Vector type
@return Log Likelihood. | [
"Computes",
"log",
"likelihood",
"of",
"an",
"entire",
"clustering",
".",
"<p",
">",
"Version",
"as",
"used",
"in",
"the",
"X",
"-",
"means",
"publication",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/quality/AbstractKMeansQualityMeasure.java#L124-L172 |
HeidelTime/heideltime | src/de/unihd/dbs/uima/annotator/heideltime/utilities/DateCalculator.java | DateCalculator.getXNextWeek | public static String getXNextWeek(String date, Integer x, Language language) {
NormalizationManager nm = NormalizationManager.getInstance(language, false);
String date_no_W = date.replace("W", "");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-w");
String newDate = "";
Calendar c = Calendar.getInstance();
try {
c.setTime(formatter.parse(date_no_W));
c.add(Calendar.WEEK_OF_YEAR, x);
c.getTime();
newDate = formatter.format(c.getTime());
newDate = newDate.substring(0,4)+"-W"+nm.getFromNormNumber(newDate.substring(5));
} catch (ParseException e) {
e.printStackTrace();
}
return newDate;
} | java | public static String getXNextWeek(String date, Integer x, Language language) {
NormalizationManager nm = NormalizationManager.getInstance(language, false);
String date_no_W = date.replace("W", "");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-w");
String newDate = "";
Calendar c = Calendar.getInstance();
try {
c.setTime(formatter.parse(date_no_W));
c.add(Calendar.WEEK_OF_YEAR, x);
c.getTime();
newDate = formatter.format(c.getTime());
newDate = newDate.substring(0,4)+"-W"+nm.getFromNormNumber(newDate.substring(5));
} catch (ParseException e) {
e.printStackTrace();
}
return newDate;
} | [
"public",
"static",
"String",
"getXNextWeek",
"(",
"String",
"date",
",",
"Integer",
"x",
",",
"Language",
"language",
")",
"{",
"NormalizationManager",
"nm",
"=",
"NormalizationManager",
".",
"getInstance",
"(",
"language",
",",
"false",
")",
";",
"String",
"... | get the x-next week of date
@param date current date
@param x amount of weeks to go forward
@return new week | [
"get",
"the",
"x",
"-",
"next",
"week",
"of",
"date"
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/utilities/DateCalculator.java#L213-L229 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.byID | public <T extends Entity> T byID(Class<T> clazz, AssetID id) {
return instance.getWrapperManager().create(clazz, id, true);
} | java | public <T extends Entity> T byID(Class<T> clazz, AssetID id) {
return instance.getWrapperManager().create(clazz, id, true);
} | [
"public",
"<",
"T",
"extends",
"Entity",
">",
"T",
"byID",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"AssetID",
"id",
")",
"{",
"return",
"instance",
".",
"getWrapperManager",
"(",
")",
".",
"create",
"(",
"clazz",
",",
"id",
",",
"true",
")",
";"... | Returns an Entity of Type T with the given ID or null if the ID is
invalid.
@param <T> Entity Type to retrieve.
@param clazz - T Class.
@param id ID of the Entity to retrieve.
@return an instance of an Entity of Type T or null if ID is invalid. | [
"Returns",
"an",
"Entity",
"of",
"Type",
"T",
"with",
"the",
"given",
"ID",
"or",
"null",
"if",
"the",
"ID",
"is",
"invalid",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L983-L985 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/PeriodFormatterBuilder.java | PeriodFormatterBuilder.appendSeparatorIfFieldsAfter | public PeriodFormatterBuilder appendSeparatorIfFieldsAfter(String text) {
return appendSeparator(text, text, null, false, true);
} | java | public PeriodFormatterBuilder appendSeparatorIfFieldsAfter(String text) {
return appendSeparator(text, text, null, false, true);
} | [
"public",
"PeriodFormatterBuilder",
"appendSeparatorIfFieldsAfter",
"(",
"String",
"text",
")",
"{",
"return",
"appendSeparator",
"(",
"text",
",",
"text",
",",
"null",
",",
"false",
",",
"true",
")",
";",
"}"
] | Append a separator, which is output only if fields are printed after the separator.
<p>
For example,
<code>builder.appendDays().appendSeparatorIfFieldsAfter(",").appendHours()</code>
will only output the comma if the hours fields is output.
<p>
The text will be parsed case-insensitively.
<p>
Note: appending a separator discontinues any further work on the latest
appended field.
@param text the text to use as a separator
@return this PeriodFormatterBuilder
@throws IllegalStateException if this separator follows a previous one | [
"Append",
"a",
"separator",
"which",
"is",
"output",
"only",
"if",
"fields",
"are",
"printed",
"after",
"the",
"separator",
".",
"<p",
">",
"For",
"example",
"<code",
">",
"builder",
".",
"appendDays",
"()",
".",
"appendSeparatorIfFieldsAfter",
"(",
")",
"."... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L747-L749 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(File sourceDir, OutputStream os, NameMapper mapper, int compressionLevel) {
log.debug("Compressing '{}' into a stream.", sourceDir);
if (!sourceDir.exists()) {
throw new ZipException("Given file '" + sourceDir + "' doesn't exist!");
}
ZipOutputStream out = null;
IOException error = null;
try {
out = new ZipOutputStream(new BufferedOutputStream(os));
out.setLevel(compressionLevel);
pack(sourceDir, out, mapper, "", true);
}
catch (IOException e) {
error = e;
}
finally {
if (out != null && error == null) {
try {
out.finish();
out.flush();
}
catch (IOException e) {
error = e;
}
}
}
if (error != null) {
throw ZipExceptionUtil.rethrow(error);
}
} | java | public static void pack(File sourceDir, OutputStream os, NameMapper mapper, int compressionLevel) {
log.debug("Compressing '{}' into a stream.", sourceDir);
if (!sourceDir.exists()) {
throw new ZipException("Given file '" + sourceDir + "' doesn't exist!");
}
ZipOutputStream out = null;
IOException error = null;
try {
out = new ZipOutputStream(new BufferedOutputStream(os));
out.setLevel(compressionLevel);
pack(sourceDir, out, mapper, "", true);
}
catch (IOException e) {
error = e;
}
finally {
if (out != null && error == null) {
try {
out.finish();
out.flush();
}
catch (IOException e) {
error = e;
}
}
}
if (error != null) {
throw ZipExceptionUtil.rethrow(error);
}
} | [
"public",
"static",
"void",
"pack",
"(",
"File",
"sourceDir",
",",
"OutputStream",
"os",
",",
"NameMapper",
"mapper",
",",
"int",
"compressionLevel",
")",
"{",
"log",
".",
"debug",
"(",
"\"Compressing '{}' into a stream.\"",
",",
"sourceDir",
")",
";",
"if",
"... | Compresses the given directory and all of its sub-directories into the passed in
stream. It is the responsibility of the caller to close the passed in
stream properly.
@param sourceDir
root directory.
@param os
output stream (will be buffered in this method).
@param mapper
call-back for renaming the entries.
@param compressionLevel
compression level
@since 1.10 | [
"Compresses",
"the",
"given",
"directory",
"and",
"all",
"of",
"its",
"sub",
"-",
"directories",
"into",
"the",
"passed",
"in",
"stream",
".",
"It",
"is",
"the",
"responsibility",
"of",
"the",
"caller",
"to",
"close",
"the",
"passed",
"in",
"stream",
"prop... | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1690-L1719 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getKeyAsync | public Observable<KeyBundle> getKeyAsync(String vaultBaseUrl, String keyName, String keyVersion) {
return getKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | java | public Observable<KeyBundle> getKeyAsync(String vaultBaseUrl, String keyName, String keyVersion) {
return getKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"KeyBundle",
">",
"getKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"String",
"keyVersion",
")",
"{",
"return",
"getKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
",",
"keyVersion",
")",
"... | Gets the public part of a stored key.
The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released in the response. This operation requires the keys/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key to get.
@param keyVersion Adding the version parameter retrieves a specific version of a key.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyBundle object | [
"Gets",
"the",
"public",
"part",
"of",
"a",
"stored",
"key",
".",
"The",
"get",
"key",
"operation",
"is",
"applicable",
"to",
"all",
"key",
"types",
".",
"If",
"the",
"requested",
"key",
"is",
"symmetric",
"then",
"no",
"key",
"material",
"is",
"released... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1414-L1421 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java | TagLibFactory.endElement | @Override
public void endElement(String uri, String name, String qName) {
setContent(content.toString().trim());
content = new StringBuffer();
inside = "";
/*
* if(tag!=null && tag.getName().equalsIgnoreCase("input")) {
* print.ln(tag.getName()+"-"+att.getName()+":"+inside+"-"+insideTag+"-"+insideAtt);
*
* }
*/
if (qName.equals("tag")) endTag();
else if (qName.equals("attribute")) endAtt();
else if (qName.equals("script")) endScript();
} | java | @Override
public void endElement(String uri, String name, String qName) {
setContent(content.toString().trim());
content = new StringBuffer();
inside = "";
/*
* if(tag!=null && tag.getName().equalsIgnoreCase("input")) {
* print.ln(tag.getName()+"-"+att.getName()+":"+inside+"-"+insideTag+"-"+insideAtt);
*
* }
*/
if (qName.equals("tag")) endTag();
else if (qName.equals("attribute")) endAtt();
else if (qName.equals("script")) endScript();
} | [
"@",
"Override",
"public",
"void",
"endElement",
"(",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"qName",
")",
"{",
"setContent",
"(",
"content",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
")",
";",
"content",
"=",
"new",
"StringBuff... | Geerbte Methode von org.xml.sax.ContentHandler, wird bei durchparsen des XML, beim auftreten
eines End-Tag aufgerufen.
@see org.xml.sax.ContentHandler#endElement(String, String, String) | [
"Geerbte",
"Methode",
"von",
"org",
".",
"xml",
".",
"sax",
".",
"ContentHandler",
"wird",
"bei",
"durchparsen",
"des",
"XML",
"beim",
"auftreten",
"eines",
"End",
"-",
"Tag",
"aufgerufen",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java#L209-L224 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/filters/FacebookAuthFilter.java | FacebookAuthFilter.attemptAuthentication | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws IOException {
final String requestURI = request.getRequestURI();
UserAuthentication userAuth = null;
if (requestURI.endsWith(FACEBOOK_ACTION)) {
String authCode = request.getParameter("code");
if (!StringUtils.isBlank(authCode)) {
String appid = SecurityUtils.getAppidFromAuthRequest(request);
String redirectURI = SecurityUtils.getRedirectUrl(request);
App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid));
String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.FB_PREFIX);
String url = Utils.formatMessage(TOKEN_URL, authCode, redirectURI, keys[0], keys[1]);
try {
HttpGet tokenPost = new HttpGet(url);
String accessToken = parseAccessToken(httpclient.execute(tokenPost));
if (accessToken != null) {
userAuth = getOrCreateUser(app, accessToken);
}
} catch (Exception e) {
logger.warn("Facebook auth request failed: GET " + url, e);
}
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true);
} | java | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws IOException {
final String requestURI = request.getRequestURI();
UserAuthentication userAuth = null;
if (requestURI.endsWith(FACEBOOK_ACTION)) {
String authCode = request.getParameter("code");
if (!StringUtils.isBlank(authCode)) {
String appid = SecurityUtils.getAppidFromAuthRequest(request);
String redirectURI = SecurityUtils.getRedirectUrl(request);
App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid));
String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.FB_PREFIX);
String url = Utils.formatMessage(TOKEN_URL, authCode, redirectURI, keys[0], keys[1]);
try {
HttpGet tokenPost = new HttpGet(url);
String accessToken = parseAccessToken(httpclient.execute(tokenPost));
if (accessToken != null) {
userAuth = getOrCreateUser(app, accessToken);
}
} catch (Exception e) {
logger.warn("Facebook auth request failed: GET " + url, e);
}
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true);
} | [
"@",
"Override",
"public",
"Authentication",
"attemptAuthentication",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"final",
"String",
"requestURI",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",... | Handles an authentication request.
@param request HTTP request
@param response HTTP response
@return an authentication object that contains the principal object if successful.
@throws IOException ex | [
"Handles",
"an",
"authentication",
"request",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/filters/FacebookAuthFilter.java#L92-L119 |
VoltDB/voltdb | src/frontend/org/voltdb/AbstractTopology.java | AbstractTopology.getTopology | public static AbstractTopology getTopology(Map<Integer, HostInfo> hostInfos, Set<Integer> missingHosts,
int kfactor, boolean restorePartition ) {
TopologyBuilder builder = addPartitionsToHosts(hostInfos, missingHosts, kfactor, 0);
AbstractTopology topo = new AbstractTopology(EMPTY_TOPOLOGY, builder);
if (restorePartition && hostInfos.size() == topo.getHostCount()) {
topo = mutateRestorePartitionsForRecovery(topo, hostInfos, missingHosts);
}
return topo;
} | java | public static AbstractTopology getTopology(Map<Integer, HostInfo> hostInfos, Set<Integer> missingHosts,
int kfactor, boolean restorePartition ) {
TopologyBuilder builder = addPartitionsToHosts(hostInfos, missingHosts, kfactor, 0);
AbstractTopology topo = new AbstractTopology(EMPTY_TOPOLOGY, builder);
if (restorePartition && hostInfos.size() == topo.getHostCount()) {
topo = mutateRestorePartitionsForRecovery(topo, hostInfos, missingHosts);
}
return topo;
} | [
"public",
"static",
"AbstractTopology",
"getTopology",
"(",
"Map",
"<",
"Integer",
",",
"HostInfo",
">",
"hostInfos",
",",
"Set",
"<",
"Integer",
">",
"missingHosts",
",",
"int",
"kfactor",
",",
"boolean",
"restorePartition",
")",
"{",
"TopologyBuilder",
"builde... | Create a new topology using {@code hosts}
@param hostInfos hosts to put in topology
@param missingHosts set of missing host IDs
@param kfactor for cluster
@return {@link AbstractTopology} for cluster
@throws RuntimeException if hosts are not valid for topology | [
"Create",
"a",
"new",
"topology",
"using",
"{",
"@code",
"hosts",
"}"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/AbstractTopology.java#L975-L983 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateTimeComparator.java | DateTimeComparator.getInstance | public static DateTimeComparator getInstance(DateTimeFieldType lowerLimit, DateTimeFieldType upperLimit) {
if (lowerLimit == null && upperLimit == null) {
return ALL_INSTANCE;
}
if (lowerLimit == DateTimeFieldType.dayOfYear() && upperLimit == null) {
return DATE_INSTANCE;
}
if (lowerLimit == null && upperLimit == DateTimeFieldType.dayOfYear()) {
return TIME_INSTANCE;
}
return new DateTimeComparator(lowerLimit, upperLimit);
} | java | public static DateTimeComparator getInstance(DateTimeFieldType lowerLimit, DateTimeFieldType upperLimit) {
if (lowerLimit == null && upperLimit == null) {
return ALL_INSTANCE;
}
if (lowerLimit == DateTimeFieldType.dayOfYear() && upperLimit == null) {
return DATE_INSTANCE;
}
if (lowerLimit == null && upperLimit == DateTimeFieldType.dayOfYear()) {
return TIME_INSTANCE;
}
return new DateTimeComparator(lowerLimit, upperLimit);
} | [
"public",
"static",
"DateTimeComparator",
"getInstance",
"(",
"DateTimeFieldType",
"lowerLimit",
",",
"DateTimeFieldType",
"upperLimit",
")",
"{",
"if",
"(",
"lowerLimit",
"==",
"null",
"&&",
"upperLimit",
"==",
"null",
")",
"{",
"return",
"ALL_INSTANCE",
";",
"}"... | Returns a DateTimeComparator with a lower and upper limit. Fields of a
magnitude less than the lower limit are excluded from comparisons.
Fields of a magnitude greater than or equal to the upper limit are also
excluded from comparisons. Either limit may be specified as null, which
indicates an unbounded limit.
<p>
The time-zone is considered when using this comparator unless both limits are null.
The input millis are rounded/truncated using the time-zone of that input value.
Thus, two inputs with different time-zones will typically not be equal
@param lowerLimit inclusive lower limit for fields to be compared, null means no limit
@param upperLimit exclusive upper limit for fields to be compared, null means no limit
@return a comparator over all fields between the limits | [
"Returns",
"a",
"DateTimeComparator",
"with",
"a",
"lower",
"and",
"upper",
"limit",
".",
"Fields",
"of",
"a",
"magnitude",
"less",
"than",
"the",
"lower",
"limit",
"are",
"excluded",
"from",
"comparisons",
".",
"Fields",
"of",
"a",
"magnitude",
"greater",
"... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeComparator.java#L105-L116 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.removeResourceFromProject | public void removeResourceFromProject(CmsDbContext dbc, CmsResource resource) throws CmsException {
// remove the resource to the project only if the resource is already in the project
if (isInsideCurrentProject(dbc, resource.getRootPath())) {
// check if there are already any subfolders of this resource
I_CmsProjectDriver projectDriver = getProjectDriver(dbc);
if (resource.isFolder()) {
List<String> projectResources = projectDriver.readProjectResources(dbc, dbc.currentProject());
for (int i = 0; i < projectResources.size(); i++) {
String resname = projectResources.get(i);
if (resname.startsWith(resource.getRootPath())) {
// delete the existing project resource first
projectDriver.deleteProjectResource(dbc, dbc.currentProject().getUuid(), resname);
}
}
}
try {
projectDriver.deleteProjectResource(dbc, dbc.currentProject().getUuid(), resource.getRootPath());
} catch (CmsException exc) {
// if the subfolder exists already - all is ok
} finally {
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROJECT_RESOURCES);
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_PROJECT_MODIFIED,
Collections.<String, Object> singletonMap("project", dbc.currentProject())));
}
}
} | java | public void removeResourceFromProject(CmsDbContext dbc, CmsResource resource) throws CmsException {
// remove the resource to the project only if the resource is already in the project
if (isInsideCurrentProject(dbc, resource.getRootPath())) {
// check if there are already any subfolders of this resource
I_CmsProjectDriver projectDriver = getProjectDriver(dbc);
if (resource.isFolder()) {
List<String> projectResources = projectDriver.readProjectResources(dbc, dbc.currentProject());
for (int i = 0; i < projectResources.size(); i++) {
String resname = projectResources.get(i);
if (resname.startsWith(resource.getRootPath())) {
// delete the existing project resource first
projectDriver.deleteProjectResource(dbc, dbc.currentProject().getUuid(), resname);
}
}
}
try {
projectDriver.deleteProjectResource(dbc, dbc.currentProject().getUuid(), resource.getRootPath());
} catch (CmsException exc) {
// if the subfolder exists already - all is ok
} finally {
m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROJECT_RESOURCES);
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_PROJECT_MODIFIED,
Collections.<String, Object> singletonMap("project", dbc.currentProject())));
}
}
} | [
"public",
"void",
"removeResourceFromProject",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"// remove the resource to the project only if the resource is already in the project",
"if",
"(",
"isInsideCurrentProject",
"(",
"dbc",
... | Removes a resource from the current project of the user.<p>
@param dbc the current database context
@param resource the resource to apply this operation to
@throws CmsException if something goes wrong
@see CmsObject#copyResourceToProject(String)
@see I_CmsResourceType#copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource) | [
"Removes",
"a",
"resource",
"from",
"the",
"current",
"project",
"of",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L8218-L8247 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/ResourceBundleTools.java | ResourceBundleTools.getMessageBundle | public static ResourceBundle getMessageBundle() {
try {
ResourceBundle bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE);
ResourceBundle fallbackBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH);
return new ResourceBundleWithFallback(bundle, fallbackBundle);
} catch (MissingResourceException e) {
return ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH);
}
} | java | public static ResourceBundle getMessageBundle() {
try {
ResourceBundle bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE);
ResourceBundle fallbackBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH);
return new ResourceBundleWithFallback(bundle, fallbackBundle);
} catch (MissingResourceException e) {
return ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH);
}
} | [
"public",
"static",
"ResourceBundle",
"getMessageBundle",
"(",
")",
"{",
"try",
"{",
"ResourceBundle",
"bundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"MESSAGE_BUNDLE",
")",
";",
"ResourceBundle",
"fallbackBundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(... | Gets the ResourceBundle (i18n strings) for the default language of the user's system. | [
"Gets",
"the",
"ResourceBundle",
"(",
"i18n",
"strings",
")",
"for",
"the",
"default",
"language",
"of",
"the",
"user",
"s",
"system",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/ResourceBundleTools.java#L39-L47 |
hal/core | gui/src/main/java/org/jboss/as/console/client/v3/stores/domain/ServerStore.java | ServerStore.deriveGroups | private SortedSet<ServerGroup> deriveGroups(List<HostInfo> hosts) {
serverGroups.clear();
for (HostInfo host : hosts) {
List<ServerInstance> serverInstances = host.getServerInstances();
for (ServerInstance server : serverInstances) {
String group = server.getGroup();
String profile = server.getProfile();
ServerGroup serverGroup = serverGroups.get(group);
if (serverGroup == null) {
serverGroup = new ServerGroup(group, profile);
serverGroup.fill(hosts);
serverGroups.put(group, serverGroup);
}
}
}
return new TreeSet<ServerGroup>(serverGroups.values());
} | java | private SortedSet<ServerGroup> deriveGroups(List<HostInfo> hosts) {
serverGroups.clear();
for (HostInfo host : hosts) {
List<ServerInstance> serverInstances = host.getServerInstances();
for (ServerInstance server : serverInstances) {
String group = server.getGroup();
String profile = server.getProfile();
ServerGroup serverGroup = serverGroups.get(group);
if (serverGroup == null) {
serverGroup = new ServerGroup(group, profile);
serverGroup.fill(hosts);
serverGroups.put(group, serverGroup);
}
}
}
return new TreeSet<ServerGroup>(serverGroups.values());
} | [
"private",
"SortedSet",
"<",
"ServerGroup",
">",
"deriveGroups",
"(",
"List",
"<",
"HostInfo",
">",
"hosts",
")",
"{",
"serverGroups",
".",
"clear",
"(",
")",
";",
"for",
"(",
"HostInfo",
"host",
":",
"hosts",
")",
"{",
"List",
"<",
"ServerInstance",
">"... | Builds {@link ServerGroup} instances and populates the map {@link #serverGroups} | [
"Builds",
"{"
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/stores/domain/ServerStore.java#L181-L197 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java | TrustedIdProvidersInner.listByAccountAsync | public Observable<Page<TrustedIdProviderInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<TrustedIdProviderInner>>, Page<TrustedIdProviderInner>>() {
@Override
public Page<TrustedIdProviderInner> call(ServiceResponse<Page<TrustedIdProviderInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<TrustedIdProviderInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<TrustedIdProviderInner>>, Page<TrustedIdProviderInner>>() {
@Override
public Page<TrustedIdProviderInner> call(ServiceResponse<Page<TrustedIdProviderInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"TrustedIdProviderInner",
">",
">",
"listByAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listByAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Lists the Data Lake Store trusted identity providers within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<TrustedIdProviderInner> object | [
"Lists",
"the",
"Data",
"Lake",
"Store",
"trusted",
"identity",
"providers",
"within",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/TrustedIdProvidersInner.java#L142-L150 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ConfigurationsInner.java | ConfigurationsInner.beginUpdateAsync | public Observable<Void> beginUpdateAsync(String resourceGroupName, String clusterName, String configurationName, Map<String, String> parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, configurationName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginUpdateAsync(String resourceGroupName, String clusterName, String configurationName, Map<String, String> parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, configurationName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"configurationName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"return",
"beginUpdateWithSer... | Configures the HTTP settings on the specified cluster. This API is deprecated, please use UpdateGatewaySettings in cluster endpoint instead.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param configurationName The name of the cluster configuration.
@param parameters The cluster configurations.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Configures",
"the",
"HTTP",
"settings",
"on",
"the",
"specified",
"cluster",
".",
"This",
"API",
"is",
"deprecated",
"please",
"use",
"UpdateGatewaySettings",
"in",
"cluster",
"endpoint",
"instead",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ConfigurationsInner.java#L285-L292 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/UserGroupPermissionEvaluator.java | UserGroupPermissionEvaluator.hasPermission | @Override
public boolean hasPermission(User user, E userGroup, Permission permission) {
// always grant READ access to groups in which the user itself is a member
if (user != null && permission.equals(Permission.READ)
&& userGroup.getMembers().contains(user)) {
LOG.trace("Granting READ access on group where the user is member.");
return true;
}
// call parent implementation
return super.hasPermission(user, userGroup, permission);
} | java | @Override
public boolean hasPermission(User user, E userGroup, Permission permission) {
// always grant READ access to groups in which the user itself is a member
if (user != null && permission.equals(Permission.READ)
&& userGroup.getMembers().contains(user)) {
LOG.trace("Granting READ access on group where the user is member.");
return true;
}
// call parent implementation
return super.hasPermission(user, userGroup, permission);
} | [
"@",
"Override",
"public",
"boolean",
"hasPermission",
"(",
"User",
"user",
",",
"E",
"userGroup",
",",
"Permission",
"permission",
")",
"{",
"// always grant READ access to groups in which the user itself is a member",
"if",
"(",
"user",
"!=",
"null",
"&&",
"permission... | Grants READ permission on groups where the user is a member.
Uses default implementation otherwise. | [
"Grants",
"READ",
"permission",
"on",
"groups",
"where",
"the",
"user",
"is",
"a",
"member",
".",
"Uses",
"default",
"implementation",
"otherwise",
"."
] | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/UserGroupPermissionEvaluator.java#L34-L46 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java | FactoryKernel.random2D_F32 | public static Kernel2D_F32 random2D_F32(int width , int offset, float min, float max, Random rand) {
Kernel2D_F32 ret = new Kernel2D_F32(width,offset);
float range = max - min;
for (int i = 0; i < ret.data.length; i++) {
ret.data[i] = rand.nextFloat() * range + min;
}
return ret;
} | java | public static Kernel2D_F32 random2D_F32(int width , int offset, float min, float max, Random rand) {
Kernel2D_F32 ret = new Kernel2D_F32(width,offset);
float range = max - min;
for (int i = 0; i < ret.data.length; i++) {
ret.data[i] = rand.nextFloat() * range + min;
}
return ret;
} | [
"public",
"static",
"Kernel2D_F32",
"random2D_F32",
"(",
"int",
"width",
",",
"int",
"offset",
",",
"float",
"min",
",",
"float",
"max",
",",
"Random",
"rand",
")",
"{",
"Kernel2D_F32",
"ret",
"=",
"new",
"Kernel2D_F32",
"(",
"width",
",",
"offset",
")",
... | Creates a random 2D kernel drawn from a uniform distribution.
@param width Kernel's width.
@param offset Offset for element zero in the kernel
@param min minimum value.
@param max maximum value.
@param rand Random number generator.
@return Randomized kernel. | [
"Creates",
"a",
"random",
"2D",
"kernel",
"drawn",
"from",
"a",
"uniform",
"distribution",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java#L298-L307 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java | FastAdapter.onBindViewHolder | @Override
@SuppressWarnings("unchecked")
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (mLegacyBindViewMode) {
if (mVerbose) {
Log.v(TAG, "onBindViewHolderLegacy: " + position + "/" + holder.getItemViewType() + " isLegacy: true");
}
//set the R.id.fastadapter_item_adapter tag to the adapter so we always have the proper bound adapter available
holder.itemView.setTag(R.id.fastadapter_item_adapter, this);
//now we bind the item to this viewHolder
mOnBindViewHolderListener.onBindViewHolder(holder, position, Collections.EMPTY_LIST);
}
} | java | @Override
@SuppressWarnings("unchecked")
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (mLegacyBindViewMode) {
if (mVerbose) {
Log.v(TAG, "onBindViewHolderLegacy: " + position + "/" + holder.getItemViewType() + " isLegacy: true");
}
//set the R.id.fastadapter_item_adapter tag to the adapter so we always have the proper bound adapter available
holder.itemView.setTag(R.id.fastadapter_item_adapter, this);
//now we bind the item to this viewHolder
mOnBindViewHolderListener.onBindViewHolder(holder, position, Collections.EMPTY_LIST);
}
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"onBindViewHolder",
"(",
"final",
"RecyclerView",
".",
"ViewHolder",
"holder",
",",
"int",
"position",
")",
"{",
"if",
"(",
"mLegacyBindViewMode",
")",
"{",
"if",
"(",
"mVer... | Binds the data to the created ViewHolder and sets the listeners to the holder.itemView
Note that you should use the `onBindViewHolder(RecyclerView.ViewHolder holder, int position, List payloads`
as it allows you to implement a more efficient adapter implementation
@param holder the viewHolder we bind the data on
@param position the global position | [
"Binds",
"the",
"data",
"to",
"the",
"created",
"ViewHolder",
"and",
"sets",
"the",
"listeners",
"to",
"the",
"holder",
".",
"itemView",
"Note",
"that",
"you",
"should",
"use",
"the",
"onBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"holder",
"int",... | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java#L712-L724 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.compareShifted | private int compareShifted(MutableBigInteger b, int ints) {
int blen = b.intLen;
int alen = intLen - ints;
if (alen < blen)
return -1;
if (alen > blen)
return 1;
// Add Integer.MIN_VALUE to make the comparison act as unsigned integer
// comparison.
int[] bval = b.value;
for (int i = offset, j = b.offset; i < alen + offset; i++, j++) {
int b1 = value[i] + 0x80000000;
int b2 = bval[j] + 0x80000000;
if (b1 < b2)
return -1;
if (b1 > b2)
return 1;
}
return 0;
} | java | private int compareShifted(MutableBigInteger b, int ints) {
int blen = b.intLen;
int alen = intLen - ints;
if (alen < blen)
return -1;
if (alen > blen)
return 1;
// Add Integer.MIN_VALUE to make the comparison act as unsigned integer
// comparison.
int[] bval = b.value;
for (int i = offset, j = b.offset; i < alen + offset; i++, j++) {
int b1 = value[i] + 0x80000000;
int b2 = bval[j] + 0x80000000;
if (b1 < b2)
return -1;
if (b1 > b2)
return 1;
}
return 0;
} | [
"private",
"int",
"compareShifted",
"(",
"MutableBigInteger",
"b",
",",
"int",
"ints",
")",
"{",
"int",
"blen",
"=",
"b",
".",
"intLen",
";",
"int",
"alen",
"=",
"intLen",
"-",
"ints",
";",
"if",
"(",
"alen",
"<",
"blen",
")",
"return",
"-",
"1",
"... | Returns a value equal to what {@code b.leftShift(32*ints); return compare(b);}
would return, but doesn't change the value of {@code b}. | [
"Returns",
"a",
"value",
"equal",
"to",
"what",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L284-L304 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.getAward | public GitlabAward getAward(GitlabMergeRequest mergeRequest, Integer awardId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/"
+ mergeRequest.getIid() + GitlabAward.URL + "/" + awardId;
return retrieve().to(tailUrl, GitlabAward.class);
} | java | public GitlabAward getAward(GitlabMergeRequest mergeRequest, Integer awardId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/"
+ mergeRequest.getIid() + GitlabAward.URL + "/" + awardId;
return retrieve().to(tailUrl, GitlabAward.class);
} | [
"public",
"GitlabAward",
"getAward",
"(",
"GitlabMergeRequest",
"mergeRequest",
",",
"Integer",
"awardId",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"URL",
"+",
"\"/\"",
"+",
"mergeRequest",
".",
"getProjectId",
"(",
")",
... | Get a specific award for a merge request
@param mergeRequest
@param awardId
@throws IOException on gitlab api call error | [
"Get",
"a",
"specific",
"award",
"for",
"a",
"merge",
"request"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3463-L3468 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java | BlobInfo.newBuilder | public static Builder newBuilder(String bucket, String name, Long generation) {
return newBuilder(BlobId.of(bucket, name, generation));
} | java | public static Builder newBuilder(String bucket, String name, Long generation) {
return newBuilder(BlobId.of(bucket, name, generation));
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"String",
"bucket",
",",
"String",
"name",
",",
"Long",
"generation",
")",
"{",
"return",
"newBuilder",
"(",
"BlobId",
".",
"of",
"(",
"bucket",
",",
"name",
",",
"generation",
")",
")",
";",
"}"
] | Returns a {@code BlobInfo} builder where blob identity is set using the provided values. | [
"Returns",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java#L1019-L1021 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java | Feature.setShortAttribute | public void setShortAttribute(String name, Short value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof ShortAttribute)) {
throw new IllegalStateException("Cannot set short value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((ShortAttribute) attribute).setValue(value);
} | java | public void setShortAttribute(String name, Short value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof ShortAttribute)) {
throw new IllegalStateException("Cannot set short value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((ShortAttribute) attribute).setValue(value);
} | [
"public",
"void",
"setShortAttribute",
"(",
"String",
"name",
",",
"Short",
"value",
")",
"{",
"Attribute",
"attribute",
"=",
"getAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"(",
"attribute",
"instanceof",
"ShortAttribute",
")... | Set attribute value of given type.
@param name attribute name
@param value attribute value | [
"Set",
"attribute",
"value",
"of",
"given",
"type",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L335-L342 |
VoltDB/voltdb | examples/voter/client/voter/JDBCBenchmark.java | JDBCBenchmark.runBenchmark | public void runBenchmark() throws Exception {
System.out.print(HORIZONTAL_RULE);
System.out.println(" Setup & Initialization");
System.out.println(HORIZONTAL_RULE);
// connect to one or more servers, loop until success
connect(config.servers);
// initialize using synchronous call
// Initialize the application
System.out.println("\nPopulating Static Tables\n");
final PreparedStatement initializeCS = client
.prepareCall("{call Initialize(?,?)}");
initializeCS.setInt(1, config.contestants);
initializeCS.setString(2, CONTESTANT_NAMES_CSV);
initializeCS.executeUpdate();
System.out.print(HORIZONTAL_RULE);
System.out.println(" Starting Benchmark");
System.out.println(HORIZONTAL_RULE);
// create/start the requested number of threads
Thread[] voterThreads = new Thread[config.threads];
for (int i = 0; i < config.threads; ++i) {
voterThreads[i] = new Thread(new VoterThread());
voterThreads[i].start();
}
// Run the benchmark loop for the requested warmup time
System.out.println("Warming up...");
Thread.sleep(1000l * config.warmup);
// signal to threads to end the warmup phase
warmupComplete.set(true);
// reset the stats after warmup
fullStatsContext.fetchAndResetBaseline();
periodicStatsContext.fetchAndResetBaseline();
// print periodic statistics to the console
benchmarkStartTS = System.currentTimeMillis();
schedulePeriodicStats();
// Run the benchmark loop for the requested warmup time
System.out.println("\nRunning benchmark...");
Thread.sleep(1000l * config.duration);
// stop the threads
benchmarkComplete.set(true);
// cancel periodic stats printing
timer.cancel();
// block until all outstanding txns return
// client.drain();
// join on the threads
for (Thread t : voterThreads) {
t.join();
}
// print the summary results
printResults();
// close down the client connections
client.close();
} | java | public void runBenchmark() throws Exception {
System.out.print(HORIZONTAL_RULE);
System.out.println(" Setup & Initialization");
System.out.println(HORIZONTAL_RULE);
// connect to one or more servers, loop until success
connect(config.servers);
// initialize using synchronous call
// Initialize the application
System.out.println("\nPopulating Static Tables\n");
final PreparedStatement initializeCS = client
.prepareCall("{call Initialize(?,?)}");
initializeCS.setInt(1, config.contestants);
initializeCS.setString(2, CONTESTANT_NAMES_CSV);
initializeCS.executeUpdate();
System.out.print(HORIZONTAL_RULE);
System.out.println(" Starting Benchmark");
System.out.println(HORIZONTAL_RULE);
// create/start the requested number of threads
Thread[] voterThreads = new Thread[config.threads];
for (int i = 0; i < config.threads; ++i) {
voterThreads[i] = new Thread(new VoterThread());
voterThreads[i].start();
}
// Run the benchmark loop for the requested warmup time
System.out.println("Warming up...");
Thread.sleep(1000l * config.warmup);
// signal to threads to end the warmup phase
warmupComplete.set(true);
// reset the stats after warmup
fullStatsContext.fetchAndResetBaseline();
periodicStatsContext.fetchAndResetBaseline();
// print periodic statistics to the console
benchmarkStartTS = System.currentTimeMillis();
schedulePeriodicStats();
// Run the benchmark loop for the requested warmup time
System.out.println("\nRunning benchmark...");
Thread.sleep(1000l * config.duration);
// stop the threads
benchmarkComplete.set(true);
// cancel periodic stats printing
timer.cancel();
// block until all outstanding txns return
// client.drain();
// join on the threads
for (Thread t : voterThreads) {
t.join();
}
// print the summary results
printResults();
// close down the client connections
client.close();
} | [
"public",
"void",
"runBenchmark",
"(",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"print",
"(",
"HORIZONTAL_RULE",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" Setup & Initialization\"",
")",
";",
"System",
".",
"out",
".",
"pr... | Core benchmark code. Connect. Initialize. Run the loop. Cleanup. Print
Results.
@throws Exception
if anything unexpected happens. | [
"Core",
"benchmark",
"code",
".",
"Connect",
".",
"Initialize",
".",
"Run",
"the",
"loop",
".",
"Cleanup",
".",
"Print",
"Results",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/voter/client/voter/JDBCBenchmark.java#L391-L457 |
lucee/Lucee | core/src/main/java/lucee/runtime/schedule/StorageUtil.java | StorageUtil.toCredentials | public Credentials toCredentials(Element el, String attributeUser, String attributePassword, Credentials defaultCredentials) {
String user = el.getAttribute(attributeUser);
String pass = el.getAttribute(attributePassword);
if (user == null) return defaultCredentials;
if (pass == null) pass = "";
return CredentialsImpl.toCredentials(user, pass);
} | java | public Credentials toCredentials(Element el, String attributeUser, String attributePassword, Credentials defaultCredentials) {
String user = el.getAttribute(attributeUser);
String pass = el.getAttribute(attributePassword);
if (user == null) return defaultCredentials;
if (pass == null) pass = "";
return CredentialsImpl.toCredentials(user, pass);
} | [
"public",
"Credentials",
"toCredentials",
"(",
"Element",
"el",
",",
"String",
"attributeUser",
",",
"String",
"attributePassword",
",",
"Credentials",
"defaultCredentials",
")",
"{",
"String",
"user",
"=",
"el",
".",
"getAttribute",
"(",
"attributeUser",
")",
";"... | reads 2 XML Element Attribute ans cast it to a Credential
@param el XML Element to read Attribute from it
@param attributeUser Name of the user Attribute to read
@param attributePassword Name of the password Attribute to read
@param defaultCredentials
@return Attribute Value | [
"reads",
"2",
"XML",
"Element",
"Attribute",
"ans",
"cast",
"it",
"to",
"a",
"Credential"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L342-L348 |
kaazing/java.client | amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java | AmqpClient.closeConnection | AmqpClient closeConnection(int replyCode, String replyText, int classId, int methodId1, Continuation callback, ErrorHandler error) {
Object[] args = {replyCode, replyText, classId, methodId1};
AmqpBuffer bodyArg = null;
String methodName = "closeConnection";
String methodId = "10" + "50";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg};
asyncClient.enqueueAction(methodName, "write", arguments, callback, error);
return this;
} | java | AmqpClient closeConnection(int replyCode, String replyText, int classId, int methodId1, Continuation callback, ErrorHandler error) {
Object[] args = {replyCode, replyText, classId, methodId1};
AmqpBuffer bodyArg = null;
String methodName = "closeConnection";
String methodId = "10" + "50";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg};
asyncClient.enqueueAction(methodName, "write", arguments, callback, error);
return this;
} | [
"AmqpClient",
"closeConnection",
"(",
"int",
"replyCode",
",",
"String",
"replyText",
",",
"int",
"classId",
",",
"int",
"methodId1",
",",
"Continuation",
"callback",
",",
"ErrorHandler",
"error",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
"{",
"replyCode",
... | Closes the Amqp Server connection.
@param replyCode
@param replyText
@param classId
@param methodId1
@param callback
@param error
@return AmqpClient | [
"Closes",
"the",
"Amqp",
"Server",
"connection",
"."
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java#L898-L908 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addNotLikeCondition | protected void addNotLikeCondition(final String propertyName, final String value) {
final Expression<String> propertyNameField = getRootPath().get(propertyName).as(String.class);
fieldConditions.add(getCriteriaBuilder().notLike(propertyNameField, "%" + cleanLikeCondition(value) + "%"));
} | java | protected void addNotLikeCondition(final String propertyName, final String value) {
final Expression<String> propertyNameField = getRootPath().get(propertyName).as(String.class);
fieldConditions.add(getCriteriaBuilder().notLike(propertyNameField, "%" + cleanLikeCondition(value) + "%"));
} | [
"protected",
"void",
"addNotLikeCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"value",
")",
"{",
"final",
"Expression",
"<",
"String",
">",
"propertyNameField",
"=",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
"... | Add a Field Search Condition that will search a field for values that aren't like a specified value using the following
SQL logic: {@code field NOT LIKE '%value%'}
@param propertyName The name of the field as defined in the Entity mapping class.
@param value The value to search against. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"search",
"a",
"field",
"for",
"values",
"that",
"aren",
"t",
"like",
"a",
"specified",
"value",
"using",
"the",
"following",
"SQL",
"logic",
":",
"{",
"@code",
"field",
"NOT",
"LIKE",
"%value%",
... | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L211-L214 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java | RedisClusterStorage.getTriggerState | @Override
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisCluster jedis) {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Map<RedisTriggerState, Double> scores = new HashMap<>(RedisTriggerState.values().length);
for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) {
scores.put(redisTriggerState, jedis.zscore(redisSchema.triggerStateKey(redisTriggerState), triggerHashKey));
}
for (Map.Entry<RedisTriggerState, Double> entry : scores.entrySet()) {
if (entry.getValue() != null) {
return entry.getKey().getTriggerState();
}
}
return Trigger.TriggerState.NONE;
} | java | @Override
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisCluster jedis) {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Map<RedisTriggerState, Double> scores = new HashMap<>(RedisTriggerState.values().length);
for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) {
scores.put(redisTriggerState, jedis.zscore(redisSchema.triggerStateKey(redisTriggerState), triggerHashKey));
}
for (Map.Entry<RedisTriggerState, Double> entry : scores.entrySet()) {
if (entry.getValue() != null) {
return entry.getKey().getTriggerState();
}
}
return Trigger.TriggerState.NONE;
} | [
"@",
"Override",
"public",
"Trigger",
".",
"TriggerState",
"getTriggerState",
"(",
"TriggerKey",
"triggerKey",
",",
"JedisCluster",
"jedis",
")",
"{",
"final",
"String",
"triggerHashKey",
"=",
"redisSchema",
".",
"triggerHashKey",
"(",
"triggerKey",
")",
";",
"Map... | Get the current state of the identified <code>{@link Trigger}</code>.
@param triggerKey the key of the desired trigger
@param jedis a thread-safe Redis connection
@return the state of the trigger | [
"Get",
"the",
"current",
"state",
"of",
"the",
"identified",
"<code",
">",
"{",
"@link",
"Trigger",
"}",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java#L399-L412 |
amzn/ion-java | src/com/amazon/ion/impl/IonUTF8.java | IonUTF8.getScalarReadLengthFromBytes | public final static int getScalarReadLengthFromBytes(byte[] bytes, int offset, int maxLength)
{
int src = offset;
int end = offset + maxLength;
if (src >= end) throw new ArrayIndexOutOfBoundsException();
int c = bytes[src++] & 0xff;
int utf8length = getUTF8LengthFromFirstByte(c);
if (src + utf8length > end) throw new ArrayIndexOutOfBoundsException();
return utf8length;
} | java | public final static int getScalarReadLengthFromBytes(byte[] bytes, int offset, int maxLength)
{
int src = offset;
int end = offset + maxLength;
if (src >= end) throw new ArrayIndexOutOfBoundsException();
int c = bytes[src++] & 0xff;
int utf8length = getUTF8LengthFromFirstByte(c);
if (src + utf8length > end) throw new ArrayIndexOutOfBoundsException();
return utf8length;
} | [
"public",
"final",
"static",
"int",
"getScalarReadLengthFromBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"maxLength",
")",
"{",
"int",
"src",
"=",
"offset",
";",
"int",
"end",
"=",
"offset",
"+",
"maxLength",
";",
"if",
"(",
... | this helper calculates the number of bytes it will consume from the
supplied byte array (bytes) if getScalarFromBytes is called with
the same parameters. This is in place of having getScalarFromBytes
return an object with the bytes consumed and the resultant scalar.
This will throw ArrayIndexOutOfBoundsException if there are fewer
bytes remaining (maxLength) than needed for a valid UTF8 sequence
starting at offset.
@param bytes UTF8 bytes in user supplied array
@param offset first array element to read from
@param maxLength maximum number of bytes to read from the array
@return number of bytes needed to decode the next scalar | [
"this",
"helper",
"calculates",
"the",
"number",
"of",
"bytes",
"it",
"will",
"consume",
"from",
"the",
"supplied",
"byte",
"array",
"(",
"bytes",
")",
"if",
"getScalarFromBytes",
"is",
"called",
"with",
"the",
"same",
"parameters",
".",
"This",
"is",
"in",
... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonUTF8.java#L319-L330 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java | JsonFactory.fromInputStream | public final <T> T fromInputStream(InputStream inputStream, Class<T> destinationClass)
throws IOException {
return createJsonParser(inputStream).parseAndClose(destinationClass);
} | java | public final <T> T fromInputStream(InputStream inputStream, Class<T> destinationClass)
throws IOException {
return createJsonParser(inputStream).parseAndClose(destinationClass);
} | [
"public",
"final",
"<",
"T",
">",
"T",
"fromInputStream",
"(",
"InputStream",
"inputStream",
",",
"Class",
"<",
"T",
">",
"destinationClass",
")",
"throws",
"IOException",
"{",
"return",
"createJsonParser",
"(",
"inputStream",
")",
".",
"parseAndClose",
"(",
"... | Parse and close an input stream as a JSON object, array, or value into a new instance of the
given destination class using {@link JsonParser#parseAndClose(Class)}.
<p>Tries to detect the charset of the input stream automatically.
@param inputStream JSON value in an input stream
@param destinationClass destination class that has an accessible default constructor to use to
create a new instance
@return new instance of the parsed destination class
@since 1.7 | [
"Parse",
"and",
"close",
"an",
"input",
"stream",
"as",
"a",
"JSON",
"object",
"array",
"or",
"value",
"into",
"a",
"new",
"instance",
"of",
"the",
"given",
"destination",
"class",
"using",
"{",
"@link",
"JsonParser#parseAndClose",
"(",
"Class",
")",
"}",
... | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java#L197-L200 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java | CommerceAddressRestrictionPersistenceImpl.fetchByC_C_C | @Override
public CommerceAddressRestriction fetchByC_C_C(long classNameId,
long classPK, long commerceCountryId) {
return fetchByC_C_C(classNameId, classPK, commerceCountryId, true);
} | java | @Override
public CommerceAddressRestriction fetchByC_C_C(long classNameId,
long classPK, long commerceCountryId) {
return fetchByC_C_C(classNameId, classPK, commerceCountryId, true);
} | [
"@",
"Override",
"public",
"CommerceAddressRestriction",
"fetchByC_C_C",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
",",
"long",
"commerceCountryId",
")",
"{",
"return",
"fetchByC_C_C",
"(",
"classNameId",
",",
"classPK",
",",
"commerceCountryId",
",",
"tru... | Returns the commerce address restriction where classNameId = ? and classPK = ? and commerceCountryId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param classNameId the class name ID
@param classPK the class pk
@param commerceCountryId the commerce country ID
@return the matching commerce address restriction, or <code>null</code> if a matching commerce address restriction could not be found | [
"Returns",
"the",
"commerce",
"address",
"restriction",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"and",
"commerceCountryId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java#L1247-L1251 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.cmp | public static boolean cmp(byte[] a, byte[] b) {
if(a.length != b.length) {
return false;
}
for(int i = 0; i < a.length; i++) {
if(a[i] != b[i]) {
return false;
}
}
return true;
} | java | public static boolean cmp(byte[] a, byte[] b) {
if(a.length != b.length) {
return false;
}
for(int i = 0; i < a.length; i++) {
if(a[i] != b[i]) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"cmp",
"(",
"byte",
"[",
"]",
"a",
",",
"byte",
"[",
"]",
"b",
")",
"{",
"if",
"(",
"a",
".",
"length",
"!=",
"b",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Compare two byte arrays
@param a byte array to compare
@param b byte array to compare
@return true if a and b have same length, and all the same values, false
otherwise | [
"Compare",
"two",
"byte",
"arrays"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L61-L71 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/tls/MariaDbX509TrustManager.java | MariaDbX509TrustManager.checkClientTrusted | @Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String string)
throws CertificateException {
if (trustManager == null) {
return;
}
trustManager.checkClientTrusted(x509Certificates, string);
} | java | @Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String string)
throws CertificateException {
if (trustManager == null) {
return;
}
trustManager.checkClientTrusted(x509Certificates, string);
} | [
"@",
"Override",
"public",
"void",
"checkClientTrusted",
"(",
"X509Certificate",
"[",
"]",
"x509Certificates",
",",
"String",
"string",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"trustManager",
"==",
"null",
")",
"{",
"return",
";",
"}",
"trustManag... | Check client trusted.
@param x509Certificates certificate
@param string string
@throws CertificateException exception | [
"Check",
"client",
"trusted",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/tls/MariaDbX509TrustManager.java#L203-L210 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java | FacebookSignatureUtil.verifySignature | public static boolean verifySignature(Map<String, CharSequence> params, String secret,
String expected) {
assert !(null == secret || "".equals(secret));
if (null == params || params.isEmpty() )
return false;
if (null == expected || "".equals(expected)) {
return false;
}
params.remove(FacebookParam.SIGNATURE.toString());
List<String> sigParams = convert(params.entrySet());
return verifySignature(sigParams, secret, expected);
} | java | public static boolean verifySignature(Map<String, CharSequence> params, String secret,
String expected) {
assert !(null == secret || "".equals(secret));
if (null == params || params.isEmpty() )
return false;
if (null == expected || "".equals(expected)) {
return false;
}
params.remove(FacebookParam.SIGNATURE.toString());
List<String> sigParams = convert(params.entrySet());
return verifySignature(sigParams, secret, expected);
} | [
"public",
"static",
"boolean",
"verifySignature",
"(",
"Map",
"<",
"String",
",",
"CharSequence",
">",
"params",
",",
"String",
"secret",
",",
"String",
"expected",
")",
"{",
"assert",
"!",
"(",
"null",
"==",
"secret",
"||",
"\"\"",
".",
"equals",
"(",
"... | Verifies that a signature received matches the expected value.
@param params a map of parameters and their values, such as one
obtained from extractFacebookNamespaceParams
@return a boolean indicating whether the calculated signature matched the
expected signature | [
"Verifies",
"that",
"a",
"signature",
"received",
"matches",
"the",
"expected",
"value",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java#L197-L208 |
wildfly/wildfly-maven-plugin | core/src/main/java/org/wildfly/plugin/core/Assertions.java | Assertions.requiresNotNullOrNotEmptyParameter | static String requiresNotNullOrNotEmptyParameter(final String name, final String value) throws IllegalArgumentException {
Assert.checkNotNullParam(name, value);
Assert.checkNotEmptyParam(name, value);
return value;
} | java | static String requiresNotNullOrNotEmptyParameter(final String name, final String value) throws IllegalArgumentException {
Assert.checkNotNullParam(name, value);
Assert.checkNotEmptyParam(name, value);
return value;
} | [
"static",
"String",
"requiresNotNullOrNotEmptyParameter",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"Assert",
".",
"checkNotNullParam",
"(",
"name",
",",
"value",
")",
";",
"Assert",
".",
"chec... | Checks if the parameter is {@code null} or empty and throws an {@link IllegalArgumentException} if it is.
@param name the name of the parameter
@param value the value to check
@return the parameter value
@throws IllegalArgumentException if the object representing the parameter is {@code null} | [
"Checks",
"if",
"the",
"parameter",
"is",
"{",
"@code",
"null",
"}",
"or",
"empty",
"and",
"throws",
"an",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"it",
"is",
"."
] | train | https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Assertions.java#L41-L45 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setLinearUpperLimits | public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setLinearUpperLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setLinearUpperLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the upper limits for the "moving" body translation relative to joint point.
@param limitX the X upper lower translation limit
@param limitY the Y upper lower translation limit
@param limitZ the Z upper lower translation limit | [
"Sets",
"the",
"upper",
"limits",
"for",
"the",
"moving",
"body",
"translation",
"relative",
"to",
"joint",
"point",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L85-L87 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.getPermissions | public CmsPermissionSet getPermissions(String resourceName, String userName) throws CmsException {
// reading permissions is allowed even if the resource is marked as deleted
CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
CmsUser user = readUser(userName);
return m_securityManager.getPermissions(m_context, resource, user);
} | java | public CmsPermissionSet getPermissions(String resourceName, String userName) throws CmsException {
// reading permissions is allowed even if the resource is marked as deleted
CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
CmsUser user = readUser(userName);
return m_securityManager.getPermissions(m_context, resource, user);
} | [
"public",
"CmsPermissionSet",
"getPermissions",
"(",
"String",
"resourceName",
",",
"String",
"userName",
")",
"throws",
"CmsException",
"{",
"// reading permissions is allowed even if the resource is marked as deleted",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"res... | Returns the set of permissions of a given user for a given resource.<p>
@param resourceName the name of the resource
@param userName the name of the user
@return the current permissions on this resource
@throws CmsException if something goes wrong | [
"Returns",
"the",
"set",
"of",
"permissions",
"of",
"a",
"given",
"user",
"for",
"a",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1677-L1683 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java | ServerInstanceLogRecordListImpl.getNewIterator | protected Iterator<RepositoryLogRecord> getNewIterator(int offset, int length) {
OnePidRecordListImpl logResult = getLogResult();
OnePidRecordListImpl traceResult = getTraceResult();
if (logResult == null && traceResult == null) {
return EMPTY_ITERATOR;
} else if (traceResult == null) {
return logResult.getNewIterator(offset, length);
} else if (logResult == null) {
return traceResult.getNewIterator(offset, length);
} else {
MergedServerInstanceLogRecordIterator result = new MergedServerInstanceLogRecordIterator(logResult, traceResult);
result.setRange(offset, length);
return result;
}
} | java | protected Iterator<RepositoryLogRecord> getNewIterator(int offset, int length) {
OnePidRecordListImpl logResult = getLogResult();
OnePidRecordListImpl traceResult = getTraceResult();
if (logResult == null && traceResult == null) {
return EMPTY_ITERATOR;
} else if (traceResult == null) {
return logResult.getNewIterator(offset, length);
} else if (logResult == null) {
return traceResult.getNewIterator(offset, length);
} else {
MergedServerInstanceLogRecordIterator result = new MergedServerInstanceLogRecordIterator(logResult, traceResult);
result.setRange(offset, length);
return result;
}
} | [
"protected",
"Iterator",
"<",
"RepositoryLogRecord",
">",
"getNewIterator",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"OnePidRecordListImpl",
"logResult",
"=",
"getLogResult",
"(",
")",
";",
"OnePidRecordListImpl",
"traceResult",
"=",
"getTraceResult",
"... | Creates new OnePidRecordIterator returning records in the range.
@param offset the number of records skipped from the beginning of the list.
@param length the number of records to return.
@return OnePidRecordIterator instance. | [
"Creates",
"new",
"OnePidRecordIterator",
"returning",
"records",
"in",
"the",
"range",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/ServerInstanceLogRecordListImpl.java#L221-L235 |
realexpayments/rxp-hpp-java | src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java | RealexHpp.responseFromJson | public HppResponse responseFromJson(String json, boolean encoded) {
LOGGER.info("Converting JSON to HppResponse.");
//convert to HppResponse from JSON
HppResponse hppResponse = JsonUtils.fromJsonHppResponse(json);
//decode if necessary
if (encoded) {
LOGGER.debug("Decoding object.");
try {
hppResponse = hppResponse.decode(ENCODING_CHARSET);
} catch (UnsupportedEncodingException ex) {
LOGGER.error("Exception decoding HPP response.", ex);
throw new RealexException("Exception decoding HPP response.", ex);
}
}
//validate HPP response hash
LOGGER.debug("Validating response hash.");
ValidationUtils.validate(hppResponse, secret);
return hppResponse;
} | java | public HppResponse responseFromJson(String json, boolean encoded) {
LOGGER.info("Converting JSON to HppResponse.");
//convert to HppResponse from JSON
HppResponse hppResponse = JsonUtils.fromJsonHppResponse(json);
//decode if necessary
if (encoded) {
LOGGER.debug("Decoding object.");
try {
hppResponse = hppResponse.decode(ENCODING_CHARSET);
} catch (UnsupportedEncodingException ex) {
LOGGER.error("Exception decoding HPP response.", ex);
throw new RealexException("Exception decoding HPP response.", ex);
}
}
//validate HPP response hash
LOGGER.debug("Validating response hash.");
ValidationUtils.validate(hppResponse, secret);
return hppResponse;
} | [
"public",
"HppResponse",
"responseFromJson",
"(",
"String",
"json",
",",
"boolean",
"encoded",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Converting JSON to HppResponse.\"",
")",
";",
"//convert to HppResponse from JSON",
"HppResponse",
"hppResponse",
"=",
"JsonUtils",
".... | <p>
Method produces <code>HppResponse</code> object from JSON.
Carries out the following actions:
<ul>
<li>Deserialises JSON to response object</li>
<li>Decodes Base64 inputs</li>
<li>Validates hash</li>
</ul>
</p>
@param json
@param encoded <code>true</code> if the JSON values have been encoded.
@return HppRequest | [
"<p",
">",
"Method",
"produces",
"<code",
">",
"HppResponse<",
"/",
"code",
">",
"object",
"from",
"JSON",
".",
"Carries",
"out",
"the",
"following",
"actions",
":",
"<ul",
">",
"<li",
">",
"Deserialises",
"JSON",
"to",
"response",
"object<",
"/",
"li",
... | train | https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java#L263-L286 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/MonitorService.java | MonitorService.list | public Collection<Monitor> list(String name, String type)
{
return list(name, type, 0, -1);
} | java | public Collection<Monitor> list(String name, String type)
{
return list(name, type, 0, -1);
} | [
"public",
"Collection",
"<",
"Monitor",
">",
"list",
"(",
"String",
"name",
",",
"String",
"type",
")",
"{",
"return",
"list",
"(",
"name",
",",
"type",
",",
"0",
",",
"-",
"1",
")",
";",
"}"
] | Returns the set of monitors with the given type and where the name contains the given (partial) name.
<P> Defaults to page size of 20 monitors with 0 offset.
@param name The name of the monitors to return. Can be a partial name. A null value returns all monitors.
@param type The type of the monitors to return. A null value returns all monitors.
@return The set of monitors | [
"Returns",
"the",
"set",
"of",
"monitors",
"with",
"the",
"given",
"type",
"and",
"where",
"the",
"name",
"contains",
"the",
"given",
"(",
"partial",
")",
"name",
".",
"<P",
">",
"Defaults",
"to",
"page",
"size",
"of",
"20",
"monitors",
"with",
"0",
"o... | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/MonitorService.java#L108-L111 |
yidongnan/grpc-spring-boot-starter | grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/autoconfigure/GrpcServerFactoryAutoConfiguration.java | GrpcServerFactoryAutoConfiguration.nettyGrpcServerFactory | @ConditionalOnMissingBean
@ConditionalOnClass(name = {"io.netty.channel.Channel", "io.grpc.netty.NettyServerBuilder"})
@Bean
public NettyGrpcServerFactory nettyGrpcServerFactory(final GrpcServerProperties properties,
final GrpcServiceDiscoverer serviceDiscoverer, final List<GrpcServerConfigurer> serverConfigurers) {
final NettyGrpcServerFactory factory = new NettyGrpcServerFactory(properties, serverConfigurers);
for (final GrpcServiceDefinition service : serviceDiscoverer.findGrpcServices()) {
factory.addService(service);
}
return factory;
} | java | @ConditionalOnMissingBean
@ConditionalOnClass(name = {"io.netty.channel.Channel", "io.grpc.netty.NettyServerBuilder"})
@Bean
public NettyGrpcServerFactory nettyGrpcServerFactory(final GrpcServerProperties properties,
final GrpcServiceDiscoverer serviceDiscoverer, final List<GrpcServerConfigurer> serverConfigurers) {
final NettyGrpcServerFactory factory = new NettyGrpcServerFactory(properties, serverConfigurers);
for (final GrpcServiceDefinition service : serviceDiscoverer.findGrpcServices()) {
factory.addService(service);
}
return factory;
} | [
"@",
"ConditionalOnMissingBean",
"@",
"ConditionalOnClass",
"(",
"name",
"=",
"{",
"\"io.netty.channel.Channel\"",
",",
"\"io.grpc.netty.NettyServerBuilder\"",
"}",
")",
"@",
"Bean",
"public",
"NettyGrpcServerFactory",
"nettyGrpcServerFactory",
"(",
"final",
"GrpcServerProper... | Creates a GrpcServerFactory using the non-shaded netty. This is the fallback, if the shaded one is not present.
@param properties The properties used to configure the server.
@param serviceDiscoverer The discoverer used to identify the services that should be served.
@param serverConfigurers The server configurers that contain additional configuration for the server.
@return The shadedNettyGrpcServerFactory bean. | [
"Creates",
"a",
"GrpcServerFactory",
"using",
"the",
"non",
"-",
"shaded",
"netty",
".",
"This",
"is",
"the",
"fallback",
"if",
"the",
"shaded",
"one",
"is",
"not",
"present",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/autoconfigure/GrpcServerFactoryAutoConfiguration.java#L94-L104 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java | BaseNeo4jDialect.isPartOfRegularEmbedded | public static boolean isPartOfRegularEmbedded(String[] keyColumnNames, String column) {
return isPartOfEmbedded( column ) && !ArrayHelper.contains( keyColumnNames, column );
} | java | public static boolean isPartOfRegularEmbedded(String[] keyColumnNames, String column) {
return isPartOfEmbedded( column ) && !ArrayHelper.contains( keyColumnNames, column );
} | [
"public",
"static",
"boolean",
"isPartOfRegularEmbedded",
"(",
"String",
"[",
"]",
"keyColumnNames",
",",
"String",
"column",
")",
"{",
"return",
"isPartOfEmbedded",
"(",
"column",
")",
"&&",
"!",
"ArrayHelper",
".",
"contains",
"(",
"keyColumnNames",
",",
"colu... | A regular embedded is an element that it is embedded but it is not a key or a collection.
@param keyColumnNames the column names representing the identifier of the entity
@param column the column we want to check
@return {@code true} if the column represent an attribute of a regular embedded element, {@code false} otherwise | [
"A",
"regular",
"embedded",
"is",
"an",
"element",
"that",
"it",
"is",
"embedded",
"but",
"it",
"is",
"not",
"a",
"key",
"or",
"a",
"collection",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java#L219-L221 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java | PojoComparator.accessField | public final Object accessField(Field field, Object object) {
try {
object = field.get(object);
} catch (NullPointerException npex) {
throw new NullKeyFieldException("Unable to access field "+field+" on object "+object);
} catch (IllegalAccessException iaex) {
throw new RuntimeException("This should not happen since we call setAccesssible(true) in PojoTypeInfo."
+ " fields: " + field + " obj: " + object);
}
return object;
} | java | public final Object accessField(Field field, Object object) {
try {
object = field.get(object);
} catch (NullPointerException npex) {
throw new NullKeyFieldException("Unable to access field "+field+" on object "+object);
} catch (IllegalAccessException iaex) {
throw new RuntimeException("This should not happen since we call setAccesssible(true) in PojoTypeInfo."
+ " fields: " + field + " obj: " + object);
}
return object;
} | [
"public",
"final",
"Object",
"accessField",
"(",
"Field",
"field",
",",
"Object",
"object",
")",
"{",
"try",
"{",
"object",
"=",
"field",
".",
"get",
"(",
"object",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"npex",
")",
"{",
"throw",
"new",
... | This method is handling the IllegalAccess exceptions of Field.get() | [
"This",
"method",
"is",
"handling",
"the",
"IllegalAccess",
"exceptions",
"of",
"Field",
".",
"get",
"()"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoComparator.java#L177-L187 |
Coveros/selenified | src/main/java/com/coveros/selenified/Selenified.java | Selenified.getAdditionalDesiredCapabilities | private static DesiredCapabilities getAdditionalDesiredCapabilities(String clazz, ITestContext context) {
return (DesiredCapabilities) context.getAttribute(clazz + DESIRED_CAPABILITIES);
} | java | private static DesiredCapabilities getAdditionalDesiredCapabilities(String clazz, ITestContext context) {
return (DesiredCapabilities) context.getAttribute(clazz + DESIRED_CAPABILITIES);
} | [
"private",
"static",
"DesiredCapabilities",
"getAdditionalDesiredCapabilities",
"(",
"String",
"clazz",
",",
"ITestContext",
"context",
")",
"{",
"return",
"(",
"DesiredCapabilities",
")",
"context",
".",
"getAttribute",
"(",
"clazz",
"+",
"DESIRED_CAPABILITIES",
")",
... | Retrieves the additional desired capabilities set by the current class for the browsers
@param clazz - the test suite class, used for making threadsafe storage of
application, allowing suites to have independent applications
under test, run at the same time
@param context - the TestNG context associated with the test suite, used for
storing app url information
@return DesiredCapabilities | [
"Retrieves",
"the",
"additional",
"desired",
"capabilities",
"set",
"by",
"the",
"current",
"class",
"for",
"the",
"browsers"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L228-L230 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/doc/DocClient.java | DocClient.createDocument | public CreateDocumentResponse createDocument(File file, String title) {
CreateDocumentRequest request = new CreateDocumentRequest();
String format;
String filename = file.getName();
if (filename.lastIndexOf(".") == -1) {
throw new BceClientException("Cannot get file format from file name:" + filename);
}
format = filename.substring(filename.lastIndexOf(".") + 1);
request.setFile(file);
request.setTitle(title);
request.setFormat(format);
return this.createDocument(request);
} | java | public CreateDocumentResponse createDocument(File file, String title) {
CreateDocumentRequest request = new CreateDocumentRequest();
String format;
String filename = file.getName();
if (filename.lastIndexOf(".") == -1) {
throw new BceClientException("Cannot get file format from file name:" + filename);
}
format = filename.substring(filename.lastIndexOf(".") + 1);
request.setFile(file);
request.setTitle(title);
request.setFormat(format);
return this.createDocument(request);
} | [
"public",
"CreateDocumentResponse",
"createDocument",
"(",
"File",
"file",
",",
"String",
"title",
")",
"{",
"CreateDocumentRequest",
"request",
"=",
"new",
"CreateDocumentRequest",
"(",
")",
";",
"String",
"format",
";",
"String",
"filename",
"=",
"file",
".",
... | Create a Document.
@param file The document .
@param title The document title.
@return A CreateDocumentResponse object containing the information returned by Document. | [
"Create",
"a",
"Document",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L159-L171 |
structr/structr | structr-ui/src/main/java/org/structr/files/cmis/CMISAclService.java | CMISAclService.applyAcl | public Acl applyAcl(final String repositoryId, final String objectId, final Acl acl, final AclPropagation aclPropagation) {
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractNode node = app.get(AbstractNode.class, objectId);
if (node != null) {
node.revokeAll();
// process add ACL entries
for (final Ace toAdd : acl.getAces()) {
applyAce(node, toAdd, false);
}
tx.success();
// return the wrapper which implements the Acl interface
return CMISObjectWrapper.wrap(node, null, false);
}
} catch (FrameworkException fex) {
logger.warn("", fex);
}
throw new CmisObjectNotFoundException("Object with ID " + objectId + " does not exist");
} | java | public Acl applyAcl(final String repositoryId, final String objectId, final Acl acl, final AclPropagation aclPropagation) {
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractNode node = app.get(AbstractNode.class, objectId);
if (node != null) {
node.revokeAll();
// process add ACL entries
for (final Ace toAdd : acl.getAces()) {
applyAce(node, toAdd, false);
}
tx.success();
// return the wrapper which implements the Acl interface
return CMISObjectWrapper.wrap(node, null, false);
}
} catch (FrameworkException fex) {
logger.warn("", fex);
}
throw new CmisObjectNotFoundException("Object with ID " + objectId + " does not exist");
} | [
"public",
"Acl",
"applyAcl",
"(",
"final",
"String",
"repositoryId",
",",
"final",
"String",
"objectId",
",",
"final",
"Acl",
"acl",
",",
"final",
"AclPropagation",
"aclPropagation",
")",
"{",
"final",
"App",
"app",
"=",
"StructrApp",
".",
"getInstance",
"(",
... | Applies the given Acl exclusively, i.e. removes all other permissions / grants first.
@param repositoryId
@param objectId
@param acl
@param aclPropagation
@return the resulting Acl | [
"Applies",
"the",
"given",
"Acl",
"exclusively",
"i",
".",
"e",
".",
"removes",
"all",
"other",
"permissions",
"/",
"grants",
"first",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/files/cmis/CMISAclService.java#L88-L115 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java | PathManagerService.addHardcodedAbsolutePath | protected final ServiceController<?> addHardcodedAbsolutePath(final ServiceTarget serviceTarget, final String pathName, final String path) {
ServiceController<?> controller = addAbsolutePathService(serviceTarget, pathName, path);
addPathEntry(pathName, path, null, true);
if (capabilityRegistry != null) {
RuntimeCapability<Void> pathCapability = PATH_CAPABILITY.fromBaseCapability(pathName);
capabilityRegistry.registerCapability(
new RuntimeCapabilityRegistration(pathCapability, CapabilityScope.GLOBAL, new RegistrationPoint(PathAddress.EMPTY_ADDRESS, null)));
}
return controller;
} | java | protected final ServiceController<?> addHardcodedAbsolutePath(final ServiceTarget serviceTarget, final String pathName, final String path) {
ServiceController<?> controller = addAbsolutePathService(serviceTarget, pathName, path);
addPathEntry(pathName, path, null, true);
if (capabilityRegistry != null) {
RuntimeCapability<Void> pathCapability = PATH_CAPABILITY.fromBaseCapability(pathName);
capabilityRegistry.registerCapability(
new RuntimeCapabilityRegistration(pathCapability, CapabilityScope.GLOBAL, new RegistrationPoint(PathAddress.EMPTY_ADDRESS, null)));
}
return controller;
} | [
"protected",
"final",
"ServiceController",
"<",
"?",
">",
"addHardcodedAbsolutePath",
"(",
"final",
"ServiceTarget",
"serviceTarget",
",",
"final",
"String",
"pathName",
",",
"final",
"String",
"path",
")",
"{",
"ServiceController",
"<",
"?",
">",
"controller",
"=... | Add a {@code PathEntry} and install a {@code Service<String>} for one of the standard read-only paths
that are determined from this process' environment. Not to be used for paths stored in the persistent
configuration.
@param serviceTarget service target to use for the service installation
@param pathName the logical name of the path within the model. Cannot be {@code null}
@param path the value of the path within the model. This is an absolute path. Cannot be {@code null}
@return the controller for the installed {@code Service<String>} | [
"Add",
"a",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java#L159-L168 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlPkStatement.java | SqlPkStatement.appendWhereClause | protected void appendWhereClause(FieldDescriptor[] fields, StringBuffer stmt) throws PersistenceBrokerException
{
stmt.append(" WHERE ");
for(int i = 0; i < fields.length; i++)
{
FieldDescriptor fmd = fields[i];
stmt.append(fmd.getColumnName());
stmt.append(" = ? ");
if(i < fields.length - 1)
{
stmt.append(" AND ");
}
}
} | java | protected void appendWhereClause(FieldDescriptor[] fields, StringBuffer stmt) throws PersistenceBrokerException
{
stmt.append(" WHERE ");
for(int i = 0; i < fields.length; i++)
{
FieldDescriptor fmd = fields[i];
stmt.append(fmd.getColumnName());
stmt.append(" = ? ");
if(i < fields.length - 1)
{
stmt.append(" AND ");
}
}
} | [
"protected",
"void",
"appendWhereClause",
"(",
"FieldDescriptor",
"[",
"]",
"fields",
",",
"StringBuffer",
"stmt",
")",
"throws",
"PersistenceBrokerException",
"{",
"stmt",
".",
"append",
"(",
"\" WHERE \"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Generate a sql where-clause for the array of fields
@param fields array containing all columns used in WHERE clause | [
"Generate",
"a",
"sql",
"where",
"-",
"clause",
"for",
"the",
"array",
"of",
"fields"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlPkStatement.java#L82-L97 |
anotheria/configureme | src/main/java/org/configureme/util/StringUtils.java | StringUtils.getStringBefore | public static String getStringBefore(final String src, final String toSearch, final int start) {
final int ind = src.indexOf(toSearch, start);
if (ind == -1)
return "";
return src.substring(start, ind);
} | java | public static String getStringBefore(final String src, final String toSearch, final int start) {
final int ind = src.indexOf(toSearch, start);
if (ind == -1)
return "";
return src.substring(start, ind);
} | [
"public",
"static",
"String",
"getStringBefore",
"(",
"final",
"String",
"src",
",",
"final",
"String",
"toSearch",
",",
"final",
"int",
"start",
")",
"{",
"final",
"int",
"ind",
"=",
"src",
".",
"indexOf",
"(",
"toSearch",
",",
"start",
")",
";",
"if",
... | Get {@link java.lang.String} before given search {@link java.lang.String} from given start search index.
@param src
source string
@param toSearch
search string
@param start
start search index
@return {@link java.lang.String} | [
"Get",
"{",
"@link",
"java",
".",
"lang",
".",
"String",
"}",
"before",
"given",
"search",
"{",
"@link",
"java",
".",
"lang",
".",
"String",
"}",
"from",
"given",
"start",
"search",
"index",
"."
] | train | https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/util/StringUtils.java#L107-L113 |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractRun.java | SelfExtractRun.createTempDirectory | private static String createTempDirectory(String baseDir, String fileStem) {
Long nano = new Long(System.nanoTime());
return baseDir + File.separator + fileStem + nano;
} | java | private static String createTempDirectory(String baseDir, String fileStem) {
Long nano = new Long(System.nanoTime());
return baseDir + File.separator + fileStem + nano;
} | [
"private",
"static",
"String",
"createTempDirectory",
"(",
"String",
"baseDir",
",",
"String",
"fileStem",
")",
"{",
"Long",
"nano",
"=",
"new",
"Long",
"(",
"System",
".",
"nanoTime",
"(",
")",
")",
";",
"return",
"baseDir",
"+",
"File",
".",
"separator",... | Generate unique directory name of form:
basedir/fileStem<time-in-nanos>
@param baseDir
@param fileStem
@return unique dir name | [
"Generate",
"unique",
"directory",
"name",
"of",
"form",
":",
"basedir",
"/",
"fileStem<time",
"-",
"in",
"-",
"nanos",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractRun.java#L120-L123 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/Drawer.java | Drawer.switchDrawerContent | public void switchDrawerContent(@NonNull OnDrawerItemClickListener onDrawerItemClickListener, OnDrawerItemLongClickListener onDrawerItemLongClickListener, @NonNull List<IDrawerItem> drawerItems, int drawerSelection) {
//just allow a single switched drawer
if (!switchedDrawerContent()) {
//save out previous values
originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
originalDrawerState = getAdapter().saveInstanceState(new Bundle());
mDrawerBuilder.mExpandableExtension.collapse(false);
originalDrawerItems = getDrawerItems();
}
//set the new items
setOnDrawerItemClickListener(onDrawerItemClickListener);
setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
setItems(drawerItems, true);
setSelectionAtPosition(drawerSelection, false);
if (!mDrawerBuilder.mKeepStickyItemsVisible) {
//hide stickyFooter and it's shadow
if (getStickyFooter() != null) {
getStickyFooter().setVisibility(View.GONE);
}
if (getStickyFooterShadow() != null) {
getStickyFooterShadow().setVisibility(View.GONE);
}
}
} | java | public void switchDrawerContent(@NonNull OnDrawerItemClickListener onDrawerItemClickListener, OnDrawerItemLongClickListener onDrawerItemLongClickListener, @NonNull List<IDrawerItem> drawerItems, int drawerSelection) {
//just allow a single switched drawer
if (!switchedDrawerContent()) {
//save out previous values
originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
originalDrawerState = getAdapter().saveInstanceState(new Bundle());
mDrawerBuilder.mExpandableExtension.collapse(false);
originalDrawerItems = getDrawerItems();
}
//set the new items
setOnDrawerItemClickListener(onDrawerItemClickListener);
setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
setItems(drawerItems, true);
setSelectionAtPosition(drawerSelection, false);
if (!mDrawerBuilder.mKeepStickyItemsVisible) {
//hide stickyFooter and it's shadow
if (getStickyFooter() != null) {
getStickyFooter().setVisibility(View.GONE);
}
if (getStickyFooterShadow() != null) {
getStickyFooterShadow().setVisibility(View.GONE);
}
}
} | [
"public",
"void",
"switchDrawerContent",
"(",
"@",
"NonNull",
"OnDrawerItemClickListener",
"onDrawerItemClickListener",
",",
"OnDrawerItemLongClickListener",
"onDrawerItemLongClickListener",
",",
"@",
"NonNull",
"List",
"<",
"IDrawerItem",
">",
"drawerItems",
",",
"int",
"d... | method to switch the drawer content to new elements
@param onDrawerItemClickListener
@param drawerItems
@param drawerSelection | [
"method",
"to",
"switch",
"the",
"drawer",
"content",
"to",
"new",
"elements"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L1003-L1029 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java | LongTermRetentionBackupsInner.beginDeleteAsync | public Observable<Void> beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) {
return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) {
return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginDeleteAsync",
"(",
"String",
"locationName",
",",
"String",
"longTermRetentionServerName",
",",
"String",
"longTermRetentionDatabaseName",
",",
"String",
"backupName",
")",
"{",
"return",
"beginDeleteWithServiceResponseAsync",... | Deletes a long term retention backup.
@param locationName The location of the database
@param longTermRetentionServerName the String value
@param longTermRetentionDatabaseName the String value
@param backupName The backup name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"a",
"long",
"term",
"retention",
"backup",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java#L322-L329 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java | ProviderManager.removeIQProvider | public static String removeIQProvider(String elementName, String namespace) {
String key = getKey(elementName, namespace);
iqProviders.remove(key);
return key;
} | java | public static String removeIQProvider(String elementName, String namespace) {
String key = getKey(elementName, namespace);
iqProviders.remove(key);
return key;
} | [
"public",
"static",
"String",
"removeIQProvider",
"(",
"String",
"elementName",
",",
"String",
"namespace",
")",
"{",
"String",
"key",
"=",
"getKey",
"(",
"elementName",
",",
"namespace",
")",
";",
"iqProviders",
".",
"remove",
"(",
"key",
")",
";",
"return"... | Removes an IQ provider with the specified element name and namespace. This
method is typically called to cleanup providers that are programmatically added
using the {@link #addIQProvider(String, String, Object) addIQProvider} method.
@param elementName the XML element name.
@param namespace the XML namespace.
@return the key of the removed IQ Provider | [
"Removes",
"an",
"IQ",
"provider",
"with",
"the",
"specified",
"element",
"name",
"and",
"namespace",
".",
"This",
"method",
"is",
"typically",
"called",
"to",
"cleanup",
"providers",
"that",
"are",
"programmatically",
"added",
"using",
"the",
"{",
"@link",
"#... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java#L219-L223 |
lambdazen/bitsy | src/main/java/com/lambdazen/bitsy/index/BitsyIndexMap.java | BitsyIndexMap.get | public Collection<BeanType> get(String key, Object value) {
IndexType index = indexMap.get(key);
if (index == null) {
throw new BitsyException(BitsyErrorCodes.MISSING_INDEX, "An index on " + key + " must be created before querying vertices/edges by that key. Defined indexes: " + indexMap.keySet());
} else {
return index.get(value);
}
} | java | public Collection<BeanType> get(String key, Object value) {
IndexType index = indexMap.get(key);
if (index == null) {
throw new BitsyException(BitsyErrorCodes.MISSING_INDEX, "An index on " + key + " must be created before querying vertices/edges by that key. Defined indexes: " + indexMap.keySet());
} else {
return index.get(value);
}
} | [
"public",
"Collection",
"<",
"BeanType",
">",
"get",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"IndexType",
"index",
"=",
"indexMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"throw",
"new",
"BitsyEx... | This method returns a copy of the edges/vertices held for the given key and value | [
"This",
"method",
"returns",
"a",
"copy",
"of",
"the",
"edges",
"/",
"vertices",
"held",
"for",
"the",
"given",
"key",
"and",
"value"
] | train | https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/index/BitsyIndexMap.java#L23-L31 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/Job.java | Job.futureCall | public <T, T1, T2, T3, T4> FutureValue<T> futureCall(Job4<T, T1, T2, T3, T4> jobInstance,
Value<? extends T1> v1, Value<? extends T2> v2, Value<? extends T3> v3,
Value<? extends T4> v4, JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2, v3, v4);
} | java | public <T, T1, T2, T3, T4> FutureValue<T> futureCall(Job4<T, T1, T2, T3, T4> jobInstance,
Value<? extends T1> v1, Value<? extends T2> v2, Value<? extends T3> v3,
Value<? extends T4> v4, JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2, v3, v4);
} | [
"public",
"<",
"T",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"FutureValue",
"<",
"T",
">",
"futureCall",
"(",
"Job4",
"<",
"T",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"jobInstance",
",",
"Value",
"<",
"?",
"extends",
"T1",
"... | Invoke this method from within the {@code run} method of a <b>generator
job</b> in order to specify a job node in the generated child job graph.
This version of the method is for child jobs that take four arguments.
@param <T> The return type of the child job being specified
@param <T1> The type of the first input to the child job
@param <T2> The type of the second input to the child job
@param <T3> The type of the third input to the child job
@param <T4> The type of the fourth input to the child job
@param jobInstance A user-written job object
@param v1 the first input to the child job
@param v2 the second input to the child job
@param v3 the third input to the child job
@param v4 the fourth input to the child job
@param settings Optional one or more {@code JobSetting}
@return a {@code FutureValue} representing an empty value slot that will be
filled by the output of {@code jobInstance} when it finalizes. This
may be passed in to further invocations of {@code futureCall()} in
order to specify a data dependency. | [
"Invoke",
"this",
"method",
"from",
"within",
"the",
"{",
"@code",
"run",
"}",
"method",
"of",
"a",
"<b",
">",
"generator",
"job<",
"/",
"b",
">",
"in",
"order",
"to",
"specify",
"a",
"job",
"node",
"in",
"the",
"generated",
"child",
"job",
"graph",
... | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/Job.java#L291-L295 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/util/BeanUtil.java | BeanUtil.requireNonNull | public static Object requireNonNull(Object object, String errorMessage) {
if (null == object) {
throw new NullPointerException(errorMessage);
}
return object;
} | java | public static Object requireNonNull(Object object, String errorMessage) {
if (null == object) {
throw new NullPointerException(errorMessage);
}
return object;
} | [
"public",
"static",
"Object",
"requireNonNull",
"(",
"Object",
"object",
",",
"String",
"errorMessage",
")",
"{",
"if",
"(",
"null",
"==",
"object",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"errorMessage",
")",
";",
"}",
"return",
"object",
";"... | 判断对象是否为空,如果为空,直接抛出异常
@param object 需要检查的对象
@param errorMessage 异常信息
@return 非空的对象 | [
"判断对象是否为空,如果为空,直接抛出异常"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/util/BeanUtil.java#L43-L48 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SVGAndroidRenderer.java | SVGAndroidRenderer.extractRawText | private void extractRawText(TextContainer parent, StringBuilder str)
{
Iterator<SvgObject> iter = parent.children.iterator();
boolean isFirstChild = true;
while (iter.hasNext())
{
SvgObject child = iter.next();
if (child instanceof TextContainer) {
extractRawText((TextContainer) child, str);
} else if (child instanceof TextSequence) {
str.append(textXMLSpaceTransform(((TextSequence) child).text, isFirstChild, !iter.hasNext() /*isLastChild*/));
}
isFirstChild = false;
}
} | java | private void extractRawText(TextContainer parent, StringBuilder str)
{
Iterator<SvgObject> iter = parent.children.iterator();
boolean isFirstChild = true;
while (iter.hasNext())
{
SvgObject child = iter.next();
if (child instanceof TextContainer) {
extractRawText((TextContainer) child, str);
} else if (child instanceof TextSequence) {
str.append(textXMLSpaceTransform(((TextSequence) child).text, isFirstChild, !iter.hasNext() /*isLastChild*/));
}
isFirstChild = false;
}
} | [
"private",
"void",
"extractRawText",
"(",
"TextContainer",
"parent",
",",
"StringBuilder",
"str",
")",
"{",
"Iterator",
"<",
"SvgObject",
">",
"iter",
"=",
"parent",
".",
"children",
".",
"iterator",
"(",
")",
";",
"boolean",
"isFirstChild",
"=",
"true",
";"... | /*
Extract the raw text from a TextContainer. Used by <tref> handler code. | [
"/",
"*",
"Extract",
"the",
"raw",
"text",
"from",
"a",
"TextContainer",
".",
"Used",
"by",
"<tref",
">",
"handler",
"code",
"."
] | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVGAndroidRenderer.java#L1816-L1832 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/Put.java | Put.withExpressionAttributeNames | public Put withExpressionAttributeNames(java.util.Map<String, String> expressionAttributeNames) {
setExpressionAttributeNames(expressionAttributeNames);
return this;
} | java | public Put withExpressionAttributeNames(java.util.Map<String, String> expressionAttributeNames) {
setExpressionAttributeNames(expressionAttributeNames);
return this;
} | [
"public",
"Put",
"withExpressionAttributeNames",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"expressionAttributeNames",
")",
"{",
"setExpressionAttributeNames",
"(",
"expressionAttributeNames",
")",
";",
"return",
"this",
";",
"}"
] | <p>
One or more substitution tokens for attribute names in an expression.
</p>
@param expressionAttributeNames
One or more substitution tokens for attribute names in an expression.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"One",
"or",
"more",
"substitution",
"tokens",
"for",
"attribute",
"names",
"in",
"an",
"expression",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/Put.java#L265-L268 |
forge/core | javaee/impl/src/main/java/org/jboss/forge/addon/javaee/cdi/CDIOperations.java | CDIOperations.getProjectInjectionPointBeans | public List<JavaResource> getProjectInjectionPointBeans(Project project)
{
final List<JavaResource> beans = new ArrayList<>();
if (project != null)
{
project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor()
{
@Override
public void visit(VisitContext context, JavaResource resource)
{
try
{
JavaSource<?> javaSource = resource.getJavaType();
if (javaSource.isClass()
// JPA
&& !javaSource.hasAnnotation(Entity.class)
&& !javaSource.hasAnnotation(MappedSuperclass.class)
&& !javaSource.hasAnnotation(Embeddable.class)
// Bean Validation
&& !javaSource.hasImport(Payload.class)
)
{
beans.add(resource);
}
}
catch (FileNotFoundException e)
{
// ignore
}
}
});
}
return beans;
} | java | public List<JavaResource> getProjectInjectionPointBeans(Project project)
{
final List<JavaResource> beans = new ArrayList<>();
if (project != null)
{
project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor()
{
@Override
public void visit(VisitContext context, JavaResource resource)
{
try
{
JavaSource<?> javaSource = resource.getJavaType();
if (javaSource.isClass()
// JPA
&& !javaSource.hasAnnotation(Entity.class)
&& !javaSource.hasAnnotation(MappedSuperclass.class)
&& !javaSource.hasAnnotation(Embeddable.class)
// Bean Validation
&& !javaSource.hasImport(Payload.class)
)
{
beans.add(resource);
}
}
catch (FileNotFoundException e)
{
// ignore
}
}
});
}
return beans;
} | [
"public",
"List",
"<",
"JavaResource",
">",
"getProjectInjectionPointBeans",
"(",
"Project",
"project",
")",
"{",
"final",
"List",
"<",
"JavaResource",
">",
"beans",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"project",
"!=",
"null",
")",
"{"... | Returns all the objects from the given {@link Project} that support injection point. Most of the Java EE
components can use @Inject, except most of the JPA artifacts (entities, embeddable...) | [
"Returns",
"all",
"the",
"objects",
"from",
"the",
"given",
"{"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/cdi/CDIOperations.java#L109-L142 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.