code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static <V extends FeatureVector<?>> VectorTypeInformation<V> typeRequest(Class<? super V> cls, int mindim, int maxdim) {
return new VectorTypeInformation<>(cls, mindim, maxdim);
}
|
class class_name[name] begin[{]
method[typeRequest, return_type[type[VectorTypeInformation]], modifier[public static], parameter[cls, mindim, maxdim]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mindim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxdim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=VectorTypeInformation, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[V] Keyword[extends] identifier[FeatureVector] operator[<] operator[?] operator[>] operator[>] identifier[VectorTypeInformation] operator[<] identifier[V] operator[>] identifier[typeRequest] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[super] identifier[V] operator[>] identifier[cls] , Keyword[int] identifier[mindim] , Keyword[int] identifier[maxdim] operator[SEP] {
Keyword[return] Keyword[new] identifier[VectorTypeInformation] operator[<] operator[>] operator[SEP] identifier[cls] , identifier[mindim] , identifier[maxdim] operator[SEP] operator[SEP]
}
|
int encodeCEs(long ces[], int cesLength) {
if(cesLength < 0 || cesLength > Collation.MAX_EXPANSION_LENGTH) {
throw new IllegalArgumentException("mapping to too many CEs");
}
if(!isMutable()) {
throw new IllegalStateException("attempt to add mappings after build()");
}
if(cesLength == 0) {
// Convenience: We cannot map to nothing, but we can map to a completely ignorable CE.
// Do this here so that callers need not do it.
return encodeOneCEAsCE32(0);
} else if(cesLength == 1) {
return encodeOneCE(ces[0]);
} else if(cesLength == 2) {
// Try to encode two CEs as one CE32.
long ce0 = ces[0];
long ce1 = ces[1];
long p0 = ce0 >>> 32;
if((ce0 & 0xffffffffff00ffL) == Collation.COMMON_SECONDARY_CE &&
(ce1 & 0xffffffff00ffffffL) == Collation.COMMON_TERTIARY_CE &&
p0 != 0) {
// Latin mini expansion
return
(int)p0 |
(((int)ce0 & 0xff00) << 8) |
(((int)ce1 >> 16) & 0xff00) |
Collation.SPECIAL_CE32_LOW_BYTE |
Collation.LATIN_EXPANSION_TAG;
}
}
// Try to encode two or more CEs as CE32s.
int[] newCE32s = new int[Collation.MAX_EXPANSION_LENGTH]; // TODO: instance field?
for(int i = 0;; ++i) {
if(i == cesLength) {
return encodeExpansion32(newCE32s, 0, cesLength);
}
int ce32 = encodeOneCEAsCE32(ces[i]);
if(ce32 == Collation.NO_CE32) { break; }
newCE32s[i] = ce32;
}
return encodeExpansion(ces, 0, cesLength);
}
|
class class_name[name] begin[{]
method[encodeCEs, return_type[type[int]], modifier[default], parameter[ces, cesLength]] begin[{]
if[binary_operation[binary_operation[member[.cesLength], <, literal[0]], ||, binary_operation[member[.cesLength], >, member[Collation.MAX_EXPANSION_LENGTH]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mapping to too many CEs")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[.isMutable, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="attempt to add mappings after build()")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.cesLength], ==, literal[0]]] begin[{]
return[call[.encodeOneCEAsCE32, parameter[literal[0]]]]
else begin[{]
if[binary_operation[member[.cesLength], ==, literal[1]]] begin[{]
return[call[.encodeOneCE, parameter[member[.ces]]]]
else begin[{]
if[binary_operation[member[.cesLength], ==, literal[2]]] begin[{]
local_variable[type[long], ce0]
local_variable[type[long], ce1]
local_variable[type[long], p0]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.ce0], &, literal[0xffffffffff00ffL]], ==, member[Collation.COMMON_SECONDARY_CE]], &&, binary_operation[binary_operation[member[.ce1], &, literal[0xffffffff00ffffffL]], ==, member[Collation.COMMON_TERTIARY_CE]]], &&, binary_operation[member[.p0], !=, literal[0]]]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[Cast(expression=MemberReference(member=p0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int)), |, binary_operation[binary_operation[Cast(expression=MemberReference(member=ce0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int)), &, literal[0xff00]], <<, literal[8]]], |, binary_operation[binary_operation[Cast(expression=MemberReference(member=ce1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int)), >>, literal[16]], &, literal[0xff00]]], |, member[Collation.SPECIAL_CE32_LOW_BYTE]], |, member[Collation.LATIN_EXPANSION_TAG]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
local_variable[type[int], newCE32s]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cesLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=newCE32s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=cesLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeExpansion32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=encodeOneCEAsCE32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=ce32)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ce32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NO_CE32, postfix_operators=[], prefix_operators=[], qualifier=Collation, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newCE32s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=ce32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=None, init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[call[.encodeExpansion, parameter[member[.ces], literal[0], member[.cesLength]]]]
end[}]
END[}]
|
Keyword[int] identifier[encodeCEs] operator[SEP] Keyword[long] identifier[ces] operator[SEP] operator[SEP] , Keyword[int] identifier[cesLength] operator[SEP] {
Keyword[if] operator[SEP] identifier[cesLength] operator[<] Other[0] operator[||] identifier[cesLength] operator[>] identifier[Collation] operator[SEP] identifier[MAX_EXPANSION_LENGTH] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[isMutable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cesLength] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[encodeOneCEAsCE32] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cesLength] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[encodeOneCE] operator[SEP] identifier[ces] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cesLength] operator[==] Other[2] operator[SEP] {
Keyword[long] identifier[ce0] operator[=] identifier[ces] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[long] identifier[ce1] operator[=] identifier[ces] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[long] identifier[p0] operator[=] identifier[ce0] operator[>] operator[>] operator[>] Other[32] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[ce0] operator[&] literal[Integer] operator[SEP] operator[==] identifier[Collation] operator[SEP] identifier[COMMON_SECONDARY_CE] operator[&&] operator[SEP] identifier[ce1] operator[&] literal[Integer] operator[SEP] operator[==] identifier[Collation] operator[SEP] identifier[COMMON_TERTIARY_CE] operator[&&] identifier[p0] operator[!=] Other[0] operator[SEP] {
Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[p0] operator[|] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[ce0] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] operator[|] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[ce1] operator[>] operator[>] Other[16] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[|] identifier[Collation] operator[SEP] identifier[SPECIAL_CE32_LOW_BYTE] operator[|] identifier[Collation] operator[SEP] identifier[LATIN_EXPANSION_TAG] operator[SEP]
}
}
Keyword[int] operator[SEP] operator[SEP] identifier[newCE32s] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[Collation] operator[SEP] identifier[MAX_EXPANSION_LENGTH] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] identifier[cesLength] operator[SEP] {
Keyword[return] identifier[encodeExpansion32] operator[SEP] identifier[newCE32s] , Other[0] , identifier[cesLength] operator[SEP] operator[SEP]
}
Keyword[int] identifier[ce32] operator[=] identifier[encodeOneCEAsCE32] operator[SEP] identifier[ces] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ce32] operator[==] identifier[Collation] operator[SEP] identifier[NO_CE32] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[newCE32s] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[ce32] operator[SEP]
}
Keyword[return] identifier[encodeExpansion] operator[SEP] identifier[ces] , Other[0] , identifier[cesLength] operator[SEP] operator[SEP]
}
|
public static DiffSet diffSet(GraphQLSchema schemaOld, GraphQLSchema schemaNew) {
Map<String, Object> introspectionOld = introspect(schemaOld);
Map<String, Object> introspectionNew = introspect(schemaNew);
return diffSet(introspectionOld, introspectionNew);
}
|
class class_name[name] begin[{]
method[diffSet, return_type[type[DiffSet]], modifier[public static], parameter[schemaOld, schemaNew]] begin[{]
local_variable[type[Map], introspectionOld]
local_variable[type[Map], introspectionNew]
return[call[.diffSet, parameter[member[.introspectionOld], member[.introspectionNew]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DiffSet] identifier[diffSet] operator[SEP] identifier[GraphQLSchema] identifier[schemaOld] , identifier[GraphQLSchema] identifier[schemaNew] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[introspectionOld] operator[=] identifier[introspect] operator[SEP] identifier[schemaOld] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[introspectionNew] operator[=] identifier[introspect] operator[SEP] identifier[schemaNew] operator[SEP] operator[SEP] Keyword[return] identifier[diffSet] operator[SEP] identifier[introspectionOld] , identifier[introspectionNew] operator[SEP] operator[SEP]
}
|
private static void setConf(String varname, String key, String varvalue, boolean register)
throws IllegalArgumentException {
HiveConf conf = SessionState.get().getConf();
String value = new VariableSubstitution().substitute(conf, varvalue);
if (conf.getBoolVar(HiveConf.ConfVars.HIVECONFVALIDATION)) {
HiveConf.ConfVars confVars = HiveConf.getConfVars(key);
if (confVars != null) {
if (!confVars.isType(value)) {
StringBuilder message = new StringBuilder();
message.append("'SET ").append(varname).append('=').append(varvalue);
message.append("' FAILED because ").append(key).append(" expects ");
message.append(confVars.typeString()).append(" type value.");
throw new IllegalArgumentException(message.toString());
}
String fail = confVars.validate(value);
if (fail != null) {
StringBuilder message = new StringBuilder();
message.append("'SET ").append(varname).append('=').append(varvalue);
message.append("' FAILED in validation : ").append(fail).append('.');
throw new IllegalArgumentException(message.toString());
}
} else if (key.startsWith("hive.")) {
throw new IllegalArgumentException("hive configuration " + key + " does not exists.");
}
}
conf.verifyAndSet(key, value);
if (register) {
SessionState.get().getOverriddenConfigurations().put(key, value);
}
}
|
class class_name[name] begin[{]
method[setConf, return_type[void], modifier[private static], parameter[varname, key, varvalue, register]] begin[{]
local_variable[type[HiveConf], conf]
local_variable[type[String], value]
if[call[conf.getBoolVar, parameter[member[HiveConf.ConfVars.HIVECONFVALIDATION]]]] begin[{]
local_variable[type[HiveConf], confVars]
if[binary_operation[member[.confVars], !=, literal[null]]] begin[{]
if[call[confVars.isType, parameter[member[.value]]]] begin[{]
local_variable[type[StringBuilder], message]
call[message.append, parameter[literal["'SET "]]]
call[message.append, parameter[literal["' FAILED because "]]]
call[message.append, parameter[call[confVars.typeString, parameter[]]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], fail]
if[binary_operation[member[.fail], !=, literal[null]]] begin[{]
local_variable[type[StringBuilder], message]
call[message.append, parameter[literal["'SET "]]]
call[message.append, parameter[literal["' FAILED in validation : "]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
if[call[key.startsWith, parameter[literal["hive."]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hive configuration "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not exists."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
call[conf.verifyAndSet, parameter[member[.key], member[.value]]]
if[member[.register]] begin[{]
call[SessionState.get, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[setConf] operator[SEP] identifier[String] identifier[varname] , identifier[String] identifier[key] , identifier[String] identifier[varvalue] , Keyword[boolean] identifier[register] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
identifier[HiveConf] identifier[conf] operator[=] identifier[SessionState] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getConf] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] Keyword[new] identifier[VariableSubstitution] operator[SEP] operator[SEP] operator[SEP] identifier[substitute] operator[SEP] identifier[conf] , identifier[varvalue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[conf] operator[SEP] identifier[getBoolVar] operator[SEP] identifier[HiveConf] operator[SEP] identifier[ConfVars] operator[SEP] identifier[HIVECONFVALIDATION] operator[SEP] operator[SEP] {
identifier[HiveConf] operator[SEP] identifier[ConfVars] identifier[confVars] operator[=] identifier[HiveConf] operator[SEP] identifier[getConfVars] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[confVars] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[confVars] operator[SEP] identifier[isType] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[message] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[varname] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[varvalue] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[append] operator[SEP] identifier[confVars] operator[SEP] identifier[typeString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[message] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[fail] operator[=] identifier[confVars] operator[SEP] identifier[validate] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fail] operator[!=] Other[null] operator[SEP] {
identifier[StringBuilder] identifier[message] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[varname] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[varvalue] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fail] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[message] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
identifier[conf] operator[SEP] identifier[verifyAndSet] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[register] operator[SEP] {
identifier[SessionState] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getOverriddenConfigurations] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
|
@BackpressureSupport(BackpressureKind.SPECIAL)
@SchedulerSupport(SchedulerSupport.NONE)
public final void subscribe(FlowableSubscriber<? super T> s) {
ObjectHelper.requireNonNull(s, "s is null");
try {
Subscriber<? super T> z = RxJavaPlugins.onSubscribe(this, s);
ObjectHelper.requireNonNull(z, "The RxJavaPlugins.onSubscribe hook returned a null FlowableSubscriber. Please check the handler provided to RxJavaPlugins.setOnFlowableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins");
subscribeActual(z);
} catch (NullPointerException e) { // NOPMD
throw e;
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
// can't call onError because no way to know if a Subscription has been set or not
// can't call onSubscribe because the call might have set a Subscription already
RxJavaPlugins.onError(e);
NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
npe.initCause(e);
throw npe;
}
}
|
class class_name[name] begin[{]
method[subscribe, return_type[void], modifier[final public], parameter[s]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.s], literal["s is null"]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onSubscribe, postfix_operators=[], prefix_operators=[], qualifier=RxJavaPlugins, selectors=[], type_arguments=None), name=z)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=super, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Subscriber, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The RxJavaPlugins.onSubscribe hook returned a null FlowableSubscriber. Please check the handler provided to RxJavaPlugins.setOnFlowableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins")], member=requireNonNull, postfix_operators=[], prefix_operators=[], qualifier=ObjectHelper, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=subscribeActual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NullPointerException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=throwIfFatal, postfix_operators=[], prefix_operators=[], qualifier=Exceptions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onError, postfix_operators=[], prefix_operators=[], qualifier=RxJavaPlugins, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Actually not, but can't throw other exceptions due to RS")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), name=npe)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NullPointerException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=[], prefix_operators=[], qualifier=npe, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=npe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[SPECIAL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] Keyword[void] identifier[subscribe] operator[SEP] identifier[FlowableSubscriber] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[s] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[s] , literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[Subscriber] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[z] operator[=] identifier[RxJavaPlugins] operator[SEP] identifier[onSubscribe] operator[SEP] Keyword[this] , identifier[s] operator[SEP] operator[SEP] identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[z] , literal[String] operator[SEP] operator[SEP] identifier[subscribeActual] operator[SEP] identifier[z] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NullPointerException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[Exceptions] operator[SEP] identifier[throwIfFatal] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[RxJavaPlugins] operator[SEP] identifier[onError] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[NullPointerException] identifier[npe] operator[=] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[npe] operator[SEP] identifier[initCause] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[npe] operator[SEP]
}
}
|
static List<Requirement> mergeRequirements(AbstractCompiler compiler,
List<ConformanceConfig> configs) {
List<Requirement.Builder> builders = new ArrayList<>();
Map<String, Requirement.Builder> extendable = new HashMap<>();
for (ConformanceConfig config : configs) {
for (Requirement requirement : config.getRequirementList()) {
Requirement.Builder builder = requirement.toBuilder();
if (requirement.hasRuleId()) {
if (requirement.getRuleId().isEmpty()) {
reportInvalidRequirement(compiler, requirement, "empty rule_id");
continue;
}
if (extendable.containsKey(requirement.getRuleId())) {
reportInvalidRequirement(compiler, requirement,
"two requirements with the same rule_id: " + requirement.getRuleId());
continue;
}
extendable.put(requirement.getRuleId(), builder);
}
if (!requirement.hasExtends()) {
builders.add(builder);
}
}
}
for (ConformanceConfig config : configs) {
for (Requirement requirement : config.getRequirementList()) {
if (requirement.hasExtends()) {
Requirement.Builder existing = extendable.get(requirement.getExtends());
if (existing == null) {
reportInvalidRequirement(compiler, requirement,
"no requirement with rule_id: " + requirement.getExtends());
continue;
}
for (Descriptors.FieldDescriptor field : requirement.getAllFields().keySet()) {
if (!EXTENDABLE_FIELDS.contains(field.getName())) {
reportInvalidRequirement(compiler, requirement,
"extending rules allow only " + EXTENDABLE_FIELDS);
}
}
existing.addAllWhitelist(requirement.getWhitelistList());
existing.addAllWhitelistRegexp(requirement.getWhitelistRegexpList());
existing.addAllOnlyApplyTo(requirement.getOnlyApplyToList());
existing.addAllOnlyApplyToRegexp(requirement.getOnlyApplyToRegexpList());
existing.addAllWhitelistEntry(requirement.getWhitelistEntryList());
}
}
}
List<Requirement> requirements = new ArrayList<>(builders.size());
for (Requirement.Builder builder : builders) {
removeDuplicates(builder);
requirements.add(builder.build());
}
return requirements;
}
|
class class_name[name] begin[{]
method[mergeRequirements, return_type[type[List]], modifier[static], parameter[compiler, configs]] begin[{]
local_variable[type[List], builders]
local_variable[type[Map], extendable]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toBuilder, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Requirement, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), IfStatement(condition=MethodInvocation(arguments=[], member=hasRuleId, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getRuleId, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compiler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="empty rule_id")], member=reportInvalidRequirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRuleId, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=extendable, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compiler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="two requirements with the same rule_id: "), operandr=MethodInvocation(arguments=[], member=getRuleId, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None), operator=+)], member=reportInvalidRequirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRuleId, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None), MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=extendable, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=hasExtends, postfix_operators=[], prefix_operators=['!'], qualifier=requirement, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=builders, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRequirementList, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=requirement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Requirement, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=configs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=config)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ConformanceConfig, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasExtends, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExtends, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=extendable, selectors=[], type_arguments=None), name=existing)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Requirement, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=existing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compiler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="no requirement with rule_id: "), operandr=MethodInvocation(arguments=[], member=getExtends, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None), operator=+)], member=reportInvalidRequirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=EXTENDABLE_FIELDS, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compiler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="extending rules allow only "), operandr=MemberReference(member=EXTENDABLE_FIELDS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=reportInvalidRequirement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAllFields, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[MethodInvocation(arguments=[], member=keySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Descriptors, sub_type=ReferenceType(arguments=None, dimensions=None, name=FieldDescriptor, sub_type=None)))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWhitelistList, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=addAllWhitelist, postfix_operators=[], prefix_operators=[], qualifier=existing, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWhitelistRegexpList, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=addAllWhitelistRegexp, postfix_operators=[], prefix_operators=[], qualifier=existing, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOnlyApplyToList, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=addAllOnlyApplyTo, postfix_operators=[], prefix_operators=[], qualifier=existing, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOnlyApplyToRegexpList, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=addAllOnlyApplyToRegexp, postfix_operators=[], prefix_operators=[], qualifier=existing, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWhitelistEntryList, postfix_operators=[], prefix_operators=[], qualifier=requirement, selectors=[], type_arguments=None)], member=addAllWhitelistEntry, postfix_operators=[], prefix_operators=[], qualifier=existing, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRequirementList, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=requirement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Requirement, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=configs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=config)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ConformanceConfig, sub_type=None))), label=None)
local_variable[type[List], requirements]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeDuplicates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=requirements, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=builders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Requirement, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))), label=None)
return[member[.requirements]]
end[}]
END[}]
|
Keyword[static] identifier[List] operator[<] identifier[Requirement] operator[>] identifier[mergeRequirements] operator[SEP] identifier[AbstractCompiler] identifier[compiler] , identifier[List] operator[<] identifier[ConformanceConfig] operator[>] identifier[configs] operator[SEP] {
identifier[List] operator[<] identifier[Requirement] operator[SEP] identifier[Builder] operator[>] identifier[builders] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Requirement] operator[SEP] identifier[Builder] operator[>] identifier[extendable] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ConformanceConfig] identifier[config] operator[:] identifier[configs] operator[SEP] {
Keyword[for] operator[SEP] identifier[Requirement] identifier[requirement] operator[:] identifier[config] operator[SEP] identifier[getRequirementList] operator[SEP] operator[SEP] operator[SEP] {
identifier[Requirement] operator[SEP] identifier[Builder] identifier[builder] operator[=] identifier[requirement] operator[SEP] identifier[toBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[requirement] operator[SEP] identifier[hasRuleId] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[requirement] operator[SEP] identifier[getRuleId] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[reportInvalidRequirement] operator[SEP] identifier[compiler] , identifier[requirement] , literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[extendable] operator[SEP] identifier[containsKey] operator[SEP] identifier[requirement] operator[SEP] identifier[getRuleId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[reportInvalidRequirement] operator[SEP] identifier[compiler] , identifier[requirement] , literal[String] operator[+] identifier[requirement] operator[SEP] identifier[getRuleId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[extendable] operator[SEP] identifier[put] operator[SEP] identifier[requirement] operator[SEP] identifier[getRuleId] operator[SEP] operator[SEP] , identifier[builder] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[requirement] operator[SEP] identifier[hasExtends] operator[SEP] operator[SEP] operator[SEP] {
identifier[builders] operator[SEP] identifier[add] operator[SEP] identifier[builder] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[ConformanceConfig] identifier[config] operator[:] identifier[configs] operator[SEP] {
Keyword[for] operator[SEP] identifier[Requirement] identifier[requirement] operator[:] identifier[config] operator[SEP] identifier[getRequirementList] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[requirement] operator[SEP] identifier[hasExtends] operator[SEP] operator[SEP] operator[SEP] {
identifier[Requirement] operator[SEP] identifier[Builder] identifier[existing] operator[=] identifier[extendable] operator[SEP] identifier[get] operator[SEP] identifier[requirement] operator[SEP] identifier[getExtends] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existing] operator[==] Other[null] operator[SEP] {
identifier[reportInvalidRequirement] operator[SEP] identifier[compiler] , identifier[requirement] , literal[String] operator[+] identifier[requirement] operator[SEP] identifier[getExtends] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Descriptors] operator[SEP] identifier[FieldDescriptor] identifier[field] operator[:] identifier[requirement] operator[SEP] identifier[getAllFields] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[EXTENDABLE_FIELDS] operator[SEP] identifier[contains] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[reportInvalidRequirement] operator[SEP] identifier[compiler] , identifier[requirement] , literal[String] operator[+] identifier[EXTENDABLE_FIELDS] operator[SEP] operator[SEP]
}
}
identifier[existing] operator[SEP] identifier[addAllWhitelist] operator[SEP] identifier[requirement] operator[SEP] identifier[getWhitelistList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[existing] operator[SEP] identifier[addAllWhitelistRegexp] operator[SEP] identifier[requirement] operator[SEP] identifier[getWhitelistRegexpList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[existing] operator[SEP] identifier[addAllOnlyApplyTo] operator[SEP] identifier[requirement] operator[SEP] identifier[getOnlyApplyToList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[existing] operator[SEP] identifier[addAllOnlyApplyToRegexp] operator[SEP] identifier[requirement] operator[SEP] identifier[getOnlyApplyToRegexpList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[existing] operator[SEP] identifier[addAllWhitelistEntry] operator[SEP] identifier[requirement] operator[SEP] identifier[getWhitelistEntryList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[List] operator[<] identifier[Requirement] operator[>] identifier[requirements] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[builders] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Requirement] operator[SEP] identifier[Builder] identifier[builder] operator[:] identifier[builders] operator[SEP] {
identifier[removeDuplicates] operator[SEP] identifier[builder] operator[SEP] operator[SEP] identifier[requirements] operator[SEP] identifier[add] operator[SEP] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[requirements] operator[SEP]
}
|
public static Map<EventType, Method> getEventMap(Class<?> serviceInterface) {
if (!serviceInterface.isInterface()) {
Class type = serviceInterface;
Map<EventType, Method> events = new HashMap<>();
while (type != Object.class) {
for (Class<?> iface : type.getInterfaces()) {
events.putAll(findEvents(iface));
}
type = type.getSuperclass();
}
return events;
}
return findEvents(serviceInterface);
}
|
class class_name[name] begin[{]
method[getEventMap, return_type[type[Map]], modifier[public static], parameter[serviceInterface]] begin[{]
if[call[serviceInterface.isInterface, parameter[]]] begin[{]
local_variable[type[Class], type]
local_variable[type[Map], events]
while[binary_operation[member[.type], !=, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=iface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findEvents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=putAll, postfix_operators=[], prefix_operators=[], qualifier=events, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=iface)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)
assign[member[.type], call[type.getSuperclass, parameter[]]]
end[}]
return[member[.events]]
else begin[{]
None
end[}]
return[call[.findEvents, parameter[member[.serviceInterface]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[EventType] , identifier[Method] operator[>] identifier[getEventMap] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[serviceInterface] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[serviceInterface] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] {
identifier[Class] identifier[type] operator[=] identifier[serviceInterface] operator[SEP] identifier[Map] operator[<] identifier[EventType] , identifier[Method] operator[>] identifier[events] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[type] operator[!=] identifier[Object] operator[SEP] Keyword[class] operator[SEP] {
Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[iface] operator[:] identifier[type] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] {
identifier[events] operator[SEP] identifier[putAll] operator[SEP] identifier[findEvents] operator[SEP] identifier[iface] operator[SEP] operator[SEP] operator[SEP]
}
identifier[type] operator[=] identifier[type] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[events] operator[SEP]
}
Keyword[return] identifier[findEvents] operator[SEP] identifier[serviceInterface] operator[SEP] operator[SEP]
}
|
protected static URL findConfigUrlInDirectory(File directory, String configName) {
if (directory.isDirectory()) {
File cfile = new File(directory, configName);
if (cfile.isFile()) {
try {
return cfile.toURI().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
return null;
}
|
class class_name[name] begin[{]
method[findConfigUrlInDirectory, return_type[type[URL]], modifier[static protected], parameter[directory, configName]] begin[{]
if[call[directory.isDirectory, parameter[]]] begin[{]
local_variable[type[File], cfile]
if[call[cfile.isFile, parameter[]]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=cfile, selectors=[MethodInvocation(arguments=[], member=toURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[protected] Keyword[static] identifier[URL] identifier[findConfigUrlInDirectory] operator[SEP] identifier[File] identifier[directory] , identifier[String] identifier[configName] operator[SEP] {
Keyword[if] operator[SEP] identifier[directory] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
identifier[File] identifier[cfile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[directory] , identifier[configName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cfile] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[cfile] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedURLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public Trigger getTrigger(String triggerId) {
String triggerGroup = extractGroupFromId(triggerId);
return read(triggerGroup, triggerId);
}
|
class class_name[name] begin[{]
method[getTrigger, return_type[type[Trigger]], modifier[public], parameter[triggerId]] begin[{]
local_variable[type[String], triggerGroup]
return[call[.read, parameter[member[.triggerGroup], member[.triggerId]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Trigger] identifier[getTrigger] operator[SEP] identifier[String] identifier[triggerId] operator[SEP] {
identifier[String] identifier[triggerGroup] operator[=] identifier[extractGroupFromId] operator[SEP] identifier[triggerId] operator[SEP] operator[SEP] Keyword[return] identifier[read] operator[SEP] identifier[triggerGroup] , identifier[triggerId] operator[SEP] operator[SEP]
}
|
public void commit(ObjectEnvelope mod) throws PersistenceBrokerException
{
mod.doDelete();
mod.setModificationState(StateTransient.getInstance());
}
|
class class_name[name] begin[{]
method[commit, return_type[void], modifier[public], parameter[mod]] begin[{]
call[mod.doDelete, parameter[]]
call[mod.setModificationState, parameter[call[StateTransient.getInstance, parameter[]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[commit] operator[SEP] identifier[ObjectEnvelope] identifier[mod] operator[SEP] Keyword[throws] identifier[PersistenceBrokerException] {
identifier[mod] operator[SEP] identifier[doDelete] operator[SEP] operator[SEP] operator[SEP] identifier[mod] operator[SEP] identifier[setModificationState] operator[SEP] identifier[StateTransient] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void w(String msg, Throwable tr) {
println(LogLevel.WARN, msg, tr);
}
|
class class_name[name] begin[{]
method[w, return_type[void], modifier[public], parameter[msg, tr]] begin[{]
call[.println, parameter[member[LogLevel.WARN], member[.msg], member[.tr]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[w] operator[SEP] identifier[String] identifier[msg] , identifier[Throwable] identifier[tr] operator[SEP] {
identifier[println] operator[SEP] identifier[LogLevel] operator[SEP] identifier[WARN] , identifier[msg] , identifier[tr] operator[SEP] operator[SEP]
}
|
@Programmatic
public UserSettingJdo newLong(
final String user,
final String key,
final String description,
final Long value) {
return newSetting(user, key, description, SettingType.LONG, value.toString());
}
|
class class_name[name] begin[{]
method[newLong, return_type[type[UserSettingJdo]], modifier[public], parameter[user, key, description, value]] begin[{]
return[call[.newSetting, parameter[member[.user], member[.key], member[.description], member[SettingType.LONG], call[value.toString, parameter[]]]]]
end[}]
END[}]
|
annotation[@] identifier[Programmatic] Keyword[public] identifier[UserSettingJdo] identifier[newLong] operator[SEP] Keyword[final] identifier[String] identifier[user] , Keyword[final] identifier[String] identifier[key] , Keyword[final] identifier[String] identifier[description] , Keyword[final] identifier[Long] identifier[value] operator[SEP] {
Keyword[return] identifier[newSetting] operator[SEP] identifier[user] , identifier[key] , identifier[description] , identifier[SettingType] operator[SEP] identifier[LONG] , identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean add(Object listener) {
if (listener == null) {
return false;
}
checkListenerType(listener);
synchronized (this) {
if (listeners == EMPTY_OBJECT_ARRAY) {
listeners = new Object[] { listener };
}
else {
int listenersLength = listeners.length;
for (int i = 0; i < listenersLength; i++) {
if (listeners[i] == listener) {
return false;
}
}
Object[] tmp = new Object[listenersLength + 1];
tmp[listenersLength] = listener;
System.arraycopy(listeners, 0, tmp, 0, listenersLength);
listeners = tmp;
}
}
return true;
}
|
class class_name[name] begin[{]
method[add, return_type[type[boolean]], modifier[public], parameter[listener]] begin[{]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
call[.checkListenerType, parameter[member[.listener]]]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[binary_operation[member[.listeners], ==, member[.EMPTY_OBJECT_ARRAY]]] begin[{]
assign[member[.listeners], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]
else begin[{]
local_variable[type[int], listenersLength]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=listenersLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[Object], tmp]
assign[member[.tmp], member[.listener]]
call[System.arraycopy, parameter[member[.listeners], literal[0], member[.tmp], literal[0], member[.listenersLength]]]
assign[member[.listeners], member[.tmp]]
end[}]
END[}]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[add] operator[SEP] identifier[Object] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[checkListenerType] operator[SEP] identifier[listener] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[listeners] operator[==] identifier[EMPTY_OBJECT_ARRAY] operator[SEP] {
identifier[listeners] operator[=] Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[listener]
} operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[listenersLength] operator[=] identifier[listeners] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[listenersLength] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[listeners] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[listener] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
identifier[Object] operator[SEP] operator[SEP] identifier[tmp] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[listenersLength] operator[+] Other[1] operator[SEP] operator[SEP] identifier[tmp] operator[SEP] identifier[listenersLength] operator[SEP] operator[=] identifier[listener] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[listeners] , Other[0] , identifier[tmp] , Other[0] , identifier[listenersLength] operator[SEP] operator[SEP] identifier[listeners] operator[=] identifier[tmp] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public <T> T getOrElse(ClientOption<T> option, T defaultValue) {
return getOrElse0(option, defaultValue);
}
|
class class_name[name] begin[{]
method[getOrElse, return_type[type[T]], modifier[public], parameter[option, defaultValue]] begin[{]
return[call[.getOrElse0, parameter[member[.option], member[.defaultValue]]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[getOrElse] operator[SEP] identifier[ClientOption] operator[<] identifier[T] operator[>] identifier[option] , identifier[T] identifier[defaultValue] operator[SEP] {
Keyword[return] identifier[getOrElse0] operator[SEP] identifier[option] , identifier[defaultValue] operator[SEP] operator[SEP]
}
|
public Node renameNode(Node n,
String namespaceURI,
String name)
throws DOMException{
return n;
}
|
class class_name[name] begin[{]
method[renameNode, return_type[type[Node]], modifier[public], parameter[n, namespaceURI, name]] begin[{]
return[member[.n]]
end[}]
END[}]
|
Keyword[public] identifier[Node] identifier[renameNode] operator[SEP] identifier[Node] identifier[n] , identifier[String] identifier[namespaceURI] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[DOMException] {
Keyword[return] identifier[n] operator[SEP]
}
|
@javax.annotation.Nonnull
public Bounds getBounds(@javax.annotation.Nonnull double[][] points) {
int dim = points[0].length;
double[] max = IntStream.range(0, dim).mapToDouble(d -> {
return Arrays.stream(points).mapToDouble(pt -> pt[d]).filter(x -> Double.isFinite(x)).max().orElse(Double.NaN);
}).toArray();
double[] min = IntStream.range(0, dim).mapToDouble(d -> {
return Arrays.stream(points).mapToDouble(pt -> pt[d]).filter(x -> Double.isFinite(x)).min().orElse(Double.NaN);
}).toArray();
return new Bounds(max, min);
}
|
class class_name[name] begin[{]
method[getBounds, return_type[type[Bounds]], modifier[public], parameter[points]] begin[{]
local_variable[type[int], dim]
local_variable[type[double], max]
local_variable[type[double], min]
return[ClassCreator(arguments=[MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Bounds, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nonnull] Keyword[public] identifier[Bounds] identifier[getBounds] operator[SEP] annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nonnull] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[points] operator[SEP] {
Keyword[int] identifier[dim] operator[=] identifier[points] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[max] operator[=] identifier[IntStream] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[dim] operator[SEP] operator[SEP] identifier[mapToDouble] operator[SEP] identifier[d] operator[->] {
Keyword[return] identifier[Arrays] operator[SEP] identifier[stream] operator[SEP] identifier[points] operator[SEP] operator[SEP] identifier[mapToDouble] operator[SEP] identifier[pt] operator[->] identifier[pt] operator[SEP] identifier[d] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[x] operator[->] identifier[Double] operator[SEP] identifier[isFinite] operator[SEP] identifier[x] operator[SEP] operator[SEP] operator[SEP] identifier[max] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] identifier[Double] operator[SEP] identifier[NaN] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[min] operator[=] identifier[IntStream] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[dim] operator[SEP] operator[SEP] identifier[mapToDouble] operator[SEP] identifier[d] operator[->] {
Keyword[return] identifier[Arrays] operator[SEP] identifier[stream] operator[SEP] identifier[points] operator[SEP] operator[SEP] identifier[mapToDouble] operator[SEP] identifier[pt] operator[->] identifier[pt] operator[SEP] identifier[d] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[x] operator[->] identifier[Double] operator[SEP] identifier[isFinite] operator[SEP] identifier[x] operator[SEP] operator[SEP] operator[SEP] identifier[min] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] identifier[Double] operator[SEP] identifier[NaN] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Bounds] operator[SEP] identifier[max] , identifier[min] operator[SEP] operator[SEP]
}
|
public final void info(Object pObject)
{
getLogger().log(FQCN, Level.INFO, pObject, null);
}
|
class class_name[name] begin[{]
method[info, return_type[void], modifier[final public], parameter[pObject]] begin[{]
call[.getLogger, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[info] operator[SEP] identifier[Object] identifier[pObject] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[FQCN] , identifier[Level] operator[SEP] identifier[INFO] , identifier[pObject] , Other[null] operator[SEP] operator[SEP]
}
|
public void marshall(MailFromAttributes mailFromAttributes, ProtocolMarshaller protocolMarshaller) {
if (mailFromAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mailFromAttributes.getMailFromDomain(), MAILFROMDOMAIN_BINDING);
protocolMarshaller.marshall(mailFromAttributes.getMailFromDomainStatus(), MAILFROMDOMAINSTATUS_BINDING);
protocolMarshaller.marshall(mailFromAttributes.getBehaviorOnMxFailure(), BEHAVIORONMXFAILURE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
|
class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[mailFromAttributes, protocolMarshaller]] begin[{]
if[binary_operation[member[.mailFromAttributes], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMailFromDomain, postfix_operators=[], prefix_operators=[], qualifier=mailFromAttributes, selectors=[], type_arguments=None), MemberReference(member=MAILFROMDOMAIN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMailFromDomainStatus, postfix_operators=[], prefix_operators=[], qualifier=mailFromAttributes, selectors=[], type_arguments=None), MemberReference(member=MAILFROMDOMAINSTATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBehaviorOnMxFailure, postfix_operators=[], prefix_operators=[], qualifier=mailFromAttributes, selectors=[], type_arguments=None), MemberReference(member=BEHAVIORONMXFAILURE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[MailFromAttributes] identifier[mailFromAttributes] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[mailFromAttributes] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[mailFromAttributes] operator[SEP] identifier[getMailFromDomain] operator[SEP] operator[SEP] , identifier[MAILFROMDOMAIN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[mailFromAttributes] operator[SEP] identifier[getMailFromDomainStatus] operator[SEP] operator[SEP] , identifier[MAILFROMDOMAINSTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[mailFromAttributes] operator[SEP] identifier[getBehaviorOnMxFailure] operator[SEP] operator[SEP] , identifier[BEHAVIORONMXFAILURE_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static CPDefinitionLocalization remove(
long cpDefinitionLocalizationId)
throws com.liferay.commerce.product.exception.NoSuchCPDefinitionLocalizationException {
return getPersistence().remove(cpDefinitionLocalizationId);
}
|
class class_name[name] begin[{]
method[remove, return_type[type[CPDefinitionLocalization]], modifier[public static], parameter[cpDefinitionLocalizationId]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CPDefinitionLocalization] identifier[remove] operator[SEP] Keyword[long] identifier[cpDefinitionLocalizationId] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[exception] operator[SEP] identifier[NoSuchCPDefinitionLocalizationException] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[cpDefinitionLocalizationId] operator[SEP] operator[SEP]
}
|
public static void setBoolean(MemorySegment[] segments, int offset, boolean value) {
if (inFirstSegment(segments, offset, 1)) {
segments[0].putBoolean(offset, value);
} else {
setBooleanMultiSegments(segments, offset, value);
}
}
|
class class_name[name] begin[{]
method[setBoolean, return_type[void], modifier[public static], parameter[segments, offset, value]] begin[{]
if[call[.inFirstSegment, parameter[member[.segments], member[.offset], literal[1]]]] begin[{]
member[.segments]
else begin[{]
call[.setBooleanMultiSegments, parameter[member[.segments], member[.offset], member[.value]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setBoolean] operator[SEP] identifier[MemorySegment] operator[SEP] operator[SEP] identifier[segments] , Keyword[int] identifier[offset] , Keyword[boolean] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[inFirstSegment] operator[SEP] identifier[segments] , identifier[offset] , Other[1] operator[SEP] operator[SEP] {
identifier[segments] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[putBoolean] operator[SEP] identifier[offset] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setBooleanMultiSegments] operator[SEP] identifier[segments] , identifier[offset] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public RTText getRichText(RTFormat format) {
assertRegistration();
RTEditable rtEditable = new RTEditable(this);
return rtEditable.convertTo(format, mMediaFactory);
}
|
class class_name[name] begin[{]
method[getRichText, return_type[type[RTText]], modifier[public], parameter[format]] begin[{]
call[.assertRegistration, parameter[]]
local_variable[type[RTEditable], rtEditable]
return[call[rtEditable.convertTo, parameter[member[.format], member[.mMediaFactory]]]]
end[}]
END[}]
|
Keyword[public] identifier[RTText] identifier[getRichText] operator[SEP] identifier[RTFormat] identifier[format] operator[SEP] {
identifier[assertRegistration] operator[SEP] operator[SEP] operator[SEP] identifier[RTEditable] identifier[rtEditable] operator[=] Keyword[new] identifier[RTEditable] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] identifier[rtEditable] operator[SEP] identifier[convertTo] operator[SEP] identifier[format] , identifier[mMediaFactory] operator[SEP] operator[SEP]
}
|
public static Polygon create(org.locationtech.jts.geom.Polygon polygon) {
double[] lats = new double[polygon.getNumPoints()];
double[] lons = new double[polygon.getNumPoints()];
for (int i = 0; i < polygon.getNumPoints(); i++) {
lats[i] = polygon.getCoordinates()[i].y;
lons[i] = polygon.getCoordinates()[i].x;
}
return new Polygon(lats, lons);
}
|
class class_name[name] begin[{]
method[create, return_type[type[Polygon]], modifier[public static], parameter[polygon]] begin[{]
local_variable[type[double], lats]
local_variable[type[double], lons]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getCoordinates, postfix_operators=[], prefix_operators=[], qualifier=polygon, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=y, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lons, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getCoordinates, postfix_operators=[], prefix_operators=[], qualifier=polygon, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=x, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumPoints, postfix_operators=[], prefix_operators=[], qualifier=polygon, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=lats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lons, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Polygon, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Polygon] identifier[create] operator[SEP] identifier[org] operator[SEP] identifier[locationtech] operator[SEP] identifier[jts] operator[SEP] identifier[geom] operator[SEP] identifier[Polygon] identifier[polygon] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[lats] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[polygon] operator[SEP] identifier[getNumPoints] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[lons] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[polygon] operator[SEP] identifier[getNumPoints] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[polygon] operator[SEP] identifier[getNumPoints] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[lats] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[polygon] operator[SEP] identifier[getCoordinates] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[y] operator[SEP] identifier[lons] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[polygon] operator[SEP] identifier[getCoordinates] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[x] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Polygon] operator[SEP] identifier[lats] , identifier[lons] operator[SEP] operator[SEP]
}
|
public URL discoverResource(Method m, String uri) {
for (String s : possibleLocations(m, uri)) {
try {
URL resource = this.getClass().getClassLoader().getResource(resourcePrefix + "/" + URLDecoder.decode(s, UTF_8));
if (resource == null) {
throw new IllegalArgumentException(String.format("Resource %s not found.", uri));
}
if (!new File(URLDecoder.decode(resource.getFile(), UTF_8)).isFile()) {
continue; // Probably directory
}
return resource;
} catch (IllegalArgumentException ignored) {
} // just go on
}
throw new IllegalArgumentException(String.format("Can not discover resource for method [%s] and URI [%s]", m, uri));
}
|
class class_name[name] begin[{]
method[discoverResource, return_type[type[URL]], modifier[public], parameter[m, uri]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=resourcePrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None), operator=+)], member=getResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=resource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Resource %s not found."), MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])), IfStatement(condition=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MethodInvocation(arguments=[], member=isFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), ReturnStatement(expression=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignored, types=['IllegalArgumentException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=possibleLocations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not discover resource for method [%s] and URI [%s]"), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] identifier[URL] identifier[discoverResource] operator[SEP] identifier[Method] identifier[m] , identifier[String] identifier[uri] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[possibleLocations] operator[SEP] identifier[m] , identifier[uri] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[URL] identifier[resource] operator[=] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[getResource] operator[SEP] identifier[resourcePrefix] operator[+] literal[String] operator[+] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[s] , identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resource] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[uri] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] Keyword[new] identifier[File] operator[SEP] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[resource] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] , identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[return] identifier[resource] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[ignored] operator[SEP] {
}
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[m] , identifier[uri] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String determineAccessorName(@Nonnull final AccessorPrefix prefix, @Nonnull final String fieldName) {
Check.notNull(prefix, "prefix");
Check.notEmpty(fieldName, "fieldName");
final Matcher m = PATTERN.matcher(fieldName);
Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", fieldName);
final String name = m.group();
return prefix.getPrefix() + name.substring(0, 1).toUpperCase() + name.substring(1);
}
|
class class_name[name] begin[{]
method[determineAccessorName, return_type[type[String]], modifier[public static], parameter[prefix, fieldName]] begin[{]
call[Check.notNull, parameter[member[.prefix], literal["prefix"]]]
call[Check.notEmpty, parameter[member[.fieldName], literal["fieldName"]]]
local_variable[type[Matcher], m]
call[Check.stateIsTrue, parameter[call[m.find, parameter[]], literal["passed field name '%s' is not applicable"], member[.fieldName]]]
local_variable[type[String], name]
return[binary_operation[binary_operation[call[prefix.getPrefix, parameter[]], +, call[name.substring, parameter[literal[0], literal[1]]]], +, call[name.substring, parameter[literal[1]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[determineAccessorName] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[AccessorPrefix] identifier[prefix] , annotation[@] identifier[Nonnull] Keyword[final] identifier[String] identifier[fieldName] operator[SEP] {
identifier[Check] operator[SEP] identifier[notNull] operator[SEP] identifier[prefix] , literal[String] operator[SEP] operator[SEP] identifier[Check] operator[SEP] identifier[notEmpty] operator[SEP] identifier[fieldName] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Matcher] identifier[m] operator[=] identifier[PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[Check] operator[SEP] identifier[stateIsTrue] operator[SEP] identifier[m] operator[SEP] identifier[find] operator[SEP] operator[SEP] , literal[String] , identifier[fieldName] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[prefix] operator[SEP] identifier[getPrefix] operator[SEP] operator[SEP] operator[+] identifier[name] operator[SEP] identifier[substring] operator[SEP] Other[0] , Other[1] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[+] identifier[name] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
|
public static final Date parseTimestamp(String value)
{
Date result = null;
if (value != null && value.length() != 0)
{
try
{
result = TIMESTAMP_FORMAT.get().parse(value);
}
catch (ParseException ex)
{
// Ignore parse exception
}
}
return (result);
}
|
class class_name[name] begin[{]
method[parseTimestamp, return_type[type[Date]], modifier[final public static], parameter[value]] begin[{]
local_variable[type[Date], result]
if[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, binary_operation[call[value.length, parameter[]], !=, literal[0]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=TIMESTAMP_FORMAT, selectors=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ParseException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[final] identifier[Date] identifier[parseTimestamp] operator[SEP] identifier[String] identifier[value] operator[SEP] {
identifier[Date] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[try] {
identifier[result] operator[=] identifier[TIMESTAMP_FORMAT] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[ex] operator[SEP] {
}
}
Keyword[return] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public EList<String> getDescription() {
return (EList<String>) eGet(StorePackage.Literals.IFC_HEADER__DESCRIPTION, true);
}
|
class class_name[name] begin[{]
method[getDescription, return_type[type[EList]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=IFC_HEADER__DESCRIPTION, postfix_operators=[], prefix_operators=[], qualifier=StorePackage.Literals, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=EList, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[EList] operator[<] identifier[String] operator[>] identifier[getDescription] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[EList] operator[<] identifier[String] operator[>] operator[SEP] identifier[eGet] operator[SEP] identifier[StorePackage] operator[SEP] identifier[Literals] operator[SEP] identifier[IFC_HEADER__DESCRIPTION] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void apply(Object instance, Map<String, Property> properties, ContextualPropertyResolver resolver)
throws Exception {
if (property.isContextual() || property.isReference()) {
applyContextual(instance, properties, resolver);
} else {
applyNonContextual(instance, properties, resolver);
}
}
|
class class_name[name] begin[{]
method[apply, return_type[void], modifier[public], parameter[instance, properties, resolver]] begin[{]
if[binary_operation[call[property.isContextual, parameter[]], ||, call[property.isReference, parameter[]]]] begin[{]
call[.applyContextual, parameter[member[.instance], member[.properties], member[.resolver]]]
else begin[{]
call[.applyNonContextual, parameter[member[.instance], member[.properties], member[.resolver]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[apply] operator[SEP] identifier[Object] identifier[instance] , identifier[Map] operator[<] identifier[String] , identifier[Property] operator[>] identifier[properties] , identifier[ContextualPropertyResolver] identifier[resolver] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[isContextual] operator[SEP] operator[SEP] operator[||] identifier[property] operator[SEP] identifier[isReference] operator[SEP] operator[SEP] operator[SEP] {
identifier[applyContextual] operator[SEP] identifier[instance] , identifier[properties] , identifier[resolver] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[applyNonContextual] operator[SEP] identifier[instance] , identifier[properties] , identifier[resolver] operator[SEP] operator[SEP]
}
}
|
protected String toFilename(QualifiedName name, String separator) {
final List<String> segments = name.getSegments();
if (segments.isEmpty()) {
return ""; //$NON-NLS-1$
}
final StringBuilder builder = new StringBuilder();
builder.append(name.toString(separator));
builder.append(getFilenameExtension());
return builder.toString();
}
|
class class_name[name] begin[{]
method[toFilename, return_type[type[String]], modifier[protected], parameter[name, separator]] begin[{]
local_variable[type[List], segments]
if[call[segments.isEmpty, parameter[]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], builder]
call[builder.append, parameter[call[name.toString, parameter[member[.separator]]]]]
call[builder.append, parameter[call[.getFilenameExtension, parameter[]]]]
return[call[builder.toString, parameter[]]]
end[}]
END[}]
|
Keyword[protected] identifier[String] identifier[toFilename] operator[SEP] identifier[QualifiedName] identifier[name] , identifier[String] identifier[separator] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[segments] operator[=] identifier[name] operator[SEP] identifier[getSegments] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[segments] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[final] identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[name] operator[SEP] identifier[toString] operator[SEP] identifier[separator] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[getFilenameExtension] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@VisibleForTesting
static String buildJcrPathForZip(final String path) {
String normalizedPath = StringUtils.defaultString(path);
if (!normalizedPath.startsWith("/")) {
normalizedPath = "/" + normalizedPath;
}
return ROOT_DIR + PlatformNameFormat.getPlatformPath(normalizedPath);
}
|
class class_name[name] begin[{]
method[buildJcrPathForZip, return_type[type[String]], modifier[static], parameter[path]] begin[{]
local_variable[type[String], normalizedPath]
if[call[normalizedPath.startsWith, parameter[literal["/"]]]] begin[{]
assign[member[.normalizedPath], binary_operation[literal["/"], +, member[.normalizedPath]]]
else begin[{]
None
end[}]
return[binary_operation[member[.ROOT_DIR], +, call[PlatformNameFormat.getPlatformPath, parameter[member[.normalizedPath]]]]]
end[}]
END[}]
|
annotation[@] identifier[VisibleForTesting] Keyword[static] identifier[String] identifier[buildJcrPathForZip] operator[SEP] Keyword[final] identifier[String] identifier[path] operator[SEP] {
identifier[String] identifier[normalizedPath] operator[=] identifier[StringUtils] operator[SEP] identifier[defaultString] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[normalizedPath] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[normalizedPath] operator[=] literal[String] operator[+] identifier[normalizedPath] operator[SEP]
}
Keyword[return] identifier[ROOT_DIR] operator[+] identifier[PlatformNameFormat] operator[SEP] identifier[getPlatformPath] operator[SEP] identifier[normalizedPath] operator[SEP] operator[SEP]
}
|
final int writeAsciiByte(int value) throws IOException {
if (commPort != null && commPort.isOpen()) {
byte[] buffer;
if (value == ModbusASCIITransport.FRAME_START) {
buffer = new byte[]{58};
logger.debug("Wrote FRAME_START");
}
else if (value == ModbusASCIITransport.FRAME_END) {
buffer = new byte[]{13, 10};
logger.debug("Wrote FRAME_END");
}
else {
buffer = ModbusUtil.toHex(value);
if (logger.isDebugEnabled()) {
logger.debug("Wrote byte {}={}", value, ModbusUtil.toHex(value));
}
}
if (buffer != null) {
return commPort.writeBytes(buffer, buffer.length);
}
else {
throw new IOException("Message to send is empty");
}
}
else {
throw new IOException("Comm port is not valid or not open");
}
}
|
class class_name[name] begin[{]
method[writeAsciiByte, return_type[type[int]], modifier[final], parameter[value]] begin[{]
if[binary_operation[binary_operation[member[.commPort], !=, literal[null]], &&, call[commPort.isOpen, parameter[]]]] begin[{]
local_variable[type[byte], buffer]
if[binary_operation[member[.value], ==, member[ModbusASCIITransport.FRAME_START]]] begin[{]
assign[member[.buffer], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=58)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))]
call[logger.debug, parameter[literal["Wrote FRAME_START"]]]
else begin[{]
if[binary_operation[member[.value], ==, member[ModbusASCIITransport.FRAME_END]]] begin[{]
assign[member[.buffer], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=13), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))]
call[logger.debug, parameter[literal["Wrote FRAME_END"]]]
else begin[{]
assign[member[.buffer], call[ModbusUtil.toHex, parameter[member[.value]]]]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[literal["Wrote byte {}={}"], member[.value], call[ModbusUtil.toHex, parameter[member[.value]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
if[binary_operation[member[.buffer], !=, literal[null]]] begin[{]
return[call[commPort.writeBytes, parameter[member[.buffer], member[buffer.length]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Message to send is empty")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
end[}]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Comm port is not valid or not open")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
end[}]
end[}]
END[}]
|
Keyword[final] Keyword[int] identifier[writeAsciiByte] operator[SEP] Keyword[int] identifier[value] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[commPort] operator[!=] Other[null] operator[&&] identifier[commPort] operator[SEP] identifier[isOpen] operator[SEP] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] identifier[ModbusASCIITransport] operator[SEP] identifier[FRAME_START] operator[SEP] {
identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
Other[58]
} operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] operator[==] identifier[ModbusASCIITransport] operator[SEP] identifier[FRAME_END] operator[SEP] {
identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
Other[13] , Other[10]
} operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[buffer] operator[=] identifier[ModbusUtil] operator[SEP] identifier[toHex] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[value] , identifier[ModbusUtil] operator[SEP] identifier[toHex] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[buffer] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[commPort] operator[SEP] identifier[writeBytes] operator[SEP] identifier[buffer] , identifier[buffer] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public static int cuStreamWaitEvent(CUstream hStream, CUevent hEvent, int Flags)
{
return checkResult(cuStreamWaitEventNative(hStream, hEvent, Flags));
}
|
class class_name[name] begin[{]
method[cuStreamWaitEvent, return_type[type[int]], modifier[public static], parameter[hStream, hEvent, Flags]] begin[{]
return[call[.checkResult, parameter[call[.cuStreamWaitEventNative, parameter[member[.hStream], member[.hEvent], member[.Flags]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[cuStreamWaitEvent] operator[SEP] identifier[CUstream] identifier[hStream] , identifier[CUevent] identifier[hEvent] , Keyword[int] identifier[Flags] operator[SEP] {
Keyword[return] identifier[checkResult] operator[SEP] identifier[cuStreamWaitEventNative] operator[SEP] identifier[hStream] , identifier[hEvent] , identifier[Flags] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponse<LogsInner>> listLogsWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (containerGroupName == null) {
throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.");
}
if (containerName == null) {
throw new IllegalArgumentException("Parameter containerName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final Integer tail = null;
return service.listLogs(this.client.subscriptionId(), resourceGroupName, containerGroupName, containerName, this.client.apiVersion(), tail, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<LogsInner>>>() {
@Override
public Observable<ServiceResponse<LogsInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<LogsInner> clientResponse = listLogsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[listLogsWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, containerGroupName, containerName]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.subscriptionId, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.subscriptionId() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.resourceGroupName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter resourceGroupName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.containerGroupName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter containerGroupName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.containerName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter containerName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.client]call[None.apiVersion, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.apiVersion() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Integer], tail]
return[call[service.listLogs, parameter[THIS[member[None.client]call[None.subscriptionId, parameter[]]], member[.resourceGroupName], member[.containerGroupName], member[.containerName], THIS[member[None.client]call[None.apiVersion, parameter[]]], member[.tail], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[LogsInner] operator[>] operator[>] identifier[listLogsWithServiceResponseAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[containerGroupName] , identifier[String] identifier[containerName] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resourceGroupName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[containerGroupName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[containerName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Integer] identifier[tail] operator[=] Other[null] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[listLogs] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] , identifier[resourceGroupName] , identifier[containerGroupName] , identifier[containerName] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , identifier[tail] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[LogsInner] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[LogsInner] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[LogsInner] operator[>] identifier[clientResponse] operator[=] identifier[listLogsDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
@Override
public void writeCookieValue(CookieValue cookieValue) {
HttpServletRequest request = cookieValue.getRequest();
HttpServletResponse response = cookieValue.getResponse();
StringBuilder sb = new StringBuilder();
sb.append(this.cookieName).append('=');
String value = getValue(cookieValue);
if (value != null && value.length() > 0) {
validateValue(value);
sb.append(value);
}
int maxAge = getMaxAge(cookieValue);
if (maxAge > -1) {
sb.append("; Max-Age=").append(cookieValue.getCookieMaxAge());
OffsetDateTime expires = (maxAge != 0)
? OffsetDateTime.now().plusSeconds(maxAge)
: Instant.EPOCH.atOffset(ZoneOffset.UTC);
sb.append("; Expires=")
.append(expires.format(DateTimeFormatter.RFC_1123_DATE_TIME));
}
String domain = getDomainName(request);
if (domain != null && domain.length() > 0) {
validateDomain(domain);
sb.append("; Domain=").append(domain);
}
String path = getCookiePath(request);
if (path != null && path.length() > 0) {
validatePath(path);
sb.append("; Path=").append(path);
}
if (isSecureCookie(request)) {
sb.append("; Secure");
}
if (this.useHttpOnlyCookie) {
sb.append("; HttpOnly");
}
if (this.sameSite != null) {
sb.append("; SameSite=").append(this.sameSite);
}
response.addHeader("Set-Cookie", sb.toString());
}
|
class class_name[name] begin[{]
method[writeCookieValue, return_type[void], modifier[public], parameter[cookieValue]] begin[{]
local_variable[type[HttpServletRequest], request]
local_variable[type[HttpServletResponse], response]
local_variable[type[StringBuilder], sb]
call[sb.append, parameter[THIS[member[None.cookieName]]]]
local_variable[type[String], value]
if[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, binary_operation[call[value.length, parameter[]], >, literal[0]]]] begin[{]
call[.validateValue, parameter[member[.value]]]
call[sb.append, parameter[member[.value]]]
else begin[{]
None
end[}]
local_variable[type[int], maxAge]
if[binary_operation[member[.maxAge], >, literal[1]]] begin[{]
call[sb.append, parameter[literal["; Max-Age="]]]
local_variable[type[OffsetDateTime], expires]
call[sb.append, parameter[literal["; Expires="]]]
else begin[{]
None
end[}]
local_variable[type[String], domain]
if[binary_operation[binary_operation[member[.domain], !=, literal[null]], &&, binary_operation[call[domain.length, parameter[]], >, literal[0]]]] begin[{]
call[.validateDomain, parameter[member[.domain]]]
call[sb.append, parameter[literal["; Domain="]]]
else begin[{]
None
end[}]
local_variable[type[String], path]
if[binary_operation[binary_operation[member[.path], !=, literal[null]], &&, binary_operation[call[path.length, parameter[]], >, literal[0]]]] begin[{]
call[.validatePath, parameter[member[.path]]]
call[sb.append, parameter[literal["; Path="]]]
else begin[{]
None
end[}]
if[call[.isSecureCookie, parameter[member[.request]]]] begin[{]
call[sb.append, parameter[literal["; Secure"]]]
else begin[{]
None
end[}]
if[THIS[member[None.useHttpOnlyCookie]]] begin[{]
call[sb.append, parameter[literal["; HttpOnly"]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.sameSite]], !=, literal[null]]] begin[{]
call[sb.append, parameter[literal["; SameSite="]]]
else begin[{]
None
end[}]
call[response.addHeader, parameter[literal["Set-Cookie"], call[sb.toString, parameter[]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[writeCookieValue] operator[SEP] identifier[CookieValue] identifier[cookieValue] operator[SEP] {
identifier[HttpServletRequest] identifier[request] operator[=] identifier[cookieValue] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[HttpServletResponse] identifier[response] operator[=] identifier[cookieValue] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] Keyword[this] operator[SEP] identifier[cookieName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[getValue] operator[SEP] identifier[cookieValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[validateValue] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[int] identifier[maxAge] operator[=] identifier[getMaxAge] operator[SEP] identifier[cookieValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxAge] operator[>] operator[-] Other[1] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[cookieValue] operator[SEP] identifier[getCookieMaxAge] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[OffsetDateTime] identifier[expires] operator[=] operator[SEP] identifier[maxAge] operator[!=] Other[0] operator[SEP] operator[?] identifier[OffsetDateTime] operator[SEP] identifier[now] operator[SEP] operator[SEP] operator[SEP] identifier[plusSeconds] operator[SEP] identifier[maxAge] operator[SEP] operator[:] identifier[Instant] operator[SEP] identifier[EPOCH] operator[SEP] identifier[atOffset] operator[SEP] identifier[ZoneOffset] operator[SEP] identifier[UTC] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[expires] operator[SEP] identifier[format] operator[SEP] identifier[DateTimeFormatter] operator[SEP] identifier[RFC_1123_DATE_TIME] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[domain] operator[=] identifier[getDomainName] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[domain] operator[!=] Other[null] operator[&&] identifier[domain] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[validateDomain] operator[SEP] identifier[domain] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[domain] operator[SEP] operator[SEP]
}
identifier[String] identifier[path] operator[=] identifier[getCookiePath] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[!=] Other[null] operator[&&] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[validatePath] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isSecureCookie] operator[SEP] identifier[request] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[useHttpOnlyCookie] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[sameSite] operator[!=] Other[null] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] Keyword[this] operator[SEP] identifier[sameSite] operator[SEP] operator[SEP]
}
identifier[response] operator[SEP] identifier[addHeader] operator[SEP] literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void stop(long millisec) {
// PK12235, more specific states
if (0 == millisec) {
// immediate hard stop
setState(STATE_STOPPED);
} else {
setState(STATE_STOPPING);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Stop: " + this);
}
}
|
class class_name[name] begin[{]
method[stop, return_type[void], modifier[public], parameter[millisec]] begin[{]
if[binary_operation[literal[0], ==, member[.millisec]]] begin[{]
call[.setState, parameter[member[.STATE_STOPPED]]]
else begin[{]
call[.setState, parameter[member[.STATE_STOPPING]]]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[literal["Stop: "], +, THIS[]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[stop] operator[SEP] Keyword[long] identifier[millisec] operator[SEP] {
Keyword[if] operator[SEP] Other[0] operator[==] identifier[millisec] operator[SEP] {
identifier[setState] operator[SEP] identifier[STATE_STOPPED] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setState] operator[SEP] identifier[STATE_STOPPING] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP]
}
}
|
protected void invokeCallbacks(ThreadLocalRandom r) {
final Set<SelectionKey> selectedKeys = m_selector.selectedKeys();
final int keyCount = selectedKeys.size();
int startInx = r.nextInt(keyCount);
int itInx = 0;
Iterator<SelectionKey> it = selectedKeys.iterator();
while(itInx < startInx) {
it.next();
itInx++;
}
while(itInx < keyCount) {
final Object obj = it.next().attachment();
if (obj == null) {
continue;
}
final VoltPort port = (VoltPort)obj;
callPort(port);
itInx++;
}
itInx = 0;
it = selectedKeys.iterator();
while(itInx < startInx) {
final Object obj = it.next().attachment();
if (obj == null) {
continue;
}
final VoltPort port = (VoltPort)obj;
callPort(port);
itInx++;
}
selectedKeys.clear();
}
|
class class_name[name] begin[{]
method[invokeCallbacks, return_type[void], modifier[protected], parameter[r]] begin[{]
local_variable[type[Set], selectedKeys]
local_variable[type[int], keyCount]
local_variable[type[int], startInx]
local_variable[type[int], itInx]
local_variable[type[Iterator], it]
while[binary_operation[member[.itInx], <, member[.startInx]]] begin[{]
call[it.next, parameter[]]
member[.itInx]
end[}]
while[binary_operation[member[.itInx], <, member[.keyCount]]] begin[{]
local_variable[type[Object], obj]
if[binary_operation[member[.obj], ==, literal[null]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[VoltPort], port]
call[.callPort, parameter[member[.port]]]
member[.itInx]
end[}]
assign[member[.itInx], literal[0]]
assign[member[.it], call[selectedKeys.iterator, parameter[]]]
while[binary_operation[member[.itInx], <, member[.startInx]]] begin[{]
local_variable[type[Object], obj]
if[binary_operation[member[.obj], ==, literal[null]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[VoltPort], port]
call[.callPort, parameter[member[.port]]]
member[.itInx]
end[}]
call[selectedKeys.clear, parameter[]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[invokeCallbacks] operator[SEP] identifier[ThreadLocalRandom] identifier[r] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[SelectionKey] operator[>] identifier[selectedKeys] operator[=] identifier[m_selector] operator[SEP] identifier[selectedKeys] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[keyCount] operator[=] identifier[selectedKeys] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[startInx] operator[=] identifier[r] operator[SEP] identifier[nextInt] operator[SEP] identifier[keyCount] operator[SEP] operator[SEP] Keyword[int] identifier[itInx] operator[=] Other[0] operator[SEP] identifier[Iterator] operator[<] identifier[SelectionKey] operator[>] identifier[it] operator[=] identifier[selectedKeys] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itInx] operator[<] identifier[startInx] operator[SEP] {
identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[itInx] operator[++] operator[SEP]
}
Keyword[while] operator[SEP] identifier[itInx] operator[<] identifier[keyCount] operator[SEP] {
Keyword[final] identifier[Object] identifier[obj] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[attachment] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] identifier[VoltPort] identifier[port] operator[=] operator[SEP] identifier[VoltPort] operator[SEP] identifier[obj] operator[SEP] identifier[callPort] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[itInx] operator[++] operator[SEP]
}
identifier[itInx] operator[=] Other[0] operator[SEP] identifier[it] operator[=] identifier[selectedKeys] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itInx] operator[<] identifier[startInx] operator[SEP] {
Keyword[final] identifier[Object] identifier[obj] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[attachment] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] identifier[VoltPort] identifier[port] operator[=] operator[SEP] identifier[VoltPort] operator[SEP] identifier[obj] operator[SEP] identifier[callPort] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[itInx] operator[++] operator[SEP]
}
identifier[selectedKeys] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
|
public static URI asURI(final String algorithm, final String value) {
try {
final String scheme = DIGEST_ALGORITHM.getScheme(algorithm);
return new URI(scheme, value, null);
} catch (final URISyntaxException unlikelyException) {
LOGGER.warn("Exception creating checksum URI: {}",
unlikelyException);
throw new RepositoryRuntimeException(unlikelyException);
}
}
|
class class_name[name] begin[{]
method[asURI, return_type[type[URI]], modifier[public static], parameter[algorithm, value]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=algorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getScheme, postfix_operators=[], prefix_operators=[], qualifier=DIGEST_ALGORITHM, selectors=[], type_arguments=None), name=scheme)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URI, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception creating checksum URI: {}"), MemberReference(member=unlikelyException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=unlikelyException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RepositoryRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=unlikelyException, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[URI] identifier[asURI] operator[SEP] Keyword[final] identifier[String] identifier[algorithm] , Keyword[final] identifier[String] identifier[value] operator[SEP] {
Keyword[try] {
Keyword[final] identifier[String] identifier[scheme] operator[=] identifier[DIGEST_ALGORITHM] operator[SEP] identifier[getScheme] operator[SEP] identifier[algorithm] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[URI] operator[SEP] identifier[scheme] , identifier[value] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[URISyntaxException] identifier[unlikelyException] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[unlikelyException] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RepositoryRuntimeException] operator[SEP] identifier[unlikelyException] operator[SEP] operator[SEP]
}
}
|
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
String name = emd.name();
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
writer.getDocLink(context, cd, (MemberDoc) emd,
name, false));
Content code = HtmlTree.CODE(memberLink);
addParameters(emd, false, code, name.length() - 1);
tdSummary.addContent(code);
}
|
class class_name[name] begin[{]
method[addSummaryLink, return_type[void], modifier[protected], parameter[context, cd, member, tdSummary]] begin[{]
local_variable[type[ExecutableMemberDoc], emd]
local_variable[type[String], name]
local_variable[type[Content], memberLink]
local_variable[type[Content], code]
call[.addParameters, parameter[member[.emd], literal[false], member[.code], binary_operation[call[name.length, parameter[]], -, literal[1]]]]
call[tdSummary.addContent, parameter[member[.code]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[addSummaryLink] operator[SEP] identifier[LinkInfoImpl] operator[SEP] identifier[Kind] identifier[context] , identifier[ClassDoc] identifier[cd] , identifier[ProgramElementDoc] identifier[member] , identifier[Content] identifier[tdSummary] operator[SEP] {
identifier[ExecutableMemberDoc] identifier[emd] operator[=] operator[SEP] identifier[ExecutableMemberDoc] operator[SEP] identifier[member] operator[SEP] identifier[String] identifier[name] operator[=] identifier[emd] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[Content] identifier[memberLink] operator[=] identifier[HtmlTree] operator[SEP] identifier[SPAN] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[memberNameLink] , identifier[writer] operator[SEP] identifier[getDocLink] operator[SEP] identifier[context] , identifier[cd] , operator[SEP] identifier[MemberDoc] operator[SEP] identifier[emd] , identifier[name] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[Content] identifier[code] operator[=] identifier[HtmlTree] operator[SEP] identifier[CODE] operator[SEP] identifier[memberLink] operator[SEP] operator[SEP] identifier[addParameters] operator[SEP] identifier[emd] , literal[boolean] , identifier[code] , identifier[name] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[tdSummary] operator[SEP] identifier[addContent] operator[SEP] identifier[code] operator[SEP] operator[SEP]
}
|
public void sendFile(File file, OutputStream os) throws IOException {
FileInputStream is = null;
BufferedInputStream buf = null;;
try {
is = new FileInputStream(file);
buf = new BufferedInputStream(is);
int readBytes = 0;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Writing file...");
}
while ((readBytes = buf.read()) != -1) {
os.write(readBytes);
}
os.flush();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("File written");
}
} finally {
if (is != null) {
is.close();
}
if (buf != null) {
buf.close();
}
}
}
|
class class_name[name] begin[{]
method[sendFile, return_type[void], modifier[public], parameter[file, os]] begin[{]
local_variable[type[FileInputStream], is]
local_variable[type[BufferedInputStream], buf]
Statement(label=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedInputStream, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=readBytes)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Writing file...")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)])), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=readBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=readBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="File written")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[sendFile] operator[SEP] identifier[File] identifier[file] , identifier[OutputStream] identifier[os] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[FileInputStream] identifier[is] operator[=] Other[null] operator[SEP] identifier[BufferedInputStream] identifier[buf] operator[=] Other[null] operator[SEP] operator[SEP] Keyword[try] {
identifier[is] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[buf] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] identifier[is] operator[SEP] operator[SEP] Keyword[int] identifier[readBytes] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[SEP] identifier[readBytes] operator[=] identifier[buf] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[os] operator[SEP] identifier[write] operator[SEP] identifier[readBytes] operator[SEP] operator[SEP]
}
identifier[os] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[is] operator[!=] Other[null] operator[SEP] {
identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[buf] operator[!=] Other[null] operator[SEP] {
identifier[buf] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public MediaType removeQualityValue() {
if (!this.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.remove(PARAM_QUALITY_FACTOR);
return new MediaType(this, params);
}
|
class class_name[name] begin[{]
method[removeQualityValue, return_type[type[MediaType]], modifier[public], parameter[]] begin[{]
if[THIS[member[None.parameters]call[None.containsKey, parameter[member[.PARAM_QUALITY_FACTOR]]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[Map], params]
call[params.remove, parameter[member[.PARAM_QUALITY_FACTOR]]]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MediaType, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[MediaType] identifier[removeQualityValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[parameters] operator[SEP] identifier[containsKey] operator[SEP] identifier[PARAM_QUALITY_FACTOR] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] Keyword[this] operator[SEP] identifier[parameters] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[remove] operator[SEP] identifier[PARAM_QUALITY_FACTOR] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MediaType] operator[SEP] Keyword[this] , identifier[params] operator[SEP] operator[SEP]
}
|
@DoesServiceRequest
public void create(TableRequestOptions options, OperationContext opContext) throws StorageException {
if (opContext == null) {
opContext = new OperationContext();
}
opContext.initialize();
options = TableRequestOptions.populateAndApplyDefaults(options, this.tableServiceClient);
Utility.assertNotNullOrEmpty("tableName", this.name);
final DynamicTableEntity tableEntry = new DynamicTableEntity();
tableEntry.getProperties().put(TableConstants.TABLE_NAME, new EntityProperty(this.name));
TableOperation.insert(tableEntry).execute(this.tableServiceClient, TableConstants.TABLES_SERVICE_TABLES_NAME,
options, opContext);
}
|
class class_name[name] begin[{]
method[create, return_type[void], modifier[public], parameter[options, opContext]] begin[{]
if[binary_operation[member[.opContext], ==, literal[null]]] begin[{]
assign[member[.opContext], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OperationContext, sub_type=None))]
else begin[{]
None
end[}]
call[opContext.initialize, parameter[]]
assign[member[.options], call[TableRequestOptions.populateAndApplyDefaults, parameter[member[.options], THIS[member[None.tableServiceClient]]]]]
call[Utility.assertNotNullOrEmpty, parameter[literal["tableName"], THIS[member[None.name]]]]
local_variable[type[DynamicTableEntity], tableEntry]
call[tableEntry.getProperties, parameter[]]
call[TableOperation.insert, parameter[member[.tableEntry]]]
end[}]
END[}]
|
annotation[@] identifier[DoesServiceRequest] Keyword[public] Keyword[void] identifier[create] operator[SEP] identifier[TableRequestOptions] identifier[options] , identifier[OperationContext] identifier[opContext] operator[SEP] Keyword[throws] identifier[StorageException] {
Keyword[if] operator[SEP] identifier[opContext] operator[==] Other[null] operator[SEP] {
identifier[opContext] operator[=] Keyword[new] identifier[OperationContext] operator[SEP] operator[SEP] operator[SEP]
}
identifier[opContext] operator[SEP] identifier[initialize] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[=] identifier[TableRequestOptions] operator[SEP] identifier[populateAndApplyDefaults] operator[SEP] identifier[options] , Keyword[this] operator[SEP] identifier[tableServiceClient] operator[SEP] operator[SEP] identifier[Utility] operator[SEP] identifier[assertNotNullOrEmpty] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[final] identifier[DynamicTableEntity] identifier[tableEntry] operator[=] Keyword[new] identifier[DynamicTableEntity] operator[SEP] operator[SEP] operator[SEP] identifier[tableEntry] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[TableConstants] operator[SEP] identifier[TABLE_NAME] , Keyword[new] identifier[EntityProperty] operator[SEP] Keyword[this] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[TableOperation] operator[SEP] identifier[insert] operator[SEP] identifier[tableEntry] operator[SEP] operator[SEP] identifier[execute] operator[SEP] Keyword[this] operator[SEP] identifier[tableServiceClient] , identifier[TableConstants] operator[SEP] identifier[TABLES_SERVICE_TABLES_NAME] , identifier[options] , identifier[opContext] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponse<Page<ApplicationGatewayInner>>> listAllSinglePageAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
return service.listAll(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ApplicationGatewayInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ApplicationGatewayInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<ApplicationGatewayInner>> result = listAllDelegate(response);
return Observable.just(new ServiceResponse<Page<ApplicationGatewayInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[listAllSinglePageAsync, return_type[type[Observable]], modifier[public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.subscriptionId, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.subscriptionId() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], apiVersion]
return[call[service.listAll, parameter[THIS[member[None.client]call[None.subscriptionId, parameter[]]], member[.apiVersion], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ApplicationGatewayInner] operator[>] operator[>] operator[>] identifier[listAllSinglePageAsync] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[apiVersion] operator[=] literal[String] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[listAll] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] , identifier[apiVersion] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ApplicationGatewayInner] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ApplicationGatewayInner] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[PageImpl] operator[<] identifier[ApplicationGatewayInner] operator[>] operator[>] identifier[result] operator[=] identifier[listAllDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] Keyword[new] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ApplicationGatewayInner] operator[>] operator[>] operator[SEP] identifier[result] operator[SEP] identifier[body] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[response] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
private RpcClientLookoutModel createClientMetricsModel(SofaRequest request, SofaResponse response) {
RpcClientLookoutModel clientMetricsModel = new RpcClientLookoutModel();
RpcInternalContext context = RpcInternalContext.getContext();
String app = getStringAvoidNull(context.getAttachment(RpcConstants.INTERNAL_KEY_APP_NAME));
String service = request.getTargetServiceUniqueName();
String method = request.getMethodName();
String protocol = getStringAvoidNull(context.getAttachment(RpcConstants.INTERNAL_KEY_PROTOCOL_NAME));
String invokeType = request.getInvokeType();
String targetApp = request.getTargetAppName();
Long requestSize = getLongAvoidNull(context.getAttachment(RpcConstants.INTERNAL_KEY_REQ_SIZE));
Long responseSize = getLongAvoidNull(context.getAttachment(RpcConstants.INTERNAL_KEY_RESP_SIZE));
Long elapsedTime = getLongAvoidNull(context.getAttachment(RpcConstants.INTERNAL_KEY_CLIENT_ELAPSE));
Boolean success = response != null && !response.isError() && response.getErrorMsg() == null &&
(!(response.getAppResponse() instanceof Throwable));
clientMetricsModel.setApp(app);
clientMetricsModel.setService(service);
clientMetricsModel.setMethod(method);
clientMetricsModel.setProtocol(protocol);
clientMetricsModel.setInvokeType(invokeType);
clientMetricsModel.setTargetApp(targetApp);
clientMetricsModel.setRequestSize(requestSize);
clientMetricsModel.setResponseSize(responseSize);
clientMetricsModel.setElapsedTime(elapsedTime);
clientMetricsModel.setSuccess(success);
return clientMetricsModel;
}
|
class class_name[name] begin[{]
method[createClientMetricsModel, return_type[type[RpcClientLookoutModel]], modifier[private], parameter[request, response]] begin[{]
local_variable[type[RpcClientLookoutModel], clientMetricsModel]
local_variable[type[RpcInternalContext], context]
local_variable[type[String], app]
local_variable[type[String], service]
local_variable[type[String], method]
local_variable[type[String], protocol]
local_variable[type[String], invokeType]
local_variable[type[String], targetApp]
local_variable[type[Long], requestSize]
local_variable[type[Long], responseSize]
local_variable[type[Long], elapsedTime]
local_variable[type[Boolean], success]
call[clientMetricsModel.setApp, parameter[member[.app]]]
call[clientMetricsModel.setService, parameter[member[.service]]]
call[clientMetricsModel.setMethod, parameter[member[.method]]]
call[clientMetricsModel.setProtocol, parameter[member[.protocol]]]
call[clientMetricsModel.setInvokeType, parameter[member[.invokeType]]]
call[clientMetricsModel.setTargetApp, parameter[member[.targetApp]]]
call[clientMetricsModel.setRequestSize, parameter[member[.requestSize]]]
call[clientMetricsModel.setResponseSize, parameter[member[.responseSize]]]
call[clientMetricsModel.setElapsedTime, parameter[member[.elapsedTime]]]
call[clientMetricsModel.setSuccess, parameter[member[.success]]]
return[member[.clientMetricsModel]]
end[}]
END[}]
|
Keyword[private] identifier[RpcClientLookoutModel] identifier[createClientMetricsModel] operator[SEP] identifier[SofaRequest] identifier[request] , identifier[SofaResponse] identifier[response] operator[SEP] {
identifier[RpcClientLookoutModel] identifier[clientMetricsModel] operator[=] Keyword[new] identifier[RpcClientLookoutModel] operator[SEP] operator[SEP] operator[SEP] identifier[RpcInternalContext] identifier[context] operator[=] identifier[RpcInternalContext] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[app] operator[=] identifier[getStringAvoidNull] operator[SEP] identifier[context] operator[SEP] identifier[getAttachment] operator[SEP] identifier[RpcConstants] operator[SEP] identifier[INTERNAL_KEY_APP_NAME] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[service] operator[=] identifier[request] operator[SEP] identifier[getTargetServiceUniqueName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[method] operator[=] identifier[request] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[protocol] operator[=] identifier[getStringAvoidNull] operator[SEP] identifier[context] operator[SEP] identifier[getAttachment] operator[SEP] identifier[RpcConstants] operator[SEP] identifier[INTERNAL_KEY_PROTOCOL_NAME] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[invokeType] operator[=] identifier[request] operator[SEP] identifier[getInvokeType] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[targetApp] operator[=] identifier[request] operator[SEP] identifier[getTargetAppName] operator[SEP] operator[SEP] operator[SEP] identifier[Long] identifier[requestSize] operator[=] identifier[getLongAvoidNull] operator[SEP] identifier[context] operator[SEP] identifier[getAttachment] operator[SEP] identifier[RpcConstants] operator[SEP] identifier[INTERNAL_KEY_REQ_SIZE] operator[SEP] operator[SEP] operator[SEP] identifier[Long] identifier[responseSize] operator[=] identifier[getLongAvoidNull] operator[SEP] identifier[context] operator[SEP] identifier[getAttachment] operator[SEP] identifier[RpcConstants] operator[SEP] identifier[INTERNAL_KEY_RESP_SIZE] operator[SEP] operator[SEP] operator[SEP] identifier[Long] identifier[elapsedTime] operator[=] identifier[getLongAvoidNull] operator[SEP] identifier[context] operator[SEP] identifier[getAttachment] operator[SEP] identifier[RpcConstants] operator[SEP] identifier[INTERNAL_KEY_CLIENT_ELAPSE] operator[SEP] operator[SEP] operator[SEP] identifier[Boolean] identifier[success] operator[=] identifier[response] operator[!=] Other[null] operator[&&] operator[!] identifier[response] operator[SEP] identifier[isError] operator[SEP] operator[SEP] operator[&&] identifier[response] operator[SEP] identifier[getErrorMsg] operator[SEP] operator[SEP] operator[==] Other[null] operator[&&] operator[SEP] operator[!] operator[SEP] identifier[response] operator[SEP] identifier[getAppResponse] operator[SEP] operator[SEP] Keyword[instanceof] identifier[Throwable] operator[SEP] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setApp] operator[SEP] identifier[app] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setService] operator[SEP] identifier[service] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setProtocol] operator[SEP] identifier[protocol] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setInvokeType] operator[SEP] identifier[invokeType] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setTargetApp] operator[SEP] identifier[targetApp] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setRequestSize] operator[SEP] identifier[requestSize] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setResponseSize] operator[SEP] identifier[responseSize] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setElapsedTime] operator[SEP] identifier[elapsedTime] operator[SEP] operator[SEP] identifier[clientMetricsModel] operator[SEP] identifier[setSuccess] operator[SEP] identifier[success] operator[SEP] operator[SEP] Keyword[return] identifier[clientMetricsModel] operator[SEP]
}
|
protected void createPool(JobConf conf, List<PathFilter> filters) {
pools.add(new MultiPathFilter(filters));
}
|
class class_name[name] begin[{]
method[createPool, return_type[void], modifier[protected], parameter[conf, filters]] begin[{]
call[pools.add, parameter[ClassCreator(arguments=[MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MultiPathFilter, sub_type=None))]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[createPool] operator[SEP] identifier[JobConf] identifier[conf] , identifier[List] operator[<] identifier[PathFilter] operator[>] identifier[filters] operator[SEP] {
identifier[pools] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[MultiPathFilter] operator[SEP] identifier[filters] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) throws Exception {
//#thriftclientapi
Hello.FutureIface client = Thrift.client().newIface("localhost:8080", Hello.FutureIface.class);
Future<String> response = client.hi().onSuccess(new Function<String, BoxedUnit>() {
@Override
public BoxedUnit apply(String response) {
System.out.println("Received response: " + response);
return null;
}
});
Await.result(response);
//#thriftclientapi
}
|
class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[Hello], client]
local_variable[type[Future], response]
call[Await.result, parameter[member[.response]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Hello] operator[SEP] identifier[FutureIface] identifier[client] operator[=] identifier[Thrift] operator[SEP] identifier[client] operator[SEP] operator[SEP] operator[SEP] identifier[newIface] operator[SEP] literal[String] , identifier[Hello] operator[SEP] identifier[FutureIface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Future] operator[<] identifier[String] operator[>] identifier[response] operator[=] identifier[client] operator[SEP] identifier[hi] operator[SEP] operator[SEP] operator[SEP] identifier[onSuccess] operator[SEP] Keyword[new] identifier[Function] operator[<] identifier[String] , identifier[BoxedUnit] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[BoxedUnit] identifier[apply] operator[SEP] identifier[String] identifier[response] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[response] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[Await] operator[SEP] identifier[result] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
|
@Override
public String getOrientationName(int index) {
if (getAxisTransformation().getRotationGroup().getPointGroup().equals("C2")) {
if (index == 0) {
return "Front C2 axis";
} else if (index == 2) {
return "Back C2 axis";
}
}
return getPolyhedron().getViewName(index);
}
|
class class_name[name] begin[{]
method[getOrientationName, return_type[type[String]], modifier[public], parameter[index]] begin[{]
if[call[.getAxisTransformation, parameter[]]] begin[{]
if[binary_operation[member[.index], ==, literal[0]]] begin[{]
return[literal["Front C2 axis"]]
else begin[{]
if[binary_operation[member[.index], ==, literal[2]]] begin[{]
return[literal["Back C2 axis"]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[call[.getPolyhedron, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getOrientationName] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[getAxisTransformation] operator[SEP] operator[SEP] operator[SEP] identifier[getRotationGroup] operator[SEP] operator[SEP] operator[SEP] identifier[getPointGroup] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[index] operator[==] Other[2] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
}
Keyword[return] identifier[getPolyhedron] operator[SEP] operator[SEP] operator[SEP] identifier[getViewName] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
|
@Transactional
@PostMapping(value = "/{entityTypeId}/{id}", params = "_method=PUT")
@ResponseStatus(OK)
public void updatePost(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("id") String untypedId,
@RequestBody Map<String, Object> entityMap) {
updateInternal(entityTypeId, untypedId, entityMap);
}
|
class class_name[name] begin[{]
method[updatePost, return_type[void], modifier[public], parameter[entityTypeId, untypedId, entityMap]] begin[{]
call[.updateInternal, parameter[member[.entityTypeId], member[.untypedId], member[.entityMap]]]
end[}]
END[}]
|
annotation[@] identifier[Transactional] annotation[@] identifier[PostMapping] operator[SEP] identifier[value] operator[=] literal[String] , identifier[params] operator[=] literal[String] operator[SEP] annotation[@] identifier[ResponseStatus] operator[SEP] identifier[OK] operator[SEP] Keyword[public] Keyword[void] identifier[updatePost] operator[SEP] annotation[@] identifier[PathVariable] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[entityTypeId] , annotation[@] identifier[PathVariable] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[untypedId] , annotation[@] identifier[RequestBody] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[entityMap] operator[SEP] {
identifier[updateInternal] operator[SEP] identifier[entityTypeId] , identifier[untypedId] , identifier[entityMap] operator[SEP] operator[SEP]
}
|
@Override
protected void writeETF(PrintWriter pw, DFA<?, I> dfa, Alphabet<I> inputs) {
writeETFInternal(pw, dfa, inputs);
}
|
class class_name[name] begin[{]
method[writeETF, return_type[void], modifier[protected], parameter[pw, dfa, inputs]] begin[{]
call[.writeETFInternal, parameter[member[.pw], member[.dfa], member[.inputs]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[writeETF] operator[SEP] identifier[PrintWriter] identifier[pw] , identifier[DFA] operator[<] operator[?] , identifier[I] operator[>] identifier[dfa] , identifier[Alphabet] operator[<] identifier[I] operator[>] identifier[inputs] operator[SEP] {
identifier[writeETFInternal] operator[SEP] identifier[pw] , identifier[dfa] , identifier[inputs] operator[SEP] operator[SEP]
}
|
private static JSONObject toJSONObject(@Nonnull ResourceBundle bundle) {
JSONObject json = new JSONObject();
for (String key : bundle.keySet()) {
json.put(key, bundle.getString(key));
}
return json;
}
|
class class_name[name] begin[{]
method[toJSONObject, return_type[type[JSONObject]], modifier[private static], parameter[bundle]] begin[{]
local_variable[type[JSONObject], json]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=json, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.json]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[JSONObject] identifier[toJSONObject] operator[SEP] annotation[@] identifier[Nonnull] identifier[ResourceBundle] identifier[bundle] operator[SEP] {
identifier[JSONObject] identifier[json] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[bundle] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[bundle] operator[SEP] identifier[getString] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[json] operator[SEP]
}
|
public static RoaringBitmap naive_xor(RoaringBitmap... bitmaps) {
RoaringBitmap answer = new RoaringBitmap();
for (int k = 0; k < bitmaps.length; ++k) {
answer.xor(bitmaps[k]);
}
return answer;
}
|
class class_name[name] begin[{]
method[naive_xor, return_type[type[RoaringBitmap]], modifier[public static], parameter[bitmaps]] begin[{]
local_variable[type[RoaringBitmap], answer]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bitmaps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=xor, postfix_operators=[], prefix_operators=[], qualifier=answer, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bitmaps, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.answer]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[RoaringBitmap] identifier[naive_xor] operator[SEP] identifier[RoaringBitmap] operator[...] identifier[bitmaps] operator[SEP] {
identifier[RoaringBitmap] identifier[answer] operator[=] Keyword[new] identifier[RoaringBitmap] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] Other[0] operator[SEP] identifier[k] operator[<] identifier[bitmaps] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[k] operator[SEP] {
identifier[answer] operator[SEP] identifier[xor] operator[SEP] identifier[bitmaps] operator[SEP] identifier[k] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[answer] operator[SEP]
}
|
Attribute modify(
final AttributeDefinition definition,
final String completeName,
final String value,
final AttributeValueQuotes valueQuotes) {
return new Attribute(
(definition == null? this.definition : definition),
(completeName == null? this.completeName : completeName),
this.operator,
value, // This is not keepable
(valueQuotes == null? this.valueQuotes : valueQuotes),
this.templateName,
this.line,
this.col);
}
|
class class_name[name] begin[{]
method[modify, return_type[type[Attribute]], modifier[default], parameter[definition, completeName, value, valueQuotes]] begin[{]
return[ClassCreator(arguments=[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=definition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=definition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=definition, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=completeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=completeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=completeName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=operator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=valueQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=valueQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=valueQuotes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=templateName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=line, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=col, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))]
end[}]
END[}]
|
identifier[Attribute] identifier[modify] operator[SEP] Keyword[final] identifier[AttributeDefinition] identifier[definition] , Keyword[final] identifier[String] identifier[completeName] , Keyword[final] identifier[String] identifier[value] , Keyword[final] identifier[AttributeValueQuotes] identifier[valueQuotes] operator[SEP] {
Keyword[return] Keyword[new] identifier[Attribute] operator[SEP] operator[SEP] identifier[definition] operator[==] Other[null] operator[?] Keyword[this] operator[SEP] identifier[definition] operator[:] identifier[definition] operator[SEP] , operator[SEP] identifier[completeName] operator[==] Other[null] operator[?] Keyword[this] operator[SEP] identifier[completeName] operator[:] identifier[completeName] operator[SEP] , Keyword[this] operator[SEP] identifier[operator] , identifier[value] , operator[SEP] identifier[valueQuotes] operator[==] Other[null] operator[?] Keyword[this] operator[SEP] identifier[valueQuotes] operator[:] identifier[valueQuotes] operator[SEP] , Keyword[this] operator[SEP] identifier[templateName] , Keyword[this] operator[SEP] identifier[line] , Keyword[this] operator[SEP] identifier[col] operator[SEP] operator[SEP]
}
|
public JanbaneryToWorkspace connectUsing(String user, String password) throws ServerCommunicationException {
DefaultConfiguration conf = new DefaultConfiguration(user, password);
RestClient restClient = getRestClient(conf);
Janbanery janbanery = new Janbanery(conf, restClient);
// fetch and switch to apiKey mode
String apiKey = getCurrentUserApiKey(janbanery);
conf.forceKeyAuthMode(apiKey);
return new JanbaneryToWorkspace(janbanery);
}
|
class class_name[name] begin[{]
method[connectUsing, return_type[type[JanbaneryToWorkspace]], modifier[public], parameter[user, password]] begin[{]
local_variable[type[DefaultConfiguration], conf]
local_variable[type[RestClient], restClient]
local_variable[type[Janbanery], janbanery]
local_variable[type[String], apiKey]
call[conf.forceKeyAuthMode, parameter[member[.apiKey]]]
return[ClassCreator(arguments=[MemberReference(member=janbanery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JanbaneryToWorkspace, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[JanbaneryToWorkspace] identifier[connectUsing] operator[SEP] identifier[String] identifier[user] , identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[ServerCommunicationException] {
identifier[DefaultConfiguration] identifier[conf] operator[=] Keyword[new] identifier[DefaultConfiguration] operator[SEP] identifier[user] , identifier[password] operator[SEP] operator[SEP] identifier[RestClient] identifier[restClient] operator[=] identifier[getRestClient] operator[SEP] identifier[conf] operator[SEP] operator[SEP] identifier[Janbanery] identifier[janbanery] operator[=] Keyword[new] identifier[Janbanery] operator[SEP] identifier[conf] , identifier[restClient] operator[SEP] operator[SEP] identifier[String] identifier[apiKey] operator[=] identifier[getCurrentUserApiKey] operator[SEP] identifier[janbanery] operator[SEP] operator[SEP] identifier[conf] operator[SEP] identifier[forceKeyAuthMode] operator[SEP] identifier[apiKey] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[JanbaneryToWorkspace] operator[SEP] identifier[janbanery] operator[SEP] operator[SEP]
}
|
private void buildErrorNode(final CoreException ce) {
final TextArea ta = TextAreaBuilder.create()
.text(ce.getMessage())
.build();
this.errorNode = PaneBuilder.create().children(ta).build();
}
|
class class_name[name] begin[{]
method[buildErrorNode, return_type[void], modifier[private], parameter[ce]] begin[{]
local_variable[type[TextArea], ta]
assign[THIS[member[None.errorNode]], call[PaneBuilder.create, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[buildErrorNode] operator[SEP] Keyword[final] identifier[CoreException] identifier[ce] operator[SEP] {
Keyword[final] identifier[TextArea] identifier[ta] operator[=] identifier[TextAreaBuilder] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[text] operator[SEP] identifier[ce] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[errorNode] operator[=] identifier[PaneBuilder] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[children] operator[SEP] identifier[ta] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
private TableDataModel createTableModel() {
String[][] data = new String[][]{
new String[]{"Joe", "Bloggs", "01/02/1973"},
new String[]{"Jane", "Bloggs", "04/05/1976"},
new String[]{"Kid", "Bloggs", "31/12/1999"}
};
return new MyTableDataModel(data);
}
|
class class_name[name] begin[{]
method[createTableModel, return_type[type[TableDataModel]], modifier[private], parameter[]] begin[{]
local_variable[type[String], data]
return[ClassCreator(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MyTableDataModel, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[TableDataModel] identifier[createTableModel] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] identifier[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String] , literal[String] , literal[String]
} , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String] , literal[String] , literal[String]
} , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String] , literal[String] , literal[String]
}
} operator[SEP] Keyword[return] Keyword[new] identifier[MyTableDataModel] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
|
void unlink(Node<E> p, Node<E> trail) {
// assert isFullyLocked();
// p.next is not changed, to allow iterators that are
// traversing p to maintain their weak-consistency guarantee.
p.item = null;
trail.next = p.next;
if (last == p)
last = trail;
if (count.getAndDecrement() == capacity)
notFull.signal();
}
|
class class_name[name] begin[{]
method[unlink, return_type[void], modifier[default], parameter[p, trail]] begin[{]
assign[member[p.item], literal[null]]
assign[member[trail.next], member[p.next]]
if[binary_operation[member[.last], ==, member[.p]]] begin[{]
assign[member[.last], member[.trail]]
else begin[{]
None
end[}]
if[binary_operation[call[count.getAndDecrement, parameter[]], ==, member[.capacity]]] begin[{]
call[notFull.signal, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[void] identifier[unlink] operator[SEP] identifier[Node] operator[<] identifier[E] operator[>] identifier[p] , identifier[Node] operator[<] identifier[E] operator[>] identifier[trail] operator[SEP] {
identifier[p] operator[SEP] identifier[item] operator[=] Other[null] operator[SEP] identifier[trail] operator[SEP] identifier[next] operator[=] identifier[p] operator[SEP] identifier[next] operator[SEP] Keyword[if] operator[SEP] identifier[last] operator[==] identifier[p] operator[SEP] identifier[last] operator[=] identifier[trail] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[SEP] identifier[getAndDecrement] operator[SEP] operator[SEP] operator[==] identifier[capacity] operator[SEP] identifier[notFull] operator[SEP] identifier[signal] operator[SEP] operator[SEP] operator[SEP]
}
|
public static JavaRDD<List<List<Writable>>> zeroMeanUnitVarianceSequence(Schema schema,
JavaRDD<List<List<Writable>>> sequence, List<String> excludeColumns) {
DataRowsFacade frame = DataFrames.toDataFrameSequence(schema, sequence);
if (excludeColumns == null)
excludeColumns = Arrays.asList(DataFrames.SEQUENCE_UUID_COLUMN, DataFrames.SEQUENCE_INDEX_COLUMN);
else {
excludeColumns = new ArrayList<>(excludeColumns);
excludeColumns.add(DataFrames.SEQUENCE_UUID_COLUMN);
excludeColumns.add(DataFrames.SEQUENCE_INDEX_COLUMN);
}
frame = zeromeanUnitVariance(frame, excludeColumns);
return DataFrames.toRecordsSequence(frame).getSecond();
}
|
class class_name[name] begin[{]
method[zeroMeanUnitVarianceSequence, return_type[type[JavaRDD]], modifier[public static], parameter[schema, sequence, excludeColumns]] begin[{]
local_variable[type[DataRowsFacade], frame]
if[binary_operation[member[.excludeColumns], ==, literal[null]]] begin[{]
assign[member[.excludeColumns], call[Arrays.asList, parameter[member[DataFrames.SEQUENCE_UUID_COLUMN], member[DataFrames.SEQUENCE_INDEX_COLUMN]]]]
else begin[{]
assign[member[.excludeColumns], ClassCreator(arguments=[MemberReference(member=excludeColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
call[excludeColumns.add, parameter[member[DataFrames.SEQUENCE_UUID_COLUMN]]]
call[excludeColumns.add, parameter[member[DataFrames.SEQUENCE_INDEX_COLUMN]]]
end[}]
assign[member[.frame], call[.zeromeanUnitVariance, parameter[member[.frame], member[.excludeColumns]]]]
return[call[DataFrames.toRecordsSequence, parameter[member[.frame]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[JavaRDD] operator[<] identifier[List] operator[<] identifier[List] operator[<] identifier[Writable] operator[>] operator[>] operator[>] identifier[zeroMeanUnitVarianceSequence] operator[SEP] identifier[Schema] identifier[schema] , identifier[JavaRDD] operator[<] identifier[List] operator[<] identifier[List] operator[<] identifier[Writable] operator[>] operator[>] operator[>] identifier[sequence] , identifier[List] operator[<] identifier[String] operator[>] identifier[excludeColumns] operator[SEP] {
identifier[DataRowsFacade] identifier[frame] operator[=] identifier[DataFrames] operator[SEP] identifier[toDataFrameSequence] operator[SEP] identifier[schema] , identifier[sequence] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[excludeColumns] operator[==] Other[null] operator[SEP] identifier[excludeColumns] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[DataFrames] operator[SEP] identifier[SEQUENCE_UUID_COLUMN] , identifier[DataFrames] operator[SEP] identifier[SEQUENCE_INDEX_COLUMN] operator[SEP] operator[SEP] Keyword[else] {
identifier[excludeColumns] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[excludeColumns] operator[SEP] operator[SEP] identifier[excludeColumns] operator[SEP] identifier[add] operator[SEP] identifier[DataFrames] operator[SEP] identifier[SEQUENCE_UUID_COLUMN] operator[SEP] operator[SEP] identifier[excludeColumns] operator[SEP] identifier[add] operator[SEP] identifier[DataFrames] operator[SEP] identifier[SEQUENCE_INDEX_COLUMN] operator[SEP] operator[SEP]
}
identifier[frame] operator[=] identifier[zeromeanUnitVariance] operator[SEP] identifier[frame] , identifier[excludeColumns] operator[SEP] operator[SEP] Keyword[return] identifier[DataFrames] operator[SEP] identifier[toRecordsSequence] operator[SEP] identifier[frame] operator[SEP] operator[SEP] identifier[getSecond] operator[SEP] operator[SEP] operator[SEP]
}
|
protected String checkRoot(String path){
if(path==null||path.length()==0||path.equals("/")){
return "";
}else if(path.endsWith("/")){
return path.substring(0,path.length()-1);
}else if(path.startsWith("/")){
return path.substring(1,path.length());
}else{
return path;
}
}
|
class class_name[name] begin[{]
method[checkRoot, return_type[type[String]], modifier[protected], parameter[path]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.path], ==, literal[null]], ||, binary_operation[call[path.length, parameter[]], ==, literal[0]]], ||, call[path.equals, parameter[literal["/"]]]]] begin[{]
return[literal[""]]
else begin[{]
if[call[path.endsWith, parameter[literal["/"]]]] begin[{]
return[call[path.substring, parameter[literal[0], binary_operation[call[path.length, parameter[]], -, literal[1]]]]]
else begin[{]
if[call[path.startsWith, parameter[literal["/"]]]] begin[{]
return[call[path.substring, parameter[literal[1], call[path.length, parameter[]]]]]
else begin[{]
return[member[.path]]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[protected] identifier[String] identifier[checkRoot] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] identifier[path] operator[==] Other[null] operator[||] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[||] identifier[path] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[1] , identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[path] operator[SEP]
}
}
|
public UUID getUUID(FastTrackField type)
{
String value = getString(type);
UUID result = null;
if (value != null && !value.isEmpty() && value.length() >= 36)
{
if (value.startsWith("{"))
{
value = value.substring(1, value.length() - 1);
}
if (value.length() > 16)
{
value = value.substring(0, 36);
}
result = UUID.fromString(value);
}
return result;
}
|
class class_name[name] begin[{]
method[getUUID, return_type[type[UUID]], modifier[public], parameter[type]] begin[{]
local_variable[type[String], value]
local_variable[type[UUID], result]
if[binary_operation[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, call[value.isEmpty, parameter[]]], &&, binary_operation[call[value.length, parameter[]], >=, literal[36]]]] begin[{]
if[call[value.startsWith, parameter[literal["{"]]]] begin[{]
assign[member[.value], call[value.substring, parameter[literal[1], binary_operation[call[value.length, parameter[]], -, literal[1]]]]]
else begin[{]
None
end[}]
if[binary_operation[call[value.length, parameter[]], >, literal[16]]] begin[{]
assign[member[.value], call[value.substring, parameter[literal[0], literal[36]]]]
else begin[{]
None
end[}]
assign[member[.result], call[UUID.fromString, parameter[member[.value]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[UUID] identifier[getUUID] operator[SEP] identifier[FastTrackField] identifier[type] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[getString] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[UUID] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] operator[!] identifier[value] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>=] Other[36] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[value] operator[=] identifier[value] operator[SEP] identifier[substring] operator[SEP] Other[1] , identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[16] operator[SEP] {
identifier[value] operator[=] identifier[value] operator[SEP] identifier[substring] operator[SEP] Other[0] , Other[36] operator[SEP] operator[SEP]
}
identifier[result] operator[=] identifier[UUID] operator[SEP] identifier[fromString] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static Binder from(Class<?> returnType, Class<?> argType0, Class<?>... argTypes) {
return from(MethodType.methodType(returnType, argType0, argTypes));
}
|
class class_name[name] begin[{]
method[from, return_type[type[Binder]], modifier[public static], parameter[returnType, argType0, argTypes]] begin[{]
return[call[.from, parameter[call[MethodType.methodType, parameter[member[.returnType], member[.argType0], member[.argTypes]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Binder] identifier[from] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[returnType] , identifier[Class] operator[<] operator[?] operator[>] identifier[argType0] , identifier[Class] operator[<] operator[?] operator[>] operator[...] identifier[argTypes] operator[SEP] {
Keyword[return] identifier[from] operator[SEP] identifier[MethodType] operator[SEP] identifier[methodType] operator[SEP] identifier[returnType] , identifier[argType0] , identifier[argTypes] operator[SEP] operator[SEP] operator[SEP]
}
|
public Map<String, String> getDataAsMap(String prefix, String separator, int skipLines) {
if (separator.isEmpty()) {
throw new IllegalArgumentException("CSV separator cannot be empty");
}
Map<String, String> variables = new HashMap<>();
if (input != null) {
try {
String line;
int lineNum = 0;
StringBuilder multiLineValue = new StringBuilder();
String multiLineVariable = null;
while ((line = input.readLine()) != null) {
if (++lineNum > skipLines) {
if (line.startsWith("#")) {
continue;
}
String[] lineValues = JOrphanUtils.split(line, separator, false);
if (lineValues.length == 1) {
if (multiLineValue.length() > 0 && lineValues[0].endsWith("\"")) {
multiLineValue.append(lineValues[0].substring(0, lineValues[0].length() - 1));
variables.put(prefix + multiLineVariable, multiLineValue.toString());
// reset memory
multiLineValue.setLength(0);
multiLineVariable = null;
} else if (multiLineValue.length() > 0) {
multiLineValue.append(lineValues[0]).append('\n');
} else {
log.warn("Less than 2 columns at line: " + line);
variables.put(prefix + lineValues[0], "");
}
} else if (lineValues.length >= 2) {
if (lineValues[1].startsWith("\"")) {
// multi line value
multiLineVariable = lineValues[0];
multiLineValue.append(lineValues[1].substring(1)).append('\n');
} else {
variables.put(prefix + lineValues[0], lineValues[1]);
}
}
}
}
} catch (IOException ex) {
log.error("Error while reading: " + ex.getMessage());
}
}
return variables;
}
|
class class_name[name] begin[{]
method[getDataAsMap, return_type[type[Map]], modifier[public], parameter[prefix, separator, skipLines]] begin[{]
if[call[separator.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CSV separator cannot be empty")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Map], variables]
if[binary_operation[member[.input], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=lineNum)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=multiLineValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=multiLineVariable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lineNum, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), operandr=MemberReference(member=skipLines, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="#")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=split, postfix_operators=[], prefix_operators=[], qualifier=JOrphanUtils, selectors=[], type_arguments=None), name=lineValues)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lineValues, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lineValues, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\"")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=+), MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=put, postfix_operators=[], prefix_operators=[], qualifier=variables, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=multiLineVariable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=append, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\"")], member=endsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Less than 2 columns at line: "), operandr=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=put, postfix_operators=[], prefix_operators=[], qualifier=variables, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MemberReference(member=lineValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=append, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=multiLineVariable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=variables, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=multiLineValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=multiLineVariable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))]))]))]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while reading: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.variables]]
end[}]
END[}]
|
Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[getDataAsMap] operator[SEP] identifier[String] identifier[prefix] , identifier[String] identifier[separator] , Keyword[int] identifier[skipLines] operator[SEP] {
Keyword[if] operator[SEP] identifier[separator] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[variables] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[input] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[String] identifier[line] operator[SEP] Keyword[int] identifier[lineNum] operator[=] Other[0] operator[SEP] identifier[StringBuilder] identifier[multiLineValue] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[multiLineVariable] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[input] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[++] identifier[lineNum] operator[>] identifier[skipLines] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[lineValues] operator[=] identifier[JOrphanUtils] operator[SEP] identifier[split] operator[SEP] identifier[line] , identifier[separator] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lineValues] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[multiLineValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] identifier[lineValues] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[multiLineValue] operator[SEP] identifier[append] operator[SEP] identifier[lineValues] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[lineValues] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[prefix] operator[+] identifier[multiLineVariable] , identifier[multiLineValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[multiLineValue] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[multiLineVariable] operator[=] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[multiLineValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[multiLineValue] operator[SEP] identifier[append] operator[SEP] identifier[lineValues] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[line] operator[SEP] operator[SEP] identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[prefix] operator[+] identifier[lineValues] operator[SEP] Other[0] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[lineValues] operator[SEP] identifier[length] operator[>=] Other[2] operator[SEP] {
Keyword[if] operator[SEP] identifier[lineValues] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[multiLineVariable] operator[=] identifier[lineValues] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[multiLineValue] operator[SEP] identifier[append] operator[SEP] identifier[lineValues] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[prefix] operator[+] identifier[lineValues] operator[SEP] Other[0] operator[SEP] , identifier[lineValues] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[variables] operator[SEP]
}
|
public String login(Authentication authentication) {
String token = getToken();
return login(token, authentication);
}
|
class class_name[name] begin[{]
method[login, return_type[type[String]], modifier[public], parameter[authentication]] begin[{]
local_variable[type[String], token]
return[call[.login, parameter[member[.token], member[.authentication]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[login] operator[SEP] identifier[Authentication] identifier[authentication] operator[SEP] {
identifier[String] identifier[token] operator[=] identifier[getToken] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[login] operator[SEP] identifier[token] , identifier[authentication] operator[SEP] operator[SEP]
}
|
public static <T, R, E extends Exception> List<R> map(final T[] a, final int fromIndex, final int toIndex,
final Try.Function<? super T, ? extends R, E> func) throws E {
checkFromToIndex(fromIndex, toIndex, len(a));
N.checkArgNotNull(func);
if (N.isNullOrEmpty(a)) {
return new ArrayList<>();
}
final List<R> result = new ArrayList<>(toIndex - fromIndex);
for (int i = fromIndex; i < toIndex; i++) {
result.add(func.apply(a[i]));
}
return result;
}
|
class class_name[name] begin[{]
method[map, return_type[type[List]], modifier[public static], parameter[a, fromIndex, toIndex, func]] begin[{]
call[.checkFromToIndex, parameter[member[.fromIndex], member[.toIndex], call[.len, parameter[member[.a]]]]]
call[N.checkArgNotNull, parameter[member[.func]]]
if[call[N.isNullOrEmpty, parameter[member[.a]]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[List], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=func, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=toIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=fromIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[R] , identifier[E] Keyword[extends] identifier[Exception] operator[>] identifier[List] operator[<] identifier[R] operator[>] identifier[map] operator[SEP] Keyword[final] identifier[T] operator[SEP] operator[SEP] identifier[a] , Keyword[final] Keyword[int] identifier[fromIndex] , Keyword[final] Keyword[int] identifier[toIndex] , Keyword[final] identifier[Try] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[R] , identifier[E] operator[>] identifier[func] operator[SEP] Keyword[throws] identifier[E] {
identifier[checkFromToIndex] operator[SEP] identifier[fromIndex] , identifier[toIndex] , identifier[len] operator[SEP] identifier[a] operator[SEP] operator[SEP] operator[SEP] identifier[N] operator[SEP] identifier[checkArgNotNull] operator[SEP] identifier[func] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[a] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[R] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[toIndex] operator[-] identifier[fromIndex] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[fromIndex] operator[SEP] identifier[i] operator[<] identifier[toIndex] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[func] operator[SEP] identifier[apply] operator[SEP] identifier[a] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public DateTime getDateTime(int index) {
return new DateTime(rows.get(row).getString(index));
}
|
class class_name[name] begin[{]
method[getDateTime, return_type[type[DateTime]], modifier[public], parameter[index]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=rows, selectors=[MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DateTime, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[DateTime] identifier[getDateTime] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[return] Keyword[new] identifier[DateTime] operator[SEP] identifier[rows] operator[SEP] identifier[get] operator[SEP] identifier[row] operator[SEP] operator[SEP] identifier[getString] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP]
}
|
protected long scanPagesToSend(long maxClientReplicatedPageVersion, FastUnsafeOffHeapIntList pagesToSend)
{
long maxPageVersion = 0;
boolean upgraded = false;
for(int i=0;i<this.pageVersionList.size();i++)
{
if (pageVersionList.get(i) == 0 && !upgraded)
{
boolean originalLockWasReleased = this.readWriteLock.upgradeToWriteLock();
this.currentPageVersion++;
if (originalLockWasReleased)
{
pagesToSend.clear();
for(int j=0;j<i;j++)
{
maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, j);
}
}
upgraded = true;
}
maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, i);
}
return maxPageVersion;
}
|
class class_name[name] begin[{]
method[scanPagesToSend, return_type[type[long]], modifier[protected], parameter[maxClientReplicatedPageVersion, pagesToSend]] begin[{]
local_variable[type[long], maxPageVersion]
local_variable[type[boolean], upgraded]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=pageVersionList, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operandr=MemberReference(member=upgraded, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=readWriteLock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=upgradeToWriteLock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=originalLockWasReleased)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=This(postfix_operators=['++'], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=currentPageVersion, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None), IfStatement(condition=MemberReference(member=originalLockWasReleased, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=pagesToSend, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxPageVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=maxClientReplicatedPageVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pagesToSend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxPageVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=markAndAddPageIfRequired, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=upgraded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxPageVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=maxClientReplicatedPageVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pagesToSend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxPageVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=markAndAddPageIfRequired, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pageVersionList, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.maxPageVersion]]
end[}]
END[}]
|
Keyword[protected] Keyword[long] identifier[scanPagesToSend] operator[SEP] Keyword[long] identifier[maxClientReplicatedPageVersion] , identifier[FastUnsafeOffHeapIntList] identifier[pagesToSend] operator[SEP] {
Keyword[long] identifier[maxPageVersion] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[upgraded] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Keyword[this] operator[SEP] identifier[pageVersionList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[pageVersionList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[==] Other[0] operator[&&] operator[!] identifier[upgraded] operator[SEP] {
Keyword[boolean] identifier[originalLockWasReleased] operator[=] Keyword[this] operator[SEP] identifier[readWriteLock] operator[SEP] identifier[upgradeToWriteLock] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[currentPageVersion] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[originalLockWasReleased] operator[SEP] {
identifier[pagesToSend] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[i] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[maxPageVersion] operator[=] identifier[markAndAddPageIfRequired] operator[SEP] identifier[maxClientReplicatedPageVersion] , identifier[pagesToSend] , identifier[maxPageVersion] , identifier[j] operator[SEP] operator[SEP]
}
}
identifier[upgraded] operator[=] literal[boolean] operator[SEP]
}
identifier[maxPageVersion] operator[=] identifier[markAndAddPageIfRequired] operator[SEP] identifier[maxClientReplicatedPageVersion] , identifier[pagesToSend] , identifier[maxPageVersion] , identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[maxPageVersion] operator[SEP]
}
|
public static double[] singularValues( DMatrixRMaj A ) {
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,true,true);
if( svd.inputModified() ) {
A = A.copy();
}
if( !svd.decompose(A)) {
throw new RuntimeException("SVD Failed!");
}
double sv[] = svd.getSingularValues();
Arrays.sort(sv,0,svd.numberOfSingularValues());
// change the ordering to ascending
for (int i = 0; i < sv.length/2; i++) {
double tmp = sv[i];
sv[i] = sv[sv.length-i-1];
sv[sv.length-i-1] = tmp;
}
return sv;
}
|
class class_name[name] begin[{]
method[singularValues, return_type[type[double]], modifier[public static], parameter[A]] begin[{]
local_variable[type[SingularValueDecomposition_F64], svd]
if[call[svd.inputModified, parameter[]]] begin[{]
assign[member[.A], call[A.copy, parameter[]]]
else begin[{]
None
end[}]
if[call[svd.decompose, parameter[member[.A]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SVD Failed!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[double], sv]
call[Arrays.sort, parameter[member[.sv], literal[0], call[svd.numberOfSingularValues, parameter[]]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=sv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=tmp)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=sv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=sv, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=sv, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), type==, value=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=sv, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.sv]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[singularValues] operator[SEP] identifier[DMatrixRMaj] identifier[A] operator[SEP] {
identifier[SingularValueDecomposition_F64] operator[<] identifier[DMatrixRMaj] operator[>] identifier[svd] operator[=] identifier[DecompositionFactory_DDRM] operator[SEP] identifier[svd] operator[SEP] identifier[A] operator[SEP] identifier[numRows] , identifier[A] operator[SEP] identifier[numCols] , literal[boolean] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[svd] operator[SEP] identifier[inputModified] operator[SEP] operator[SEP] operator[SEP] {
identifier[A] operator[=] identifier[A] operator[SEP] identifier[copy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[svd] operator[SEP] identifier[decompose] operator[SEP] identifier[A] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[double] identifier[sv] operator[SEP] operator[SEP] operator[=] identifier[svd] operator[SEP] identifier[getSingularValues] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[sv] , Other[0] , identifier[svd] operator[SEP] identifier[numberOfSingularValues] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[sv] operator[SEP] identifier[length] operator[/] Other[2] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[double] identifier[tmp] operator[=] identifier[sv] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sv] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[sv] operator[SEP] identifier[sv] operator[SEP] identifier[length] operator[-] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] identifier[sv] operator[SEP] identifier[sv] operator[SEP] identifier[length] operator[-] identifier[i] operator[-] Other[1] operator[SEP] operator[=] identifier[tmp] operator[SEP]
}
Keyword[return] identifier[sv] operator[SEP]
}
|
@SuppressWarnings("rawtypes")
public static void setOnObservableAssembly(@Nullable Function<? super Observable, ? extends Observable> onObservableAssembly) {
if (lockdown) {
throw new IllegalStateException("Plugins can't be changed anymore");
}
RxJavaPlugins.onObservableAssembly = onObservableAssembly;
}
|
class class_name[name] begin[{]
method[setOnObservableAssembly, return_type[void], modifier[public static], parameter[onObservableAssembly]] begin[{]
if[member[.lockdown]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Plugins can't be changed anymore")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[RxJavaPlugins.onObservableAssembly], member[.onObservableAssembly]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[setOnObservableAssembly] operator[SEP] annotation[@] identifier[Nullable] identifier[Function] operator[<] operator[?] Keyword[super] identifier[Observable] , operator[?] Keyword[extends] identifier[Observable] operator[>] identifier[onObservableAssembly] operator[SEP] {
Keyword[if] operator[SEP] identifier[lockdown] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[RxJavaPlugins] operator[SEP] identifier[onObservableAssembly] operator[=] identifier[onObservableAssembly] operator[SEP]
}
|
public void completePayment(@NonNull PaymentCompletionProvider provider) {
provider.completePayment(mPaymentSessionData,
new PaymentResultListener() {
@Override
public void onPaymentResult(@NonNull @PaymentResult String paymentResult) {
mPaymentSessionData.setPaymentResult(paymentResult);
mCustomerSession.resetUsageTokens();
if (mPaymentSessionListener != null) {
mPaymentSessionListener
.onPaymentSessionDataChanged(mPaymentSessionData);
}
}
});
}
|
class class_name[name] begin[{]
method[completePayment, return_type[void], modifier[public], parameter[provider]] begin[{]
call[provider.completePayment, parameter[member[.mPaymentSessionData], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=paymentResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPaymentResult, postfix_operators=[], prefix_operators=[], qualifier=mPaymentSessionData, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=resetUsageTokens, postfix_operators=[], prefix_operators=[], qualifier=mCustomerSession, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mPaymentSessionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mPaymentSessionData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onPaymentSessionDataChanged, postfix_operators=[], prefix_operators=[], qualifier=mPaymentSessionListener, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=onPaymentResult, parameters=[FormalParameter(annotations=[Annotation(element=None, name=NonNull), Annotation(element=None, name=PaymentResult)], modifiers=set(), name=paymentResult, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PaymentResultListener, sub_type=None))]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[completePayment] operator[SEP] annotation[@] identifier[NonNull] identifier[PaymentCompletionProvider] identifier[provider] operator[SEP] {
identifier[provider] operator[SEP] identifier[completePayment] operator[SEP] identifier[mPaymentSessionData] , Keyword[new] identifier[PaymentResultListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onPaymentResult] operator[SEP] annotation[@] identifier[NonNull] annotation[@] identifier[PaymentResult] identifier[String] identifier[paymentResult] operator[SEP] {
identifier[mPaymentSessionData] operator[SEP] identifier[setPaymentResult] operator[SEP] identifier[paymentResult] operator[SEP] operator[SEP] identifier[mCustomerSession] operator[SEP] identifier[resetUsageTokens] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mPaymentSessionListener] operator[!=] Other[null] operator[SEP] {
identifier[mPaymentSessionListener] operator[SEP] identifier[onPaymentSessionDataChanged] operator[SEP] identifier[mPaymentSessionData] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public void addPathDetails(Map<String, List<PathDetail>> details) {
if (!this.pathDetails.isEmpty() && !details.isEmpty() && this.pathDetails.size() != details.size()) {
throw new IllegalStateException("Details have to be the same size");
}
for (Map.Entry<String, List<PathDetail>> detailEntry : details.entrySet()) {
if (this.pathDetails.containsKey(detailEntry.getKey())) {
List<PathDetail> pd = this.pathDetails.get(detailEntry.getKey());
merge(pd, detailEntry.getValue());
} else {
this.pathDetails.put(detailEntry.getKey(), detailEntry.getValue());
}
}
}
|
class class_name[name] begin[{]
method[addPathDetails, return_type[void], modifier[public], parameter[details]] begin[{]
if[binary_operation[binary_operation[THIS[member[None.pathDetails]call[None.isEmpty, parameter[]]], &&, call[details.isEmpty, parameter[]]], &&, binary_operation[THIS[member[None.pathDetails]call[None.size, parameter[]]], !=, call[details.size, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Details have to be the same size")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pathDetails, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=detailEntry, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pathDetails, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=detailEntry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=detailEntry, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pathDetails, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=detailEntry, selectors=[], type_arguments=None)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=pd)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=PathDetail, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=detailEntry, selectors=[], type_arguments=None)], member=merge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=details, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=detailEntry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=PathDetail, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addPathDetails] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[PathDetail] operator[>] operator[>] identifier[details] operator[SEP] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[pathDetails] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[details] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] Keyword[this] operator[SEP] identifier[pathDetails] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] identifier[details] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[List] operator[<] identifier[PathDetail] operator[>] operator[>] identifier[detailEntry] operator[:] identifier[details] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[pathDetails] operator[SEP] identifier[containsKey] operator[SEP] identifier[detailEntry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[PathDetail] operator[>] identifier[pd] operator[=] Keyword[this] operator[SEP] identifier[pathDetails] operator[SEP] identifier[get] operator[SEP] identifier[detailEntry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[merge] operator[SEP] identifier[pd] , identifier[detailEntry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[pathDetails] operator[SEP] identifier[put] operator[SEP] identifier[detailEntry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[detailEntry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void batchSync(List<Dml> dmls, OuterAdapter adapter) {
// 分批同步
if (dmls.size() <= canalClientConfig.getSyncBatchSize()) {
adapter.sync(dmls);
} else {
int len = 0;
List<Dml> dmlsBatch = new ArrayList<>();
for (Dml dml : dmls) {
dmlsBatch.add(dml);
if (dml.getData() == null || dml.getData().isEmpty()) {
len += 1;
} else {
len += dml.getData().size();
}
if (len >= canalClientConfig.getSyncBatchSize()) {
adapter.sync(dmlsBatch);
dmlsBatch.clear();
len = 0;
}
}
if (!dmlsBatch.isEmpty()) {
adapter.sync(dmlsBatch);
}
}
}
|
class class_name[name] begin[{]
method[batchSync, return_type[void], modifier[private], parameter[dmls, adapter]] begin[{]
if[binary_operation[call[dmls.size, parameter[]], <=, call[canalClientConfig.getSyncBatchSize, parameter[]]]] begin[{]
call[adapter.sync, parameter[member[.dmls]]]
else begin[{]
local_variable[type[int], len]
local_variable[type[List], dmlsBatch]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=dmlsBatch, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=dml, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=dml, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=dml, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getSyncBatchSize, postfix_operators=[], prefix_operators=[], qualifier=canalClientConfig, selectors=[], type_arguments=None), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dmlsBatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sync, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=dmlsBatch, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=dmls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dml)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Dml, sub_type=None))), label=None)
if[call[dmlsBatch.isEmpty, parameter[]]] begin[{]
call[adapter.sync, parameter[member[.dmlsBatch]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[batchSync] operator[SEP] identifier[List] operator[<] identifier[Dml] operator[>] identifier[dmls] , identifier[OuterAdapter] identifier[adapter] operator[SEP] {
Keyword[if] operator[SEP] identifier[dmls] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<=] identifier[canalClientConfig] operator[SEP] identifier[getSyncBatchSize] operator[SEP] operator[SEP] operator[SEP] {
identifier[adapter] operator[SEP] identifier[sync] operator[SEP] identifier[dmls] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[len] operator[=] Other[0] operator[SEP] identifier[List] operator[<] identifier[Dml] operator[>] identifier[dmlsBatch] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Dml] identifier[dml] operator[:] identifier[dmls] operator[SEP] {
identifier[dmlsBatch] operator[SEP] identifier[add] operator[SEP] identifier[dml] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dml] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[dml] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[len] operator[+=] Other[1] operator[SEP]
}
Keyword[else] {
identifier[len] operator[+=] identifier[dml] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[len] operator[>=] identifier[canalClientConfig] operator[SEP] identifier[getSyncBatchSize] operator[SEP] operator[SEP] operator[SEP] {
identifier[adapter] operator[SEP] identifier[sync] operator[SEP] identifier[dmlsBatch] operator[SEP] operator[SEP] identifier[dmlsBatch] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[len] operator[=] Other[0] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[dmlsBatch] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[adapter] operator[SEP] identifier[sync] operator[SEP] identifier[dmlsBatch] operator[SEP] operator[SEP]
}
}
}
|
public static boolean hasHaving(JPQLExpression jpqlExpression)
{
if (isSelectStatement(jpqlExpression))
{
return ((SelectStatement) jpqlExpression.getQueryStatement()).hasHavingClause();
}
return false;
}
|
class class_name[name] begin[{]
method[hasHaving, return_type[type[boolean]], modifier[public static], parameter[jpqlExpression]] begin[{]
if[call[.isSelectStatement, parameter[member[.jpqlExpression]]]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[], member=getQueryStatement, postfix_operators=[], prefix_operators=[], qualifier=jpqlExpression, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SelectStatement, sub_type=None))]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[hasHaving] operator[SEP] identifier[JPQLExpression] identifier[jpqlExpression] operator[SEP] {
Keyword[if] operator[SEP] identifier[isSelectStatement] operator[SEP] identifier[jpqlExpression] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[SelectStatement] operator[SEP] identifier[jpqlExpression] operator[SEP] identifier[getQueryStatement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[hasHavingClause] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void waitUntilIdle() {
// Wait till we are all done
long t0 = System.currentTimeMillis();
synchronized (poolsIdle) {
while (!arePoolsIdle()) {
try {
poolsIdle.wait();
} catch (InterruptedException e) {
logger.error("Failed to wait on termination condition: " + e.getMessage());
}
}
}
long t1 = System.currentTimeMillis();
logger.info(
"Finished running " + GlobalState.agents.size() + agentsIn + Log.formattedDuration(t0, t1));
}
|
class class_name[name] begin[{]
method[waitUntilIdle, return_type[void], modifier[public static], parameter[]] begin[{]
local_variable[type[long], t0]
SYNCHRONIZED[member[.poolsIdle]] BEGIN[{]
while[call[.arePoolsIdle, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=wait, postfix_operators=[], prefix_operators=[], qualifier=poolsIdle, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to wait on termination condition: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
local_variable[type[long], t1]
call[logger.info, parameter[binary_operation[binary_operation[binary_operation[literal["Finished running "], +, call[GlobalState.agents.size, parameter[]]], +, member[.agentsIn]], +, call[Log.formattedDuration, parameter[member[.t0], member[.t1]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[waitUntilIdle] operator[SEP] operator[SEP] {
Keyword[long] identifier[t0] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[poolsIdle] operator[SEP] {
Keyword[while] operator[SEP] operator[!] identifier[arePoolsIdle] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[poolsIdle] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[long] identifier[t1] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[GlobalState] operator[SEP] identifier[agents] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[agentsIn] operator[+] identifier[Log] operator[SEP] identifier[formattedDuration] operator[SEP] identifier[t0] , identifier[t1] operator[SEP] operator[SEP] operator[SEP]
}
|
@NonNull
public IconicsDrawable sizeDpY(@Dimension(unit = DP) int sizeDp) {
return sizePxY(Utils.convertDpToPx(mContext, sizeDp));
}
|
class class_name[name] begin[{]
method[sizeDpY, return_type[type[IconicsDrawable]], modifier[public], parameter[sizeDp]] begin[{]
return[call[.sizePxY, parameter[call[Utils.convertDpToPx, parameter[member[.mContext], member[.sizeDp]]]]]]
end[}]
END[}]
|
annotation[@] identifier[NonNull] Keyword[public] identifier[IconicsDrawable] identifier[sizeDpY] operator[SEP] annotation[@] identifier[Dimension] operator[SEP] identifier[unit] operator[=] identifier[DP] operator[SEP] Keyword[int] identifier[sizeDp] operator[SEP] {
Keyword[return] identifier[sizePxY] operator[SEP] identifier[Utils] operator[SEP] identifier[convertDpToPx] operator[SEP] identifier[mContext] , identifier[sizeDp] operator[SEP] operator[SEP] operator[SEP]
}
|
private void removeCollectionParameters() {
int parmCount = SignatureUtils.getNumParameters(getSigConstantOperand());
if (stack.getStackDepth() >= parmCount) {
for (int i = 0; i < parmCount; i++) {
OpcodeStack.Item item = stack.getStackItem(i);
XField field = item.getXField();
if (field != null) {
collectionFields.remove(field.getName());
}
}
}
}
|
class class_name[name] begin[{]
method[removeCollectionParameters, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[int], parmCount]
if[binary_operation[call[stack.getStackDepth, parameter[]], >=, member[.parmCount]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getStackItem, postfix_operators=[], prefix_operators=[], qualifier=stack, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OpcodeStack, sub_type=ReferenceType(arguments=None, dimensions=None, name=Item, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getXField, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XField, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=collectionFields, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=parmCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[removeCollectionParameters] operator[SEP] operator[SEP] {
Keyword[int] identifier[parmCount] operator[=] identifier[SignatureUtils] operator[SEP] identifier[getNumParameters] operator[SEP] identifier[getSigConstantOperand] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stack] operator[SEP] identifier[getStackDepth] operator[SEP] operator[SEP] operator[>=] identifier[parmCount] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[parmCount] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[OpcodeStack] operator[SEP] identifier[Item] identifier[item] operator[=] identifier[stack] operator[SEP] identifier[getStackItem] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[XField] identifier[field] operator[=] identifier[item] operator[SEP] identifier[getXField] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] {
identifier[collectionFields] operator[SEP] identifier[remove] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
@SuppressWarnings({"static-method"})
protected String generateXml(Map<String, Object> map) throws JsonProcessingException {
final XmlMapper mapper = new XmlMapper();
return mapper.writerWithDefaultPrettyPrinter().withRootName(XML_ROOT_NAME).writeValueAsString(map);
}
|
class class_name[name] begin[{]
method[generateXml, return_type[type[String]], modifier[protected], parameter[map]] begin[{]
local_variable[type[XmlMapper], mapper]
return[call[mapper.writerWithDefaultPrettyPrinter, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String]
} operator[SEP] Keyword[protected] identifier[String] identifier[generateXml] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[map] operator[SEP] Keyword[throws] identifier[JsonProcessingException] {
Keyword[final] identifier[XmlMapper] identifier[mapper] operator[=] Keyword[new] identifier[XmlMapper] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[mapper] operator[SEP] identifier[writerWithDefaultPrettyPrinter] operator[SEP] operator[SEP] operator[SEP] identifier[withRootName] operator[SEP] identifier[XML_ROOT_NAME] operator[SEP] operator[SEP] identifier[writeValueAsString] operator[SEP] identifier[map] operator[SEP] operator[SEP]
}
|
public void writeTo (@Nonnull final byte [] aBuf, @Nonnegative final int nOfs, @Nonnegative final int nLen)
{
writeTo (aBuf, nOfs, nLen, true);
}
|
class class_name[name] begin[{]
method[writeTo, return_type[void], modifier[public], parameter[aBuf, nOfs, nLen]] begin[{]
call[.writeTo, parameter[member[.aBuf], member[.nOfs], member[.nLen], literal[true]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[writeTo] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[aBuf] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nOfs] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nLen] operator[SEP] {
identifier[writeTo] operator[SEP] identifier[aBuf] , identifier[nOfs] , identifier[nLen] , literal[boolean] operator[SEP] operator[SEP]
}
|
private Map<String, Double> getTF(String content) {
Map<String,Double> tfMap=new HashMap<>();
if(content==null || content.equals(""))
return tfMap;
JiebaSegmenter segmenter = new JiebaSegmenter();
List<String> segments=segmenter.sentenceProcess(content);
Map<String,Integer> freqMap=new HashMap<>();
int wordSum=0;
for(String segment:segments) {
//停用词不予考虑,单字词不予考虑
if(!stopWordsSet.contains(segment) && segment.length()>1) {
wordSum++;
if(freqMap.containsKey(segment)) {
freqMap.put(segment,freqMap.get(segment)+1);
}else {
freqMap.put(segment, 1);
}
}
}
// 计算double型的tf值
for(String word:freqMap.keySet()) {
tfMap.put(word,freqMap.get(word)*0.1/wordSum);
}
return tfMap;
}
|
class class_name[name] begin[{]
method[getTF, return_type[type[Map]], modifier[private], parameter[content]] begin[{]
local_variable[type[Map], tfMap]
if[binary_operation[binary_operation[member[.content], ==, literal[null]], ||, call[content.equals, parameter[literal[""]]]]] begin[{]
return[member[.tfMap]]
else begin[{]
None
end[}]
local_variable[type[JiebaSegmenter], segmenter]
local_variable[type[List], segments]
local_variable[type[Map], freqMap]
local_variable[type[int], wordSum]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=stopWordsSet, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=segment, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=wordSum, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=freqMap, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=put, postfix_operators=[], prefix_operators=[], qualifier=freqMap, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=freqMap, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=put, postfix_operators=[], prefix_operators=[], qualifier=freqMap, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=segments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=segment)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=freqMap, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.1), operator=*), operandr=MemberReference(member=wordSum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)], member=put, postfix_operators=[], prefix_operators=[], qualifier=tfMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=freqMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.tfMap]]
end[}]
END[}]
|
Keyword[private] identifier[Map] operator[<] identifier[String] , identifier[Double] operator[>] identifier[getTF] operator[SEP] identifier[String] identifier[content] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Double] operator[>] identifier[tfMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[content] operator[==] Other[null] operator[||] identifier[content] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[tfMap] operator[SEP] identifier[JiebaSegmenter] identifier[segmenter] operator[=] Keyword[new] identifier[JiebaSegmenter] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[segments] operator[=] identifier[segmenter] operator[SEP] identifier[sentenceProcess] operator[SEP] identifier[content] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[freqMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[wordSum] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[segment] operator[:] identifier[segments] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[stopWordsSet] operator[SEP] identifier[contains] operator[SEP] identifier[segment] operator[SEP] operator[&&] identifier[segment] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[wordSum] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[freqMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[segment] operator[SEP] operator[SEP] {
identifier[freqMap] operator[SEP] identifier[put] operator[SEP] identifier[segment] , identifier[freqMap] operator[SEP] identifier[get] operator[SEP] identifier[segment] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[freqMap] operator[SEP] identifier[put] operator[SEP] identifier[segment] , Other[1] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[String] identifier[word] operator[:] identifier[freqMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[tfMap] operator[SEP] identifier[put] operator[SEP] identifier[word] , identifier[freqMap] operator[SEP] identifier[get] operator[SEP] identifier[word] operator[SEP] operator[*] literal[Float] operator[/] identifier[wordSum] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tfMap] operator[SEP]
}
|
public boolean isJava7SwitchExpression(final XSwitchExpression it) {
boolean _xblockexpression = false;
{
final LightweightTypeReference switchType = this.getSwitchVariableType(it);
if ((switchType == null)) {
return false;
}
boolean _isSubtypeOf = switchType.isSubtypeOf(Integer.TYPE);
if (_isSubtypeOf) {
return true;
}
boolean _isSubtypeOf_1 = switchType.isSubtypeOf(Enum.class);
if (_isSubtypeOf_1) {
return true;
}
boolean _isSubtypeOf_2 = switchType.isSubtypeOf(String.class);
if (_isSubtypeOf_2) {
return true;
}
_xblockexpression = false;
}
return _xblockexpression;
}
|
class class_name[name] begin[{]
method[isJava7SwitchExpression, return_type[type[boolean]], modifier[public], parameter[it]] begin[{]
local_variable[type[boolean], _xblockexpression]
local_variable[type[LightweightTypeReference], switchType]
if[binary_operation[member[.switchType], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[boolean], _isSubtypeOf]
if[member[._isSubtypeOf]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], _isSubtypeOf_1]
if[member[._isSubtypeOf_1]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], _isSubtypeOf_2]
if[member[._isSubtypeOf_2]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
assign[member[._xblockexpression], literal[false]]
return[member[._xblockexpression]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isJava7SwitchExpression] operator[SEP] Keyword[final] identifier[XSwitchExpression] identifier[it] operator[SEP] {
Keyword[boolean] identifier[_xblockexpression] operator[=] literal[boolean] operator[SEP] {
Keyword[final] identifier[LightweightTypeReference] identifier[switchType] operator[=] Keyword[this] operator[SEP] identifier[getSwitchVariableType] operator[SEP] identifier[it] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[switchType] operator[==] Other[null] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[_isSubtypeOf] operator[=] identifier[switchType] operator[SEP] identifier[isSubtypeOf] operator[SEP] identifier[Integer] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_isSubtypeOf] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[_isSubtypeOf_1] operator[=] identifier[switchType] operator[SEP] identifier[isSubtypeOf] operator[SEP] identifier[Enum] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_isSubtypeOf_1] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[_isSubtypeOf_2] operator[=] identifier[switchType] operator[SEP] identifier[isSubtypeOf] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_isSubtypeOf_2] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[_xblockexpression] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[_xblockexpression] operator[SEP]
}
|
private void findGroupBys() {
if (filters == null || filters.isEmpty()) {
return;
}
if ((use_multi_gets && override_multi_get) && !search_query_failure) {
}
row_key_literals = new ByteMap<byte[][]>();
final int expansion_limit = tsdb.getConfig().getInt(
"tsd.query.filter.expansion_limit");
Collections.sort(filters);
final Iterator<TagVFilter> current_iterator = filters.iterator();
final Iterator<TagVFilter> look_ahead = filters.iterator();
byte[] tagk = null;
TagVFilter next = look_ahead.hasNext() ? look_ahead.next() : null;
int row_key_literals_count = 0;
while (current_iterator.hasNext()) {
next = look_ahead.hasNext() ? look_ahead.next() : null;
int gbs = 0;
// sorted!
final ByteMap<Void> literals = new ByteMap<Void>();
final List<TagVFilter> literal_filters = new ArrayList<TagVFilter>();
TagVFilter current = null;
do { // yeah, I'm breakin out the do!!!
current = current_iterator.next();
if (tagk == null) {
tagk = new byte[TSDB.tagk_width()];
System.arraycopy(current.getTagkBytes(), 0, tagk, 0, TSDB.tagk_width());
}
if (current.isGroupBy()) {
gbs++;
}
if (!current.getTagVUids().isEmpty()) {
for (final byte[] uid : current.getTagVUids()) {
literals.put(uid, null);
}
literal_filters.add(current);
}
if (next != null && Bytes.memcmp(tagk, next.getTagkBytes()) != 0) {
break;
}
next = look_ahead.hasNext() ? look_ahead.next() : null;
} while (current_iterator.hasNext() &&
Bytes.memcmp(tagk, current.getTagkBytes()) == 0);
if (gbs > 0) {
if (group_bys == null) {
group_bys = new ArrayList<byte[]>();
}
group_bys.add(current.getTagkBytes());
}
if (literals.size() > 0) {
if (literals.size() + row_key_literals_count > expansion_limit) {
LOG.debug("Skipping literals for " + current.getTagk() +
" as it exceedes the limit");
//has_filter_cannot_use_get = true;
} else {
final byte[][] values = new byte[literals.size()][];
literals.keySet().toArray(values);
row_key_literals.put(current.getTagkBytes(), values);
row_key_literals_count += values.length;
for (final TagVFilter filter : literal_filters) {
filter.setPostScan(false);
}
}
} else {
row_key_literals.put(current.getTagkBytes(), null);
// no literal values, just keys, so we can't multi-get
if (search_query_failure) {
use_multi_gets = false;
}
}
// make sure the multi-get cardinality doesn't exceed our limit (or disable
// multi-gets)
if ((use_multi_gets && override_multi_get)) {
int multi_get_limit = tsdb.getConfig().getInt("tsd.query.multi_get.limit");
int cardinality = filters.size() * row_key_literals_count;
if (cardinality > multi_get_limit) {
use_multi_gets = false;
} else if (search_query_failure) {
row_key_literals_list.add(row_key_literals);
}
// TODO - account for time as well
}
}
}
|
class class_name[name] begin[{]
method[findGroupBys, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.filters], ==, literal[null]], ||, call[filters.isEmpty, parameter[]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.use_multi_gets], &&, member[.override_multi_get]], &&, member[.search_query_failure]]] begin[{]
else begin[{]
None
end[}]
assign[member[.row_key_literals], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None, None], name=byte))], dimensions=None, name=ByteMap, sub_type=None))]
local_variable[type[int], expansion_limit]
call[Collections.sort, parameter[member[.filters]]]
local_variable[type[Iterator], current_iterator]
local_variable[type[Iterator], look_ahead]
local_variable[type[byte], tagk]
local_variable[type[TagVFilter], next]
local_variable[type[int], row_key_literals_count]
while[call[current_iterator.hasNext, parameter[]]] begin[{]
assign[member[.next], TernaryExpression(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=look_ahead, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=look_ahead, selectors=[], type_arguments=None))]
local_variable[type[int], gbs]
local_variable[type[ByteMap], literals]
local_variable[type[List], literal_filters]
local_variable[type[TagVFilter], current]
do[binary_operation[call[current_iterator.hasNext, parameter[]], &&, binary_operation[call[Bytes.memcmp, parameter[member[.tagk], call[current.getTagkBytes, parameter[]]]], ==, literal[0]]]] begin[{]
assign[member[.current], call[current_iterator.next, parameter[]]]
if[binary_operation[member[.tagk], ==, literal[null]]] begin[{]
assign[member[.tagk], ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=tagk_width, postfix_operators=[], prefix_operators=[], qualifier=TSDB, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))]
call[System.arraycopy, parameter[call[current.getTagkBytes, parameter[]], literal[0], member[.tagk], literal[0], call[TSDB.tagk_width, parameter[]]]]
else begin[{]
None
end[}]
if[call[current.isGroupBy, parameter[]]] begin[{]
member[.gbs]
else begin[{]
None
end[}]
if[call[current.getTagVUids, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=put, postfix_operators=[], prefix_operators=[], qualifier=literals, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getTagVUids, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=uid)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte))), label=None)
call[literal_filters.add, parameter[member[.current]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.next], !=, literal[null]], &&, binary_operation[call[Bytes.memcmp, parameter[member[.tagk], call[next.getTagkBytes, parameter[]]]], !=, literal[0]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.next], TernaryExpression(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=look_ahead, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=look_ahead, selectors=[], type_arguments=None))]
end[}]
if[binary_operation[member[.gbs], >, literal[0]]] begin[{]
if[binary_operation[member[.group_bys], ==, literal[null]]] begin[{]
assign[member[.group_bys], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
call[group_bys.add, parameter[call[current.getTagkBytes, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[literals.size, parameter[]], >, literal[0]]] begin[{]
if[binary_operation[binary_operation[call[literals.size, parameter[]], +, member[.row_key_literals_count]], >, member[.expansion_limit]]] begin[{]
call[LOG.debug, parameter[binary_operation[binary_operation[literal["Skipping literals for "], +, call[current.getTagk, parameter[]]], +, literal[" as it exceedes the limit"]]]]
else begin[{]
local_variable[type[byte], values]
call[literals.keySet, parameter[]]
call[row_key_literals.put, parameter[call[current.getTagkBytes, parameter[]], member[.values]]]
assign[member[.row_key_literals_count], member[values.length]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setPostScan, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=literal_filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filter)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=TagVFilter, sub_type=None))), label=None)
end[}]
else begin[{]
call[row_key_literals.put, parameter[call[current.getTagkBytes, parameter[]], literal[null]]]
if[member[.search_query_failure]] begin[{]
assign[member[.use_multi_gets], literal[false]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.use_multi_gets], &&, member[.override_multi_get]]] begin[{]
local_variable[type[int], multi_get_limit]
local_variable[type[int], cardinality]
if[binary_operation[member[.cardinality], >, member[.multi_get_limit]]] begin[{]
assign[member[.use_multi_gets], literal[false]]
else begin[{]
if[member[.search_query_failure]] begin[{]
call[row_key_literals_list.add, parameter[member[.row_key_literals]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[findGroupBys] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[filters] operator[==] Other[null] operator[||] identifier[filters] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[use_multi_gets] operator[&&] identifier[override_multi_get] operator[SEP] operator[&&] operator[!] identifier[search_query_failure] operator[SEP] {
}
identifier[row_key_literals] operator[=] Keyword[new] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[expansion_limit] operator[=] identifier[tsdb] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[filters] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[TagVFilter] operator[>] identifier[current_iterator] operator[=] identifier[filters] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[TagVFilter] operator[>] identifier[look_ahead] operator[=] identifier[filters] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[tagk] operator[=] Other[null] operator[SEP] identifier[TagVFilter] identifier[next] operator[=] identifier[look_ahead] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[?] identifier[look_ahead] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[int] identifier[row_key_literals_count] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[current_iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[next] operator[=] identifier[look_ahead] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[?] identifier[look_ahead] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[int] identifier[gbs] operator[=] Other[0] operator[SEP] Keyword[final] identifier[ByteMap] operator[<] identifier[Void] operator[>] identifier[literals] operator[=] Keyword[new] identifier[ByteMap] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[TagVFilter] operator[>] identifier[literal_filters] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TagVFilter] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[TagVFilter] identifier[current] operator[=] Other[null] operator[SEP] Keyword[do] {
identifier[current] operator[=] identifier[current_iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tagk] operator[==] Other[null] operator[SEP] {
identifier[tagk] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[TSDB] operator[SEP] identifier[tagk_width] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[current] operator[SEP] identifier[getTagkBytes] operator[SEP] operator[SEP] , Other[0] , identifier[tagk] , Other[0] , identifier[TSDB] operator[SEP] identifier[tagk_width] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[current] operator[SEP] identifier[isGroupBy] operator[SEP] operator[SEP] operator[SEP] {
identifier[gbs] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[current] operator[SEP] identifier[getTagVUids] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[uid] operator[:] identifier[current] operator[SEP] identifier[getTagVUids] operator[SEP] operator[SEP] operator[SEP] {
identifier[literals] operator[SEP] identifier[put] operator[SEP] identifier[uid] , Other[null] operator[SEP] operator[SEP]
}
identifier[literal_filters] operator[SEP] identifier[add] operator[SEP] identifier[current] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[next] operator[!=] Other[null] operator[&&] identifier[Bytes] operator[SEP] identifier[memcmp] operator[SEP] identifier[tagk] , identifier[next] operator[SEP] identifier[getTagkBytes] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[next] operator[=] identifier[look_ahead] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[?] identifier[look_ahead] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
Keyword[while] operator[SEP] identifier[current_iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[&&] identifier[Bytes] operator[SEP] identifier[memcmp] operator[SEP] identifier[tagk] , identifier[current] operator[SEP] identifier[getTagkBytes] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[gbs] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[group_bys] operator[==] Other[null] operator[SEP] {
identifier[group_bys] operator[=] Keyword[new] identifier[ArrayList] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[group_bys] operator[SEP] identifier[add] operator[SEP] identifier[current] operator[SEP] identifier[getTagkBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[literals] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[literals] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[row_key_literals_count] operator[>] identifier[expansion_limit] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[current] operator[SEP] identifier[getTagk] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[literals] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[literals] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] identifier[values] operator[SEP] operator[SEP] identifier[row_key_literals] operator[SEP] identifier[put] operator[SEP] identifier[current] operator[SEP] identifier[getTagkBytes] operator[SEP] operator[SEP] , identifier[values] operator[SEP] operator[SEP] identifier[row_key_literals_count] operator[+=] identifier[values] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[TagVFilter] identifier[filter] operator[:] identifier[literal_filters] operator[SEP] {
identifier[filter] operator[SEP] identifier[setPostScan] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[row_key_literals] operator[SEP] identifier[put] operator[SEP] identifier[current] operator[SEP] identifier[getTagkBytes] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[search_query_failure] operator[SEP] {
identifier[use_multi_gets] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[use_multi_gets] operator[&&] identifier[override_multi_get] operator[SEP] operator[SEP] {
Keyword[int] identifier[multi_get_limit] operator[=] identifier[tsdb] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[cardinality] operator[=] identifier[filters] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[*] identifier[row_key_literals_count] operator[SEP] Keyword[if] operator[SEP] identifier[cardinality] operator[>] identifier[multi_get_limit] operator[SEP] {
identifier[use_multi_gets] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[search_query_failure] operator[SEP] {
identifier[row_key_literals_list] operator[SEP] identifier[add] operator[SEP] identifier[row_key_literals] operator[SEP] operator[SEP]
}
}
}
}
|
protected final double[] probabilities(
final Seq<Phenotype<G, C>> population,
final int count,
final Optimize opt
) {
return requireNonNull(opt) == Optimize.MINIMUM
? _reverter.apply(probabilities(population, count))
: probabilities(population, count);
}
|
class class_name[name] begin[{]
method[probabilities, return_type[type[double]], modifier[final protected], parameter[population, count, opt]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=opt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requireNonNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=MINIMUM, postfix_operators=[], prefix_operators=[], qualifier=Optimize, selectors=[]), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=population, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=probabilities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=population, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=probabilities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=apply, postfix_operators=[], prefix_operators=[], qualifier=_reverter, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[protected] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[probabilities] operator[SEP] Keyword[final] identifier[Seq] operator[<] identifier[Phenotype] operator[<] identifier[G] , identifier[C] operator[>] operator[>] identifier[population] , Keyword[final] Keyword[int] identifier[count] , Keyword[final] identifier[Optimize] identifier[opt] operator[SEP] {
Keyword[return] identifier[requireNonNull] operator[SEP] identifier[opt] operator[SEP] operator[==] identifier[Optimize] operator[SEP] identifier[MINIMUM] operator[?] identifier[_reverter] operator[SEP] identifier[apply] operator[SEP] identifier[probabilities] operator[SEP] identifier[population] , identifier[count] operator[SEP] operator[SEP] operator[:] identifier[probabilities] operator[SEP] identifier[population] , identifier[count] operator[SEP] operator[SEP]
}
|
@Override
public final void dispose() {
if (disposed) {
return;
}
IoFuture disposalFuture;
synchronized (disposalLock) {
disposalFuture = this.disposalFuture;
if (!disposing) {
disposing = true;
try {
this.disposalFuture = disposalFuture = dispose0();
} catch (Exception e) {
IoSession ioSession = this.disposalFuture != null ? this.disposalFuture.getSession() : null;
ExceptionMonitor.getInstance().exceptionCaught(e, ioSession);
} finally {
if (disposalFuture == null) {
disposed = true;
}
}
}
}
if (disposalFuture != null) {
disposalFuture.awaitUninterruptibly();
}
if (createdExecutor) {
ExecutorService e = (ExecutorService) executor;
e.shutdown();
while (!e.isTerminated()) {
try {
e.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
} catch (InterruptedException e1) {
// Ignore; it should end shortly.
}
}
}
disposed = true;
}
|
class class_name[name] begin[{]
method[dispose, return_type[void], modifier[final public], parameter[]] begin[{]
if[member[.disposed]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[IoFuture], disposalFuture]
SYNCHRONIZED[member[.disposalLock]] BEGIN[{]
assign[member[.disposalFuture], THIS[member[None.disposalFuture]]]
if[member[.disposing]] begin[{]
assign[member[.disposing], literal[true]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=disposalFuture, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Assignment(expressionl=MemberReference(member=disposalFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=dispose0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=disposalFuture, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=disposalFuture, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getSession, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), name=ioSession)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IoSession, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMonitor, selectors=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ioSession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exceptionCaught, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=disposalFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=disposed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))], label=None, resources=None)
else begin[{]
None
end[}]
END[}]
if[binary_operation[member[.disposalFuture], !=, literal[null]]] begin[{]
call[disposalFuture.awaitUninterruptibly, parameter[]]
else begin[{]
None
end[}]
if[member[.createdExecutor]] begin[{]
local_variable[type[ExecutorService], e]
call[e.shutdown, parameter[]]
while[call[e.isTerminated, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), MemberReference(member=SECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=awaitTermination, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
else begin[{]
None
end[}]
assign[member[.disposed], literal[true]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[dispose] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[disposed] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[IoFuture] identifier[disposalFuture] operator[SEP] Keyword[synchronized] operator[SEP] identifier[disposalLock] operator[SEP] {
identifier[disposalFuture] operator[=] Keyword[this] operator[SEP] identifier[disposalFuture] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[disposing] operator[SEP] {
identifier[disposing] operator[=] literal[boolean] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[disposalFuture] operator[=] identifier[disposalFuture] operator[=] identifier[dispose0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[IoSession] identifier[ioSession] operator[=] Keyword[this] operator[SEP] identifier[disposalFuture] operator[!=] Other[null] operator[?] Keyword[this] operator[SEP] identifier[disposalFuture] operator[SEP] identifier[getSession] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] identifier[ExceptionMonitor] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[exceptionCaught] operator[SEP] identifier[e] , identifier[ioSession] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[disposalFuture] operator[==] Other[null] operator[SEP] {
identifier[disposed] operator[=] literal[boolean] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[disposalFuture] operator[!=] Other[null] operator[SEP] {
identifier[disposalFuture] operator[SEP] identifier[awaitUninterruptibly] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[createdExecutor] operator[SEP] {
identifier[ExecutorService] identifier[e] operator[=] operator[SEP] identifier[ExecutorService] operator[SEP] identifier[executor] operator[SEP] identifier[e] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[e] operator[SEP] identifier[isTerminated] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[e] operator[SEP] identifier[awaitTermination] operator[SEP] identifier[Integer] operator[SEP] identifier[MAX_VALUE] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e1] operator[SEP] {
}
}
}
identifier[disposed] operator[=] literal[boolean] operator[SEP]
}
|
private void tryRefreshAccessToken(final Long reqStartedAt) {
authLock.writeLock().lock();
try {
if (!isLoggedIn()) {
throw new StitchClientException(StitchClientErrorCode.LOGGED_OUT_DURING_REQUEST);
}
try {
final Jwt jwt = Jwt.fromEncoded(getAuthInfo().getAccessToken());
if (jwt.getIssuedAt() >= reqStartedAt) {
return;
}
} catch (final IOException e) {
// Swallow
}
// retry
refreshAccessToken();
} finally {
authLock.writeLock().unlock();
}
}
|
class class_name[name] begin[{]
method[tryRefreshAccessToken, return_type[void], modifier[private], parameter[reqStartedAt]] begin[{]
call[authLock.writeLock, parameter[]]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isLoggedIn, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=LOGGED_OUT_DURING_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=StitchClientErrorCode, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StitchClientException, sub_type=None)), label=None)])), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAuthInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getAccessToken, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=fromEncoded, postfix_operators=[], prefix_operators=[], qualifier=Jwt, selectors=[], type_arguments=None), name=jwt)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Jwt, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getIssuedAt, postfix_operators=[], prefix_operators=[], qualifier=jwt, selectors=[], type_arguments=None), operandr=MemberReference(member=reqStartedAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[], member=refreshAccessToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=authLock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[tryRefreshAccessToken] operator[SEP] Keyword[final] identifier[Long] identifier[reqStartedAt] operator[SEP] {
identifier[authLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[isLoggedIn] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[StitchClientException] operator[SEP] identifier[StitchClientErrorCode] operator[SEP] identifier[LOGGED_OUT_DURING_REQUEST] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[final] identifier[Jwt] identifier[jwt] operator[=] identifier[Jwt] operator[SEP] identifier[fromEncoded] operator[SEP] identifier[getAuthInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getAccessToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jwt] operator[SEP] identifier[getIssuedAt] operator[SEP] operator[SEP] operator[>=] identifier[reqStartedAt] operator[SEP] {
Keyword[return] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
}
identifier[refreshAccessToken] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[authLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public boolean printControl(PrintWriter out, int iPrintOptions)
{
if (!this.getScreenField().isInputField())
return false;
if (this.getScreenField().isToolbar())
return false;
String strFieldDesc = DBConstants.BLANK;
if (this.getScreenField().getConverter() != null)
strFieldDesc = this.getScreenField().getConverter().getFieldDesc();
String strFieldName = this.getScreenField().getSFieldParam();
String strControlType = this.getInputType(null);
String strFieldType = this.getInputType(ScreenModel.DOJO_TYPE);
if ((this.getScreenField().isEnabled() == true) && (!this.getScreenField().getParentScreen().isPrintReport()))
{ // Input field and not printing a report
Convert converter = this.getScreenField().getConverter();
int iMaxSize = 10;
if (converter != null)
iMaxSize = converter.getMaxLength();
String strMaxSize = Integer.toString(iMaxSize);
String strSize = DEFAULT_CONTROL_LENGTH;
if (iMaxSize < 40)
strSize = strMaxSize;
String strValue = this.getScreenField().getSFieldValue(true, false);
// Overriding methods will replace with: text int checkbox radio hidden float date url textbox
strFieldDesc = Utility.replace(strFieldDesc, " ", "\240"); // spaces -> nbsp
this.printInputControl(out, strFieldDesc, strFieldName, strSize, strMaxSize, strValue, strControlType, strFieldType);
}
else
this.printDisplayControl(out, strFieldDesc, strFieldName, strFieldType);
return true;
}
|
class class_name[name] begin[{]
method[printControl, return_type[type[boolean]], modifier[public], parameter[out, iPrintOptions]] begin[{]
if[THIS[call[None.getScreenField, parameter[]]call[None.isInputField, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[THIS[call[None.getScreenField, parameter[]]call[None.isToolbar, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], strFieldDesc]
if[binary_operation[THIS[call[None.getScreenField, parameter[]]call[None.getConverter, parameter[]]], !=, literal[null]]] begin[{]
assign[member[.strFieldDesc], THIS[call[None.getScreenField, parameter[]]call[None.getConverter, parameter[]]call[None.getFieldDesc, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[String], strFieldName]
local_variable[type[String], strControlType]
local_variable[type[String], strFieldType]
if[binary_operation[binary_operation[THIS[call[None.getScreenField, parameter[]]call[None.isEnabled, parameter[]]], ==, literal[true]], &&, THIS[]]] begin[{]
local_variable[type[Convert], converter]
local_variable[type[int], iMaxSize]
if[binary_operation[member[.converter], !=, literal[null]]] begin[{]
assign[member[.iMaxSize], call[converter.getMaxLength, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[String], strMaxSize]
local_variable[type[String], strSize]
if[binary_operation[member[.iMaxSize], <, literal[40]]] begin[{]
assign[member[.strSize], member[.strMaxSize]]
else begin[{]
None
end[}]
local_variable[type[String], strValue]
assign[member[.strFieldDesc], call[Utility.replace, parameter[member[.strFieldDesc], literal[" "], literal["\240"]]]]
THIS[call[None.printInputControl, parameter[member[.out], member[.strFieldDesc], member[.strFieldName], member[.strSize], member[.strMaxSize], member[.strValue], member[.strControlType], member[.strFieldType]]]]
else begin[{]
THIS[call[None.printDisplayControl, parameter[member[.out], member[.strFieldDesc], member[.strFieldName], member[.strFieldType]]]]
end[}]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[printControl] operator[SEP] identifier[PrintWriter] identifier[out] , Keyword[int] identifier[iPrintOptions] operator[SEP] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[isInputField] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[isToolbar] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[String] identifier[strFieldDesc] operator[=] identifier[DBConstants] operator[SEP] identifier[BLANK] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[getConverter] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[strFieldDesc] operator[=] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[getConverter] operator[SEP] operator[SEP] operator[SEP] identifier[getFieldDesc] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strFieldName] operator[=] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[getSFieldParam] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strControlType] operator[=] Keyword[this] operator[SEP] identifier[getInputType] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[String] identifier[strFieldType] operator[=] Keyword[this] operator[SEP] identifier[getInputType] operator[SEP] identifier[ScreenModel] operator[SEP] identifier[DOJO_TYPE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP] operator[&&] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[getParentScreen] operator[SEP] operator[SEP] operator[SEP] identifier[isPrintReport] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Convert] identifier[converter] operator[=] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[getConverter] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[iMaxSize] operator[=] Other[10] operator[SEP] Keyword[if] operator[SEP] identifier[converter] operator[!=] Other[null] operator[SEP] identifier[iMaxSize] operator[=] identifier[converter] operator[SEP] identifier[getMaxLength] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strMaxSize] operator[=] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[iMaxSize] operator[SEP] operator[SEP] identifier[String] identifier[strSize] operator[=] identifier[DEFAULT_CONTROL_LENGTH] operator[SEP] Keyword[if] operator[SEP] identifier[iMaxSize] operator[<] Other[40] operator[SEP] identifier[strSize] operator[=] identifier[strMaxSize] operator[SEP] identifier[String] identifier[strValue] operator[=] Keyword[this] operator[SEP] identifier[getScreenField] operator[SEP] operator[SEP] operator[SEP] identifier[getSFieldValue] operator[SEP] literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[strFieldDesc] operator[=] identifier[Utility] operator[SEP] identifier[replace] operator[SEP] identifier[strFieldDesc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[printInputControl] operator[SEP] identifier[out] , identifier[strFieldDesc] , identifier[strFieldName] , identifier[strSize] , identifier[strMaxSize] , identifier[strValue] , identifier[strControlType] , identifier[strFieldType] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[this] operator[SEP] identifier[printDisplayControl] operator[SEP] identifier[out] , identifier[strFieldDesc] , identifier[strFieldName] , identifier[strFieldType] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public static boolean isPackagePrivate(Element element) {
if (isPublic(element)) {
return false;
} else if (isProtected(element)) {
return false;
} else if (isPrivate(element)) {
return false;
}
return true;
}
|
class class_name[name] begin[{]
method[isPackagePrivate, return_type[type[boolean]], modifier[public static], parameter[element]] begin[{]
if[call[.isPublic, parameter[member[.element]]]] begin[{]
return[literal[false]]
else begin[{]
if[call[.isProtected, parameter[member[.element]]]] begin[{]
return[literal[false]]
else begin[{]
if[call[.isPrivate, parameter[member[.element]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
end[}]
end[}]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isPackagePrivate] operator[SEP] identifier[Element] identifier[element] operator[SEP] {
Keyword[if] operator[SEP] identifier[isPublic] operator[SEP] identifier[element] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isProtected] operator[SEP] identifier[element] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isPrivate] operator[SEP] identifier[element] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static CommercePriceEntry findByCompanyId_First(long companyId,
OrderByComparator<CommercePriceEntry> orderByComparator)
throws com.liferay.commerce.price.list.exception.NoSuchPriceEntryException {
return getPersistence()
.findByCompanyId_First(companyId, orderByComparator);
}
|
class class_name[name] begin[{]
method[findByCompanyId_First, return_type[type[CommercePriceEntry]], modifier[public static], parameter[companyId, orderByComparator]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CommercePriceEntry] identifier[findByCompanyId_First] operator[SEP] Keyword[long] identifier[companyId] , identifier[OrderByComparator] operator[<] identifier[CommercePriceEntry] operator[>] identifier[orderByComparator] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[price] operator[SEP] identifier[list] operator[SEP] identifier[exception] operator[SEP] identifier[NoSuchPriceEntryException] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByCompanyId_First] operator[SEP] identifier[companyId] , identifier[orderByComparator] operator[SEP] operator[SEP]
}
|
void invalidateCorruptReplicas(Block blk) {
Collection<DatanodeDescriptor> nodes = corruptReplicas.getNodes(blk);
boolean gotException = false;
if (nodes == null) {
return;
}
// Make a copy of this list, since calling invalidateBlock will modify
// the original (avoid CME)
nodes = new ArrayList<DatanodeDescriptor>(nodes);
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("NameNode.invalidateCorruptReplicas: " +
"invalidating corrupt replicas on " + nodes.size() + "nodes");
}
for (Iterator<DatanodeDescriptor> it = nodes.iterator(); it.hasNext();) {
DatanodeDescriptor node = it.next();
try {
invalidateBlock(blk, node, true);
} catch (IOException e) {
NameNode.stateChangeLog.info("NameNode.invalidateCorruptReplicas " +
"error in deleting bad block " + blk +
" on " + node + e);
gotException = true;
}
}
// Remove the block from corruptReplicasMap
if (!gotException) {
corruptReplicas.removeFromCorruptReplicasMap(blk);
}
}
|
class class_name[name] begin[{]
method[invalidateCorruptReplicas, return_type[void], modifier[default], parameter[blk]] begin[{]
local_variable[type[Collection], nodes]
local_variable[type[boolean], gotException]
if[binary_operation[member[.nodes], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.nodes], ClassCreator(arguments=[MemberReference(member=nodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DatanodeDescriptor, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
if[call[NameNode.stateChangeLog.isDebugEnabled, parameter[]]] begin[{]
call[NameNode.stateChangeLog.debug, parameter[binary_operation[binary_operation[binary_operation[literal["NameNode.invalidateCorruptReplicas: "], +, literal["invalidating corrupt replicas on "]], +, call[nodes.size, parameter[]]], +, literal["nodes"]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DatanodeDescriptor, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=blk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=invalidateBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NameNode.invalidateCorruptReplicas "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error in deleting bad block "), operator=+), operandr=MemberReference(member=blk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" on "), operator=+), operandr=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=NameNode.stateChangeLog, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=gotException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=nodes, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DatanodeDescriptor, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
if[member[.gotException]] begin[{]
call[corruptReplicas.removeFromCorruptReplicasMap, parameter[member[.blk]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[void] identifier[invalidateCorruptReplicas] operator[SEP] identifier[Block] identifier[blk] operator[SEP] {
identifier[Collection] operator[<] identifier[DatanodeDescriptor] operator[>] identifier[nodes] operator[=] identifier[corruptReplicas] operator[SEP] identifier[getNodes] operator[SEP] identifier[blk] operator[SEP] operator[SEP] Keyword[boolean] identifier[gotException] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[nodes] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[nodes] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[DatanodeDescriptor] operator[>] operator[SEP] identifier[nodes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[NameNode] operator[SEP] identifier[stateChangeLog] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[NameNode] operator[SEP] identifier[stateChangeLog] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[nodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[DatanodeDescriptor] operator[>] identifier[it] operator[=] identifier[nodes] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[DatanodeDescriptor] identifier[node] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[invalidateBlock] operator[SEP] identifier[blk] , identifier[node] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[NameNode] operator[SEP] identifier[stateChangeLog] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[blk] operator[+] literal[String] operator[+] identifier[node] operator[+] identifier[e] operator[SEP] operator[SEP] identifier[gotException] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[gotException] operator[SEP] {
identifier[corruptReplicas] operator[SEP] identifier[removeFromCorruptReplicasMap] operator[SEP] identifier[blk] operator[SEP] operator[SEP]
}
}
|
public static String adHocSQLFromInvocationForDebug(StoredProcedureInvocation invocation) {
assert(invocation.getProcName().startsWith("@AdHoc"));
ParameterSet params = invocation.getParams();
// the final param is the byte array we need
byte[] serializedBatchData = (byte[]) params.getParam(params.size() - 1);
Pair<Object[], AdHocPlannedStatement[]> data = decodeSerializedBatchData(serializedBatchData);
Object[] userparams = data.getFirst();
AdHocPlannedStatement[] statements = data.getSecond();
StringBuilder sb = new StringBuilder();
if (statements.length == 0) {
sb.append("ADHOC INVOCATION HAS NO SQL");
}
else if (statements.length == 1) {
sb.append(adHocSQLStringFromPlannedStatement(statements[0], userparams));
}
else { // > 1
sb.append("BEGIN ADHOC_SQL_BATCH {\n");
for (AdHocPlannedStatement stmt : statements) {
sb.append(adHocSQLStringFromPlannedStatement(stmt, userparams)).append("\n");
}
sb.append("} END ADHOC_SQL_BATCH");
}
return sb.toString();
}
|
class class_name[name] begin[{]
method[adHocSQLFromInvocationForDebug, return_type[type[String]], modifier[public static], parameter[invocation]] begin[{]
AssertStatement(condition=MethodInvocation(arguments=[], member=getProcName, postfix_operators=[], prefix_operators=[], qualifier=invocation, selectors=[], type_arguments=None), label=None, value=None)
local_variable[type[ParameterSet], params]
local_variable[type[byte], serializedBatchData]
local_variable[type[Pair], data]
local_variable[type[Object], userparams]
local_variable[type[AdHocPlannedStatement], statements]
local_variable[type[StringBuilder], sb]
if[binary_operation[member[statements.length], ==, literal[0]]] begin[{]
call[sb.append, parameter[literal["ADHOC INVOCATION HAS NO SQL"]]]
else begin[{]
if[binary_operation[member[statements.length], ==, literal[1]]] begin[{]
call[sb.append, parameter[call[.adHocSQLStringFromPlannedStatement, parameter[member[.statements], member[.userparams]]]]]
else begin[{]
call[sb.append, parameter[literal["BEGIN ADHOC_SQL_BATCH {\n"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=userparams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=adHocSQLStringFromPlannedStatement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=statements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=stmt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AdHocPlannedStatement, sub_type=None))), label=None)
call[sb.append, parameter[literal["} END ADHOC_SQL_BATCH"]]]
end[}]
end[}]
return[call[sb.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[adHocSQLFromInvocationForDebug] operator[SEP] identifier[StoredProcedureInvocation] identifier[invocation] operator[SEP] {
Keyword[assert] operator[SEP] identifier[invocation] operator[SEP] identifier[getProcName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[ParameterSet] identifier[params] operator[=] identifier[invocation] operator[SEP] identifier[getParams] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[serializedBatchData] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[getParam] operator[SEP] identifier[params] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[Pair] operator[<] identifier[Object] operator[SEP] operator[SEP] , identifier[AdHocPlannedStatement] operator[SEP] operator[SEP] operator[>] identifier[data] operator[=] identifier[decodeSerializedBatchData] operator[SEP] identifier[serializedBatchData] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[userparams] operator[=] identifier[data] operator[SEP] identifier[getFirst] operator[SEP] operator[SEP] operator[SEP] identifier[AdHocPlannedStatement] operator[SEP] operator[SEP] identifier[statements] operator[=] identifier[data] operator[SEP] identifier[getSecond] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[statements] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[statements] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[adHocSQLStringFromPlannedStatement] operator[SEP] identifier[statements] operator[SEP] Other[0] operator[SEP] , identifier[userparams] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AdHocPlannedStatement] identifier[stmt] operator[:] identifier[statements] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[adHocSQLStringFromPlannedStatement] operator[SEP] identifier[stmt] , identifier[userparams] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@SneakyThrows
protected boolean updateUserResource(final UserResource user, final Principal p, final Credential credential) {
this.mapper.map(user, p, credential);
return endpoint.update(user) != null;
}
|
class class_name[name] begin[{]
method[updateUserResource, return_type[type[boolean]], modifier[protected], parameter[user, p, credential]] begin[{]
THIS[member[None.mapper]call[None.map, parameter[member[.user], member[.p], member[.credential]]]]
return[binary_operation[call[endpoint.update, parameter[member[.user]]], !=, literal[null]]]
end[}]
END[}]
|
annotation[@] identifier[SneakyThrows] Keyword[protected] Keyword[boolean] identifier[updateUserResource] operator[SEP] Keyword[final] identifier[UserResource] identifier[user] , Keyword[final] identifier[Principal] identifier[p] , Keyword[final] identifier[Credential] identifier[credential] operator[SEP] {
Keyword[this] operator[SEP] identifier[mapper] operator[SEP] identifier[map] operator[SEP] identifier[user] , identifier[p] , identifier[credential] operator[SEP] operator[SEP] Keyword[return] identifier[endpoint] operator[SEP] identifier[update] operator[SEP] identifier[user] operator[SEP] operator[!=] Other[null] operator[SEP]
}
|
public final void annotate(final InputStream inputStream,
final OutputStream outputStream) throws IOException, JDOMException {
BufferedReader breader = new BufferedReader(
new InputStreamReader(inputStream, UTF_8));
BufferedWriter bwriter = new BufferedWriter(
new OutputStreamWriter(outputStream, UTF_8));
// read KAF document from inputstream
KAFDocument kaf = KAFDocument.createFromStream(breader);
// load parameters into a properties
String model = parsedArguments.getString(MODEL);
String outputFormat = parsedArguments.getString("outputFormat");
String lexer = parsedArguments.getString("lexer");
String dictTag = parsedArguments.getString("dictTag");
String dictPath = parsedArguments.getString("dictPath");
String clearFeatures = parsedArguments.getString("clearFeatures");
// language parameter
String lang = null;
if (parsedArguments.getString("language") != null) {
lang = parsedArguments.getString("language");
if (!kaf.getLang().equalsIgnoreCase(lang)) {
System.err.println("Language parameter in NAF and CLI do not match!!");
}
} else {
lang = kaf.getLang();
}
Properties properties = setAnnotateProperties(model, lang, lexer, dictTag,
dictPath, clearFeatures);
KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor(
"entities", IXA_PIPE_NERC + Files.getNameWithoutExtension(model),
version + "-" + commit);
newLp.setBeginTimestamp();
Annotate annotator = new Annotate(properties);
annotator.annotateNEsToKAF(kaf);
newLp.setEndTimestamp();
String kafToString = null;
if (outputFormat.equalsIgnoreCase("conll03")) {
kafToString = annotator.annotateNEsToCoNLL2003(kaf);
} else if (outputFormat.equalsIgnoreCase("conll02")) {
kafToString = annotator.annotateNEsToCoNLL2002(kaf);
} else if (outputFormat.equalsIgnoreCase("opennlp")) {
kafToString = annotator.annotateNEsToOpenNLP(kaf);
} else {
kafToString = kaf.toString();
}
bwriter.write(kafToString);
bwriter.close();
breader.close();
}
|
class class_name[name] begin[{]
method[annotate, return_type[void], modifier[final public], parameter[inputStream, outputStream]] begin[{]
local_variable[type[BufferedReader], breader]
local_variable[type[BufferedWriter], bwriter]
local_variable[type[KAFDocument], kaf]
local_variable[type[String], model]
local_variable[type[String], outputFormat]
local_variable[type[String], lexer]
local_variable[type[String], dictTag]
local_variable[type[String], dictPath]
local_variable[type[String], clearFeatures]
local_variable[type[String], lang]
if[binary_operation[call[parsedArguments.getString, parameter[literal["language"]]], !=, literal[null]]] begin[{]
assign[member[.lang], call[parsedArguments.getString, parameter[literal["language"]]]]
if[call[kaf.getLang, parameter[]]] begin[{]
call[System.err.println, parameter[literal["Language parameter in NAF and CLI do not match!!"]]]
else begin[{]
None
end[}]
else begin[{]
assign[member[.lang], call[kaf.getLang, parameter[]]]
end[}]
local_variable[type[Properties], properties]
local_variable[type[KAFDocument], newLp]
call[newLp.setBeginTimestamp, parameter[]]
local_variable[type[Annotate], annotator]
call[annotator.annotateNEsToKAF, parameter[member[.kaf]]]
call[newLp.setEndTimestamp, parameter[]]
local_variable[type[String], kafToString]
if[call[outputFormat.equalsIgnoreCase, parameter[literal["conll03"]]]] begin[{]
assign[member[.kafToString], call[annotator.annotateNEsToCoNLL2003, parameter[member[.kaf]]]]
else begin[{]
if[call[outputFormat.equalsIgnoreCase, parameter[literal["conll02"]]]] begin[{]
assign[member[.kafToString], call[annotator.annotateNEsToCoNLL2002, parameter[member[.kaf]]]]
else begin[{]
if[call[outputFormat.equalsIgnoreCase, parameter[literal["opennlp"]]]] begin[{]
assign[member[.kafToString], call[annotator.annotateNEsToOpenNLP, parameter[member[.kaf]]]]
else begin[{]
assign[member[.kafToString], call[kaf.toString, parameter[]]]
end[}]
end[}]
end[}]
call[bwriter.write, parameter[member[.kafToString]]]
call[bwriter.close, parameter[]]
call[breader.close, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[annotate] operator[SEP] Keyword[final] identifier[InputStream] identifier[inputStream] , Keyword[final] identifier[OutputStream] identifier[outputStream] operator[SEP] Keyword[throws] identifier[IOException] , identifier[JDOMException] {
identifier[BufferedReader] identifier[breader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[inputStream] , identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP] identifier[BufferedWriter] identifier[bwriter] operator[=] Keyword[new] identifier[BufferedWriter] operator[SEP] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[outputStream] , identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP] identifier[KAFDocument] identifier[kaf] operator[=] identifier[KAFDocument] operator[SEP] identifier[createFromStream] operator[SEP] identifier[breader] operator[SEP] operator[SEP] identifier[String] identifier[model] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] identifier[MODEL] operator[SEP] operator[SEP] identifier[String] identifier[outputFormat] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[lexer] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[dictTag] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[dictPath] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[clearFeatures] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[lang] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[lang] operator[=] identifier[parsedArguments] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[kaf] operator[SEP] identifier[getLang] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[lang] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[lang] operator[=] identifier[kaf] operator[SEP] identifier[getLang] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Properties] identifier[properties] operator[=] identifier[setAnnotateProperties] operator[SEP] identifier[model] , identifier[lang] , identifier[lexer] , identifier[dictTag] , identifier[dictPath] , identifier[clearFeatures] operator[SEP] operator[SEP] identifier[KAFDocument] operator[SEP] identifier[LinguisticProcessor] identifier[newLp] operator[=] identifier[kaf] operator[SEP] identifier[addLinguisticProcessor] operator[SEP] literal[String] , identifier[IXA_PIPE_NERC] operator[+] identifier[Files] operator[SEP] identifier[getNameWithoutExtension] operator[SEP] identifier[model] operator[SEP] , identifier[version] operator[+] literal[String] operator[+] identifier[commit] operator[SEP] operator[SEP] identifier[newLp] operator[SEP] identifier[setBeginTimestamp] operator[SEP] operator[SEP] operator[SEP] identifier[Annotate] identifier[annotator] operator[=] Keyword[new] identifier[Annotate] operator[SEP] identifier[properties] operator[SEP] operator[SEP] identifier[annotator] operator[SEP] identifier[annotateNEsToKAF] operator[SEP] identifier[kaf] operator[SEP] operator[SEP] identifier[newLp] operator[SEP] identifier[setEndTimestamp] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[kafToString] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[outputFormat] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[kafToString] operator[=] identifier[annotator] operator[SEP] identifier[annotateNEsToCoNLL2003] operator[SEP] identifier[kaf] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[outputFormat] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[kafToString] operator[=] identifier[annotator] operator[SEP] identifier[annotateNEsToCoNLL2002] operator[SEP] identifier[kaf] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[outputFormat] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[kafToString] operator[=] identifier[annotator] operator[SEP] identifier[annotateNEsToOpenNLP] operator[SEP] identifier[kaf] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[kafToString] operator[=] identifier[kaf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[bwriter] operator[SEP] identifier[write] operator[SEP] identifier[kafToString] operator[SEP] operator[SEP] identifier[bwriter] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[breader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
public void showInfo(Formatter f) {
if (dcm == null) {
if (spec == null) return;
dcm = scanCollection(spec, f);
if (dcm == null) return;
}
// just a list of the files
f.format("dcm = %s%n", dcm);
try {
for (MFile mfile : dcm.getFilesSorted()) {
f.format(" %s%n", mfile.getPath());
}
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
// show nrecords, data size
int nrecords = 0;
long dataSize = 0;
long msgSize = 0;
for (Object o : param2BeanTable.getBeans()) {
Grib2ParameterBean p = (Grib2ParameterBean) o;
for (Grib2RecordBean r : p.getRecordBeans()) {
nrecords++;
dataSize += r.getDataLength();
msgSize += r.getMsgLength();
}
}
f.format("nrecords = %d, total grib data size = %d, total grib msg sizes = %d", nrecords, dataSize, msgSize);
}
|
class class_name[name] begin[{]
method[showInfo, return_type[void], modifier[public], parameter[f]] begin[{]
if[binary_operation[member[.dcm], ==, literal[null]]] begin[{]
if[binary_operation[member[.spec], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.dcm], call[.scanCollection, parameter[member[.spec], member[.f]]]]
if[binary_operation[member[.dcm], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[f.format, parameter[literal["dcm = %s%n"], member[.dcm]]]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" %s%n"), MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=mfile, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFilesSorted, postfix_operators=[], prefix_operators=[], qualifier=dcm, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mfile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MFile, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
local_variable[type[int], nrecords]
local_variable[type[long], dataSize]
local_variable[type[long], msgSize]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Grib2ParameterBean, sub_type=None)), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Grib2ParameterBean, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=nrecords, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dataSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getDataLength, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=msgSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getMsgLength, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRecordBeans, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Grib2RecordBean, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getBeans, postfix_operators=[], prefix_operators=[], qualifier=param2BeanTable, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
call[f.format, parameter[literal["nrecords = %d, total grib data size = %d, total grib msg sizes = %d"], member[.nrecords], member[.dataSize], member[.msgSize]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[showInfo] operator[SEP] identifier[Formatter] identifier[f] operator[SEP] {
Keyword[if] operator[SEP] identifier[dcm] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[spec] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[dcm] operator[=] identifier[scanCollection] operator[SEP] identifier[spec] , identifier[f] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dcm] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
identifier[f] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[dcm] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] identifier[MFile] identifier[mfile] operator[:] identifier[dcm] operator[SEP] identifier[getFilesSorted] operator[SEP] operator[SEP] operator[SEP] {
identifier[f] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[mfile] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[nrecords] operator[=] Other[0] operator[SEP] Keyword[long] identifier[dataSize] operator[=] Other[0] operator[SEP] Keyword[long] identifier[msgSize] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[param2BeanTable] operator[SEP] identifier[getBeans] operator[SEP] operator[SEP] operator[SEP] {
identifier[Grib2ParameterBean] identifier[p] operator[=] operator[SEP] identifier[Grib2ParameterBean] operator[SEP] identifier[o] operator[SEP] Keyword[for] operator[SEP] identifier[Grib2RecordBean] identifier[r] operator[:] identifier[p] operator[SEP] identifier[getRecordBeans] operator[SEP] operator[SEP] operator[SEP] {
identifier[nrecords] operator[++] operator[SEP] identifier[dataSize] operator[+=] identifier[r] operator[SEP] identifier[getDataLength] operator[SEP] operator[SEP] operator[SEP] identifier[msgSize] operator[+=] identifier[r] operator[SEP] identifier[getMsgLength] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[f] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[nrecords] , identifier[dataSize] , identifier[msgSize] operator[SEP] operator[SEP]
}
|
private static AgroalDataSource getDataSource(OperationContext context) throws OperationFailedException {
ServiceRegistry registry = context.getServiceRegistry(false);
String dataSourceName = context.getCurrentAddressValue();
switch (context.getCurrentAddress().getLastElement().getKey()) {
case DataSourceOperations.DATASOURCE_SERVICE_NAME:
ServiceController<?> controller = registry.getRequiredService(AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY.getCapabilityServiceName(dataSourceName));
return ((AgroalDataSource) controller.getValue());
case XADataSourceOperations.XADATASOURCE_SERVICE_NAME:
ServiceController<?> xaController = registry.getRequiredService(AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY.getCapabilityServiceName(dataSourceName));
return ((AgroalDataSource) xaController.getValue());
default:
throw AgroalLogger.SERVICE_LOGGER.unknownDatasourceServiceType(context.getCurrentAddress().getLastElement().getKey());
}
}
|
class class_name[name] begin[{]
method[getDataSource, return_type[type[AgroalDataSource]], modifier[private static], parameter[context]] begin[{]
local_variable[type[ServiceRegistry], registry]
local_variable[type[String], dataSourceName]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=DATASOURCE_SERVICE_NAME, postfix_operators=[], prefix_operators=[], qualifier=DataSourceOperations, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=dataSourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCapabilityServiceName, postfix_operators=[], prefix_operators=[], qualifier=AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY, selectors=[], type_arguments=None)], member=getRequiredService, postfix_operators=[], prefix_operators=[], qualifier=registry, selectors=[], type_arguments=None), name=controller)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ServiceController, sub_type=None)), ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=controller, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=AgroalDataSource, sub_type=None)), label=None)]), SwitchStatementCase(case=[MemberReference(member=XADATASOURCE_SERVICE_NAME, postfix_operators=[], prefix_operators=[], qualifier=XADataSourceOperations, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=dataSourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCapabilityServiceName, postfix_operators=[], prefix_operators=[], qualifier=AbstractDataSourceDefinition.DATA_SOURCE_CAPABILITY, selectors=[], type_arguments=None)], member=getRequiredService, postfix_operators=[], prefix_operators=[], qualifier=registry, selectors=[], type_arguments=None), name=xaController)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ServiceController, sub_type=None)), ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=xaController, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=AgroalDataSource, sub_type=None)), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCurrentAddress, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[], member=getLastElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=unknownDatasourceServiceType, postfix_operators=[], prefix_operators=[], qualifier=AgroalLogger.SERVICE_LOGGER, selectors=[], type_arguments=None), label=None)])], expression=MethodInvocation(arguments=[], member=getCurrentAddress, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[], member=getLastElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[AgroalDataSource] identifier[getDataSource] operator[SEP] identifier[OperationContext] identifier[context] operator[SEP] Keyword[throws] identifier[OperationFailedException] {
identifier[ServiceRegistry] identifier[registry] operator[=] identifier[context] operator[SEP] identifier[getServiceRegistry] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[dataSourceName] operator[=] identifier[context] operator[SEP] identifier[getCurrentAddressValue] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[context] operator[SEP] identifier[getCurrentAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getLastElement] operator[SEP] operator[SEP] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[DataSourceOperations] operator[SEP] identifier[DATASOURCE_SERVICE_NAME] operator[:] identifier[ServiceController] operator[<] operator[?] operator[>] identifier[controller] operator[=] identifier[registry] operator[SEP] identifier[getRequiredService] operator[SEP] identifier[AbstractDataSourceDefinition] operator[SEP] identifier[DATA_SOURCE_CAPABILITY] operator[SEP] identifier[getCapabilityServiceName] operator[SEP] identifier[dataSourceName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[AgroalDataSource] operator[SEP] identifier[controller] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[XADataSourceOperations] operator[SEP] identifier[XADATASOURCE_SERVICE_NAME] operator[:] identifier[ServiceController] operator[<] operator[?] operator[>] identifier[xaController] operator[=] identifier[registry] operator[SEP] identifier[getRequiredService] operator[SEP] identifier[AbstractDataSourceDefinition] operator[SEP] identifier[DATA_SOURCE_CAPABILITY] operator[SEP] identifier[getCapabilityServiceName] operator[SEP] identifier[dataSourceName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[AgroalDataSource] operator[SEP] identifier[xaController] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[throw] identifier[AgroalLogger] operator[SEP] identifier[SERVICE_LOGGER] operator[SEP] identifier[unknownDatasourceServiceType] operator[SEP] identifier[context] operator[SEP] identifier[getCurrentAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getLastElement] operator[SEP] operator[SEP] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Set<String> keySet()
{
TreeSet<String> keySet = new TreeSet<String>();
for (Map.Entry<String, V> entry : entrySet())
{
keySet.add(entry.getKey());
}
return keySet;
}
|
class class_name[name] begin[{]
method[keySet, return_type[type[Set]], modifier[public], parameter[]] begin[{]
local_variable[type[TreeSet], keySet]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=keySet, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.keySet]]
end[}]
END[}]
|
Keyword[public] identifier[Set] operator[<] identifier[String] operator[>] identifier[keySet] operator[SEP] operator[SEP] {
identifier[TreeSet] operator[<] identifier[String] operator[>] identifier[keySet] operator[=] Keyword[new] identifier[TreeSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[V] operator[>] identifier[entry] operator[:] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[keySet] operator[SEP] identifier[add] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[keySet] operator[SEP]
}
|
public static boolean waitForPageResponse(HtmlPage page, String responseMessage) throws InterruptedException {
int i = 0;
boolean isTextFound = false;
while (!isTextFound && i < 5) {
isTextFound = page.asText().contains(responseMessage);
i++;
Thread.sleep(1000);
Log.info(c, "waitForPageResponse", "Waiting for: " + responseMessage + " isTextFound: " + isTextFound + " i: " + i);
}
return isTextFound;
}
|
class class_name[name] begin[{]
method[waitForPageResponse, return_type[type[boolean]], modifier[public static], parameter[page, responseMessage]] begin[{]
local_variable[type[int], i]
local_variable[type[boolean], isTextFound]
while[binary_operation[member[.isTextFound], &&, binary_operation[member[.i], <, literal[5]]]] begin[{]
assign[member[.isTextFound], call[page.asText, parameter[]]]
member[.i]
call[Thread.sleep, parameter[literal[1000]]]
call[Log.info, parameter[member[.c], literal["waitForPageResponse"], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["Waiting for: "], +, member[.responseMessage]], +, literal[" isTextFound: "]], +, member[.isTextFound]], +, literal[" i: "]], +, member[.i]]]]
end[}]
return[member[.isTextFound]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[waitForPageResponse] operator[SEP] identifier[HtmlPage] identifier[page] , identifier[String] identifier[responseMessage] operator[SEP] Keyword[throws] identifier[InterruptedException] {
Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[isTextFound] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[isTextFound] operator[&&] identifier[i] operator[<] Other[5] operator[SEP] {
identifier[isTextFound] operator[=] identifier[page] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[responseMessage] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] Other[1000] operator[SEP] operator[SEP] identifier[Log] operator[SEP] identifier[info] operator[SEP] identifier[c] , literal[String] , literal[String] operator[+] identifier[responseMessage] operator[+] literal[String] operator[+] identifier[isTextFound] operator[+] literal[String] operator[+] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isTextFound] operator[SEP]
}
|
public void parse(final CssSource source, final CssErrorHandler err, final CssContentHandler doc) throws
IOException,
CssException
{
parse(source.newReader(), source.getSystemID(), err, doc);
}
|
class class_name[name] begin[{]
method[parse, return_type[void], modifier[public], parameter[source, err, doc]] begin[{]
call[.parse, parameter[call[source.newReader, parameter[]], call[source.getSystemID, parameter[]], member[.err], member[.doc]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[parse] operator[SEP] Keyword[final] identifier[CssSource] identifier[source] , Keyword[final] identifier[CssErrorHandler] identifier[err] , Keyword[final] identifier[CssContentHandler] identifier[doc] operator[SEP] Keyword[throws] identifier[IOException] , identifier[CssException] {
identifier[parse] operator[SEP] identifier[source] operator[SEP] identifier[newReader] operator[SEP] operator[SEP] , identifier[source] operator[SEP] identifier[getSystemID] operator[SEP] operator[SEP] , identifier[err] , identifier[doc] operator[SEP] operator[SEP]
}
|
@Override
public GeometryColumns createFeatureTableWithMetadata(
GeometryColumns geometryColumns, String idColumnName,
List<FeatureColumn> additionalColumns, BoundingBox boundingBox,
long srsId) {
if (idColumnName == null) {
idColumnName = "id";
}
List<FeatureColumn> columns = new ArrayList<FeatureColumn>();
columns.add(FeatureColumn.createPrimaryKeyColumn(0, idColumnName));
columns.add(FeatureColumn.createGeometryColumn(1,
geometryColumns.getColumnName(),
geometryColumns.getGeometryType(), false, null));
if (additionalColumns != null) {
columns.addAll(additionalColumns);
}
return createFeatureTableWithMetadata(geometryColumns, boundingBox,
srsId, columns);
}
|
class class_name[name] begin[{]
method[createFeatureTableWithMetadata, return_type[type[GeometryColumns]], modifier[public], parameter[geometryColumns, idColumnName, additionalColumns, boundingBox, srsId]] begin[{]
if[binary_operation[member[.idColumnName], ==, literal[null]]] begin[{]
assign[member[.idColumnName], literal["id"]]
else begin[{]
None
end[}]
local_variable[type[List], columns]
call[columns.add, parameter[call[FeatureColumn.createPrimaryKeyColumn, parameter[literal[0], member[.idColumnName]]]]]
call[columns.add, parameter[call[FeatureColumn.createGeometryColumn, parameter[literal[1], call[geometryColumns.getColumnName, parameter[]], call[geometryColumns.getGeometryType, parameter[]], literal[false], literal[null]]]]]
if[binary_operation[member[.additionalColumns], !=, literal[null]]] begin[{]
call[columns.addAll, parameter[member[.additionalColumns]]]
else begin[{]
None
end[}]
return[call[.createFeatureTableWithMetadata, parameter[member[.geometryColumns], member[.boundingBox], member[.srsId], member[.columns]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GeometryColumns] identifier[createFeatureTableWithMetadata] operator[SEP] identifier[GeometryColumns] identifier[geometryColumns] , identifier[String] identifier[idColumnName] , identifier[List] operator[<] identifier[FeatureColumn] operator[>] identifier[additionalColumns] , identifier[BoundingBox] identifier[boundingBox] , Keyword[long] identifier[srsId] operator[SEP] {
Keyword[if] operator[SEP] identifier[idColumnName] operator[==] Other[null] operator[SEP] {
identifier[idColumnName] operator[=] literal[String] operator[SEP]
}
identifier[List] operator[<] identifier[FeatureColumn] operator[>] identifier[columns] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[FeatureColumn] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[add] operator[SEP] identifier[FeatureColumn] operator[SEP] identifier[createPrimaryKeyColumn] operator[SEP] Other[0] , identifier[idColumnName] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[add] operator[SEP] identifier[FeatureColumn] operator[SEP] identifier[createGeometryColumn] operator[SEP] Other[1] , identifier[geometryColumns] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] , identifier[geometryColumns] operator[SEP] identifier[getGeometryType] operator[SEP] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[additionalColumns] operator[!=] Other[null] operator[SEP] {
identifier[columns] operator[SEP] identifier[addAll] operator[SEP] identifier[additionalColumns] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createFeatureTableWithMetadata] operator[SEP] identifier[geometryColumns] , identifier[boundingBox] , identifier[srsId] , identifier[columns] operator[SEP] operator[SEP]
}
|
public static double[] normalizeEquals(final double[] v1) {
final double norm = 1. / euclideanLength(v1);
if(norm < Double.POSITIVE_INFINITY) {
for(int row = 0; row < v1.length; row++) {
v1[row] *= norm;
}
}
return v1;
}
|
class class_name[name] begin[{]
method[normalizeEquals, return_type[type[double]], modifier[public static], parameter[v1]] begin[{]
local_variable[type[double], norm]
if[binary_operation[member[.norm], <, member[Double.POSITIVE_INFINITY]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=v1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=*=, value=MemberReference(member=norm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=v1, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=row)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=row, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
return[member[.v1]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[normalizeEquals] operator[SEP] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[v1] operator[SEP] {
Keyword[final] Keyword[double] identifier[norm] operator[=] literal[Float] operator[/] identifier[euclideanLength] operator[SEP] identifier[v1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[norm] operator[<] identifier[Double] operator[SEP] identifier[POSITIVE_INFINITY] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[row] operator[=] Other[0] operator[SEP] identifier[row] operator[<] identifier[v1] operator[SEP] identifier[length] operator[SEP] identifier[row] operator[++] operator[SEP] {
identifier[v1] operator[SEP] identifier[row] operator[SEP] operator[*=] identifier[norm] operator[SEP]
}
}
Keyword[return] identifier[v1] operator[SEP]
}
|
public void save() {
File screenshotFile = new File(location.toString(), fileName);
if(!Files.exists(location)) {
screenshotFile.mkdirs();
}
if (title != null && !title.isEmpty()) {
image = ImageProcessor.addTitle(image, title, Color.red, new Font("Serif", Font.BOLD, 20));
}
FileUtil.writeImage(image, EXTENSION, screenshotFile);
}
|
class class_name[name] begin[{]
method[save, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[File], screenshotFile]
if[call[Files.exists, parameter[member[.location]]]] begin[{]
call[screenshotFile.mkdirs, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.title], !=, literal[null]], &&, call[title.isEmpty, parameter[]]]] begin[{]
assign[member[.image], call[ImageProcessor.addTitle, parameter[member[.image], member[.title], member[Color.red], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Serif"), MemberReference(member=BOLD, postfix_operators=[], prefix_operators=[], qualifier=Font, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Font, sub_type=None))]]]
else begin[{]
None
end[}]
call[FileUtil.writeImage, parameter[member[.image], member[.EXTENSION], member[.screenshotFile]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[save] operator[SEP] operator[SEP] {
identifier[File] identifier[screenshotFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[location] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[fileName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Files] operator[SEP] identifier[exists] operator[SEP] identifier[location] operator[SEP] operator[SEP] {
identifier[screenshotFile] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[title] operator[!=] Other[null] operator[&&] operator[!] identifier[title] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[image] operator[=] identifier[ImageProcessor] operator[SEP] identifier[addTitle] operator[SEP] identifier[image] , identifier[title] , identifier[Color] operator[SEP] identifier[red] , Keyword[new] identifier[Font] operator[SEP] literal[String] , identifier[Font] operator[SEP] identifier[BOLD] , Other[20] operator[SEP] operator[SEP] operator[SEP]
}
identifier[FileUtil] operator[SEP] identifier[writeImage] operator[SEP] identifier[image] , identifier[EXTENSION] , identifier[screenshotFile] operator[SEP] operator[SEP]
}
|
public boolean isNew(String identifier)
{
ItemState lastState = changesLog.getItemState(identifier);
if (lastState == null || lastState.isDeleted())
{
return false;
}
return changesLog.getItemState(identifier, ItemState.ADDED) != null;
}
|
class class_name[name] begin[{]
method[isNew, return_type[type[boolean]], modifier[public], parameter[identifier]] begin[{]
local_variable[type[ItemState], lastState]
if[binary_operation[binary_operation[member[.lastState], ==, literal[null]], ||, call[lastState.isDeleted, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[call[changesLog.getItemState, parameter[member[.identifier], member[ItemState.ADDED]]], !=, literal[null]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isNew] operator[SEP] identifier[String] identifier[identifier] operator[SEP] {
identifier[ItemState] identifier[lastState] operator[=] identifier[changesLog] operator[SEP] identifier[getItemState] operator[SEP] identifier[identifier] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastState] operator[==] Other[null] operator[||] identifier[lastState] operator[SEP] identifier[isDeleted] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[changesLog] operator[SEP] identifier[getItemState] operator[SEP] identifier[identifier] , identifier[ItemState] operator[SEP] identifier[ADDED] operator[SEP] operator[!=] Other[null] operator[SEP]
}
|
public void setCustomHttpHeader(String headerName, String headerValue) {
if(CONTENT_TYPE.equals(headerName) || HOST.equals(headerName)
|| CONTENT_LENGTH.equals(headerName)) {
throw new XMLRPCRuntimeException("You cannot modify the Host, Content-Type or Content-Length header.");
}
httpParameters.put(headerName, headerValue);
}
|
class class_name[name] begin[{]
method[setCustomHttpHeader, return_type[void], modifier[public], parameter[headerName, headerValue]] begin[{]
if[binary_operation[binary_operation[call[CONTENT_TYPE.equals, parameter[member[.headerName]]], ||, call[HOST.equals, parameter[member[.headerName]]]], ||, call[CONTENT_LENGTH.equals, parameter[member[.headerName]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You cannot modify the Host, Content-Type or Content-Length header.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XMLRPCRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[httpParameters.put, parameter[member[.headerName], member[.headerValue]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setCustomHttpHeader] operator[SEP] identifier[String] identifier[headerName] , identifier[String] identifier[headerValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[CONTENT_TYPE] operator[SEP] identifier[equals] operator[SEP] identifier[headerName] operator[SEP] operator[||] identifier[HOST] operator[SEP] identifier[equals] operator[SEP] identifier[headerName] operator[SEP] operator[||] identifier[CONTENT_LENGTH] operator[SEP] identifier[equals] operator[SEP] identifier[headerName] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XMLRPCRuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[httpParameters] operator[SEP] identifier[put] operator[SEP] identifier[headerName] , identifier[headerValue] operator[SEP] operator[SEP]
}
|
public void marshall(DeregisterJobDefinitionRequest deregisterJobDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterJobDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterJobDefinitionRequest.getJobDefinition(), JOBDEFINITION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
|
class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[deregisterJobDefinitionRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deregisterJobDefinitionRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getJobDefinition, postfix_operators=[], prefix_operators=[], qualifier=deregisterJobDefinitionRequest, selectors=[], type_arguments=None), MemberReference(member=JOBDEFINITION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DeregisterJobDefinitionRequest] identifier[deregisterJobDefinitionRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deregisterJobDefinitionRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[deregisterJobDefinitionRequest] operator[SEP] identifier[getJobDefinition] operator[SEP] operator[SEP] , identifier[JOBDEFINITION_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@XmlElementDecl(namespace = "http://www.tibco.com/xmlns/ApplicationManagement", name = "service", substitutionHeadNamespace = "http://www.tibco.com/xmlns/ApplicationManagement", substitutionHeadName = "baseService")
public JAXBElement<Service> createService(Service value) {
return new JAXBElement<Service>(_Service_QNAME, Service.class, null, value);
}
|
class class_name[name] begin[{]
method[createService, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Service_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Service, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Service, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[substitutionHeadNamespace] operator[=] literal[String] , identifier[substitutionHeadName] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[Service] operator[>] identifier[createService] operator[SEP] identifier[Service] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[Service] operator[>] operator[SEP] identifier[_Service_QNAME] , identifier[Service] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public void createLocalTx(Xid xid, EmbeddedTransaction tx) {
localTxTable.put(xid, tx);
if (trace) {
log.tracef("[%s] New tx=%s", xid, tx);
}
}
|
class class_name[name] begin[{]
method[createLocalTx, return_type[void], modifier[public], parameter[xid, tx]] begin[{]
call[localTxTable.put, parameter[member[.xid], member[.tx]]]
if[member[.trace]] begin[{]
call[log.tracef, parameter[literal["[%s] New tx=%s"], member[.xid], member[.tx]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[createLocalTx] operator[SEP] identifier[Xid] identifier[xid] , identifier[EmbeddedTransaction] identifier[tx] operator[SEP] {
identifier[localTxTable] operator[SEP] identifier[put] operator[SEP] identifier[xid] , identifier[tx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[trace] operator[SEP] {
identifier[log] operator[SEP] identifier[tracef] operator[SEP] literal[String] , identifier[xid] , identifier[tx] operator[SEP] operator[SEP]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.