code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
void mapPut(S storable) {
mMap.put(new Key<S>(storable, mFullComparator), storable);
} | class class_name[name] begin[{]
method[mapPut, return_type[void], modifier[default], parameter[storable]] begin[{]
call[mMap.put, parameter[ClassCreator(arguments=[MemberReference(member=storable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mFullComparator, 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=S, sub_type=None))], dimensions=None, name=Key, sub_type=None)), member[.storable]]]
end[}]
END[}] | Keyword[void] identifier[mapPut] operator[SEP] identifier[S] identifier[storable] operator[SEP] {
identifier[mMap] operator[SEP] identifier[put] operator[SEP] Keyword[new] identifier[Key] operator[<] identifier[S] operator[>] operator[SEP] identifier[storable] , identifier[mFullComparator] operator[SEP] , identifier[storable] operator[SEP] operator[SEP]
}
|
private String resolveCompositeKey(String key, Properties props) {
String value = null;
// Look for the comma
int comma = key.indexOf(',');
if (comma > -1) {
// If we have a first part, try resolve it
if (comma > 0) {
// Check the first part
String key1 = key.substring(0, comma);
if (props != null) {
value = props.getProperty(key1);
} else {
value = System.getProperty(key1);
}
}
// Check the second part, if there is one and first lookup failed
if (value == null && comma < key.length() - 1) {
String key2 = key.substring(comma + 1);
if (props != null) {
value = props.getProperty(key2);
} else {
value = System.getProperty(key2);
}
}
}
// Return whatever we've found or null
return value;
} | class class_name[name] begin[{]
method[resolveCompositeKey, return_type[type[String]], modifier[private], parameter[key, props]] begin[{]
local_variable[type[String], value]
local_variable[type[int], comma]
if[binary_operation[member[.comma], >, literal[1]]] begin[{]
if[binary_operation[member[.comma], >, literal[0]]] begin[{]
local_variable[type[String], key1]
if[binary_operation[member[.props], !=, literal[null]]] begin[{]
assign[member[.value], call[props.getProperty, parameter[member[.key1]]]]
else begin[{]
assign[member[.value], call[System.getProperty, parameter[member[.key1]]]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.value], ==, literal[null]], &&, binary_operation[member[.comma], <, binary_operation[call[key.length, parameter[]], -, literal[1]]]]] begin[{]
local_variable[type[String], key2]
if[binary_operation[member[.props], !=, literal[null]]] begin[{]
assign[member[.value], call[props.getProperty, parameter[member[.key2]]]]
else begin[{]
assign[member[.value], call[System.getProperty, parameter[member[.key2]]]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[resolveCompositeKey] operator[SEP] identifier[String] identifier[key] , identifier[Properties] identifier[props] operator[SEP] {
identifier[String] identifier[value] operator[=] Other[null] operator[SEP] Keyword[int] identifier[comma] operator[=] identifier[key] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[comma] operator[>] operator[-] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[comma] operator[>] Other[0] operator[SEP] {
identifier[String] identifier[key1] operator[=] identifier[key] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[comma] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[props] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] identifier[key1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[value] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[key1] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[&&] identifier[comma] operator[<] identifier[key] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
identifier[String] identifier[key2] operator[=] identifier[key] operator[SEP] identifier[substring] operator[SEP] identifier[comma] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[props] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] identifier[key2] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[value] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[key2] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[value] operator[SEP]
}
|
public static Properties load(File file) throws IOException {
if (file.isFile()) {
return load(file.toURI().toURL());
}
return new Properties();
} | class class_name[name] begin[{]
method[load, return_type[type[Properties]], modifier[public static], parameter[file]] begin[{]
if[call[file.isFile, parameter[]]] begin[{]
return[call[.load, parameter[call[file.toURI, parameter[]]]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Properties, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Properties] identifier[load] operator[SEP] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[load] operator[SEP] identifier[file] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP]
}
|
@Deprecated
public static int count(String string, CodePointPredicate predicate)
{
return StringIterate.countCodePoint(string, predicate);
} | class class_name[name] begin[{]
method[count, return_type[type[int]], modifier[public static], parameter[string, predicate]] begin[{]
return[call[StringIterate.countCodePoint, parameter[member[.string], member[.predicate]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] Keyword[int] identifier[count] operator[SEP] identifier[String] identifier[string] , identifier[CodePointPredicate] identifier[predicate] operator[SEP] {
Keyword[return] identifier[StringIterate] operator[SEP] identifier[countCodePoint] operator[SEP] identifier[string] , identifier[predicate] operator[SEP] operator[SEP]
}
|
@Override
public S handle(int version, water.api.Route route, Properties parms, String postBody) throws Exception {
// Only here for train or validate-parms
if( !route._handler_method.getName().equals("train") )
throw water.H2O.unimpl();
// Peek out the desired algo from the URL
String ss[] = route._url.split("/");
String algoURLName = ss[3]; // {}/{99}/{Grid}/{gbm}/
String algoName = ModelBuilder.algoName(algoURLName); // gbm -> GBM; deeplearning -> DeepLearning
String schemaDir = ModelBuilder.schemaDirectory(algoURLName);
// Get the latest version of this algo: /99/Grid/gbm ==> GBMV3
// String algoSchemaName = SchemaServer.schemaClass(version, algoName).getSimpleName(); // GBMV3
// int algoVersion = Integer.valueOf(algoSchemaName.substring(algoSchemaName.lastIndexOf("V")+1)); // '3'
// Ok, i'm replacing one hack with another hack here, because SchemaServer.schema*() calls are getting eliminated.
// There probably shouldn't be any reference to algoVersion here at all... TODO: unhack all of this
int algoVersion = 3;
if (algoName.equals("SVD") || algoName.equals("Aggregator") || algoName.equals("StackedEnsemble")) algoVersion = 99;
// TODO: this is a horrible hack which is going to cause maintenance problems:
String paramSchemaName = schemaDir+algoName+"V"+algoVersion+"$"+ModelBuilder.paramName(algoURLName)+"V"+algoVersion;
// Build the Grid Search schema, and fill it from the parameters
S gss = (S) new GridSearchSchema();
gss.init_meta();
gss.parameters = (P)TypeMap.newFreezable(paramSchemaName);
gss.parameters.init_meta();
gss.hyper_parameters = new IcedHashMap<>();
// Get default parameters, then overlay the passed-in values
ModelBuilder builder = ModelBuilder.make(algoURLName,null,null); // Default parameter settings
gss.parameters.fillFromImpl(builder._parms); // Defaults for this builder into schema
gss.fillFromParms(parms); // Override defaults from user parms
// Verify list of hyper parameters
// Right now only names, no types
// note: still use _validation_frame and and _training_frame at this point.
// Do not change those names yet.
validateHyperParams((P)gss.parameters, gss.hyper_parameters);
// Get actual parameters
MP params = (MP) gss.parameters.createAndFillImpl();
Map<String,Object[]> sortedMap = new TreeMap<>(gss.hyper_parameters);
// Need to change validation_frame to valid now. HyperSpacewalker will complain
// if it encountered an illegal parameter name. From now on, validation_frame,
// training_fame are no longer valid names.
if (sortedMap.containsKey("validation_frame")) {
sortedMap.put("valid", sortedMap.get("validation_frame"));
sortedMap.remove("validation_frame");
}
// Get/create a grid for given frame
// FIXME: Grid ID is not pass to grid search builder!
Key<Grid> destKey = gss.grid_id != null ? gss.grid_id.key() : null;
// Create target grid search object (keep it private for now)
// Start grid search and return the schema back with job key
Job<Grid> gsJob = GridSearch.startGridSearch(
destKey,
params,
sortedMap,
new DefaultModelParametersBuilderFactory<MP, P>(),
(HyperSpaceSearchCriteria) gss.search_criteria.createAndFillImpl()
);
// Fill schema with job parameters
// FIXME: right now we have to remove grid parameters which we sent back
gss.hyper_parameters = null;
gss.total_models = gsJob._result.get().getModelCount(); // TODO: looks like it's currently always 0
gss.job = new JobV3(gsJob);
return gss;
} | class class_name[name] begin[{]
method[handle, return_type[type[S]], modifier[public], parameter[version, route, parms, postBody]] begin[{]
if[call[route._handler_method.getName, parameter[]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[], member=unimpl, postfix_operators=[], prefix_operators=[], qualifier=water.H2O, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[String], ss]
local_variable[type[String], algoURLName]
local_variable[type[String], algoName]
local_variable[type[String], schemaDir]
local_variable[type[int], algoVersion]
if[binary_operation[binary_operation[call[algoName.equals, parameter[literal["SVD"]]], ||, call[algoName.equals, parameter[literal["Aggregator"]]]], ||, call[algoName.equals, parameter[literal["StackedEnsemble"]]]]] begin[{]
assign[member[.algoVersion], literal[99]]
else begin[{]
None
end[}]
local_variable[type[String], paramSchemaName]
local_variable[type[S], gss]
call[gss.init_meta, parameter[]]
assign[member[gss.parameters], Cast(expression=MethodInvocation(arguments=[MemberReference(member=paramSchemaName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newFreezable, postfix_operators=[], prefix_operators=[], qualifier=TypeMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=P, sub_type=None))]
call[gss.parameters.init_meta, parameter[]]
assign[member[gss.hyper_parameters], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=IcedHashMap, sub_type=None))]
local_variable[type[ModelBuilder], builder]
call[gss.parameters.fillFromImpl, parameter[member[builder._parms]]]
call[gss.fillFromParms, parameter[member[.parms]]]
call[.validateHyperParams, parameter[Cast(expression=MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=gss, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=P, sub_type=None)), member[gss.hyper_parameters]]]
local_variable[type[MP], params]
local_variable[type[Map], sortedMap]
if[call[sortedMap.containsKey, parameter[literal["validation_frame"]]]] begin[{]
call[sortedMap.put, parameter[literal["valid"], call[sortedMap.get, parameter[literal["validation_frame"]]]]]
call[sortedMap.remove, parameter[literal["validation_frame"]]]
else begin[{]
None
end[}]
local_variable[type[Key], destKey]
local_variable[type[Job], gsJob]
assign[member[gss.hyper_parameters], literal[null]]
assign[member[gss.total_models], call[gsJob._result.get, parameter[]]]
assign[member[gss.job], ClassCreator(arguments=[MemberReference(member=gsJob, 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=JobV3, sub_type=None))]
return[member[.gss]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[S] identifier[handle] operator[SEP] Keyword[int] identifier[version] , identifier[water] operator[SEP] identifier[api] operator[SEP] identifier[Route] identifier[route] , identifier[Properties] identifier[parms] , identifier[String] identifier[postBody] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] identifier[route] operator[SEP] identifier[_handler_method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] identifier[water] operator[SEP] identifier[H2O] operator[SEP] identifier[unimpl] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[ss] operator[SEP] operator[SEP] operator[=] identifier[route] operator[SEP] identifier[_url] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[algoURLName] operator[=] identifier[ss] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[String] identifier[algoName] operator[=] identifier[ModelBuilder] operator[SEP] identifier[algoName] operator[SEP] identifier[algoURLName] operator[SEP] operator[SEP] identifier[String] identifier[schemaDir] operator[=] identifier[ModelBuilder] operator[SEP] identifier[schemaDirectory] operator[SEP] identifier[algoURLName] operator[SEP] operator[SEP] Keyword[int] identifier[algoVersion] operator[=] Other[3] operator[SEP] Keyword[if] operator[SEP] identifier[algoName] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[algoName] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[algoName] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[algoVersion] operator[=] Other[99] operator[SEP] identifier[String] identifier[paramSchemaName] operator[=] identifier[schemaDir] operator[+] identifier[algoName] operator[+] literal[String] operator[+] identifier[algoVersion] operator[+] literal[String] operator[+] identifier[ModelBuilder] operator[SEP] identifier[paramName] operator[SEP] identifier[algoURLName] operator[SEP] operator[+] literal[String] operator[+] identifier[algoVersion] operator[SEP] identifier[S] identifier[gss] operator[=] operator[SEP] identifier[S] operator[SEP] Keyword[new] identifier[GridSearchSchema] operator[SEP] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[init_meta] operator[SEP] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[parameters] operator[=] operator[SEP] identifier[P] operator[SEP] identifier[TypeMap] operator[SEP] identifier[newFreezable] operator[SEP] identifier[paramSchemaName] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[parameters] operator[SEP] identifier[init_meta] operator[SEP] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[hyper_parameters] operator[=] Keyword[new] identifier[IcedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ModelBuilder] identifier[builder] operator[=] identifier[ModelBuilder] operator[SEP] identifier[make] operator[SEP] identifier[algoURLName] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[parameters] operator[SEP] identifier[fillFromImpl] operator[SEP] identifier[builder] operator[SEP] identifier[_parms] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[fillFromParms] operator[SEP] identifier[parms] operator[SEP] operator[SEP] identifier[validateHyperParams] operator[SEP] operator[SEP] identifier[P] operator[SEP] identifier[gss] operator[SEP] identifier[parameters] , identifier[gss] operator[SEP] identifier[hyper_parameters] operator[SEP] operator[SEP] identifier[MP] identifier[params] operator[=] operator[SEP] identifier[MP] operator[SEP] identifier[gss] operator[SEP] identifier[parameters] operator[SEP] identifier[createAndFillImpl] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[sortedMap] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] identifier[gss] operator[SEP] identifier[hyper_parameters] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sortedMap] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[sortedMap] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[sortedMap] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[sortedMap] operator[SEP] identifier[remove] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Key] operator[<] identifier[Grid] operator[>] identifier[destKey] operator[=] identifier[gss] operator[SEP] identifier[grid_id] operator[!=] Other[null] operator[?] identifier[gss] operator[SEP] identifier[grid_id] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] identifier[Job] operator[<] identifier[Grid] operator[>] identifier[gsJob] operator[=] identifier[GridSearch] operator[SEP] identifier[startGridSearch] operator[SEP] identifier[destKey] , identifier[params] , identifier[sortedMap] , Keyword[new] identifier[DefaultModelParametersBuilderFactory] operator[<] identifier[MP] , identifier[P] operator[>] operator[SEP] operator[SEP] , operator[SEP] identifier[HyperSpaceSearchCriteria] operator[SEP] identifier[gss] operator[SEP] identifier[search_criteria] operator[SEP] identifier[createAndFillImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[hyper_parameters] operator[=] Other[null] operator[SEP] identifier[gss] operator[SEP] identifier[total_models] operator[=] identifier[gsJob] operator[SEP] identifier[_result] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getModelCount] operator[SEP] operator[SEP] operator[SEP] identifier[gss] operator[SEP] identifier[job] operator[=] Keyword[new] identifier[JobV3] operator[SEP] identifier[gsJob] operator[SEP] operator[SEP] Keyword[return] identifier[gss] operator[SEP]
}
|
private PostMethod getRequestMethod(boolean refresh, String id) throws UnsupportedEncodingException {
GOCTransport gocTransport = new GOCTransport();
EndpointInfo endpointInfo = gocTransport.getEndpointInfo(_config, _logger, refresh);
// Create upsert URI with PATCH method
PostMethod post = new PostMethod(String.format("%s/services/data/v25.0/sobjects/SM_Alert__c/%s/%s", endpointInfo.getEndPoint(),
urlEncode(GOCData.SM_ALERT_ID__C_FIELD), urlEncode(id))) {
@Override
public String getName() {
return "PATCH";
}
};
post.setRequestHeader("Authorization", "Bearer " + endpointInfo.getToken());
return post;
} | class class_name[name] begin[{]
method[getRequestMethod, return_type[type[PostMethod]], modifier[private], parameter[refresh, id]] begin[{]
local_variable[type[GOCTransport], gocTransport]
local_variable[type[EndpointInfo], endpointInfo]
local_variable[type[PostMethod], post]
call[post.setRequestHeader, parameter[literal["Authorization"], binary_operation[literal["Bearer "], +, call[endpointInfo.getToken, parameter[]]]]]
return[member[.post]]
end[}]
END[}] | Keyword[private] identifier[PostMethod] identifier[getRequestMethod] operator[SEP] Keyword[boolean] identifier[refresh] , identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[UnsupportedEncodingException] {
identifier[GOCTransport] identifier[gocTransport] operator[=] Keyword[new] identifier[GOCTransport] operator[SEP] operator[SEP] operator[SEP] identifier[EndpointInfo] identifier[endpointInfo] operator[=] identifier[gocTransport] operator[SEP] identifier[getEndpointInfo] operator[SEP] identifier[_config] , identifier[_logger] , identifier[refresh] operator[SEP] operator[SEP] identifier[PostMethod] identifier[post] operator[=] Keyword[new] identifier[PostMethod] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[endpointInfo] operator[SEP] identifier[getEndPoint] operator[SEP] operator[SEP] , identifier[urlEncode] operator[SEP] identifier[GOCData] operator[SEP] identifier[SM_ALERT_ID__C_FIELD] operator[SEP] , identifier[urlEncode] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getName] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
} operator[SEP] identifier[post] operator[SEP] identifier[setRequestHeader] operator[SEP] literal[String] , literal[String] operator[+] identifier[endpointInfo] operator[SEP] identifier[getToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[post] operator[SEP]
}
|
private static boolean isOneVMPerClass(Object mojo) throws Exception {
// We already know that we fork process (checked in
// precondition). Threfore if we see reuseForks=false, we know
// that one class will be run in one VM.
try {
return !invokeAndGetBoolean(IS_REUSE_FORKS, mojo);
} catch (NoSuchMethodException ex) {
// Nothing: earlier versions (before 2.13) of surefire did
// not have reuseForks.
return false;
}
} | class class_name[name] begin[{]
method[isOneVMPerClass, return_type[type[boolean]], modifier[private static], parameter[mojo]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=IS_REUSE_FORKS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mojo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invokeAndGetBoolean, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isOneVMPerClass] operator[SEP] identifier[Object] identifier[mojo] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[try] {
Keyword[return] operator[!] identifier[invokeAndGetBoolean] operator[SEP] identifier[IS_REUSE_FORKS] , identifier[mojo] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[ex] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
private CtField createStampField(final CtClass candidateClass) throws CannotCompileException {
int stampModifiers = AccessFlag.STATIC | AccessFlag.FINAL;
if (!candidateClass.isInterface()) {
stampModifiers |= AccessFlag.PRIVATE;
} else {
stampModifiers |= AccessFlag.PUBLIC;
}
final CtField stampField = new CtField(CtClass.booleanType,
createStampFieldName(),
candidateClass);
stampField.setModifiers(stampModifiers);
return stampField;
} | class class_name[name] begin[{]
method[createStampField, return_type[type[CtField]], modifier[private], parameter[candidateClass]] begin[{]
local_variable[type[int], stampModifiers]
if[call[candidateClass.isInterface, parameter[]]] begin[{]
assign[member[.stampModifiers], member[AccessFlag.PRIVATE]]
else begin[{]
assign[member[.stampModifiers], member[AccessFlag.PUBLIC]]
end[}]
local_variable[type[CtField], stampField]
call[stampField.setModifiers, parameter[member[.stampModifiers]]]
return[member[.stampField]]
end[}]
END[}] | Keyword[private] identifier[CtField] identifier[createStampField] operator[SEP] Keyword[final] identifier[CtClass] identifier[candidateClass] operator[SEP] Keyword[throws] identifier[CannotCompileException] {
Keyword[int] identifier[stampModifiers] operator[=] identifier[AccessFlag] operator[SEP] identifier[STATIC] operator[|] identifier[AccessFlag] operator[SEP] identifier[FINAL] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[candidateClass] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] {
identifier[stampModifiers] operator[|=] identifier[AccessFlag] operator[SEP] identifier[PRIVATE] operator[SEP]
}
Keyword[else] {
identifier[stampModifiers] operator[|=] identifier[AccessFlag] operator[SEP] identifier[PUBLIC] operator[SEP]
}
Keyword[final] identifier[CtField] identifier[stampField] operator[=] Keyword[new] identifier[CtField] operator[SEP] identifier[CtClass] operator[SEP] identifier[booleanType] , identifier[createStampFieldName] operator[SEP] operator[SEP] , identifier[candidateClass] operator[SEP] operator[SEP] identifier[stampField] operator[SEP] identifier[setModifiers] operator[SEP] identifier[stampModifiers] operator[SEP] operator[SEP] Keyword[return] identifier[stampField] operator[SEP]
}
|
private String[] splitSeqName(String sequenceName) {
String[] result = new String[3];
String[] barSplit = sequenceName.split("/");
if (barSplit.length == 2) {
result[0] = barSplit[0];
String[] positions = barSplit[1].split("-");
if (positions.length == 2) {
result[1] = positions[0];
result[2] = positions[1];
}
} else {
result[0] = sequenceName;
result[1] = null;
result[2] = null;
}
return result;
} | class class_name[name] begin[{]
method[splitSeqName, return_type[type[String]], modifier[private], parameter[sequenceName]] begin[{]
local_variable[type[String], result]
local_variable[type[String], barSplit]
if[binary_operation[member[barSplit.length], ==, literal[2]]] begin[{]
assign[member[.result], member[.barSplit]]
local_variable[type[String], positions]
if[binary_operation[member[positions.length], ==, literal[2]]] begin[{]
assign[member[.result], member[.positions]]
assign[member[.result], member[.positions]]
else begin[{]
None
end[}]
else begin[{]
assign[member[.result], member[.sequenceName]]
assign[member[.result], literal[null]]
assign[member[.result], literal[null]]
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[String] operator[SEP] operator[SEP] identifier[splitSeqName] operator[SEP] identifier[String] identifier[sequenceName] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[String] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[barSplit] operator[=] identifier[sequenceName] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[barSplit] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
identifier[result] operator[SEP] Other[0] operator[SEP] operator[=] identifier[barSplit] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[positions] operator[=] identifier[barSplit] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[positions] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
identifier[result] operator[SEP] Other[1] operator[SEP] operator[=] identifier[positions] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[result] operator[SEP] Other[2] operator[SEP] operator[=] identifier[positions] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[result] operator[SEP] Other[0] operator[SEP] operator[=] identifier[sequenceName] operator[SEP] identifier[result] operator[SEP] Other[1] operator[SEP] operator[=] Other[null] operator[SEP] identifier[result] operator[SEP] Other[2] operator[SEP] operator[=] Other[null] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public OStorageConfigurationImpl load(final OContextConfiguration configuration) throws OSerializationException {
lock.acquireWriteLock();
try {
initConfiguration(configuration);
final byte[] record = storage.readRecord(CONFIG_RID, null, false, false, null).getResult().buffer;
if (record == null)
throw new OStorageException("Cannot load database configuration. The database seems corrupted");
fromStream(record, 0, record.length, streamCharset);
} finally {
lock.releaseWriteLock();
}
return this;
} | class class_name[name] begin[{]
method[load, return_type[type[OStorageConfigurationImpl]], modifier[public], parameter[configuration]] begin[{]
call[lock.acquireWriteLock, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=configuration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=CONFIG_RID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=readRecord, postfix_operators=[], prefix_operators=[], qualifier=storage, selectors=[MethodInvocation(arguments=[], member=getResult, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MemberReference(member=buffer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), name=record)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=record, 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=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot load database configuration. The database seems corrupted")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OStorageException, sub_type=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=record, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[]), MemberReference(member=streamCharset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=releaseWriteLock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[OStorageConfigurationImpl] identifier[load] operator[SEP] Keyword[final] identifier[OContextConfiguration] identifier[configuration] operator[SEP] Keyword[throws] identifier[OSerializationException] {
identifier[lock] operator[SEP] identifier[acquireWriteLock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[initConfiguration] operator[SEP] identifier[configuration] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[record] operator[=] identifier[storage] operator[SEP] identifier[readRecord] operator[SEP] identifier[CONFIG_RID] , Other[null] , literal[boolean] , literal[boolean] , Other[null] operator[SEP] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] Keyword[if] operator[SEP] identifier[record] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[OStorageException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[fromStream] operator[SEP] identifier[record] , Other[0] , identifier[record] operator[SEP] identifier[length] , identifier[streamCharset] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[releaseWriteLock] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void marshall(DeleteDeploymentRequest deleteDeploymentRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDeploymentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDeploymentRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(deleteDeploymentRequest.getDeploymentId(), DEPLOYMENTID_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[deleteDeploymentRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteDeploymentRequest], ==, 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=getApiId, postfix_operators=[], prefix_operators=[], qualifier=deleteDeploymentRequest, selectors=[], type_arguments=None), MemberReference(member=APIID_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=getDeploymentId, postfix_operators=[], prefix_operators=[], qualifier=deleteDeploymentRequest, selectors=[], type_arguments=None), MemberReference(member=DEPLOYMENTID_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[DeleteDeploymentRequest] identifier[deleteDeploymentRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteDeploymentRequest] 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[deleteDeploymentRequest] operator[SEP] identifier[getApiId] operator[SEP] operator[SEP] , identifier[APIID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[deleteDeploymentRequest] operator[SEP] identifier[getDeploymentId] operator[SEP] operator[SEP] , identifier[DEPLOYMENTID_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 Checksum checksum(File file, Checksum checksum) throws IORuntimeException {
Assert.notNull(file, "File is null !");
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
try {
return IoUtil.checksum(new FileInputStream(file), checksum);
} catch (FileNotFoundException e) {
throw new IORuntimeException(e);
}
} | class class_name[name] begin[{]
method[checksum, return_type[type[Checksum]], modifier[public static], parameter[file, checksum]] begin[{]
call[Assert.notNull, parameter[member[.file], literal["File is null !"]]]
if[call[file.isDirectory, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Checksums can't be computed on directories")], 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[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[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)), MemberReference(member=checksum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checksum, postfix_operators=[], prefix_operators=[], qualifier=IoUtil, selectors=[], 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=IORuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileNotFoundException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Checksum] identifier[checksum] operator[SEP] identifier[File] identifier[file] , identifier[Checksum] identifier[checksum] operator[SEP] Keyword[throws] identifier[IORuntimeException] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[file] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[IoUtil] operator[SEP] identifier[checksum] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] , identifier[checksum] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IORuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public byte[] read(final String _resourceName)
{
byte[] ret = null;
EFapsClassLoader.LOG.debug("read ''", _resourceName);
try {
final QueryBuilder queryBuilder = new QueryBuilder(this.classType);
queryBuilder.addWhereAttrEqValue("Name", _resourceName);
final InstanceQuery query = queryBuilder.getCachedQuery("esjp");
query.execute();
if (query.next()) {
final Checkout checkout = new Checkout(query.getCurrentValue());
final InputStream is = checkout.executeWithoutAccessCheck();
ret = new byte[is.available()];
is.read(ret);
is.close();
}
} catch (final EFapsException e) {
EFapsClassLoader.LOG.error("could not access the Database for reading '{}' - {}", _resourceName, e);
} catch (final IOException e) {
EFapsClassLoader.LOG.error("could not read the Javaclass '{}' - {}", _resourceName, e);
}
return ret;
} | class class_name[name] begin[{]
method[read, return_type[type[byte]], modifier[public], parameter[_resourceName]] begin[{]
local_variable[type[byte], ret]
call[EFapsClassLoader.LOG.debug, parameter[literal["read ''"], member[._resourceName]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=classType, 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=QueryBuilder, sub_type=None)), name=queryBuilder)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=QueryBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Name"), MemberReference(member=_resourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addWhereAttrEqValue, postfix_operators=[], prefix_operators=[], qualifier=queryBuilder, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="esjp")], member=getCachedQuery, postfix_operators=[], prefix_operators=[], qualifier=queryBuilder, selectors=[], type_arguments=None), name=query)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InstanceQuery, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getCurrentValue, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Checkout, sub_type=None)), name=checkout)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Checkout, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=executeWithoutAccessCheck, postfix_operators=[], prefix_operators=[], qualifier=checkout, selectors=[], type_arguments=None), name=is)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=available, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="could not access the Database for reading '{}' - {}"), MemberReference(member=_resourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=EFapsClassLoader.LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EFapsException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="could not read the Javaclass '{}' - {}"), MemberReference(member=_resourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=EFapsClassLoader.LOG, 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)
return[member[.ret]]
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[read] operator[SEP] Keyword[final] identifier[String] identifier[_resourceName] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[ret] operator[=] Other[null] operator[SEP] identifier[EFapsClassLoader] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[_resourceName] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[QueryBuilder] identifier[queryBuilder] operator[=] Keyword[new] identifier[QueryBuilder] operator[SEP] Keyword[this] operator[SEP] identifier[classType] operator[SEP] operator[SEP] identifier[queryBuilder] operator[SEP] identifier[addWhereAttrEqValue] operator[SEP] literal[String] , identifier[_resourceName] operator[SEP] operator[SEP] Keyword[final] identifier[InstanceQuery] identifier[query] operator[=] identifier[queryBuilder] operator[SEP] identifier[getCachedQuery] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[query] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Checkout] identifier[checkout] operator[=] Keyword[new] identifier[Checkout] operator[SEP] identifier[query] operator[SEP] identifier[getCurrentValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[InputStream] identifier[is] operator[=] identifier[checkout] operator[SEP] identifier[executeWithoutAccessCheck] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[is] operator[SEP] identifier[available] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[ret] operator[SEP] operator[SEP] identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[EFapsException] identifier[e] operator[SEP] {
identifier[EFapsClassLoader] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[_resourceName] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
identifier[EFapsClassLoader] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[_resourceName] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static GitLabApi oauth2Login(String url, String username, char[] password) throws GitLabApiException {
try (SecretString secretPassword = new SecretString(password)) {
return (GitLabApi.oauth2Login(ApiVersion.V4, url, username, secretPassword, null, null, false));
}
} | class class_name[name] begin[{]
method[oauth2Login, return_type[type[GitLabApi]], modifier[public static], parameter[url, username, password]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=V4, postfix_operators=[], prefix_operators=[], qualifier=ApiVersion, selectors=[]), MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=secretPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=oauth2Login, postfix_operators=[], prefix_operators=[], qualifier=GitLabApi, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=secretPassword, type=ReferenceType(arguments=None, dimensions=[], name=SecretString, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=password, 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=SecretString, sub_type=None)))])
end[}]
END[}] | Keyword[public] Keyword[static] identifier[GitLabApi] identifier[oauth2Login] operator[SEP] identifier[String] identifier[url] , identifier[String] identifier[username] , Keyword[char] operator[SEP] operator[SEP] identifier[password] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[try] operator[SEP] identifier[SecretString] identifier[secretPassword] operator[=] Keyword[new] identifier[SecretString] operator[SEP] identifier[password] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[GitLabApi] operator[SEP] identifier[oauth2Login] operator[SEP] identifier[ApiVersion] operator[SEP] identifier[V4] , identifier[url] , identifier[username] , identifier[secretPassword] , Other[null] , Other[null] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void createFileStructure(final File projectDir) throws IOException {
/*
* create an empty project file structure
*/
if (! projectDir.exists() && ! projectDir.mkdirs()) {
throw new IOException("failed creating project base dir: " + projectDir.getAbsolutePath());
}
/**
* Create project etc directory for configuration data
*/
final File etcDir = new File(projectDir, FrameworkProject.ETC_DIR_NAME);
if (! etcDir.exists() && ! etcDir.mkdirs()) {
throw new IOException("failed creating project etc dir: " + etcDir.getAbsolutePath());
}
} | class class_name[name] begin[{]
method[createFileStructure, return_type[void], modifier[public static], parameter[projectDir]] begin[{]
if[binary_operation[call[projectDir.exists, parameter[]], &&, call[projectDir.mkdirs, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed creating project base dir: "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=projectDir, selectors=[], type_arguments=None), operator=+)], 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)
else begin[{]
None
end[}]
local_variable[type[File], etcDir]
if[binary_operation[call[etcDir.exists, parameter[]], &&, call[etcDir.mkdirs, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed creating project etc dir: "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=etcDir, selectors=[], type_arguments=None), operator=+)], 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)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[createFileStructure] operator[SEP] Keyword[final] identifier[File] identifier[projectDir] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[projectDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[projectDir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[projectDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[File] identifier[etcDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[projectDir] , identifier[FrameworkProject] operator[SEP] identifier[ETC_DIR_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[etcDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[etcDir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[etcDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@NonNull
@Override
public MutableDictionary setLong(@NonNull String key, long value) {
return setValue(key, value);
} | class class_name[name] begin[{]
method[setLong, return_type[type[MutableDictionary]], modifier[public], parameter[key, value]] begin[{]
return[call[.setValue, parameter[member[.key], member[.value]]]]
end[}]
END[}] | annotation[@] identifier[NonNull] annotation[@] identifier[Override] Keyword[public] identifier[MutableDictionary] identifier[setLong] operator[SEP] annotation[@] identifier[NonNull] identifier[String] identifier[key] , Keyword[long] identifier[value] operator[SEP] {
Keyword[return] identifier[setValue] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
public boolean accept(final Node aNode) {
if (oldPrefix.equals(aNode.getPrefix())) {
// Process any nodes on the form [oldPrefix]:something.
return true;
}
if (aNode instanceof Attr) {
// These cases are defined by attribute properties.
final Attr attribute = (Attr) aNode;
if (isNamespaceDefinition(attribute)
|| isElementReference(attribute)
|| isTypeAttributeWithPrefix(attribute)
|| isExtension(attribute)) {
return true;
}
}
// Nopes.
return false;
} | class class_name[name] begin[{]
method[accept, return_type[type[boolean]], modifier[public], parameter[aNode]] begin[{]
if[call[oldPrefix.equals, parameter[call[aNode.getPrefix, parameter[]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.aNode], instanceof, type[Attr]]] begin[{]
local_variable[type[Attr], attribute]
if[binary_operation[binary_operation[binary_operation[call[.isNamespaceDefinition, parameter[member[.attribute]]], ||, call[.isElementReference, parameter[member[.attribute]]]], ||, call[.isTypeAttributeWithPrefix, parameter[member[.attribute]]]], ||, call[.isExtension, parameter[member[.attribute]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[accept] operator[SEP] Keyword[final] identifier[Node] identifier[aNode] operator[SEP] {
Keyword[if] operator[SEP] identifier[oldPrefix] operator[SEP] identifier[equals] operator[SEP] identifier[aNode] operator[SEP] identifier[getPrefix] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[aNode] Keyword[instanceof] identifier[Attr] operator[SEP] {
Keyword[final] identifier[Attr] identifier[attribute] operator[=] operator[SEP] identifier[Attr] operator[SEP] identifier[aNode] operator[SEP] Keyword[if] operator[SEP] identifier[isNamespaceDefinition] operator[SEP] identifier[attribute] operator[SEP] operator[||] identifier[isElementReference] operator[SEP] identifier[attribute] operator[SEP] operator[||] identifier[isTypeAttributeWithPrefix] operator[SEP] identifier[attribute] operator[SEP] operator[||] identifier[isExtension] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static boolean isUnaryComparison(@Nullable Object value) {
return value == null || value.equals(Double.NaN) || value.equals(Float.NaN);
} | class class_name[name] begin[{]
method[isUnaryComparison, return_type[type[boolean]], modifier[private static], parameter[value]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.value], ==, literal[null]], ||, call[value.equals, parameter[member[Double.NaN]]]], ||, call[value.equals, parameter[member[Float.NaN]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isUnaryComparison] operator[SEP] annotation[@] identifier[Nullable] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] identifier[value] operator[==] Other[null] operator[||] identifier[value] operator[SEP] identifier[equals] operator[SEP] identifier[Double] operator[SEP] identifier[NaN] operator[SEP] operator[||] identifier[value] operator[SEP] identifier[equals] operator[SEP] identifier[Float] operator[SEP] identifier[NaN] operator[SEP] operator[SEP]
}
|
boolean isMonitored(HttpSession session) {
boolean monitor = false;
if (null != session && session.getAttribute(Constants.Options.OPTIONS) != null) {
monitor = ((Options) session.getAttribute(Constants.Options.OPTIONS)).isMonitor();
}
return monitor;
} | class class_name[name] begin[{]
method[isMonitored, return_type[type[boolean]], modifier[default], parameter[session]] begin[{]
local_variable[type[boolean], monitor]
if[binary_operation[binary_operation[literal[null], !=, member[.session]], &&, binary_operation[call[session.getAttribute, parameter[member[Constants.Options.OPTIONS]]], !=, literal[null]]]] begin[{]
assign[member[.monitor], Cast(expression=MethodInvocation(arguments=[MemberReference(member=OPTIONS, postfix_operators=[], prefix_operators=[], qualifier=Constants.Options, selectors=[])], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Options, sub_type=None))]
else begin[{]
None
end[}]
return[member[.monitor]]
end[}]
END[}] | Keyword[boolean] identifier[isMonitored] operator[SEP] identifier[HttpSession] identifier[session] operator[SEP] {
Keyword[boolean] identifier[monitor] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[session] operator[&&] identifier[session] operator[SEP] identifier[getAttribute] operator[SEP] identifier[Constants] operator[SEP] identifier[Options] operator[SEP] identifier[OPTIONS] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[monitor] operator[=] operator[SEP] operator[SEP] identifier[Options] operator[SEP] identifier[session] operator[SEP] identifier[getAttribute] operator[SEP] identifier[Constants] operator[SEP] identifier[Options] operator[SEP] identifier[OPTIONS] operator[SEP] operator[SEP] operator[SEP] identifier[isMonitor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[monitor] operator[SEP]
}
|
public static double distanceBetweenSolutionsInObjectiveSpace(DoubleSolution solutionI, DoubleSolution solutionJ) {
double distance = 0.0;
double diff;
for (int i = 0; i < solutionI.getNumberOfVariables(); i++) {
diff = solutionI.getVariableValue(i) - solutionJ.getVariableValue(i);
distance += Math.pow(diff, 2.0);
}
return Math.sqrt(distance);
} | class class_name[name] begin[{]
method[distanceBetweenSolutionsInObjectiveSpace, return_type[type[double]], modifier[public static], parameter[solutionI, solutionJ]] begin[{]
local_variable[type[double], distance]
local_variable[type[double], diff]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVariableValue, postfix_operators=[], prefix_operators=[], qualifier=solutionI, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVariableValue, postfix_operators=[], prefix_operators=[], qualifier=solutionJ, selectors=[], type_arguments=None), operator=-)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2.0)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumberOfVariables, postfix_operators=[], prefix_operators=[], qualifier=solutionI, 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[call[Math.sqrt, parameter[member[.distance]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[distanceBetweenSolutionsInObjectiveSpace] operator[SEP] identifier[DoubleSolution] identifier[solutionI] , identifier[DoubleSolution] identifier[solutionJ] operator[SEP] {
Keyword[double] identifier[distance] operator[=] literal[Float] operator[SEP] Keyword[double] identifier[diff] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[solutionI] operator[SEP] identifier[getNumberOfVariables] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[diff] operator[=] identifier[solutionI] operator[SEP] identifier[getVariableValue] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[solutionJ] operator[SEP] identifier[getVariableValue] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[distance] operator[+=] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[diff] , literal[Float] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[distance] operator[SEP] operator[SEP]
}
|
@Override
public String getBeanName(Object parent, Container container) {
if(FORCE_V2) {
return v2BeanName;
}
if(beanName == null) {
try {
Class.forName("com.facebook.Session");
// We assume that if this class exists, we are v3+
beanName = v3BeanName;
}
catch (ClassNotFoundException e) {
beanName = v2BeanName;
}
}
return beanName;
} | class class_name[name] begin[{]
method[getBeanName, return_type[type[String]], modifier[public], parameter[parent, container]] begin[{]
if[member[.FORCE_V2]] begin[{]
return[member[.v2BeanName]]
else begin[{]
None
end[}]
if[binary_operation[member[.beanName], ==, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.facebook.Session")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=beanName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=v3BeanName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=beanName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=v2BeanName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.beanName]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getBeanName] operator[SEP] identifier[Object] identifier[parent] , identifier[Container] identifier[container] operator[SEP] {
Keyword[if] operator[SEP] identifier[FORCE_V2] operator[SEP] {
Keyword[return] identifier[v2BeanName] operator[SEP]
}
Keyword[if] operator[SEP] identifier[beanName] operator[==] Other[null] operator[SEP] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[beanName] operator[=] identifier[v3BeanName] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[beanName] operator[=] identifier[v2BeanName] operator[SEP]
}
}
Keyword[return] identifier[beanName] operator[SEP]
}
|
public static final FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
{
return getDefault().provider().newFileSystem(path, env);
} | class class_name[name] begin[{]
method[newFileSystem, return_type[type[FileSystem]], modifier[final public static], parameter[path, env]] begin[{]
return[call[.getDefault, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[FileSystem] identifier[newFileSystem] operator[SEP] identifier[Path] identifier[path] , identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[env] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[provider] operator[SEP] operator[SEP] operator[SEP] identifier[newFileSystem] operator[SEP] identifier[path] , identifier[env] operator[SEP] operator[SEP]
}
|
public static ClassLoader resolveClassLoaderForBeanProxy(String contextId, Class<?> proxiedType, TypeInfo typeInfo, ProxyServices proxyServices) {
Class<?> superClass = typeInfo.getSuperClass();
if (superClass.getName().startsWith(JAVA)) {
ClassLoader cl = proxyServices.getClassLoader(proxiedType);
if (cl == null) {
cl = Thread.currentThread().getContextClassLoader();
}
return cl;
}
return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass);
} | class class_name[name] begin[{]
method[resolveClassLoaderForBeanProxy, return_type[type[ClassLoader]], modifier[public static], parameter[contextId, proxiedType, typeInfo, proxyServices]] begin[{]
local_variable[type[Class], superClass]
if[call[superClass.getName, parameter[]]] begin[{]
local_variable[type[ClassLoader], cl]
if[binary_operation[member[.cl], ==, literal[null]]] begin[{]
assign[member[.cl], call[Thread.currentThread, parameter[]]]
else begin[{]
None
end[}]
return[member[.cl]]
else begin[{]
None
end[}]
return[call[Container.instance, parameter[member[.contextId]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ClassLoader] identifier[resolveClassLoaderForBeanProxy] operator[SEP] identifier[String] identifier[contextId] , identifier[Class] operator[<] operator[?] operator[>] identifier[proxiedType] , identifier[TypeInfo] identifier[typeInfo] , identifier[ProxyServices] identifier[proxyServices] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[superClass] operator[=] identifier[typeInfo] operator[SEP] identifier[getSuperClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[superClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[JAVA] operator[SEP] operator[SEP] {
identifier[ClassLoader] identifier[cl] operator[=] identifier[proxyServices] operator[SEP] identifier[getClassLoader] operator[SEP] identifier[proxiedType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cl] operator[==] Other[null] operator[SEP] {
identifier[cl] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cl] operator[SEP]
}
Keyword[return] identifier[Container] operator[SEP] identifier[instance] operator[SEP] identifier[contextId] operator[SEP] operator[SEP] identifier[services] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ProxyServices] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] identifier[superClass] operator[SEP] operator[SEP]
}
|
public static <V> PnkyPromise<V> composeAsync(final ThrowingSupplier<PnkyPromise<V>> operation,
final Executor executor)
{
final Pnky<V> pnky = Pnky.create();
executor.execute(new Runnable()
{
@Override
public void run()
{
if (pnky.state.compareAndSet(WAITING, RUNNING))
{
try
{
operation.get().alwaysAccept(new ThrowingBiConsumer<V, Throwable>()
{
@Override
public void accept(final V result, final Throwable error) throws Throwable
{
if (error != null)
{
pnky.reject(error);
}
else
{
pnky.resolve(result);
}
}
});
}
catch (final Throwable e)
{
pnky.reject(e);
}
}
}
});
return pnky;
} | class class_name[name] begin[{]
method[composeAsync, return_type[type[PnkyPromise]], modifier[public static], parameter[operation, executor]] begin[{]
local_variable[type[Pnky], pnky]
call[executor.execute, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=WAITING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=RUNNING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareAndSet, postfix_operators=[], prefix_operators=[], qualifier=pnky.state, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=operation, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resolve, postfix_operators=[], prefix_operators=[], qualifier=pnky, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reject, postfix_operators=[], prefix_operators=[], qualifier=pnky, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=accept, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=result, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=error, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=['Throwable'], type_parameters=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=V, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None))], dimensions=None, name=ThrowingBiConsumer, sub_type=None))], member=alwaysAccept, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reject, postfix_operators=[], prefix_operators=[], qualifier=pnky, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)]))], documentation=None, modifiers={'public'}, name=run, parameters=[], 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=Runnable, sub_type=None))]]
return[member[.pnky]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[V] operator[>] identifier[PnkyPromise] operator[<] identifier[V] operator[>] identifier[composeAsync] operator[SEP] Keyword[final] identifier[ThrowingSupplier] operator[<] identifier[PnkyPromise] operator[<] identifier[V] operator[>] operator[>] identifier[operation] , Keyword[final] identifier[Executor] identifier[executor] operator[SEP] {
Keyword[final] identifier[Pnky] operator[<] identifier[V] operator[>] identifier[pnky] operator[=] identifier[Pnky] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[executor] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[pnky] operator[SEP] identifier[state] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[WAITING] , identifier[RUNNING] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[operation] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[alwaysAccept] operator[SEP] Keyword[new] identifier[ThrowingBiConsumer] operator[<] identifier[V] , identifier[Throwable] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[accept] operator[SEP] Keyword[final] identifier[V] identifier[result] , Keyword[final] identifier[Throwable] identifier[error] operator[SEP] Keyword[throws] identifier[Throwable] {
Keyword[if] operator[SEP] identifier[error] operator[!=] Other[null] operator[SEP] {
identifier[pnky] operator[SEP] identifier[reject] operator[SEP] identifier[error] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[pnky] operator[SEP] identifier[resolve] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Throwable] identifier[e] operator[SEP] {
identifier[pnky] operator[SEP] identifier[reject] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] operator[SEP] Keyword[return] identifier[pnky] operator[SEP]
}
|
public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter() {
return takesArguments(0).and(not(returns(TypeDescription.VOID))).and(nameStartsWith("get").or(nameStartsWith("is").and(returnsGeneric(anyOf(boolean.class, Boolean.class)))));
} | class class_name[name] begin[{]
method[isGetter, return_type[type[ElementMatcher]], modifier[public static], parameter[]] begin[{]
return[call[.takesArguments, parameter[literal[0]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[MethodDescription] operator[>] identifier[ElementMatcher] operator[SEP] identifier[Junction] operator[<] identifier[T] operator[>] identifier[isGetter] operator[SEP] operator[SEP] {
Keyword[return] identifier[takesArguments] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[and] operator[SEP] identifier[not] operator[SEP] identifier[returns] operator[SEP] identifier[TypeDescription] operator[SEP] identifier[VOID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[and] operator[SEP] identifier[nameStartsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[or] operator[SEP] identifier[nameStartsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[and] operator[SEP] identifier[returnsGeneric] operator[SEP] identifier[anyOf] operator[SEP] Keyword[boolean] operator[SEP] Keyword[class] , identifier[Boolean] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public R visitDeprecated(DeprecatedTree node, P p) {
return defaultAction(node, p);
} | class class_name[name] begin[{]
method[visitDeprecated, return_type[type[R]], modifier[public], parameter[node, p]] begin[{]
return[call[.defaultAction, parameter[member[.node], member[.p]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[R] identifier[visitDeprecated] operator[SEP] identifier[DeprecatedTree] identifier[node] , identifier[P] identifier[p] operator[SEP] {
Keyword[return] identifier[defaultAction] operator[SEP] identifier[node] , identifier[p] operator[SEP] operator[SEP]
}
|
@Override
public void writeArray(Object array) {
if (array != null) {
if (!checkWriteReference(array)) {
storeReference(array);
buf.put(AMF.TYPE_ARRAY);
buf.putInt(Array.getLength(array));
for (int i = 0; i < Array.getLength(array); i++) {
Serializer.serialize(this, Array.get(array, i));
}
}
} else {
writeNull();
}
} | class class_name[name] begin[{]
method[writeArray, return_type[void], modifier[public], parameter[array]] begin[{]
if[binary_operation[member[.array], !=, literal[null]]] begin[{]
if[call[.checkWriteReference, parameter[member[.array]]]] begin[{]
call[.storeReference, parameter[member[.array]]]
call[buf.put, parameter[member[AMF.TYPE_ARRAY]]]
call[buf.putInt, parameter[call[Array.getLength, parameter[member[.array]]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=Array, selectors=[], type_arguments=None)], member=serialize, postfix_operators=[], prefix_operators=[], qualifier=Serializer, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=Array, 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)
else begin[{]
None
end[}]
else begin[{]
call[.writeNull, parameter[]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[writeArray] operator[SEP] identifier[Object] identifier[array] operator[SEP] {
Keyword[if] operator[SEP] identifier[array] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[checkWriteReference] operator[SEP] identifier[array] operator[SEP] operator[SEP] {
identifier[storeReference] operator[SEP] identifier[array] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[put] operator[SEP] identifier[AMF] operator[SEP] identifier[TYPE_ARRAY] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[putInt] operator[SEP] identifier[Array] operator[SEP] identifier[getLength] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[Array] operator[SEP] identifier[getLength] operator[SEP] identifier[array] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Serializer] operator[SEP] identifier[serialize] operator[SEP] Keyword[this] , identifier[Array] operator[SEP] identifier[get] operator[SEP] identifier[array] , identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[writeNull] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@GwtIncompatible("Unnecessary")
private String expandCommandLinePath(String path, JSModule forModule) {
String sub;
if (forModule != null) {
sub = config.moduleOutputPathPrefix + forModule.getName() + ".js";
} else if (!config.module.isEmpty()) {
sub = config.moduleOutputPathPrefix;
} else {
sub = config.jsOutputFile;
}
return path.replace("%outname%", sub);
} | class class_name[name] begin[{]
method[expandCommandLinePath, return_type[type[String]], modifier[private], parameter[path, forModule]] begin[{]
local_variable[type[String], sub]
if[binary_operation[member[.forModule], !=, literal[null]]] begin[{]
assign[member[.sub], binary_operation[binary_operation[member[config.moduleOutputPathPrefix], +, call[forModule.getName, parameter[]]], +, literal[".js"]]]
else begin[{]
if[call[config.module.isEmpty, parameter[]]] begin[{]
assign[member[.sub], member[config.moduleOutputPathPrefix]]
else begin[{]
assign[member[.sub], member[config.jsOutputFile]]
end[}]
end[}]
return[call[path.replace, parameter[literal["%outname%"], member[.sub]]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[private] identifier[String] identifier[expandCommandLinePath] operator[SEP] identifier[String] identifier[path] , identifier[JSModule] identifier[forModule] operator[SEP] {
identifier[String] identifier[sub] operator[SEP] Keyword[if] operator[SEP] identifier[forModule] operator[!=] Other[null] operator[SEP] {
identifier[sub] operator[=] identifier[config] operator[SEP] identifier[moduleOutputPathPrefix] operator[+] identifier[forModule] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[config] operator[SEP] identifier[module] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[sub] operator[=] identifier[config] operator[SEP] identifier[moduleOutputPathPrefix] operator[SEP]
}
Keyword[else] {
identifier[sub] operator[=] identifier[config] operator[SEP] identifier[jsOutputFile] operator[SEP]
}
Keyword[return] identifier[path] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[sub] operator[SEP] operator[SEP]
}
|
ConversationWebhookList listConversationWebhooks(final int offset, final int limit)
throws UnauthorizedException, GeneralException {
String url = CONVERSATIONS_BASE_URL + CONVERSATION_WEBHOOK_PATH;
return messageBirdService.requestList(url, offset, limit, ConversationWebhookList.class);
} | class class_name[name] begin[{]
method[listConversationWebhooks, return_type[type[ConversationWebhookList]], modifier[default], parameter[offset, limit]] begin[{]
local_variable[type[String], url]
return[call[messageBirdService.requestList, parameter[member[.url], member[.offset], member[.limit], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConversationWebhookList, sub_type=None))]]]
end[}]
END[}] | identifier[ConversationWebhookList] identifier[listConversationWebhooks] operator[SEP] Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[limit] operator[SEP] Keyword[throws] identifier[UnauthorizedException] , identifier[GeneralException] {
identifier[String] identifier[url] operator[=] identifier[CONVERSATIONS_BASE_URL] operator[+] identifier[CONVERSATION_WEBHOOK_PATH] operator[SEP] Keyword[return] identifier[messageBirdService] operator[SEP] identifier[requestList] operator[SEP] identifier[url] , identifier[offset] , identifier[limit] , identifier[ConversationWebhookList] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public synchronized void clear() {
try {
this.storage.close();
this.storage = provider.createStorage();
} catch (IOException e) {
// major fuckup
e.printStackTrace();
}
this.size = 0;
} | class class_name[name] begin[{]
method[clear, return_type[void], modifier[synchronized public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=storage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=storage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[], member=createStorage, postfix_operators=[], prefix_operators=[], qualifier=provider, selectors=[], type_arguments=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)
assign[THIS[member[None.size]], literal[0]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[clear] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[storage] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[storage] operator[=] identifier[provider] operator[SEP] identifier[createStorage] 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[this] operator[SEP] identifier[size] operator[=] Other[0] operator[SEP]
}
|
@Override
public final void setClientID(String clientID) throws JMSException
{
super.setClientID(clientID);
SetClientIDQuery query = new SetClientIDQuery();
query.setClientID(clientID);
transportEndpoint.blockingRequest(query);
} | class class_name[name] begin[{]
method[setClientID, return_type[void], modifier[final public], parameter[clientID]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=clientID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setClientID, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[SetClientIDQuery], query]
call[query.setClientID, parameter[member[.clientID]]]
call[transportEndpoint.blockingRequest, parameter[member[.query]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setClientID] operator[SEP] identifier[String] identifier[clientID] operator[SEP] Keyword[throws] identifier[JMSException] {
Keyword[super] operator[SEP] identifier[setClientID] operator[SEP] identifier[clientID] operator[SEP] operator[SEP] identifier[SetClientIDQuery] identifier[query] operator[=] Keyword[new] identifier[SetClientIDQuery] operator[SEP] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setClientID] operator[SEP] identifier[clientID] operator[SEP] operator[SEP] identifier[transportEndpoint] operator[SEP] identifier[blockingRequest] operator[SEP] identifier[query] operator[SEP] operator[SEP]
}
|
private static final int gatherIntLE(final byte[] data, final int index) {
int i = data[index] & 0xFF;
i |= (data[index + 1] & 0xFF) << 8;
i |= (data[index + 2] & 0xFF) << 16;
i |= (data[index + 3] << 24);
return i;
} | class class_name[name] begin[{]
method[gatherIntLE, return_type[type[int]], modifier[final private static], parameter[data, index]] begin[{]
local_variable[type[int], i]
assign[member[.i], binary_operation[binary_operation[member[.data], &, literal[0xFF]], <<, literal[8]]]
assign[member[.i], binary_operation[binary_operation[member[.data], &, literal[0xFF]], <<, literal[16]]]
assign[member[.i], binary_operation[member[.data], <<, literal[24]]]
return[member[.i]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] Keyword[int] identifier[gatherIntLE] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , Keyword[final] Keyword[int] identifier[index] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[data] operator[SEP] identifier[index] operator[SEP] operator[&] literal[Integer] operator[SEP] identifier[i] operator[|=] operator[SEP] identifier[data] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] identifier[i] operator[|=] operator[SEP] identifier[data] operator[SEP] identifier[index] operator[+] Other[2] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[SEP] identifier[i] operator[|=] operator[SEP] identifier[data] operator[SEP] identifier[index] operator[+] Other[3] operator[SEP] operator[<<] Other[24] operator[SEP] operator[SEP] Keyword[return] identifier[i] operator[SEP]
}
|
protected String constructInStringsQuery(String query, Set<String> values) {
String replace = "IN (?)";
assert query.lastIndexOf(replace) == query.indexOf(replace);
String sql = query.replace("IN (?)", "IN (%s)");
StringBuffer list = new StringBuffer();
for (String value : values) {
if (list.length() > 0) {
list.append(",");
}
value = String.format("'%s'", StringEscapeUtils.escapeSql(value));
list.append(value);
}
return String.format(sql, list.toString());
} | class class_name[name] begin[{]
method[constructInStringsQuery, return_type[type[String]], modifier[protected], parameter[query, values]] begin[{]
local_variable[type[String], replace]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=replace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lastIndexOf, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=replace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), operator===), label=None, value=None)
local_variable[type[String], sql]
local_variable[type[StringBuffer], list]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")], member=append, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'%s'"), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=escapeSql, postfix_operators=[], prefix_operators=[], qualifier=StringEscapeUtils, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[String.format, parameter[member[.sql], call[list.toString, parameter[]]]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[constructInStringsQuery] operator[SEP] identifier[String] identifier[query] , identifier[Set] operator[<] identifier[String] operator[>] identifier[values] operator[SEP] {
identifier[String] identifier[replace] operator[=] literal[String] operator[SEP] Keyword[assert] identifier[query] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[replace] operator[SEP] operator[==] identifier[query] operator[SEP] identifier[indexOf] operator[SEP] identifier[replace] operator[SEP] operator[SEP] identifier[String] identifier[sql] operator[=] identifier[query] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[list] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[value] operator[:] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[list] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[list] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[value] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[StringEscapeUtils] operator[SEP] identifier[escapeSql] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[append] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[sql] , identifier[list] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private String buildFacetString(List<String> facetNames, List<String>facetValues ) {
StringBuilder builder = new StringBuilder();
if( facetNames != null && facetValues != null )
{
int pairsCount = -1;
if( facetNames.size() != facetValues.size() ) {
pairsCount = facetNames.size() > facetValues.size() ? facetValues.size() : facetNames.size();
log.warn( "facetNames and facetValues lists were of different sizes, your query may not be accurate" );
} else {
pairsCount = facetNames.size();
}
for( int i=0; i < pairsCount; i++ ) {
try {
builder.append( "&facets[").append( facetNames.get( i )).append( "][]=" )
.append( URLEncoder.encode( facetValues.get( i ), "UTF-8" ));
} catch (UnsupportedEncodingException ignore) {
}
}
} else {
log.error( "facetNames or facetValues was null, you are defaulting to a regular query using no facet matching" );
}
return builder.toString();
} | class class_name[name] begin[{]
method[buildFacetString, return_type[type[String]], modifier[private], parameter[facetNames, facetValues]] begin[{]
local_variable[type[StringBuilder], builder]
if[binary_operation[binary_operation[member[.facetNames], !=, literal[null]], &&, binary_operation[member[.facetValues], !=, literal[null]]]] begin[{]
local_variable[type[int], pairsCount]
if[binary_operation[call[facetNames.size, parameter[]], !=, call[facetValues.size, parameter[]]]] begin[{]
assign[member[.pairsCount], TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=facetNames, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=facetValues, selectors=[], type_arguments=None), operator=>), if_false=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=facetNames, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=facetValues, selectors=[], type_arguments=None))]
call[log.warn, parameter[literal["facetNames and facetValues lists were of different sizes, your query may not be accurate"]]]
else begin[{]
assign[member[.pairsCount], call[facetNames.size, parameter[]]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&facets[")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=facetNames, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="][]=")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=facetValues, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=encode, postfix_operators=[], prefix_operators=[], qualifier=URLEncoder, selectors=[], type_arguments=None)], member=append, 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=ignore, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pairsCount, 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[{]
call[log.error, parameter[literal["facetNames or facetValues was null, you are defaulting to a regular query using no facet matching"]]]
end[}]
return[call[builder.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[buildFacetString] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[facetNames] , identifier[List] operator[<] identifier[String] operator[>] identifier[facetValues] operator[SEP] {
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[facetNames] operator[!=] Other[null] operator[&&] identifier[facetValues] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[pairsCount] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[facetNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] identifier[facetValues] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[pairsCount] operator[=] identifier[facetNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] identifier[facetValues] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[?] identifier[facetValues] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[:] identifier[facetNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[pairsCount] operator[=] identifier[facetNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[pairsCount] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[facetNames] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[URLEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[facetValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[ignore] operator[SEP] {
}
}
}
Keyword[else] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private static String escapeJavaString(String input)
{
int len = input.length();
// assume (for performance, not for correctness) that string will not expand by more than 10 chars
StringBuilder out = new StringBuilder(len + 10);
for (int i = 0; i < len; i++) {
char c = input.charAt(i);
if (c >= 32 && c <= 0x7f) {
if (c == '"') {
out.append('\\');
out.append('"');
} else if (c == '\\') {
out.append('\\');
out.append('\\');
} else {
out.append(c);
}
} else {
out.append('\\');
out.append('u');
// one liner hack to have the hex string of length exactly 4
out.append(Integer.toHexString(c | 0x10000).substring(1));
}
}
return out.toString();
} | class class_name[name] begin[{]
method[escapeJavaString, return_type[type[String]], modifier[private static], parameter[input]] begin[{]
local_variable[type[int], len]
local_variable[type[StringBuilder], out]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7f), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='u')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x10000), operator=|)], member=toHexString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[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)], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, 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)
return[call[out.toString, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[escapeJavaString] operator[SEP] identifier[String] identifier[input] operator[SEP] {
Keyword[int] identifier[len] operator[=] identifier[input] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[out] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[len] operator[+] Other[10] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[input] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[>=] Other[32] operator[&&] identifier[c] operator[<=] literal[Integer] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[Integer] operator[SEP] identifier[toHexString] operator[SEP] identifier[c] operator[|] literal[Integer] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[out] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public CompletableFuture<RaftSessionState> openSession(
String serviceName,
PrimitiveType primitiveType,
ServiceConfig config,
ReadConsistency readConsistency,
CommunicationStrategy communicationStrategy,
Duration minTimeout,
Duration maxTimeout) {
checkNotNull(serviceName, "serviceName cannot be null");
checkNotNull(primitiveType, "serviceType cannot be null");
checkNotNull(communicationStrategy, "communicationStrategy cannot be null");
checkNotNull(maxTimeout, "timeout cannot be null");
log.debug("Opening session; name: {}, type: {}", serviceName, primitiveType);
OpenSessionRequest request = OpenSessionRequest.builder()
.withMemberId(memberId)
.withServiceName(serviceName)
.withServiceType(primitiveType)
.withServiceConfig(Serializer.using(primitiveType.namespace()).encode(config))
.withReadConsistency(readConsistency)
.withMinTimeout(minTimeout.toMillis())
.withMaxTimeout(maxTimeout.toMillis())
.build();
CompletableFuture<RaftSessionState> future = new CompletableFuture<>();
ThreadContext proxyContext = threadContextFactory.createContext();
connection.openSession(request).whenCompleteAsync((response, error) -> {
if (error == null) {
if (response.status() == RaftResponse.Status.OK) {
// Create and store the proxy state.
RaftSessionState state = new RaftSessionState(
clientId,
SessionId.from(response.session()),
serviceName,
primitiveType,
response.timeout());
sessions.put(state.getSessionId().id(), state);
state.addStateChangeListener(s -> {
if (s == PrimitiveState.EXPIRED || s == PrimitiveState.CLOSED) {
sessions.remove(state.getSessionId().id());
}
});
// Ensure the proxy session info is reset and the session is kept alive.
keepAliveSessions(System.currentTimeMillis(), state.getSessionTimeout());
future.complete(state);
} else {
future.completeExceptionally(new RaftException.Unavailable(response.error().message()));
}
} else {
future.completeExceptionally(new RaftException.Unavailable(error.getMessage()));
}
}, proxyContext);
return future;
} | class class_name[name] begin[{]
method[openSession, return_type[type[CompletableFuture]], modifier[public], parameter[serviceName, primitiveType, config, readConsistency, communicationStrategy, minTimeout, maxTimeout]] begin[{]
call[.checkNotNull, parameter[member[.serviceName], literal["serviceName cannot be null"]]]
call[.checkNotNull, parameter[member[.primitiveType], literal["serviceType cannot be null"]]]
call[.checkNotNull, parameter[member[.communicationStrategy], literal["communicationStrategy cannot be null"]]]
call[.checkNotNull, parameter[member[.maxTimeout], literal["timeout cannot be null"]]]
call[log.debug, parameter[literal["Opening session; name: {}, type: {}"], member[.serviceName], member[.primitiveType]]]
local_variable[type[OpenSessionRequest], request]
local_variable[type[CompletableFuture], future]
local_variable[type[ThreadContext], proxyContext]
call[connection.openSession, parameter[member[.request]]]
return[member[.future]]
end[}]
END[}] | Keyword[public] identifier[CompletableFuture] operator[<] identifier[RaftSessionState] operator[>] identifier[openSession] operator[SEP] identifier[String] identifier[serviceName] , identifier[PrimitiveType] identifier[primitiveType] , identifier[ServiceConfig] identifier[config] , identifier[ReadConsistency] identifier[readConsistency] , identifier[CommunicationStrategy] identifier[communicationStrategy] , identifier[Duration] identifier[minTimeout] , identifier[Duration] identifier[maxTimeout] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[serviceName] , literal[String] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[primitiveType] , literal[String] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[communicationStrategy] , literal[String] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[maxTimeout] , literal[String] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[serviceName] , identifier[primitiveType] operator[SEP] operator[SEP] identifier[OpenSessionRequest] identifier[request] operator[=] identifier[OpenSessionRequest] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[withMemberId] operator[SEP] identifier[memberId] operator[SEP] operator[SEP] identifier[withServiceName] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] identifier[withServiceType] operator[SEP] identifier[primitiveType] operator[SEP] operator[SEP] identifier[withServiceConfig] operator[SEP] identifier[Serializer] operator[SEP] identifier[using] operator[SEP] identifier[primitiveType] operator[SEP] identifier[namespace] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[config] operator[SEP] operator[SEP] operator[SEP] identifier[withReadConsistency] operator[SEP] identifier[readConsistency] operator[SEP] operator[SEP] identifier[withMinTimeout] operator[SEP] identifier[minTimeout] operator[SEP] identifier[toMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withMaxTimeout] operator[SEP] identifier[maxTimeout] operator[SEP] identifier[toMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[CompletableFuture] operator[<] identifier[RaftSessionState] operator[>] identifier[future] operator[=] Keyword[new] identifier[CompletableFuture] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ThreadContext] identifier[proxyContext] operator[=] identifier[threadContextFactory] operator[SEP] identifier[createContext] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[openSession] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[whenCompleteAsync] operator[SEP] operator[SEP] identifier[response] , identifier[error] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[error] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[status] operator[SEP] operator[SEP] operator[==] identifier[RaftResponse] operator[SEP] identifier[Status] operator[SEP] identifier[OK] operator[SEP] {
identifier[RaftSessionState] identifier[state] operator[=] Keyword[new] identifier[RaftSessionState] operator[SEP] identifier[clientId] , identifier[SessionId] operator[SEP] identifier[from] operator[SEP] identifier[response] operator[SEP] identifier[session] operator[SEP] operator[SEP] operator[SEP] , identifier[serviceName] , identifier[primitiveType] , identifier[response] operator[SEP] identifier[timeout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sessions] operator[SEP] identifier[put] operator[SEP] identifier[state] operator[SEP] identifier[getSessionId] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] , identifier[state] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[addStateChangeListener] operator[SEP] identifier[s] operator[->] {
Keyword[if] operator[SEP] identifier[s] operator[==] identifier[PrimitiveState] operator[SEP] identifier[EXPIRED] operator[||] identifier[s] operator[==] identifier[PrimitiveState] operator[SEP] identifier[CLOSED] operator[SEP] {
identifier[sessions] operator[SEP] identifier[remove] operator[SEP] identifier[state] operator[SEP] identifier[getSessionId] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[keepAliveSessions] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] , identifier[state] operator[SEP] identifier[getSessionTimeout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[future] operator[SEP] identifier[complete] operator[SEP] identifier[state] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[future] operator[SEP] identifier[completeExceptionally] operator[SEP] Keyword[new] identifier[RaftException] operator[SEP] identifier[Unavailable] operator[SEP] identifier[response] operator[SEP] identifier[error] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[future] operator[SEP] identifier[completeExceptionally] operator[SEP] Keyword[new] identifier[RaftException] operator[SEP] identifier[Unavailable] operator[SEP] identifier[error] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} , identifier[proxyContext] operator[SEP] operator[SEP] Keyword[return] identifier[future] operator[SEP]
}
|
protected void sendTransacted(Destination destination, Serializable message) {
send(destination, message, null, null, true);
} | class class_name[name] begin[{]
method[sendTransacted, return_type[void], modifier[protected], parameter[destination, message]] begin[{]
call[.send, parameter[member[.destination], member[.message], literal[null], literal[null], literal[true]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[sendTransacted] operator[SEP] identifier[Destination] identifier[destination] , identifier[Serializable] identifier[message] operator[SEP] {
identifier[send] operator[SEP] identifier[destination] , identifier[message] , Other[null] , Other[null] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void marshall(CloneStackRequest cloneStackRequest, ProtocolMarshaller protocolMarshaller) {
if (cloneStackRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cloneStackRequest.getSourceStackId(), SOURCESTACKID_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getRegion(), REGION_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getVpcId(), VPCID_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getAttributes(), ATTRIBUTES_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getServiceRoleArn(), SERVICEROLEARN_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getDefaultInstanceProfileArn(), DEFAULTINSTANCEPROFILEARN_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getDefaultOs(), DEFAULTOS_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getHostnameTheme(), HOSTNAMETHEME_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getDefaultAvailabilityZone(), DEFAULTAVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getDefaultSubnetId(), DEFAULTSUBNETID_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getCustomJson(), CUSTOMJSON_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getConfigurationManager(), CONFIGURATIONMANAGER_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getChefConfiguration(), CHEFCONFIGURATION_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getUseCustomCookbooks(), USECUSTOMCOOKBOOKS_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getUseOpsworksSecurityGroups(), USEOPSWORKSSECURITYGROUPS_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getCustomCookbooksSource(), CUSTOMCOOKBOOKSSOURCE_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getDefaultSshKeyName(), DEFAULTSSHKEYNAME_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getClonePermissions(), CLONEPERMISSIONS_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getCloneAppIds(), CLONEAPPIDS_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getDefaultRootDeviceType(), DEFAULTROOTDEVICETYPE_BINDING);
protocolMarshaller.marshall(cloneStackRequest.getAgentVersion(), AGENTVERSION_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[cloneStackRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.cloneStackRequest], ==, 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=getSourceStackId, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=SOURCESTACKID_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=getName, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=NAME_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=getRegion, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=REGION_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=getVpcId, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=VPCID_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=getAttributes, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=ATTRIBUTES_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=getServiceRoleArn, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=SERVICEROLEARN_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=getDefaultInstanceProfileArn, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTINSTANCEPROFILEARN_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=getDefaultOs, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTOS_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=getHostnameTheme, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=HOSTNAMETHEME_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=getDefaultAvailabilityZone, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTAVAILABILITYZONE_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=getDefaultSubnetId, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTSUBNETID_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=getCustomJson, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=CUSTOMJSON_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=getConfigurationManager, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=CONFIGURATIONMANAGER_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=getChefConfiguration, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=CHEFCONFIGURATION_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=getUseCustomCookbooks, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=USECUSTOMCOOKBOOKS_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=getUseOpsworksSecurityGroups, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=USEOPSWORKSSECURITYGROUPS_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=getCustomCookbooksSource, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=CUSTOMCOOKBOOKSSOURCE_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=getDefaultSshKeyName, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTSSHKEYNAME_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=getClonePermissions, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=CLONEPERMISSIONS_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=getCloneAppIds, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=CLONEAPPIDS_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=getDefaultRootDeviceType, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTROOTDEVICETYPE_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=getAgentVersion, postfix_operators=[], prefix_operators=[], qualifier=cloneStackRequest, selectors=[], type_arguments=None), MemberReference(member=AGENTVERSION_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[CloneStackRequest] identifier[cloneStackRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[cloneStackRequest] 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[cloneStackRequest] operator[SEP] identifier[getSourceStackId] operator[SEP] operator[SEP] , identifier[SOURCESTACKID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getRegion] operator[SEP] operator[SEP] , identifier[REGION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getVpcId] operator[SEP] operator[SEP] , identifier[VPCID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] , identifier[ATTRIBUTES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getServiceRoleArn] operator[SEP] operator[SEP] , identifier[SERVICEROLEARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getDefaultInstanceProfileArn] operator[SEP] operator[SEP] , identifier[DEFAULTINSTANCEPROFILEARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getDefaultOs] operator[SEP] operator[SEP] , identifier[DEFAULTOS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getHostnameTheme] operator[SEP] operator[SEP] , identifier[HOSTNAMETHEME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getDefaultAvailabilityZone] operator[SEP] operator[SEP] , identifier[DEFAULTAVAILABILITYZONE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getDefaultSubnetId] operator[SEP] operator[SEP] , identifier[DEFAULTSUBNETID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getCustomJson] operator[SEP] operator[SEP] , identifier[CUSTOMJSON_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getConfigurationManager] operator[SEP] operator[SEP] , identifier[CONFIGURATIONMANAGER_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getChefConfiguration] operator[SEP] operator[SEP] , identifier[CHEFCONFIGURATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getUseCustomCookbooks] operator[SEP] operator[SEP] , identifier[USECUSTOMCOOKBOOKS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getUseOpsworksSecurityGroups] operator[SEP] operator[SEP] , identifier[USEOPSWORKSSECURITYGROUPS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getCustomCookbooksSource] operator[SEP] operator[SEP] , identifier[CUSTOMCOOKBOOKSSOURCE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getDefaultSshKeyName] operator[SEP] operator[SEP] , identifier[DEFAULTSSHKEYNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getClonePermissions] operator[SEP] operator[SEP] , identifier[CLONEPERMISSIONS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getCloneAppIds] operator[SEP] operator[SEP] , identifier[CLONEAPPIDS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getDefaultRootDeviceType] operator[SEP] operator[SEP] , identifier[DEFAULTROOTDEVICETYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cloneStackRequest] operator[SEP] identifier[getAgentVersion] operator[SEP] operator[SEP] , identifier[AGENTVERSION_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 MtasSpanQuery getQuery() throws ParseException {
simplify();
MtasSpanSequenceItem currentQuery = null;
List<MtasSpanSequenceItem> currentQueryList = null;
for (MtasCQLParserBasicSentencePartCondition part : partList) {
// start list
if (currentQuery != null) {
currentQueryList = new ArrayList<MtasSpanSequenceItem>();
currentQueryList.add(currentQuery);
currentQuery = null;
}
if (part.getMaximumOccurence() > 1) {
MtasSpanQuery q = new MtasSpanRecurrenceQuery(part.getQuery(),
part.getMinimumOccurence(), part.getMaximumOccurence(),
ignoreClause, maximumIgnoreLength);
currentQuery = new MtasSpanSequenceItem(q, part.isOptional());
} else {
currentQuery = new MtasSpanSequenceItem(part.getQuery(),
part.isOptional());
}
// add to list, if it exists
if (currentQueryList != null) {
currentQueryList.add(currentQuery);
currentQuery = null;
}
}
if (currentQueryList != null) {
return new MtasSpanSequenceQuery(currentQueryList, ignoreClause,
maximumIgnoreLength);
} else if (currentQuery.isOptional()) {
currentQueryList = new ArrayList<MtasSpanSequenceItem>();
currentQueryList.add(currentQuery);
currentQuery = null;
return new MtasSpanSequenceQuery(currentQueryList, ignoreClause,
maximumIgnoreLength);
} else {
return currentQuery.getQuery();
}
} | class class_name[name] begin[{]
method[getQuery, return_type[type[MtasSpanQuery]], modifier[public], parameter[]] begin[{]
call[.simplify, parameter[]]
local_variable[type[MtasSpanSequenceItem], currentQuery]
local_variable[type[List], currentQueryList]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=currentQuery, 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=currentQueryList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], 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=MtasSpanSequenceItem, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=currentQueryList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMaximumOccurence, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getQuery, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isOptional, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MtasSpanSequenceItem, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getQuery, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMinimumOccurence, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMaximumOccurence, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None), MemberReference(member=ignoreClause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maximumIgnoreLength, 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=MtasSpanRecurrenceQuery, sub_type=None)), name=q)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MtasSpanQuery, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=isOptional, postfix_operators=[], prefix_operators=[], qualifier=part, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MtasSpanSequenceItem, sub_type=None))), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=currentQueryList, 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=currentQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=currentQueryList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=partList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=part)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MtasCQLParserBasicSentencePartCondition, sub_type=None))), label=None)
if[binary_operation[member[.currentQueryList], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=currentQueryList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ignoreClause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maximumIgnoreLength, 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=MtasSpanSequenceQuery, sub_type=None))]
else begin[{]
if[call[currentQuery.isOptional, parameter[]]] begin[{]
assign[member[.currentQueryList], ClassCreator(arguments=[], 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=MtasSpanSequenceItem, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
call[currentQueryList.add, parameter[member[.currentQuery]]]
assign[member[.currentQuery], literal[null]]
return[ClassCreator(arguments=[MemberReference(member=currentQueryList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ignoreClause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maximumIgnoreLength, 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=MtasSpanSequenceQuery, sub_type=None))]
else begin[{]
return[call[currentQuery.getQuery, parameter[]]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[MtasSpanQuery] identifier[getQuery] operator[SEP] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[simplify] operator[SEP] operator[SEP] operator[SEP] identifier[MtasSpanSequenceItem] identifier[currentQuery] operator[=] Other[null] operator[SEP] identifier[List] operator[<] identifier[MtasSpanSequenceItem] operator[>] identifier[currentQueryList] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[MtasCQLParserBasicSentencePartCondition] identifier[part] operator[:] identifier[partList] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentQuery] operator[!=] Other[null] operator[SEP] {
identifier[currentQueryList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MtasSpanSequenceItem] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[currentQueryList] operator[SEP] identifier[add] operator[SEP] identifier[currentQuery] operator[SEP] operator[SEP] identifier[currentQuery] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[part] operator[SEP] identifier[getMaximumOccurence] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[MtasSpanQuery] identifier[q] operator[=] Keyword[new] identifier[MtasSpanRecurrenceQuery] operator[SEP] identifier[part] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] , identifier[part] operator[SEP] identifier[getMinimumOccurence] operator[SEP] operator[SEP] , identifier[part] operator[SEP] identifier[getMaximumOccurence] operator[SEP] operator[SEP] , identifier[ignoreClause] , identifier[maximumIgnoreLength] operator[SEP] operator[SEP] identifier[currentQuery] operator[=] Keyword[new] identifier[MtasSpanSequenceItem] operator[SEP] identifier[q] , identifier[part] operator[SEP] identifier[isOptional] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[currentQuery] operator[=] Keyword[new] identifier[MtasSpanSequenceItem] operator[SEP] identifier[part] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] , identifier[part] operator[SEP] identifier[isOptional] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentQueryList] operator[!=] Other[null] operator[SEP] {
identifier[currentQueryList] operator[SEP] identifier[add] operator[SEP] identifier[currentQuery] operator[SEP] operator[SEP] identifier[currentQuery] operator[=] Other[null] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[currentQueryList] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[MtasSpanSequenceQuery] operator[SEP] identifier[currentQueryList] , identifier[ignoreClause] , identifier[maximumIgnoreLength] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[currentQuery] operator[SEP] identifier[isOptional] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentQueryList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MtasSpanSequenceItem] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[currentQueryList] operator[SEP] identifier[add] operator[SEP] identifier[currentQuery] operator[SEP] operator[SEP] identifier[currentQuery] operator[=] Other[null] operator[SEP] Keyword[return] Keyword[new] identifier[MtasSpanSequenceQuery] operator[SEP] identifier[currentQueryList] , identifier[ignoreClause] , identifier[maximumIgnoreLength] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[currentQuery] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public ChannelPipelineFactory getPipelineFactory()
{
return new ChannelPipelineFactory()
{
@Override
public ChannelPipeline getPipeline()
throws Exception
{
final ChannelPipeline cp = Channels.pipeline();
cp.addLast(FRAME_DECODER, new FixedLengthFrameDecoder(8));
cp.addLast(HANDSHAKE, new Socks4HandshakeHandler(Socks4ClientBootstrap.super.getPipelineFactory()));
return cp;
}
};
} | class class_name[name] begin[{]
method[getPipelineFactory, return_type[type[ChannelPipelineFactory]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=pipeline, postfix_operators=[], prefix_operators=[], qualifier=Channels, selectors=[], type_arguments=None), name=cp)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ChannelPipeline, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FRAME_DECODER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FixedLengthFrameDecoder, sub_type=None))], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=cp, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HANDSHAKE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=Socks4ClientBootstrap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[], member=getPipelineFactory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Socks4HandshakeHandler, sub_type=None))], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=cp, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getPipeline, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=ChannelPipeline, sub_type=None), throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelPipelineFactory, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ChannelPipelineFactory] identifier[getPipelineFactory] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ChannelPipelineFactory] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[ChannelPipeline] identifier[getPipeline] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[ChannelPipeline] identifier[cp] operator[=] identifier[Channels] operator[SEP] identifier[pipeline] operator[SEP] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[addLast] operator[SEP] identifier[FRAME_DECODER] , Keyword[new] identifier[FixedLengthFrameDecoder] operator[SEP] Other[8] operator[SEP] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[addLast] operator[SEP] identifier[HANDSHAKE] , Keyword[new] identifier[Socks4HandshakeHandler] operator[SEP] identifier[Socks4ClientBootstrap] operator[SEP] Keyword[super] operator[SEP] identifier[getPipelineFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cp] operator[SEP]
}
} operator[SEP]
}
|
public java.util.List<String> getIncludeOnlyStatuses() {
if (includeOnlyStatuses == null) {
includeOnlyStatuses = new com.amazonaws.internal.SdkInternalList<String>();
}
return includeOnlyStatuses;
} | class class_name[name] begin[{]
method[getIncludeOnlyStatuses, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.includeOnlyStatuses], ==, literal[null]]] begin[{]
assign[member[.includeOnlyStatuses], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.includeOnlyStatuses]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[getIncludeOnlyStatuses] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[includeOnlyStatuses] operator[==] Other[null] operator[SEP] {
identifier[includeOnlyStatuses] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[includeOnlyStatuses] operator[SEP]
}
|
public void showMenu (Stage stage, Actor actor) {
Vector2 pos = actor.localToStageCoordinates(tmpVector.setZero());
float menuY;
if (pos.y - getHeight() <= 0) {
menuY = pos.y + actor.getHeight() + getHeight() - sizes.borderSize;
} else {
menuY = pos.y + sizes.borderSize;
}
showMenu(stage, pos.x, menuY);
} | class class_name[name] begin[{]
method[showMenu, return_type[void], modifier[public], parameter[stage, actor]] begin[{]
local_variable[type[Vector2], pos]
local_variable[type[float], menuY]
if[binary_operation[binary_operation[member[pos.y], -, call[.getHeight, parameter[]]], <=, literal[0]]] begin[{]
assign[member[.menuY], binary_operation[binary_operation[binary_operation[member[pos.y], +, call[actor.getHeight, parameter[]]], +, call[.getHeight, parameter[]]], -, member[sizes.borderSize]]]
else begin[{]
assign[member[.menuY], binary_operation[member[pos.y], +, member[sizes.borderSize]]]
end[}]
call[.showMenu, parameter[member[.stage], member[pos.x], member[.menuY]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[showMenu] operator[SEP] identifier[Stage] identifier[stage] , identifier[Actor] identifier[actor] operator[SEP] {
identifier[Vector2] identifier[pos] operator[=] identifier[actor] operator[SEP] identifier[localToStageCoordinates] operator[SEP] identifier[tmpVector] operator[SEP] identifier[setZero] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[menuY] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[SEP] identifier[y] operator[-] identifier[getHeight] operator[SEP] operator[SEP] operator[<=] Other[0] operator[SEP] {
identifier[menuY] operator[=] identifier[pos] operator[SEP] identifier[y] operator[+] identifier[actor] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[+] identifier[getHeight] operator[SEP] operator[SEP] operator[-] identifier[sizes] operator[SEP] identifier[borderSize] operator[SEP]
}
Keyword[else] {
identifier[menuY] operator[=] identifier[pos] operator[SEP] identifier[y] operator[+] identifier[sizes] operator[SEP] identifier[borderSize] operator[SEP]
}
identifier[showMenu] operator[SEP] identifier[stage] , identifier[pos] operator[SEP] identifier[x] , identifier[menuY] operator[SEP] operator[SEP]
}
|
public void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh)
throws org.xml.sax.SAXException
{
String str = str();
lh.comment(str.toCharArray(), 0, str.length());
} | class class_name[name] begin[{]
method[dispatchAsComment, return_type[void], modifier[public], parameter[lh]] begin[{]
local_variable[type[String], str]
call[lh.comment, parameter[call[str.toCharArray, parameter[]], literal[0], call[str.length, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[dispatchAsComment] operator[SEP] identifier[org] operator[SEP] identifier[xml] operator[SEP] identifier[sax] operator[SEP] identifier[ext] operator[SEP] identifier[LexicalHandler] identifier[lh] operator[SEP] Keyword[throws] identifier[org] operator[SEP] identifier[xml] operator[SEP] identifier[sax] operator[SEP] identifier[SAXException] {
identifier[String] identifier[str] operator[=] identifier[str] operator[SEP] operator[SEP] operator[SEP] identifier[lh] operator[SEP] identifier[comment] operator[SEP] identifier[str] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] , Other[0] , identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Symmetry010Date from(TemporalAccessor temporal) {
if (temporal instanceof Symmetry010Date) {
return (Symmetry010Date) temporal;
}
return Symmetry010Date.ofEpochDay(temporal.getLong(ChronoField.EPOCH_DAY));
} | class class_name[name] begin[{]
method[from, return_type[type[Symmetry010Date]], modifier[public static], parameter[temporal]] begin[{]
if[binary_operation[member[.temporal], instanceof, type[Symmetry010Date]]] begin[{]
return[Cast(expression=MemberReference(member=temporal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Symmetry010Date, sub_type=None))]
else begin[{]
None
end[}]
return[call[Symmetry010Date.ofEpochDay, parameter[call[temporal.getLong, parameter[member[ChronoField.EPOCH_DAY]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Symmetry010Date] identifier[from] operator[SEP] identifier[TemporalAccessor] identifier[temporal] operator[SEP] {
Keyword[if] operator[SEP] identifier[temporal] Keyword[instanceof] identifier[Symmetry010Date] operator[SEP] {
Keyword[return] operator[SEP] identifier[Symmetry010Date] operator[SEP] identifier[temporal] operator[SEP]
}
Keyword[return] identifier[Symmetry010Date] operator[SEP] identifier[ofEpochDay] operator[SEP] identifier[temporal] operator[SEP] identifier[getLong] operator[SEP] identifier[ChronoField] operator[SEP] identifier[EPOCH_DAY] operator[SEP] operator[SEP] operator[SEP]
}
|
public Set<String> names() {
TreeSet<String> result = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0, size = size(); i < size; i++) {
result.add(name(i));
}
return Collections.unmodifiableSet(result);
} | class class_name[name] begin[{]
method[names, return_type[type[Set]], modifier[public], parameter[]] begin[{]
local_variable[type[TreeSet], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=name, postfix_operators=[], prefix_operators=[], qualifier=, 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=size, 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), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=size)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[Collections.unmodifiableSet, parameter[member[.result]]]]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[String] operator[>] identifier[names] operator[SEP] operator[SEP] {
identifier[TreeSet] operator[<] identifier[String] operator[>] identifier[result] operator[=] Keyword[new] identifier[TreeSet] operator[<] operator[>] operator[SEP] identifier[String] operator[SEP] identifier[CASE_INSENSITIVE_ORDER] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[size] operator[=] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[name] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
|
@Override
public void removeDataObserver(final Observer<DataProvider<M>, M> observer) {
dataObservable.removeObserver(observer);
} | class class_name[name] begin[{]
method[removeDataObserver, return_type[void], modifier[public], parameter[observer]] begin[{]
call[dataObservable.removeObserver, parameter[member[.observer]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[removeDataObserver] operator[SEP] Keyword[final] identifier[Observer] operator[<] identifier[DataProvider] operator[<] identifier[M] operator[>] , identifier[M] operator[>] identifier[observer] operator[SEP] {
identifier[dataObservable] operator[SEP] identifier[removeObserver] operator[SEP] identifier[observer] operator[SEP] operator[SEP]
}
|
public Iterable<Result<Item>> listObjects(final String bucketName) throws XmlPullParserException {
return listObjects(bucketName, null);
} | class class_name[name] begin[{]
method[listObjects, return_type[type[Iterable]], modifier[public], parameter[bucketName]] begin[{]
return[call[.listObjects, parameter[member[.bucketName], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[Iterable] operator[<] identifier[Result] operator[<] identifier[Item] operator[>] operator[>] identifier[listObjects] operator[SEP] Keyword[final] identifier[String] identifier[bucketName] operator[SEP] Keyword[throws] identifier[XmlPullParserException] {
Keyword[return] identifier[listObjects] operator[SEP] identifier[bucketName] , Other[null] operator[SEP] operator[SEP]
}
|
@GET
@Path("agreementsPerTemplateAndConsumer")
@Deprecated
public List<IAgreement> getAgreementsPerTemplateAndConsumer(
@QueryParam("consumerId") String consumerId,
@QueryParam("templateUUID") String templateUUID) {
logger.debug("StartOf getAgreementsPerTemplateAndConsumer - REQUEST for /agreementsPerTemplateAndConsumer");
AgreementHelperE agreementRestHelper = getAgreementHelper();
List<IAgreement> agreements = agreementRestHelper.getAgreementsPerTemplateAndConsumer(consumerId, templateUUID);
return agreements;
} | class class_name[name] begin[{]
method[getAgreementsPerTemplateAndConsumer, return_type[type[List]], modifier[public], parameter[consumerId, templateUUID]] begin[{]
call[logger.debug, parameter[literal["StartOf getAgreementsPerTemplateAndConsumer - REQUEST for /agreementsPerTemplateAndConsumer"]]]
local_variable[type[AgreementHelperE], agreementRestHelper]
local_variable[type[List], agreements]
return[member[.agreements]]
end[}]
END[}] | annotation[@] identifier[GET] annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Deprecated] Keyword[public] identifier[List] operator[<] identifier[IAgreement] operator[>] identifier[getAgreementsPerTemplateAndConsumer] operator[SEP] annotation[@] identifier[QueryParam] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[consumerId] , annotation[@] identifier[QueryParam] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[templateUUID] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[AgreementHelperE] identifier[agreementRestHelper] operator[=] identifier[getAgreementHelper] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[IAgreement] operator[>] identifier[agreements] operator[=] identifier[agreementRestHelper] operator[SEP] identifier[getAgreementsPerTemplateAndConsumer] operator[SEP] identifier[consumerId] , identifier[templateUUID] operator[SEP] operator[SEP] Keyword[return] identifier[agreements] operator[SEP]
}
|
private void configureJMeterArtifacts() {
if (jmeterArtifacts.isEmpty()) {
jmeterArtifacts = createDefaultJmeterArtifactsArray(jmeterVersion);
}
getLog().debug("JMeter Artifact List:");
jmeterArtifacts.forEach(artifact ->
getLog().debug(artifact)
);
} | class class_name[name] begin[{]
method[configureJMeterArtifacts, return_type[void], modifier[private], parameter[]] begin[{]
if[call[jmeterArtifacts.isEmpty, parameter[]]] begin[{]
assign[member[.jmeterArtifacts], call[.createDefaultJmeterArtifactsArray, parameter[member[.jmeterVersion]]]]
else begin[{]
None
end[}]
call[.getLog, parameter[]]
call[jmeterArtifacts.forEach, parameter[LambdaExpression(body=MethodInvocation(arguments=[], member=getLog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=artifact, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[MemberReference(member=artifact, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[configureJMeterArtifacts] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[jmeterArtifacts] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[jmeterArtifacts] operator[=] identifier[createDefaultJmeterArtifactsArray] operator[SEP] identifier[jmeterVersion] operator[SEP] operator[SEP]
}
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[jmeterArtifacts] operator[SEP] identifier[forEach] operator[SEP] identifier[artifact] operator[->] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] identifier[artifact] operator[SEP] operator[SEP] operator[SEP]
}
|
public void addListeners()
{
super.addListeners();
Record record = this.getMainRecord();
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
if (recClassInfo != null)
{
record.setKeyArea(ScreenIn.SCREEN_IN_PROG_NAME_KEY);
SubFileFilter listener = new SubFileFilter(recClassInfo.getField(ClassInfo.CLASS_NAME), ScreenIn.SCREEN_IN_PROG_NAME, null, null, null, null, true);
record.addListener(listener);
recClassInfo.getField(ClassInfo.CLASS_NAME).addListener(new FieldReSelectHandler(this));
}
} | class class_name[name] begin[{]
method[addListeners, return_type[void], modifier[public], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=addListeners, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[Record], record]
local_variable[type[Record], recClassInfo]
if[binary_operation[member[.recClassInfo], !=, literal[null]]] begin[{]
call[record.setKeyArea, parameter[member[ScreenIn.SCREEN_IN_PROG_NAME_KEY]]]
local_variable[type[SubFileFilter], listener]
call[record.addListener, parameter[member[.listener]]]
call[recClassInfo.getField, parameter[member[ClassInfo.CLASS_NAME]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addListeners] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[addListeners] operator[SEP] operator[SEP] operator[SEP] identifier[Record] identifier[record] operator[=] Keyword[this] operator[SEP] identifier[getMainRecord] operator[SEP] operator[SEP] operator[SEP] identifier[Record] identifier[recClassInfo] operator[=] Keyword[this] operator[SEP] identifier[getRecord] operator[SEP] identifier[ClassInfo] operator[SEP] identifier[CLASS_INFO_FILE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[recClassInfo] operator[!=] Other[null] operator[SEP] {
identifier[record] operator[SEP] identifier[setKeyArea] operator[SEP] identifier[ScreenIn] operator[SEP] identifier[SCREEN_IN_PROG_NAME_KEY] operator[SEP] operator[SEP] identifier[SubFileFilter] identifier[listener] operator[=] Keyword[new] identifier[SubFileFilter] operator[SEP] identifier[recClassInfo] operator[SEP] identifier[getField] operator[SEP] identifier[ClassInfo] operator[SEP] identifier[CLASS_NAME] operator[SEP] , identifier[ScreenIn] operator[SEP] identifier[SCREEN_IN_PROG_NAME] , Other[null] , Other[null] , Other[null] , Other[null] , literal[boolean] operator[SEP] operator[SEP] identifier[record] operator[SEP] identifier[addListener] operator[SEP] identifier[listener] operator[SEP] operator[SEP] identifier[recClassInfo] operator[SEP] identifier[getField] operator[SEP] identifier[ClassInfo] operator[SEP] identifier[CLASS_NAME] operator[SEP] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[FieldReSelectHandler] operator[SEP] Keyword[this] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public com.google.api.ads.admanager.axis.v201808.VideoBumperType getVideoBumperType() {
return videoBumperType;
} | class class_name[name] begin[{]
method[getVideoBumperType, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.videoBumperType]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201808] operator[SEP] identifier[VideoBumperType] identifier[getVideoBumperType] operator[SEP] operator[SEP] {
Keyword[return] identifier[videoBumperType] operator[SEP]
}
|
@Nullable
@ReturnsMutableCopy
public static ICommonsList <String> readStreamLines (@WillClose @Nullable final InputStream aIS,
@Nonnull final Charset aCharset,
@Nonnegative final int nLinesToSkip,
@CheckForSigned final int nLinesToRead)
{
if (aIS == null)
return null;
// Read stream and collect all read lines in a list
final ICommonsList <String> ret = new CommonsArrayList <> ();
readStreamLines (aIS, aCharset, nLinesToSkip, nLinesToRead, ret::add);
return ret;
} | class class_name[name] begin[{]
method[readStreamLines, return_type[type[ICommonsList]], modifier[public static], parameter[aIS, aCharset, nLinesToSkip, nLinesToRead]] begin[{]
if[binary_operation[member[.aIS], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ICommonsList], ret]
call[.readStreamLines, parameter[member[.aIS], member[.aCharset], member[.nLinesToSkip], member[.nLinesToRead], MethodReference(expression=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]
return[member[.ret]]
end[}]
END[}] | annotation[@] identifier[Nullable] annotation[@] identifier[ReturnsMutableCopy] Keyword[public] Keyword[static] identifier[ICommonsList] operator[<] identifier[String] operator[>] identifier[readStreamLines] operator[SEP] annotation[@] identifier[WillClose] annotation[@] identifier[Nullable] Keyword[final] identifier[InputStream] identifier[aIS] , annotation[@] identifier[Nonnull] Keyword[final] identifier[Charset] identifier[aCharset] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nLinesToSkip] , annotation[@] identifier[CheckForSigned] Keyword[final] Keyword[int] identifier[nLinesToRead] operator[SEP] {
Keyword[if] operator[SEP] identifier[aIS] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[final] identifier[ICommonsList] operator[<] identifier[String] operator[>] identifier[ret] operator[=] Keyword[new] identifier[CommonsArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[readStreamLines] operator[SEP] identifier[aIS] , identifier[aCharset] , identifier[nLinesToSkip] , identifier[nLinesToRead] , identifier[ret] operator[::] identifier[add] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
private void recordCounterAndTimer(MixinMetric mixinMetric, RpcAbstractLookoutModel model) {
Counter totalCounter = mixinMetric.counter("total_count");
Timer totalTimer = mixinMetric.timer("total_time");
Long elapsedTime = model.getElapsedTime();
totalCounter.inc();
if (elapsedTime != null) {
totalTimer.record(elapsedTime, TimeUnit.MILLISECONDS);
}
if (!model.getSuccess()) {
Counter failCounter = mixinMetric.counter("fail_count");
Timer failTimer = mixinMetric.timer("fail_time");
failCounter.inc();
if (elapsedTime != null) {
failTimer.record(elapsedTime, TimeUnit.MILLISECONDS);
}
}
} | class class_name[name] begin[{]
method[recordCounterAndTimer, return_type[void], modifier[private], parameter[mixinMetric, model]] begin[{]
local_variable[type[Counter], totalCounter]
local_variable[type[Timer], totalTimer]
local_variable[type[Long], elapsedTime]
call[totalCounter.inc, parameter[]]
if[binary_operation[member[.elapsedTime], !=, literal[null]]] begin[{]
call[totalTimer.record, parameter[member[.elapsedTime], member[TimeUnit.MILLISECONDS]]]
else begin[{]
None
end[}]
if[call[model.getSuccess, parameter[]]] begin[{]
local_variable[type[Counter], failCounter]
local_variable[type[Timer], failTimer]
call[failCounter.inc, parameter[]]
if[binary_operation[member[.elapsedTime], !=, literal[null]]] begin[{]
call[failTimer.record, parameter[member[.elapsedTime], member[TimeUnit.MILLISECONDS]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[recordCounterAndTimer] operator[SEP] identifier[MixinMetric] identifier[mixinMetric] , identifier[RpcAbstractLookoutModel] identifier[model] operator[SEP] {
identifier[Counter] identifier[totalCounter] operator[=] identifier[mixinMetric] operator[SEP] identifier[counter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Timer] identifier[totalTimer] operator[=] identifier[mixinMetric] operator[SEP] identifier[timer] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Long] identifier[elapsedTime] operator[=] identifier[model] operator[SEP] identifier[getElapsedTime] operator[SEP] operator[SEP] operator[SEP] identifier[totalCounter] operator[SEP] identifier[inc] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elapsedTime] operator[!=] Other[null] operator[SEP] {
identifier[totalTimer] operator[SEP] identifier[record] operator[SEP] identifier[elapsedTime] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[model] operator[SEP] identifier[getSuccess] operator[SEP] operator[SEP] operator[SEP] {
identifier[Counter] identifier[failCounter] operator[=] identifier[mixinMetric] operator[SEP] identifier[counter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Timer] identifier[failTimer] operator[=] identifier[mixinMetric] operator[SEP] identifier[timer] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[failCounter] operator[SEP] identifier[inc] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elapsedTime] operator[!=] Other[null] operator[SEP] {
identifier[failTimer] operator[SEP] identifier[record] operator[SEP] identifier[elapsedTime] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
}
}
|
public static String getInstrumentationLevelString() {
if (disabled)
return null;
Map modules = moduleRoot.children;
if (modules == null) {
return "";
} else {
PerfLevelDescriptor[] plds = new PerfLevelDescriptor[modules.size()];
Iterator values = modules.values().iterator();
int i = 0;
while (values.hasNext()) {
PmiModule instance = ((ModuleItem) values.next()).getInstance();
plds[i++] = new PerfLevelDescriptor(instance.getPath(),
instance.getInstrumentationLevel(),
instance.getModuleID());
}
return PmiUtil.getStringFromPerfLevelSpecs(plds);
}
} | class class_name[name] begin[{]
method[getInstrumentationLevelString, return_type[type[String]], modifier[public static], parameter[]] begin[{]
if[member[.disabled]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Map], modules]
if[binary_operation[member[.modules], ==, literal[null]]] begin[{]
return[literal[""]]
else begin[{]
local_variable[type[PerfLevelDescriptor], plds]
local_variable[type[Iterator], values]
local_variable[type[int], i]
while[call[values.hasNext, parameter[]]] begin[{]
local_variable[type[PmiModule], instance]
assign[member[.plds], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=instance, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getInstrumentationLevel, postfix_operators=[], prefix_operators=[], qualifier=instance, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getModuleID, postfix_operators=[], prefix_operators=[], qualifier=instance, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PerfLevelDescriptor, sub_type=None))]
end[}]
return[call[PmiUtil.getStringFromPerfLevelSpecs, parameter[member[.plds]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getInstrumentationLevelString] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[disabled] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[Map] identifier[modules] operator[=] identifier[moduleRoot] operator[SEP] identifier[children] operator[SEP] Keyword[if] operator[SEP] identifier[modules] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] {
identifier[PerfLevelDescriptor] operator[SEP] operator[SEP] identifier[plds] operator[=] Keyword[new] identifier[PerfLevelDescriptor] operator[SEP] identifier[modules] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] identifier[values] operator[=] identifier[modules] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[values] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[PmiModule] identifier[instance] operator[=] operator[SEP] operator[SEP] identifier[ModuleItem] operator[SEP] identifier[values] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[plds] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] Keyword[new] identifier[PerfLevelDescriptor] operator[SEP] identifier[instance] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , identifier[instance] operator[SEP] identifier[getInstrumentationLevel] operator[SEP] operator[SEP] , identifier[instance] operator[SEP] identifier[getModuleID] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[PmiUtil] operator[SEP] identifier[getStringFromPerfLevelSpecs] operator[SEP] identifier[plds] operator[SEP] operator[SEP]
}
}
|
@Override
public IEntityGroupStore newGroupStore(ComponentGroupServiceDescriptor svcDescriptor)
throws GroupsException {
FileSystemGroupStore fsGroupStore = (FileSystemGroupStore) getGroupStore();
String groupsRoot = (String) svcDescriptor.get("groupsRoot");
if (groupsRoot != null) {
fsGroupStore.setGroupsRootPath(groupsRoot);
}
return fsGroupStore;
} | class class_name[name] begin[{]
method[newGroupStore, return_type[type[IEntityGroupStore]], modifier[public], parameter[svcDescriptor]] begin[{]
local_variable[type[FileSystemGroupStore], fsGroupStore]
local_variable[type[String], groupsRoot]
if[binary_operation[member[.groupsRoot], !=, literal[null]]] begin[{]
call[fsGroupStore.setGroupsRootPath, parameter[member[.groupsRoot]]]
else begin[{]
None
end[}]
return[member[.fsGroupStore]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[IEntityGroupStore] identifier[newGroupStore] operator[SEP] identifier[ComponentGroupServiceDescriptor] identifier[svcDescriptor] operator[SEP] Keyword[throws] identifier[GroupsException] {
identifier[FileSystemGroupStore] identifier[fsGroupStore] operator[=] operator[SEP] identifier[FileSystemGroupStore] operator[SEP] identifier[getGroupStore] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[groupsRoot] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[svcDescriptor] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[groupsRoot] operator[!=] Other[null] operator[SEP] {
identifier[fsGroupStore] operator[SEP] identifier[setGroupsRootPath] operator[SEP] identifier[groupsRoot] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fsGroupStore] operator[SEP]
}
|
public EClass getGSLT() {
if (gsltEClass == null) {
gsltEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(476);
}
return gsltEClass;
} | class class_name[name] begin[{]
method[getGSLT, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.gsltEClass], ==, literal[null]]] begin[{]
assign[member[.gsltEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=476)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.gsltEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getGSLT] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[gsltEClass] operator[==] Other[null] operator[SEP] {
identifier[gsltEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[476] operator[SEP] operator[SEP]
}
Keyword[return] identifier[gsltEClass] operator[SEP]
}
|
public int compareTo (ByteBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
byte thisByte, otherByte;
while (compareRemaining > 0) {
thisByte = get(thisPos);
otherByte = otherBuffer.get(otherPos);
if (thisByte != otherByte) {
return thisByte < otherByte ? -1 : 1;
}
thisPos++;
otherPos++;
compareRemaining--;
}
return remaining() - otherBuffer.remaining();
} | class class_name[name] begin[{]
method[compareTo, return_type[type[int]], modifier[public], parameter[otherBuffer]] begin[{]
local_variable[type[int], compareRemaining]
local_variable[type[int], thisPos]
local_variable[type[int], otherPos]
local_variable[type[byte], thisByte]
while[binary_operation[member[.compareRemaining], >, literal[0]]] begin[{]
assign[member[.thisByte], call[.get, parameter[member[.thisPos]]]]
assign[member[.otherByte], call[otherBuffer.get, parameter[member[.otherPos]]]]
if[binary_operation[member[.thisByte], !=, member[.otherByte]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=thisByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=otherByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1))]
else begin[{]
None
end[}]
member[.thisPos]
member[.otherPos]
member[.compareRemaining]
end[}]
return[binary_operation[call[.remaining, parameter[]], -, call[otherBuffer.remaining, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[compareTo] operator[SEP] identifier[ByteBuffer] identifier[otherBuffer] operator[SEP] {
Keyword[int] identifier[compareRemaining] operator[=] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[<] identifier[otherBuffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] operator[?] identifier[remaining] operator[SEP] operator[SEP] operator[:] identifier[otherBuffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[thisPos] operator[=] identifier[position] operator[SEP] Keyword[int] identifier[otherPos] operator[=] identifier[otherBuffer] operator[SEP] identifier[position] operator[SEP] Keyword[byte] identifier[thisByte] , identifier[otherByte] operator[SEP] Keyword[while] operator[SEP] identifier[compareRemaining] operator[>] Other[0] operator[SEP] {
identifier[thisByte] operator[=] identifier[get] operator[SEP] identifier[thisPos] operator[SEP] operator[SEP] identifier[otherByte] operator[=] identifier[otherBuffer] operator[SEP] identifier[get] operator[SEP] identifier[otherPos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[thisByte] operator[!=] identifier[otherByte] operator[SEP] {
Keyword[return] identifier[thisByte] operator[<] identifier[otherByte] operator[?] operator[-] Other[1] operator[:] Other[1] operator[SEP]
}
identifier[thisPos] operator[++] operator[SEP] identifier[otherPos] operator[++] operator[SEP] identifier[compareRemaining] operator[--] operator[SEP]
}
Keyword[return] identifier[remaining] operator[SEP] operator[SEP] operator[-] identifier[otherBuffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP]
}
|
public void if_tcmple(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmple(target);
popType();
} | class class_name[name] begin[{]
method[if_tcmple, return_type[void], modifier[public], parameter[type, target]] begin[{]
call[.pushType, parameter[member[.type]]]
call[.if_tcmple, parameter[member[.target]]]
call[.popType, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[if_tcmple] operator[SEP] identifier[TypeMirror] identifier[type] , identifier[String] identifier[target] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[pushType] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[if_tcmple] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[popType] operator[SEP] operator[SEP] operator[SEP]
}
|
public <TEnum extends Enum<TEnum>> void set(String key, TEnum value)
{
setEnum(key, value);
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[key, value]] begin[{]
call[.setEnum, parameter[member[.key], member[.value]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[TEnum] Keyword[extends] identifier[Enum] operator[<] identifier[TEnum] operator[>] operator[>] Keyword[void] identifier[set] operator[SEP] identifier[String] identifier[key] , identifier[TEnum] identifier[value] operator[SEP] {
identifier[setEnum] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
private void drawPixel(Color color, long fileOffset) {
long size = withMinLength(0);
drawPixels(color, fileOffset, size);
} | class class_name[name] begin[{]
method[drawPixel, return_type[void], modifier[private], parameter[color, fileOffset]] begin[{]
local_variable[type[long], size]
call[.drawPixels, parameter[member[.color], member[.fileOffset], member[.size]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[drawPixel] operator[SEP] identifier[Color] identifier[color] , Keyword[long] identifier[fileOffset] operator[SEP] {
Keyword[long] identifier[size] operator[=] identifier[withMinLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[drawPixels] operator[SEP] identifier[color] , identifier[fileOffset] , identifier[size] operator[SEP] operator[SEP]
}
|
public static AccessibilityNodeInfoRef owned(
AccessibilityNodeInfoCompat node) {
return node != null ? new AccessibilityNodeInfoRef(node, true) : null;
} | class class_name[name] begin[{]
method[owned, return_type[type[AccessibilityNodeInfoRef]], modifier[public static], parameter[node]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=ClassCreator(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AccessibilityNodeInfoRef, sub_type=None)))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AccessibilityNodeInfoRef] identifier[owned] operator[SEP] identifier[AccessibilityNodeInfoCompat] identifier[node] operator[SEP] {
Keyword[return] identifier[node] operator[!=] Other[null] operator[?] Keyword[new] identifier[AccessibilityNodeInfoRef] operator[SEP] identifier[node] , literal[boolean] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the TeamService.
TeamServiceInterface teamService = adManagerServices.get(session, TeamServiceInterface.class);
// Create a read/write team.
Team readWriteTeam = new Team();
readWriteTeam.setName("Read/write team #" + new Random().nextInt(Integer.MAX_VALUE));
readWriteTeam.setTeamAccessType(TeamAccessType.READ_WRITE);
readWriteTeam.setHasAllCompanies(false);
readWriteTeam.setHasAllInventory(false);
// Create a read-only team.
Team readOnlyTeam = new Team();
readOnlyTeam.setName("Read-only team #" + new Random().nextInt(Integer.MAX_VALUE));
readOnlyTeam.setTeamAccessType(TeamAccessType.READ_ONLY);
readOnlyTeam.setHasAllCompanies(false);
readOnlyTeam.setHasAllInventory(false);
// Create the teams on the server.
Team[] teams = teamService.createTeams(new Team[] {readWriteTeam, readOnlyTeam});
for (Team createdTeam : teams) {
System.out.printf(
"A team with ID %d and name '%s' was created.%n",
createdTeam.getId(), createdTeam.getName());
}
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adManagerServices, session]] begin[{]
local_variable[type[TeamServiceInterface], teamService]
local_variable[type[Team], readWriteTeam]
call[readWriteTeam.setName, parameter[binary_operation[literal["Read/write team #"], +, ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[])], member=nextInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Random, sub_type=None))]]]
call[readWriteTeam.setTeamAccessType, parameter[member[TeamAccessType.READ_WRITE]]]
call[readWriteTeam.setHasAllCompanies, parameter[literal[false]]]
call[readWriteTeam.setHasAllInventory, parameter[literal[false]]]
local_variable[type[Team], readOnlyTeam]
call[readOnlyTeam.setName, parameter[binary_operation[literal["Read-only team #"], +, ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[])], member=nextInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Random, sub_type=None))]]]
call[readOnlyTeam.setTeamAccessType, parameter[member[TeamAccessType.READ_ONLY]]]
call[readOnlyTeam.setHasAllCompanies, parameter[literal[false]]]
call[readOnlyTeam.setHasAllInventory, parameter[literal[false]]]
local_variable[type[Team], teams]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A team with ID %d and name '%s' was created.%n"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=createdTeam, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=createdTeam, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=teams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=createdTeam)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Team, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdManagerServices] identifier[adManagerServices] , identifier[AdManagerSession] identifier[session] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[TeamServiceInterface] identifier[teamService] operator[=] identifier[adManagerServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[TeamServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Team] identifier[readWriteTeam] operator[=] Keyword[new] identifier[Team] operator[SEP] operator[SEP] operator[SEP] identifier[readWriteTeam] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[+] Keyword[new] identifier[Random] operator[SEP] operator[SEP] operator[SEP] identifier[nextInt] operator[SEP] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] operator[SEP] identifier[readWriteTeam] operator[SEP] identifier[setTeamAccessType] operator[SEP] identifier[TeamAccessType] operator[SEP] identifier[READ_WRITE] operator[SEP] operator[SEP] identifier[readWriteTeam] operator[SEP] identifier[setHasAllCompanies] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[readWriteTeam] operator[SEP] identifier[setHasAllInventory] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Team] identifier[readOnlyTeam] operator[=] Keyword[new] identifier[Team] operator[SEP] operator[SEP] operator[SEP] identifier[readOnlyTeam] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[+] Keyword[new] identifier[Random] operator[SEP] operator[SEP] operator[SEP] identifier[nextInt] operator[SEP] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] operator[SEP] identifier[readOnlyTeam] operator[SEP] identifier[setTeamAccessType] operator[SEP] identifier[TeamAccessType] operator[SEP] identifier[READ_ONLY] operator[SEP] operator[SEP] identifier[readOnlyTeam] operator[SEP] identifier[setHasAllCompanies] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[readOnlyTeam] operator[SEP] identifier[setHasAllInventory] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Team] operator[SEP] operator[SEP] identifier[teams] operator[=] identifier[teamService] operator[SEP] identifier[createTeams] operator[SEP] Keyword[new] identifier[Team] operator[SEP] operator[SEP] {
identifier[readWriteTeam] , identifier[readOnlyTeam]
} operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Team] identifier[createdTeam] operator[:] identifier[teams] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[createdTeam] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[createdTeam] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
StringBuffer getString(StringBuffer sb, int startChunk, int startColumn,
int length)
{
int stop = (startChunk << m_chunkBits) + startColumn + length;
int stopChunk = stop >>> m_chunkBits;
int stopColumn = stop & m_chunkMask;
// Factored out
//StringBuffer sb=new StringBuffer(length);
for (int i = startChunk; i < stopChunk; ++i)
{
if (i == 0 && m_innerFSB != null)
m_innerFSB.getString(sb, startColumn, m_chunkSize - startColumn);
else
sb.append(m_array[i], startColumn, m_chunkSize - startColumn);
startColumn = 0; // after first chunk
}
if (stopChunk == 0 && m_innerFSB != null)
m_innerFSB.getString(sb, startColumn, stopColumn - startColumn);
else if (stopColumn > startColumn)
sb.append(m_array[stopChunk], startColumn, stopColumn - startColumn);
return sb;
} | class class_name[name] begin[{]
method[getString, return_type[type[StringBuffer]], modifier[default], parameter[sb, startChunk, startColumn, length]] begin[{]
local_variable[type[int], stop]
local_variable[type[int], stopChunk]
local_variable[type[int], stopColumn]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operandr=BinaryOperation(operandl=MemberReference(member=m_innerFSB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=m_array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=startColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=m_chunkSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=startColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=m_chunkSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=getString, postfix_operators=[], prefix_operators=[], qualifier=m_innerFSB, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=startColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=stopChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=startChunk, 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)
if[binary_operation[binary_operation[member[.stopChunk], ==, literal[0]], &&, binary_operation[member[.m_innerFSB], !=, literal[null]]]] begin[{]
call[m_innerFSB.getString, parameter[member[.sb], member[.startColumn], binary_operation[member[.stopColumn], -, member[.startColumn]]]]
else begin[{]
if[binary_operation[member[.stopColumn], >, member[.startColumn]]] begin[{]
call[sb.append, parameter[member[.m_array], member[.startColumn], binary_operation[member[.stopColumn], -, member[.startColumn]]]]
else begin[{]
None
end[}]
end[}]
return[member[.sb]]
end[}]
END[}] | identifier[StringBuffer] identifier[getString] operator[SEP] identifier[StringBuffer] identifier[sb] , Keyword[int] identifier[startChunk] , Keyword[int] identifier[startColumn] , Keyword[int] identifier[length] operator[SEP] {
Keyword[int] identifier[stop] operator[=] operator[SEP] identifier[startChunk] operator[<<] identifier[m_chunkBits] operator[SEP] operator[+] identifier[startColumn] operator[+] identifier[length] operator[SEP] Keyword[int] identifier[stopChunk] operator[=] identifier[stop] operator[>] operator[>] operator[>] identifier[m_chunkBits] operator[SEP] Keyword[int] identifier[stopColumn] operator[=] identifier[stop] operator[&] identifier[m_chunkMask] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[startChunk] operator[SEP] identifier[i] operator[<] identifier[stopChunk] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] Other[0] operator[&&] identifier[m_innerFSB] operator[!=] Other[null] operator[SEP] identifier[m_innerFSB] operator[SEP] identifier[getString] operator[SEP] identifier[sb] , identifier[startColumn] , identifier[m_chunkSize] operator[-] identifier[startColumn] operator[SEP] operator[SEP] Keyword[else] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[m_array] operator[SEP] identifier[i] operator[SEP] , identifier[startColumn] , identifier[m_chunkSize] operator[-] identifier[startColumn] operator[SEP] operator[SEP] identifier[startColumn] operator[=] Other[0] operator[SEP]
}
Keyword[if] operator[SEP] identifier[stopChunk] operator[==] Other[0] operator[&&] identifier[m_innerFSB] operator[!=] Other[null] operator[SEP] identifier[m_innerFSB] operator[SEP] identifier[getString] operator[SEP] identifier[sb] , identifier[startColumn] , identifier[stopColumn] operator[-] identifier[startColumn] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[stopColumn] operator[>] identifier[startColumn] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[m_array] operator[SEP] identifier[stopChunk] operator[SEP] , identifier[startColumn] , identifier[stopColumn] operator[-] identifier[startColumn] operator[SEP] operator[SEP] Keyword[return] identifier[sb] operator[SEP]
}
|
private void fireEvent(EventName eventName) {
switch (eventName.getEventIdentifier().intValue()) {
case MgcpEvent.REPORT_ON_COMPLETION :
//parse options
Options options = new Options(eventName.getEventIdentifier().getParms());
switch (options.getReturnCode()) {
case 100 :
if (options.getPatternIndex() >= 0) {
recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.RTC_TRIGGERED, triggers.get(options.getPatternIndex()), 0);
} else if (options.getDigitsCollected() != null) {
recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.RTC_TRIGGERED, SignalDetector.DETECTION_OF_ONE_SIGNAL, 0);
} else {
recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.NO_QUALIFIER, null, 0);
}
signal(SIGNAL_COMPLETE);
break;
case 328 :
recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.DURATION_EXCEEDED, null, 0);
signal(SIGNAL_COMPLETE);
break;
case 327 :
recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, RecorderEvent.SILENCE, null, 0);
signal(SIGNAL_COMPLETE);
break;
}
break;
case MgcpEvent.REPORT_FAILURE :
recorderEvent = new RecorderEventImpl(this, RecorderEvent.RECORD_COMPLETED, true, MediaErr.NOT_FOUND, "Not found");
signal(SIGNAL_FAILURE);
break;
}
} | class class_name[name] begin[{]
method[fireEvent, return_type[void], modifier[private], parameter[eventName]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=REPORT_ON_COMPLETION, postfix_operators=[], prefix_operators=[], qualifier=MgcpEvent, selectors=[])], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getEventIdentifier, postfix_operators=[], prefix_operators=[], qualifier=eventName, selectors=[MethodInvocation(arguments=[], member=getParms, 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=Options, sub_type=None)), name=options)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Options, sub_type=None)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100)], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPatternIndex, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDigitsCollected, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=recorderEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=RECORD_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=NO_QUALIFIER, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecorderEventImpl, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=recorderEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=RECORD_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=RTC_TRIGGERED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), MemberReference(member=DETECTION_OF_ONE_SIGNAL, postfix_operators=[], prefix_operators=[], qualifier=SignalDetector, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecorderEventImpl, sub_type=None))), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=recorderEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=RECORD_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=RTC_TRIGGERED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPatternIndex, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=triggers, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecorderEventImpl, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SIGNAL_COMPLETE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=signal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=328)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=recorderEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=RECORD_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=DURATION_EXCEEDED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecorderEventImpl, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SIGNAL_COMPLETE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=signal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=327)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=recorderEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=RECORD_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=SILENCE, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecorderEventImpl, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SIGNAL_COMPLETE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=signal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getReturnCode, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=REPORT_FAILURE, postfix_operators=[], prefix_operators=[], qualifier=MgcpEvent, selectors=[])], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=recorderEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=RECORD_COMPLETED, postfix_operators=[], prefix_operators=[], qualifier=RecorderEvent, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=NOT_FOUND, postfix_operators=[], prefix_operators=[], qualifier=MediaErr, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not found")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecorderEventImpl, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SIGNAL_FAILURE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=signal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getEventIdentifier, postfix_operators=[], prefix_operators=[], qualifier=eventName, selectors=[MethodInvocation(arguments=[], member=intValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[fireEvent] operator[SEP] identifier[EventName] identifier[eventName] operator[SEP] {
Keyword[switch] operator[SEP] identifier[eventName] operator[SEP] identifier[getEventIdentifier] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[MgcpEvent] operator[SEP] identifier[REPORT_ON_COMPLETION] operator[:] identifier[Options] identifier[options] operator[=] Keyword[new] identifier[Options] operator[SEP] identifier[eventName] operator[SEP] identifier[getEventIdentifier] operator[SEP] operator[SEP] operator[SEP] identifier[getParms] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[options] operator[SEP] identifier[getReturnCode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] Other[100] operator[:] Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[getPatternIndex] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP] {
identifier[recorderEvent] operator[=] Keyword[new] identifier[RecorderEventImpl] operator[SEP] Keyword[this] , identifier[RecorderEvent] operator[SEP] identifier[RECORD_COMPLETED] , literal[boolean] , identifier[RecorderEvent] operator[SEP] identifier[RTC_TRIGGERED] , identifier[triggers] operator[SEP] identifier[get] operator[SEP] identifier[options] operator[SEP] identifier[getPatternIndex] operator[SEP] operator[SEP] operator[SEP] , Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[getDigitsCollected] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[recorderEvent] operator[=] Keyword[new] identifier[RecorderEventImpl] operator[SEP] Keyword[this] , identifier[RecorderEvent] operator[SEP] identifier[RECORD_COMPLETED] , literal[boolean] , identifier[RecorderEvent] operator[SEP] identifier[RTC_TRIGGERED] , identifier[SignalDetector] operator[SEP] identifier[DETECTION_OF_ONE_SIGNAL] , Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[recorderEvent] operator[=] Keyword[new] identifier[RecorderEventImpl] operator[SEP] Keyword[this] , identifier[RecorderEvent] operator[SEP] identifier[RECORD_COMPLETED] , literal[boolean] , identifier[RecorderEvent] operator[SEP] identifier[NO_QUALIFIER] , Other[null] , Other[0] operator[SEP] operator[SEP]
}
identifier[signal] operator[SEP] identifier[SIGNAL_COMPLETE] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[328] operator[:] identifier[recorderEvent] operator[=] Keyword[new] identifier[RecorderEventImpl] operator[SEP] Keyword[this] , identifier[RecorderEvent] operator[SEP] identifier[RECORD_COMPLETED] , literal[boolean] , identifier[RecorderEvent] operator[SEP] identifier[DURATION_EXCEEDED] , Other[null] , Other[0] operator[SEP] operator[SEP] identifier[signal] operator[SEP] identifier[SIGNAL_COMPLETE] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[327] operator[:] identifier[recorderEvent] operator[=] Keyword[new] identifier[RecorderEventImpl] operator[SEP] Keyword[this] , identifier[RecorderEvent] operator[SEP] identifier[RECORD_COMPLETED] , literal[boolean] , identifier[RecorderEvent] operator[SEP] identifier[SILENCE] , Other[null] , Other[0] operator[SEP] operator[SEP] identifier[signal] operator[SEP] identifier[SIGNAL_COMPLETE] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[MgcpEvent] operator[SEP] identifier[REPORT_FAILURE] operator[:] identifier[recorderEvent] operator[=] Keyword[new] identifier[RecorderEventImpl] operator[SEP] Keyword[this] , identifier[RecorderEvent] operator[SEP] identifier[RECORD_COMPLETED] , literal[boolean] , identifier[MediaErr] operator[SEP] identifier[NOT_FOUND] , literal[String] operator[SEP] operator[SEP] identifier[signal] operator[SEP] identifier[SIGNAL_FAILURE] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
|
public static boolean isValidBuildMetaData(String buildMetaData) {
return buildMetaData != null &&
(buildMetaData.isEmpty() || BUILD_MD.matcher(buildMetaData).matches());
} | class class_name[name] begin[{]
method[isValidBuildMetaData, return_type[type[boolean]], modifier[public static], parameter[buildMetaData]] begin[{]
return[binary_operation[binary_operation[member[.buildMetaData], !=, literal[null]], &&, binary_operation[call[buildMetaData.isEmpty, parameter[]], ||, call[BUILD_MD.matcher, parameter[member[.buildMetaData]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isValidBuildMetaData] operator[SEP] identifier[String] identifier[buildMetaData] operator[SEP] {
Keyword[return] identifier[buildMetaData] operator[!=] Other[null] operator[&&] operator[SEP] identifier[buildMetaData] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[BUILD_MD] operator[SEP] identifier[matcher] operator[SEP] identifier[buildMetaData] operator[SEP] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void adaptLayoutParams() {
DialogRootView rootView = getRootView();
if (getWindow() != null && rootView != null) {
rootView.setLayoutParams(createLayoutParams());
rootView.setFullscreen(isFullscreen());
rootView.setMaxWidth(getMaxWidth());
rootView.setMaxHeight(getMaxHeight());
}
} | class class_name[name] begin[{]
method[adaptLayoutParams, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[DialogRootView], rootView]
if[binary_operation[binary_operation[call[.getWindow, parameter[]], !=, literal[null]], &&, binary_operation[member[.rootView], !=, literal[null]]]] begin[{]
call[rootView.setLayoutParams, parameter[call[.createLayoutParams, parameter[]]]]
call[rootView.setFullscreen, parameter[call[.isFullscreen, parameter[]]]]
call[rootView.setMaxWidth, parameter[call[.getMaxWidth, parameter[]]]]
call[rootView.setMaxHeight, parameter[call[.getMaxHeight, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[adaptLayoutParams] operator[SEP] operator[SEP] {
identifier[DialogRootView] identifier[rootView] operator[=] identifier[getRootView] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getWindow] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[rootView] operator[!=] Other[null] operator[SEP] {
identifier[rootView] operator[SEP] identifier[setLayoutParams] operator[SEP] identifier[createLayoutParams] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rootView] operator[SEP] identifier[setFullscreen] operator[SEP] identifier[isFullscreen] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rootView] operator[SEP] identifier[setMaxWidth] operator[SEP] identifier[getMaxWidth] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rootView] operator[SEP] identifier[setMaxHeight] operator[SEP] identifier[getMaxHeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static base_response add(nitro_service client, service resource) throws Exception {
service addresource = new service();
addresource.name = resource.name;
addresource.ip = resource.ip;
addresource.servername = resource.servername;
addresource.servicetype = resource.servicetype;
addresource.port = resource.port;
addresource.cleartextport = resource.cleartextport;
addresource.cachetype = resource.cachetype;
addresource.maxclient = resource.maxclient;
addresource.healthmonitor = resource.healthmonitor;
addresource.maxreq = resource.maxreq;
addresource.cacheable = resource.cacheable;
addresource.cip = resource.cip;
addresource.cipheader = resource.cipheader;
addresource.usip = resource.usip;
addresource.pathmonitor = resource.pathmonitor;
addresource.pathmonitorindv = resource.pathmonitorindv;
addresource.useproxyport = resource.useproxyport;
addresource.sc = resource.sc;
addresource.sp = resource.sp;
addresource.rtspsessionidremap = resource.rtspsessionidremap;
addresource.clttimeout = resource.clttimeout;
addresource.svrtimeout = resource.svrtimeout;
addresource.customserverid = resource.customserverid;
addresource.serverid = resource.serverid;
addresource.cka = resource.cka;
addresource.tcpb = resource.tcpb;
addresource.cmp = resource.cmp;
addresource.maxbandwidth = resource.maxbandwidth;
addresource.accessdown = resource.accessdown;
addresource.monthreshold = resource.monthreshold;
addresource.state = resource.state;
addresource.downstateflush = resource.downstateflush;
addresource.tcpprofilename = resource.tcpprofilename;
addresource.httpprofilename = resource.httpprofilename;
addresource.hashid = resource.hashid;
addresource.comment = resource.comment;
addresource.appflowlog = resource.appflowlog;
addresource.netprofile = resource.netprofile;
addresource.td = resource.td;
return addresource.add_resource(client);
} | class class_name[name] begin[{]
method[add, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[service], addresource]
assign[member[addresource.name], member[resource.name]]
assign[member[addresource.ip], member[resource.ip]]
assign[member[addresource.servername], member[resource.servername]]
assign[member[addresource.servicetype], member[resource.servicetype]]
assign[member[addresource.port], member[resource.port]]
assign[member[addresource.cleartextport], member[resource.cleartextport]]
assign[member[addresource.cachetype], member[resource.cachetype]]
assign[member[addresource.maxclient], member[resource.maxclient]]
assign[member[addresource.healthmonitor], member[resource.healthmonitor]]
assign[member[addresource.maxreq], member[resource.maxreq]]
assign[member[addresource.cacheable], member[resource.cacheable]]
assign[member[addresource.cip], member[resource.cip]]
assign[member[addresource.cipheader], member[resource.cipheader]]
assign[member[addresource.usip], member[resource.usip]]
assign[member[addresource.pathmonitor], member[resource.pathmonitor]]
assign[member[addresource.pathmonitorindv], member[resource.pathmonitorindv]]
assign[member[addresource.useproxyport], member[resource.useproxyport]]
assign[member[addresource.sc], member[resource.sc]]
assign[member[addresource.sp], member[resource.sp]]
assign[member[addresource.rtspsessionidremap], member[resource.rtspsessionidremap]]
assign[member[addresource.clttimeout], member[resource.clttimeout]]
assign[member[addresource.svrtimeout], member[resource.svrtimeout]]
assign[member[addresource.customserverid], member[resource.customserverid]]
assign[member[addresource.serverid], member[resource.serverid]]
assign[member[addresource.cka], member[resource.cka]]
assign[member[addresource.tcpb], member[resource.tcpb]]
assign[member[addresource.cmp], member[resource.cmp]]
assign[member[addresource.maxbandwidth], member[resource.maxbandwidth]]
assign[member[addresource.accessdown], member[resource.accessdown]]
assign[member[addresource.monthreshold], member[resource.monthreshold]]
assign[member[addresource.state], member[resource.state]]
assign[member[addresource.downstateflush], member[resource.downstateflush]]
assign[member[addresource.tcpprofilename], member[resource.tcpprofilename]]
assign[member[addresource.httpprofilename], member[resource.httpprofilename]]
assign[member[addresource.hashid], member[resource.hashid]]
assign[member[addresource.comment], member[resource.comment]]
assign[member[addresource.appflowlog], member[resource.appflowlog]]
assign[member[addresource.netprofile], member[resource.netprofile]]
assign[member[addresource.td], member[resource.td]]
return[call[addresource.add_resource, parameter[member[.client]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[add] operator[SEP] identifier[nitro_service] identifier[client] , identifier[service] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[service] identifier[addresource] operator[=] Keyword[new] identifier[service] operator[SEP] operator[SEP] operator[SEP] identifier[addresource] operator[SEP] identifier[name] operator[=] identifier[resource] operator[SEP] identifier[name] operator[SEP] identifier[addresource] operator[SEP] identifier[ip] operator[=] identifier[resource] operator[SEP] identifier[ip] operator[SEP] identifier[addresource] operator[SEP] identifier[servername] operator[=] identifier[resource] operator[SEP] identifier[servername] operator[SEP] identifier[addresource] operator[SEP] identifier[servicetype] operator[=] identifier[resource] operator[SEP] identifier[servicetype] operator[SEP] identifier[addresource] operator[SEP] identifier[port] operator[=] identifier[resource] operator[SEP] identifier[port] operator[SEP] identifier[addresource] operator[SEP] identifier[cleartextport] operator[=] identifier[resource] operator[SEP] identifier[cleartextport] operator[SEP] identifier[addresource] operator[SEP] identifier[cachetype] operator[=] identifier[resource] operator[SEP] identifier[cachetype] operator[SEP] identifier[addresource] operator[SEP] identifier[maxclient] operator[=] identifier[resource] operator[SEP] identifier[maxclient] operator[SEP] identifier[addresource] operator[SEP] identifier[healthmonitor] operator[=] identifier[resource] operator[SEP] identifier[healthmonitor] operator[SEP] identifier[addresource] operator[SEP] identifier[maxreq] operator[=] identifier[resource] operator[SEP] identifier[maxreq] operator[SEP] identifier[addresource] operator[SEP] identifier[cacheable] operator[=] identifier[resource] operator[SEP] identifier[cacheable] operator[SEP] identifier[addresource] operator[SEP] identifier[cip] operator[=] identifier[resource] operator[SEP] identifier[cip] operator[SEP] identifier[addresource] operator[SEP] identifier[cipheader] operator[=] identifier[resource] operator[SEP] identifier[cipheader] operator[SEP] identifier[addresource] operator[SEP] identifier[usip] operator[=] identifier[resource] operator[SEP] identifier[usip] operator[SEP] identifier[addresource] operator[SEP] identifier[pathmonitor] operator[=] identifier[resource] operator[SEP] identifier[pathmonitor] operator[SEP] identifier[addresource] operator[SEP] identifier[pathmonitorindv] operator[=] identifier[resource] operator[SEP] identifier[pathmonitorindv] operator[SEP] identifier[addresource] operator[SEP] identifier[useproxyport] operator[=] identifier[resource] operator[SEP] identifier[useproxyport] operator[SEP] identifier[addresource] operator[SEP] identifier[sc] operator[=] identifier[resource] operator[SEP] identifier[sc] operator[SEP] identifier[addresource] operator[SEP] identifier[sp] operator[=] identifier[resource] operator[SEP] identifier[sp] operator[SEP] identifier[addresource] operator[SEP] identifier[rtspsessionidremap] operator[=] identifier[resource] operator[SEP] identifier[rtspsessionidremap] operator[SEP] identifier[addresource] operator[SEP] identifier[clttimeout] operator[=] identifier[resource] operator[SEP] identifier[clttimeout] operator[SEP] identifier[addresource] operator[SEP] identifier[svrtimeout] operator[=] identifier[resource] operator[SEP] identifier[svrtimeout] operator[SEP] identifier[addresource] operator[SEP] identifier[customserverid] operator[=] identifier[resource] operator[SEP] identifier[customserverid] operator[SEP] identifier[addresource] operator[SEP] identifier[serverid] operator[=] identifier[resource] operator[SEP] identifier[serverid] operator[SEP] identifier[addresource] operator[SEP] identifier[cka] operator[=] identifier[resource] operator[SEP] identifier[cka] operator[SEP] identifier[addresource] operator[SEP] identifier[tcpb] operator[=] identifier[resource] operator[SEP] identifier[tcpb] operator[SEP] identifier[addresource] operator[SEP] identifier[cmp] operator[=] identifier[resource] operator[SEP] identifier[cmp] operator[SEP] identifier[addresource] operator[SEP] identifier[maxbandwidth] operator[=] identifier[resource] operator[SEP] identifier[maxbandwidth] operator[SEP] identifier[addresource] operator[SEP] identifier[accessdown] operator[=] identifier[resource] operator[SEP] identifier[accessdown] operator[SEP] identifier[addresource] operator[SEP] identifier[monthreshold] operator[=] identifier[resource] operator[SEP] identifier[monthreshold] operator[SEP] identifier[addresource] operator[SEP] identifier[state] operator[=] identifier[resource] operator[SEP] identifier[state] operator[SEP] identifier[addresource] operator[SEP] identifier[downstateflush] operator[=] identifier[resource] operator[SEP] identifier[downstateflush] operator[SEP] identifier[addresource] operator[SEP] identifier[tcpprofilename] operator[=] identifier[resource] operator[SEP] identifier[tcpprofilename] operator[SEP] identifier[addresource] operator[SEP] identifier[httpprofilename] operator[=] identifier[resource] operator[SEP] identifier[httpprofilename] operator[SEP] identifier[addresource] operator[SEP] identifier[hashid] operator[=] identifier[resource] operator[SEP] identifier[hashid] operator[SEP] identifier[addresource] operator[SEP] identifier[comment] operator[=] identifier[resource] operator[SEP] identifier[comment] operator[SEP] identifier[addresource] operator[SEP] identifier[appflowlog] operator[=] identifier[resource] operator[SEP] identifier[appflowlog] operator[SEP] identifier[addresource] operator[SEP] identifier[netprofile] operator[=] identifier[resource] operator[SEP] identifier[netprofile] operator[SEP] identifier[addresource] operator[SEP] identifier[td] operator[=] identifier[resource] operator[SEP] identifier[td] operator[SEP] Keyword[return] identifier[addresource] operator[SEP] identifier[add_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public static void addClassesInPackageByFile(String packageName, String packagePath, List<Class<?>> classes) throws ClassNotFoundException {
File dir = new File(packagePath);
if (!dir.exists() || !dir.isDirectory()) {
return;
}
File[] files = dir.listFiles(file -> (file.isDirectory()) || (file.getName().endsWith(".class")));
if (Checker.isNotNull(files)) {
for (File file : files) {
if (file.isDirectory()) {
addClassesInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), classes);
} else {
String className = file.getName().substring(0, file.getName().length() - 6);
classes.add(Class.forName(packageName + '.' + className));
}
}
}
} | class class_name[name] begin[{]
method[addClassesInPackageByFile, return_type[void], modifier[public static], parameter[packageName, packagePath, classes]] begin[{]
local_variable[type[File], dir]
if[binary_operation[call[dir.exists, parameter[]], ||, call[dir.isDirectory, parameter[]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[File], files]
if[call[Checker.isNotNull, parameter[member[.files]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6), operator=-)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=className)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.'), operator=+), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+), MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addClassesInPackageByFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=files, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addClassesInPackageByFile] operator[SEP] identifier[String] identifier[packageName] , identifier[String] identifier[packagePath] , identifier[List] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[classes] operator[SEP] Keyword[throws] identifier[ClassNotFoundException] {
identifier[File] identifier[dir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[packagePath] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[||] operator[!] identifier[dir] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[File] operator[SEP] operator[SEP] identifier[files] operator[=] identifier[dir] operator[SEP] identifier[listFiles] operator[SEP] identifier[file] operator[->] operator[SEP] identifier[file] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Checker] operator[SEP] identifier[isNotNull] operator[SEP] identifier[files] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[File] identifier[file] operator[:] identifier[files] operator[SEP] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
identifier[addClassesInPackageByFile] operator[SEP] identifier[packageName] operator[+] literal[String] operator[+] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[classes] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[className] operator[=] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[6] operator[SEP] operator[SEP] identifier[classes] operator[SEP] identifier[add] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[packageName] operator[+] literal[String] operator[+] identifier[className] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static File writeBytes(byte[] data, String path) throws IORuntimeException {
return writeBytes(data, touch(path));
} | class class_name[name] begin[{]
method[writeBytes, return_type[type[File]], modifier[public static], parameter[data, path]] begin[{]
return[call[.writeBytes, parameter[member[.data], call[.touch, parameter[member[.path]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[File] identifier[writeBytes] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IORuntimeException] {
Keyword[return] identifier[writeBytes] operator[SEP] identifier[data] , identifier[touch] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP]
}
|
public ClassFinder addClasspath() {
try {
String path = System.getProperty("java.class.path");
StringTokenizer tok = new StringTokenizer(path, File.pathSeparator);
while (tok.hasMoreTokens())
add(new File(tok.nextToken()));
} catch (Exception ex) {
log.error("Unable to get class path", ex);
}
return this;
} | class class_name[name] begin[{]
method[addClasspath, return_type[type[ClassFinder]], modifier[public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.class.path")], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathSeparator, postfix_operators=[], prefix_operators=[], qualifier=File, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringTokenizer, sub_type=None)), name=tok)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringTokenizer, sub_type=None)), WhileStatement(body=StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=tok, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), condition=MethodInvocation(arguments=[], member=hasMoreTokens, postfix_operators=[], prefix_operators=[], qualifier=tok, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to get class path"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=['Exception']))], finally_block=None, label=None, resources=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ClassFinder] identifier[addClasspath] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[String] identifier[path] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[StringTokenizer] identifier[tok] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[path] , identifier[File] operator[SEP] identifier[pathSeparator] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[tok] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[tok] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
private static <K, V> Map.Entry<K, V> createEntry(K key, V value) {
return new Map.Entry<K, V>() {
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V value) {
throw new UnsupportedOperationException();
}
};
} | class class_name[name] begin[{]
method[createEntry, return_type[type[Map]], modifier[private static], parameter[key, value]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getKey, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getValue, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=setValue, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=V, sub_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=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] identifier[createEntry] operator[SEP] identifier[K] identifier[key] , identifier[V] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[K] identifier[getKey] operator[SEP] operator[SEP] {
Keyword[return] identifier[key] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[V] identifier[getValue] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[V] identifier[setValue] operator[SEP] identifier[V] identifier[value] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public void endEntity(String name) throws org.xml.sax.SAXException
{
if (name.equals("[dtd]"))
m_inExternalDTD = false;
m_inEntityRef = false;
if (m_tracer != null)
this.fireEndEntity(name);
} | class class_name[name] begin[{]
method[endEntity, return_type[void], modifier[public], parameter[name]] begin[{]
if[call[name.equals, parameter[literal["[dtd]"]]]] begin[{]
assign[member[.m_inExternalDTD], literal[false]]
else begin[{]
None
end[}]
assign[member[.m_inEntityRef], literal[false]]
if[binary_operation[member[.m_tracer], !=, literal[null]]] begin[{]
THIS[call[None.fireEndEntity, parameter[member[.name]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[endEntity] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[org] operator[SEP] identifier[xml] operator[SEP] identifier[sax] operator[SEP] identifier[SAXException] {
Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[m_inExternalDTD] operator[=] literal[boolean] operator[SEP] identifier[m_inEntityRef] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[m_tracer] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[fireEndEntity] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
|
public void device_factory(String[] devlist) throws DevFailed
{
Util.out4.println("DServerClass::device_factory() arrived");
for (int i = 0;i < devlist.length;i++)
{
Util.out4.println("Device name : " + devlist[i]);
//
// Create device and add it into the device list
//
device_list.addElement(new DServer(this,
devlist[i],
"A device server device !!",
DevState.ON,
"The device is ON"));
//
// Export device to the outside world
//
Util.out4.println("Util._UseDb = " + Util._UseDb);
if (Util._UseDb == true)
export_device(((DeviceImpl)(device_list.elementAt(i))));
else
export_device(((DeviceImpl)(device_list.elementAt(i))),devlist[i]);
}
} | class class_name[name] begin[{]
method[device_factory, return_type[void], modifier[public], parameter[devlist]] begin[{]
call[Util.out4.println, parameter[literal["DServerClass::device_factory() arrived"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Device name : "), operandr=MemberReference(member=devlist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=Util.out4, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=devlist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A device server device !!"), MemberReference(member=ON, postfix_operators=[], prefix_operators=[], qualifier=DevState, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The device is ON")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DServer, sub_type=None))], member=addElement, postfix_operators=[], prefix_operators=[], qualifier=device_list, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Util._UseDb = "), operandr=MemberReference(member=_UseDb, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=Util.out4, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=_UseDb, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=device_list, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DeviceImpl, sub_type=None)), MemberReference(member=devlist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=export_device, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=device_list, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DeviceImpl, sub_type=None))], member=export_device, 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=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=devlist, 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)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[device_factory] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[devlist] operator[SEP] Keyword[throws] identifier[DevFailed] {
identifier[Util] operator[SEP] identifier[out4] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[devlist] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Util] operator[SEP] identifier[out4] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[devlist] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[device_list] operator[SEP] identifier[addElement] operator[SEP] Keyword[new] identifier[DServer] operator[SEP] Keyword[this] , identifier[devlist] operator[SEP] identifier[i] operator[SEP] , literal[String] , identifier[DevState] operator[SEP] identifier[ON] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Util] operator[SEP] identifier[out4] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[Util] operator[SEP] identifier[_UseDb] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Util] operator[SEP] identifier[_UseDb] operator[==] literal[boolean] operator[SEP] identifier[export_device] operator[SEP] operator[SEP] operator[SEP] identifier[DeviceImpl] operator[SEP] operator[SEP] identifier[device_list] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[export_device] operator[SEP] operator[SEP] operator[SEP] identifier[DeviceImpl] operator[SEP] operator[SEP] identifier[device_list] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] , identifier[devlist] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void setServerCustomizers(
Collection<? extends NettyServerCustomizer> serverCustomizers) {
Assert.notNull(serverCustomizers, "ServerCustomizers must not be null");
this.serverCustomizers = new ArrayList<>(serverCustomizers);
} | class class_name[name] begin[{]
method[setServerCustomizers, return_type[void], modifier[public], parameter[serverCustomizers]] begin[{]
call[Assert.notNull, parameter[member[.serverCustomizers], literal["ServerCustomizers must not be null"]]]
assign[THIS[member[None.serverCustomizers]], ClassCreator(arguments=[MemberReference(member=serverCustomizers, 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))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setServerCustomizers] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[NettyServerCustomizer] operator[>] identifier[serverCustomizers] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[serverCustomizers] , literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[serverCustomizers] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[serverCustomizers] operator[SEP] operator[SEP]
}
|
void checkAllLocks() throws BackendException {
StoreTransaction lt = getConsistentTx();
for (ExpectedValueCheckingStore store : expectedValuesByStore.keySet()) {
Locker locker = store.getLocker();
// Ignore locks on stores without a locker
if (null == locker)
continue;
locker.checkLocks(lt);
}
} | class class_name[name] begin[{]
method[checkAllLocks, return_type[void], modifier[default], parameter[]] begin[{]
local_variable[type[StoreTransaction], lt]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getLocker, postfix_operators=[], prefix_operators=[], qualifier=store, selectors=[], type_arguments=None), name=locker)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Locker, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=locker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkLocks, postfix_operators=[], prefix_operators=[], qualifier=locker, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=expectedValuesByStore, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=store)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExpectedValueCheckingStore, sub_type=None))), label=None)
end[}]
END[}] | Keyword[void] identifier[checkAllLocks] operator[SEP] operator[SEP] Keyword[throws] identifier[BackendException] {
identifier[StoreTransaction] identifier[lt] operator[=] identifier[getConsistentTx] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ExpectedValueCheckingStore] identifier[store] operator[:] identifier[expectedValuesByStore] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Locker] identifier[locker] operator[=] identifier[store] operator[SEP] identifier[getLocker] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[locker] operator[SEP] Keyword[continue] operator[SEP] identifier[locker] operator[SEP] identifier[checkLocks] operator[SEP] identifier[lt] operator[SEP] operator[SEP]
}
}
|
public void processRequest(RequestEvent req) {
if (tracer.isInfoEnabled()) {
tracer.info("Received Request:\n"+req.getRequest());
}
// Restcomm Statistics
final String method = req.getRequest().getMethod();
if (Request.INVITE.equalsIgnoreCase(method)) {
this.defaultUsageParameters.incrementCalls(1);
}
if (Request.MESSAGE.equalsIgnoreCase(method)) {
this.defaultUsageParameters.incrementMessages(1);
}
// get dialog wrapper
final Dialog d = req.getDialog();
final DialogWrapper dw = getDialogWrapper(d);
if (dw != null && req.getServerTransaction() == null) {
if (tracer.isInfoEnabled()) {
tracer.info("No server tx found, for in dialog request, assuming it as retransmission and dropping...");
}
return;
}
if (req.getRequest().getMethod().equals(Request.CANCEL)) {
processCancelRequest(req,dw);
} else {
processNotCancelRequest(req,dw);
}
} | class class_name[name] begin[{]
method[processRequest, return_type[void], modifier[public], parameter[req]] begin[{]
if[call[tracer.isInfoEnabled, parameter[]]] begin[{]
call[tracer.info, parameter[binary_operation[literal["Received Request:\n"], +, call[req.getRequest, parameter[]]]]]
else begin[{]
None
end[}]
local_variable[type[String], method]
if[call[Request.INVITE.equalsIgnoreCase, parameter[member[.method]]]] begin[{]
THIS[member[None.defaultUsageParameters]call[None.incrementCalls, parameter[literal[1]]]]
else begin[{]
None
end[}]
if[call[Request.MESSAGE.equalsIgnoreCase, parameter[member[.method]]]] begin[{]
THIS[member[None.defaultUsageParameters]call[None.incrementMessages, parameter[literal[1]]]]
else begin[{]
None
end[}]
local_variable[type[Dialog], d]
local_variable[type[DialogWrapper], dw]
if[binary_operation[binary_operation[member[.dw], !=, literal[null]], &&, binary_operation[call[req.getServerTransaction, parameter[]], ==, literal[null]]]] begin[{]
if[call[tracer.isInfoEnabled, parameter[]]] begin[{]
call[tracer.info, parameter[literal["No server tx found, for in dialog request, assuming it as retransmission and dropping..."]]]
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
if[call[req.getRequest, parameter[]]] begin[{]
call[.processCancelRequest, parameter[member[.req], member[.dw]]]
else begin[{]
call[.processNotCancelRequest, parameter[member[.req], member[.dw]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[processRequest] operator[SEP] identifier[RequestEvent] identifier[req] operator[SEP] {
Keyword[if] operator[SEP] identifier[tracer] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tracer] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[req] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[method] operator[=] identifier[req] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Request] operator[SEP] identifier[INVITE] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[defaultUsageParameters] operator[SEP] identifier[incrementCalls] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Request] operator[SEP] identifier[MESSAGE] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[defaultUsageParameters] operator[SEP] identifier[incrementMessages] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Dialog] identifier[d] operator[=] identifier[req] operator[SEP] identifier[getDialog] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[DialogWrapper] identifier[dw] operator[=] identifier[getDialogWrapper] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dw] operator[!=] Other[null] operator[&&] identifier[req] operator[SEP] identifier[getServerTransaction] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[tracer] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tracer] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[req] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Request] operator[SEP] identifier[CANCEL] operator[SEP] operator[SEP] {
identifier[processCancelRequest] operator[SEP] identifier[req] , identifier[dw] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[processNotCancelRequest] operator[SEP] identifier[req] , identifier[dw] operator[SEP] operator[SEP]
}
}
|
private void applyPalette(Palette palette, ViewGroup viewGroup){
int bgColor = getBackgroundColor(palette);
if (bgColor != -1)
viewGroup.setBackgroundColor(bgColor);
} | class class_name[name] begin[{]
method[applyPalette, return_type[void], modifier[private], parameter[palette, viewGroup]] begin[{]
local_variable[type[int], bgColor]
if[binary_operation[member[.bgColor], !=, literal[1]]] begin[{]
call[viewGroup.setBackgroundColor, parameter[member[.bgColor]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[applyPalette] operator[SEP] identifier[Palette] identifier[palette] , identifier[ViewGroup] identifier[viewGroup] operator[SEP] {
Keyword[int] identifier[bgColor] operator[=] identifier[getBackgroundColor] operator[SEP] identifier[palette] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bgColor] operator[!=] operator[-] Other[1] operator[SEP] identifier[viewGroup] operator[SEP] identifier[setBackgroundColor] operator[SEP] identifier[bgColor] operator[SEP] operator[SEP]
}
|
public void addSplit(Split split) {
final long timestamp = split.getStartMillis();
StopwatchTimeRange timeRange;
synchronized (this) {
timeRange = getOrCreateTimeRange(timestamp);
}
if (timeRange != null) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (timeRange) {
timeRange.addSplit(timestamp, split.runningFor());
}
}
} | class class_name[name] begin[{]
method[addSplit, return_type[void], modifier[public], parameter[split]] begin[{]
local_variable[type[long], timestamp]
local_variable[type[StopwatchTimeRange], timeRange]
SYNCHRONIZED[THIS[]] BEGIN[{]
assign[member[.timeRange], call[.getOrCreateTimeRange, parameter[member[.timestamp]]]]
END[}]
if[binary_operation[member[.timeRange], !=, literal[null]]] begin[{]
SYNCHRONIZED[member[.timeRange]] BEGIN[{]
call[timeRange.addSplit, parameter[member[.timestamp], call[split.runningFor, parameter[]]]]
END[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addSplit] operator[SEP] identifier[Split] identifier[split] operator[SEP] {
Keyword[final] Keyword[long] identifier[timestamp] operator[=] identifier[split] operator[SEP] identifier[getStartMillis] operator[SEP] operator[SEP] operator[SEP] identifier[StopwatchTimeRange] identifier[timeRange] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[timeRange] operator[=] identifier[getOrCreateTimeRange] operator[SEP] identifier[timestamp] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[timeRange] operator[!=] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[timeRange] operator[SEP] {
identifier[timeRange] operator[SEP] identifier[addSplit] operator[SEP] identifier[timestamp] , identifier[split] operator[SEP] identifier[runningFor] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static boolean hasAnyAnnotation(AnnotatedNode node, String... names) {
for (String name : names) {
if (hasAnnotation(node, name)) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[hasAnyAnnotation, return_type[type[boolean]], modifier[public static], parameter[node, names]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[hasAnyAnnotation] operator[SEP] identifier[AnnotatedNode] identifier[node] , identifier[String] operator[...] identifier[names] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[names] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasAnnotation] operator[SEP] identifier[node] , identifier[name] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
protected boolean angleRecalculate(final long timeNew) {
// recalculate angle using simple numerical integration of motion equation
float deltaT1 = (timeNew - time1) / 1000f;
if (deltaT1 > TIME_DELTA_THRESHOLD) {
deltaT1 = TIME_DELTA_THRESHOLD;
time1 = timeNew + Math.round(TIME_DELTA_THRESHOLD * 1000);
}
float deltaT2 = (time1 - time2) / 1000f;
if (deltaT2 > TIME_DELTA_THRESHOLD) {
deltaT2 = TIME_DELTA_THRESHOLD;
}
// circular acceleration coefficient
float koefI = inertiaMoment / deltaT1 / deltaT2;
// circular velocity coefficient
float koefAlpha = alpha / deltaT1;
// angular momentum coefficient
float koefk = mB * (float) (Math.sin(Math.toRadians(angle0)) * Math.cos(Math.toRadians(angle1)) -
(Math.sin(Math.toRadians(angle1)) * Math.cos(Math.toRadians(angle0))));
float angleNew = (koefI * (angle1 * 2f - angle2) + koefAlpha * angle1 + koefk) / (koefI + koefAlpha);
// reassign previous iteration variables
angle2 = angle1;
angle1 = angleNew;
time2 = time1;
time1 = timeNew;
// if angles changed less then threshold, return false - no need to redraw the view
if (Math.abs(angleLastDrawn - angle1) < ANGLE_DELTA_THRESHOLD) {
return false;
} else {
angleLastDrawn = angle1;
return true;
}
} | class class_name[name] begin[{]
method[angleRecalculate, return_type[type[boolean]], modifier[protected], parameter[timeNew]] begin[{]
local_variable[type[float], deltaT1]
if[binary_operation[member[.deltaT1], >, member[.TIME_DELTA_THRESHOLD]]] begin[{]
assign[member[.deltaT1], member[.TIME_DELTA_THRESHOLD]]
assign[member[.time1], binary_operation[member[.timeNew], +, call[Math.round, parameter[binary_operation[member[.TIME_DELTA_THRESHOLD], *, literal[1000]]]]]]
else begin[{]
None
end[}]
local_variable[type[float], deltaT2]
if[binary_operation[member[.deltaT2], >, member[.TIME_DELTA_THRESHOLD]]] begin[{]
assign[member[.deltaT2], member[.TIME_DELTA_THRESHOLD]]
else begin[{]
None
end[}]
local_variable[type[float], koefI]
local_variable[type[float], koefAlpha]
local_variable[type[float], koefk]
local_variable[type[float], angleNew]
assign[member[.angle2], member[.angle1]]
assign[member[.angle1], member[.angleNew]]
assign[member[.time2], member[.time1]]
assign[member[.time1], member[.timeNew]]
if[binary_operation[call[Math.abs, parameter[binary_operation[member[.angleLastDrawn], -, member[.angle1]]]], <, member[.ANGLE_DELTA_THRESHOLD]]] begin[{]
return[literal[false]]
else begin[{]
assign[member[.angleLastDrawn], member[.angle1]]
return[literal[true]]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[angleRecalculate] operator[SEP] Keyword[final] Keyword[long] identifier[timeNew] operator[SEP] {
Keyword[float] identifier[deltaT1] operator[=] operator[SEP] identifier[timeNew] operator[-] identifier[time1] operator[SEP] operator[/] literal[Float] operator[SEP] Keyword[if] operator[SEP] identifier[deltaT1] operator[>] identifier[TIME_DELTA_THRESHOLD] operator[SEP] {
identifier[deltaT1] operator[=] identifier[TIME_DELTA_THRESHOLD] operator[SEP] identifier[time1] operator[=] identifier[timeNew] operator[+] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[TIME_DELTA_THRESHOLD] operator[*] Other[1000] operator[SEP] operator[SEP]
}
Keyword[float] identifier[deltaT2] operator[=] operator[SEP] identifier[time1] operator[-] identifier[time2] operator[SEP] operator[/] literal[Float] operator[SEP] Keyword[if] operator[SEP] identifier[deltaT2] operator[>] identifier[TIME_DELTA_THRESHOLD] operator[SEP] {
identifier[deltaT2] operator[=] identifier[TIME_DELTA_THRESHOLD] operator[SEP]
}
Keyword[float] identifier[koefI] operator[=] identifier[inertiaMoment] operator[/] identifier[deltaT1] operator[/] identifier[deltaT2] operator[SEP] Keyword[float] identifier[koefAlpha] operator[=] identifier[alpha] operator[/] identifier[deltaT1] operator[SEP] Keyword[float] identifier[koefk] operator[=] identifier[mB] operator[*] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] identifier[angle0] operator[SEP] operator[SEP] operator[*] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] identifier[angle1] operator[SEP] operator[SEP] operator[-] operator[SEP] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] identifier[angle1] operator[SEP] operator[SEP] operator[*] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] identifier[angle0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[angleNew] operator[=] operator[SEP] identifier[koefI] operator[*] operator[SEP] identifier[angle1] operator[*] literal[Float] operator[-] identifier[angle2] operator[SEP] operator[+] identifier[koefAlpha] operator[*] identifier[angle1] operator[+] identifier[koefk] operator[SEP] operator[/] operator[SEP] identifier[koefI] operator[+] identifier[koefAlpha] operator[SEP] operator[SEP] identifier[angle2] operator[=] identifier[angle1] operator[SEP] identifier[angle1] operator[=] identifier[angleNew] operator[SEP] identifier[time2] operator[=] identifier[time1] operator[SEP] identifier[time1] operator[=] identifier[timeNew] operator[SEP] Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[angleLastDrawn] operator[-] identifier[angle1] operator[SEP] operator[<] identifier[ANGLE_DELTA_THRESHOLD] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[angleLastDrawn] operator[=] identifier[angle1] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
|
@Override
public EClass getIfcRelConnectsWithRealizingElements() {
if (ifcRelConnectsWithRealizingElementsEClass == null) {
ifcRelConnectsWithRealizingElementsEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(541);
}
return ifcRelConnectsWithRealizingElementsEClass;
} | class class_name[name] begin[{]
method[getIfcRelConnectsWithRealizingElements, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcRelConnectsWithRealizingElementsEClass], ==, literal[null]]] begin[{]
assign[member[.ifcRelConnectsWithRealizingElementsEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=541)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcRelConnectsWithRealizingElementsEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcRelConnectsWithRealizingElements] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcRelConnectsWithRealizingElementsEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcRelConnectsWithRealizingElementsEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[541] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcRelConnectsWithRealizingElementsEClass] operator[SEP]
}
|
private boolean hasCompBoundaryBefore(int c, int norm16) {
for(;;) {
if(isCompYesAndZeroCC(norm16)) {
return true;
} else if(isMaybeOrNonZeroCC(norm16)) {
return false;
} else if(isDecompNoAlgorithmic(norm16)) {
c=mapAlgorithmic(c, norm16);
norm16=getNorm16(c);
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
if((firstUnit&MAPPING_LENGTH_MASK)==0) {
return false;
}
if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0 && (extraData.charAt(norm16-1)&0xff00)!=0) {
return false; // non-zero leadCC
}
return isCompYesAndZeroCC(getNorm16(Character.codePointAt(extraData, norm16+1)));
}
}
} | class class_name[name] begin[{]
method[hasCompBoundaryBefore, return_type[type[boolean]], modifier[private], parameter[c, norm16]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isCompYesAndZeroCC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isMaybeOrNonZeroCC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isDecompNoAlgorithmic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=extraData, selectors=[], type_arguments=None), name=firstUnit)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=firstUnit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAPPING_LENGTH_MASK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), 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)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=firstUnit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAPPING_HAS_CCC_LCCC_WORD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=extraData, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff00), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), 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)])), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=extraData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=codePointAt, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None)], member=getNorm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=isCompYesAndZeroCC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mapAlgorithmic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=norm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNorm16, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=ForControl(condition=None, init=None, update=None), label=None)
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[hasCompBoundaryBefore] operator[SEP] Keyword[int] identifier[c] , Keyword[int] identifier[norm16] operator[SEP] {
Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isCompYesAndZeroCC] operator[SEP] identifier[norm16] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isMaybeOrNonZeroCC] operator[SEP] identifier[norm16] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isDecompNoAlgorithmic] operator[SEP] identifier[norm16] operator[SEP] operator[SEP] {
identifier[c] operator[=] identifier[mapAlgorithmic] operator[SEP] identifier[c] , identifier[norm16] operator[SEP] operator[SEP] identifier[norm16] operator[=] identifier[getNorm16] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[firstUnit] operator[=] identifier[extraData] operator[SEP] identifier[charAt] operator[SEP] identifier[norm16] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[firstUnit] operator[&] identifier[MAPPING_LENGTH_MASK] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[firstUnit] operator[&] identifier[MAPPING_HAS_CCC_LCCC_WORD] operator[SEP] operator[!=] Other[0] operator[&&] operator[SEP] identifier[extraData] operator[SEP] identifier[charAt] operator[SEP] identifier[norm16] operator[-] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[isCompYesAndZeroCC] operator[SEP] identifier[getNorm16] operator[SEP] identifier[Character] operator[SEP] identifier[codePointAt] operator[SEP] identifier[extraData] , identifier[norm16] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public final void explicitGenericInvocationSuffix() throws RecognitionException {
int explicitGenericInvocationSuffix_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 137) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1279:5: ( 'super' superSuffix | Identifier arguments )
int alt186=2;
int LA186_0 = input.LA(1);
if ( (LA186_0==108) ) {
alt186=1;
}
else if ( (LA186_0==Identifier) ) {
alt186=2;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
NoViableAltException nvae =
new NoViableAltException("", 186, 0, input);
throw nvae;
}
switch (alt186) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1279:7: 'super' superSuffix
{
match(input,108,FOLLOW_108_in_explicitGenericInvocationSuffix6239); if (state.failed) return;
pushFollow(FOLLOW_superSuffix_in_explicitGenericInvocationSuffix6241);
superSuffix();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1280:9: Identifier arguments
{
match(input,Identifier,FOLLOW_Identifier_in_explicitGenericInvocationSuffix6251); if (state.failed) return;
pushFollow(FOLLOW_arguments_in_explicitGenericInvocationSuffix6253);
arguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 137, explicitGenericInvocationSuffix_StartIndex); }
}
} | class class_name[name] begin[{]
method[explicitGenericInvocationSuffix, return_type[void], modifier[final public], parameter[]] begin[{]
local_variable[type[int], explicitGenericInvocationSuffix_StartIndex]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=137)], member=alreadyParsedRule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), name=alt186)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA186_0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA186_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=108), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA186_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=Identifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=186), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=input, 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=NoViableAltException, sub_type=None)), name=nvae)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NoViableAltException, sub_type=None)), ThrowStatement(expression=MemberReference(member=nvae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt186, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt186, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=108), MemberReference(member=FOLLOW_108_in_explicitGenericInvocationSuffix6239, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_superSuffix_in_explicitGenericInvocationSuffix6241, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=superSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=Identifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=FOLLOW_Identifier_in_explicitGenericInvocationSuffix6251, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_arguments_in_explicitGenericInvocationSuffix6253, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=alt186, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=137), MemberReference(member=explicitGenericInvocationSuffix_StartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=memoize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[explicitGenericInvocationSuffix] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[int] identifier[explicitGenericInvocationSuffix_StartIndex] operator[=] identifier[input] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[&&] identifier[alreadyParsedRule] operator[SEP] identifier[input] , Other[137] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[int] identifier[alt186] operator[=] Other[2] operator[SEP] Keyword[int] identifier[LA186_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA186_0] operator[==] Other[108] operator[SEP] operator[SEP] {
identifier[alt186] operator[=] Other[1] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[LA186_0] operator[==] identifier[Identifier] operator[SEP] operator[SEP] {
identifier[alt186] operator[=] Other[2] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[SEP] {
identifier[state] operator[SEP] identifier[failed] operator[=] literal[boolean] operator[SEP] Keyword[return] operator[SEP]
}
identifier[NoViableAltException] identifier[nvae] operator[=] Keyword[new] identifier[NoViableAltException] operator[SEP] literal[String] , Other[186] , Other[0] , identifier[input] operator[SEP] operator[SEP] Keyword[throw] identifier[nvae] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[alt186] operator[SEP] {
Keyword[case] Other[1] operator[:] {
identifier[match] operator[SEP] identifier[input] , Other[108] , identifier[FOLLOW_108_in_explicitGenericInvocationSuffix6239] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FOLLOW_superSuffix_in_explicitGenericInvocationSuffix6241] operator[SEP] operator[SEP] identifier[superSuffix] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] {
identifier[match] operator[SEP] identifier[input] , identifier[Identifier] , identifier[FOLLOW_Identifier_in_explicitGenericInvocationSuffix6251] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FOLLOW_arguments_in_explicitGenericInvocationSuffix6253] operator[SEP] operator[SEP] identifier[arguments] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[break] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[SEP] {
identifier[memoize] operator[SEP] identifier[input] , Other[137] , identifier[explicitGenericInvocationSuffix_StartIndex] operator[SEP] operator[SEP]
}
}
}
|
static int trimSpaces(char[] chars, int len) {
// leading and trailing #x20's are removed
int newLen = len;
// leading
while (newLen > 0 && chars[0] == ' ') {
// eliminate one leading space
shiftLeft(chars, 0, newLen);
newLen--;
}
// trailing
int i = newLen - 1;
while (i >= 0 && chars[i] == ' ') {
// eliminate one trailing space
newLen--;
i--;
}
return newLen;
} | class class_name[name] begin[{]
method[trimSpaces, return_type[type[int]], modifier[static], parameter[chars, len]] begin[{]
local_variable[type[int], newLen]
while[binary_operation[binary_operation[member[.newLen], >, literal[0]], &&, binary_operation[member[.chars], ==, literal[' ']]]] begin[{]
call[.shiftLeft, parameter[member[.chars], literal[0], member[.newLen]]]
member[.newLen]
end[}]
local_variable[type[int], i]
while[binary_operation[binary_operation[member[.i], >=, literal[0]], &&, binary_operation[member[.chars], ==, literal[' ']]]] begin[{]
member[.newLen]
member[.i]
end[}]
return[member[.newLen]]
end[}]
END[}] | Keyword[static] Keyword[int] identifier[trimSpaces] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[chars] , Keyword[int] identifier[len] operator[SEP] {
Keyword[int] identifier[newLen] operator[=] identifier[len] operator[SEP] Keyword[while] operator[SEP] identifier[newLen] operator[>] Other[0] operator[&&] identifier[chars] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[shiftLeft] operator[SEP] identifier[chars] , Other[0] , identifier[newLen] operator[SEP] operator[SEP] identifier[newLen] operator[--] operator[SEP]
}
Keyword[int] identifier[i] operator[=] identifier[newLen] operator[-] Other[1] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[>=] Other[0] operator[&&] identifier[chars] operator[SEP] identifier[i] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[newLen] operator[--] operator[SEP] identifier[i] operator[--] operator[SEP]
}
Keyword[return] identifier[newLen] operator[SEP]
}
|
public Response remove() {
assertNotEmpty(replicatorDoc.getId(), "Doc id");
assertNotEmpty(replicatorDoc.getRevision(), "Doc rev");
final URI uri = buildUri(dbURI).path(replicatorDoc.getId()).query("rev", replicatorDoc.getRevision()).build();
return dbc.delete(uri);
} | class class_name[name] begin[{]
method[remove, return_type[type[Response]], modifier[public], parameter[]] begin[{]
call[.assertNotEmpty, parameter[call[replicatorDoc.getId, parameter[]], literal["Doc id"]]]
call[.assertNotEmpty, parameter[call[replicatorDoc.getRevision, parameter[]], literal["Doc rev"]]]
local_variable[type[URI], uri]
return[call[dbc.delete, parameter[member[.uri]]]]
end[}]
END[}] | Keyword[public] identifier[Response] identifier[remove] operator[SEP] operator[SEP] {
identifier[assertNotEmpty] operator[SEP] identifier[replicatorDoc] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[assertNotEmpty] operator[SEP] identifier[replicatorDoc] operator[SEP] identifier[getRevision] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[URI] identifier[uri] operator[=] identifier[buildUri] operator[SEP] identifier[dbURI] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[replicatorDoc] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[query] operator[SEP] literal[String] , identifier[replicatorDoc] operator[SEP] identifier[getRevision] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[dbc] operator[SEP] identifier[delete] operator[SEP] identifier[uri] operator[SEP] operator[SEP]
}
|
public static Scriptable getObjectPrototype(Scriptable scope) {
return TopLevel.getBuiltinPrototype(getTopLevelScope(scope),
TopLevel.Builtins.Object);
} | class class_name[name] begin[{]
method[getObjectPrototype, return_type[type[Scriptable]], modifier[public static], parameter[scope]] begin[{]
return[call[TopLevel.getBuiltinPrototype, parameter[call[.getTopLevelScope, parameter[member[.scope]]], member[TopLevel.Builtins.Object]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Scriptable] identifier[getObjectPrototype] operator[SEP] identifier[Scriptable] identifier[scope] operator[SEP] {
Keyword[return] identifier[TopLevel] operator[SEP] identifier[getBuiltinPrototype] operator[SEP] identifier[getTopLevelScope] operator[SEP] identifier[scope] operator[SEP] , identifier[TopLevel] operator[SEP] identifier[Builtins] operator[SEP] identifier[Object] operator[SEP] operator[SEP]
}
|
public boolean matches( Message message ) throws JMSException
{
Boolean result = selectorTree != null ? selectorTree.evaluateBoolean(message) : null;
return result != null && result.booleanValue();
} | class class_name[name] begin[{]
method[matches, return_type[type[boolean]], modifier[public], parameter[message]] begin[{]
local_variable[type[Boolean], result]
return[binary_operation[binary_operation[member[.result], !=, literal[null]], &&, call[result.booleanValue, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[matches] operator[SEP] identifier[Message] identifier[message] operator[SEP] Keyword[throws] identifier[JMSException] {
identifier[Boolean] identifier[result] operator[=] identifier[selectorTree] operator[!=] Other[null] operator[?] identifier[selectorTree] operator[SEP] identifier[evaluateBoolean] operator[SEP] identifier[message] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[return] identifier[result] operator[!=] Other[null] operator[&&] identifier[result] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP]
}
|
public OvhTask organizationName_service_exchangeService_domain_POST(String organizationName, String exchangeService, Boolean configureAutodiscover, Boolean configureMx, Boolean main, String mxRelay, String name, String organization2010, OvhDomainTypeEnum type) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "configureAutodiscover", configureAutodiscover);
addBody(o, "configureMx", configureMx);
addBody(o, "main", main);
addBody(o, "mxRelay", mxRelay);
addBody(o, "name", name);
addBody(o, "organization2010", organization2010);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | class class_name[name] begin[{]
method[organizationName_service_exchangeService_domain_POST, return_type[type[OvhTask]], modifier[public], parameter[organizationName, exchangeService, configureAutodiscover, configureMx, main, mxRelay, name, organization2010, type]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[HashMap], o]
call[.addBody, parameter[member[.o], literal["configureAutodiscover"], member[.configureAutodiscover]]]
call[.addBody, parameter[member[.o], literal["configureMx"], member[.configureMx]]]
call[.addBody, parameter[member[.o], literal["main"], member[.main]]]
call[.addBody, parameter[member[.o], literal["mxRelay"], member[.mxRelay]]]
call[.addBody, parameter[member[.o], literal["name"], member[.name]]]
call[.addBody, parameter[member[.o], literal["organization2010"], member[.organization2010]]]
call[.addBody, parameter[member[.o], literal["type"], member[.type]]]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhTask, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhTask] identifier[organizationName_service_exchangeService_domain_POST] operator[SEP] identifier[String] identifier[organizationName] , identifier[String] identifier[exchangeService] , identifier[Boolean] identifier[configureAutodiscover] , identifier[Boolean] identifier[configureMx] , identifier[Boolean] identifier[main] , identifier[String] identifier[mxRelay] , identifier[String] identifier[name] , identifier[String] identifier[organization2010] , identifier[OvhDomainTypeEnum] identifier[type] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[organizationName] , identifier[exchangeService] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[configureAutodiscover] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[configureMx] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[main] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[mxRelay] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[name] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[organization2010] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[type] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[o] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhTask] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public CompletableFuture<T> exceptAsync(Consumer<Throwable> consumer) {
return whenCompleteAsync((result, error) -> {
if (error != null) {
consumer.accept(error);
}
});
} | class class_name[name] begin[{]
method[exceptAsync, return_type[type[CompletableFuture]], modifier[public], parameter[consumer]] begin[{]
return[call[.whenCompleteAsync, parameter[LambdaExpression(body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=error, 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=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=consumer, selectors=[], type_arguments=None), label=None)]))], parameters=[InferredFormalParameter(name=result), InferredFormalParameter(name=error)])]]]
end[}]
END[}] | Keyword[public] identifier[CompletableFuture] operator[<] identifier[T] operator[>] identifier[exceptAsync] operator[SEP] identifier[Consumer] operator[<] identifier[Throwable] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] identifier[whenCompleteAsync] operator[SEP] operator[SEP] identifier[result] , identifier[error] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[error] operator[!=] Other[null] operator[SEP] {
identifier[consumer] operator[SEP] identifier[accept] operator[SEP] identifier[error] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public ServiceFuture<AgentPoolInner> createOrUpdateAsync(String resourceGroupName, String managedClusterName, String agentPoolName, AgentPoolInner parameters, final ServiceCallback<AgentPoolInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName, parameters), serviceCallback);
} | class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, managedClusterName, agentPoolName, parameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.managedClusterName], member[.agentPoolName], member[.parameters]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[AgentPoolInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[managedClusterName] , identifier[String] identifier[agentPoolName] , identifier[AgentPoolInner] identifier[parameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[AgentPoolInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[managedClusterName] , identifier[agentPoolName] , identifier[parameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@ArgumentsChecked
@Throws(IllegalNotLesserThanException.class)
public static byte lesserThan(final byte expected, final byte check) {
if (expected <= check) {
throw new IllegalNotLesserThanException(check);
}
return check;
} | class class_name[name] begin[{]
method[lesserThan, return_type[type[byte]], modifier[public static], parameter[expected, check]] begin[{]
if[binary_operation[member[.expected], <=, member[.check]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=check, 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=IllegalNotLesserThanException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.check]]
end[}]
END[}] | annotation[@] identifier[ArgumentsChecked] annotation[@] identifier[Throws] operator[SEP] identifier[IllegalNotLesserThanException] operator[SEP] Keyword[class] operator[SEP] Keyword[public] Keyword[static] Keyword[byte] identifier[lesserThan] operator[SEP] Keyword[final] Keyword[byte] identifier[expected] , Keyword[final] Keyword[byte] identifier[check] operator[SEP] {
Keyword[if] operator[SEP] identifier[expected] operator[<=] identifier[check] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalNotLesserThanException] operator[SEP] identifier[check] operator[SEP] operator[SEP]
}
Keyword[return] identifier[check] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public Map<K, V> getAllFailure(Iterable<? extends K> keys, StoreAccessException e) {
try {
return loaderWriter.loadAll((Iterable) keys); // FIXME: bad typing that we should fix
} catch(BulkCacheLoadingException e1) {
throw e1;
} catch (Exception e1) {
throw ExceptionFactory.newCacheLoadingException(e1, e);
} finally {
cleanup(keys, e);
}
} | class class_name[name] begin[{]
method[getAllFailure, return_type[type[Map]], modifier[public], parameter[keys, e]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Iterable, sub_type=None))], member=loadAll, postfix_operators=[], prefix_operators=[], qualifier=loaderWriter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['BulkCacheLoadingException'])), CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newCacheLoadingException, postfix_operators=[], prefix_operators=[], qualifier=ExceptionFactory, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cleanup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[getAllFailure] operator[SEP] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[K] operator[>] identifier[keys] , identifier[StoreAccessException] identifier[e] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[loaderWriter] operator[SEP] identifier[loadAll] operator[SEP] operator[SEP] identifier[Iterable] operator[SEP] identifier[keys] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BulkCacheLoadingException] identifier[e1] operator[SEP] {
Keyword[throw] identifier[e1] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e1] operator[SEP] {
Keyword[throw] identifier[ExceptionFactory] operator[SEP] identifier[newCacheLoadingException] operator[SEP] identifier[e1] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[cleanup] operator[SEP] identifier[keys] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Object body(Object[] swaggerMethodArguments) {
Object result = null;
if (bodyContentMethodParameterIndex != null
&& swaggerMethodArguments != null
&& 0 <= bodyContentMethodParameterIndex
&& bodyContentMethodParameterIndex < swaggerMethodArguments.length) {
result = swaggerMethodArguments[bodyContentMethodParameterIndex];
}
if (formSubstitutions != null
&& !formSubstitutions.isEmpty()
&& swaggerMethodArguments != null) {
result = formSubstitutions.stream()
.map(s -> serializeFormData(s.urlParameterName(), swaggerMethodArguments[s.methodParameterIndex()]))
.collect(Collectors.joining("&"));
}
return result;
} | class class_name[name] begin[{]
method[body, return_type[type[Object]], modifier[public], parameter[swaggerMethodArguments]] begin[{]
local_variable[type[Object], result]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.bodyContentMethodParameterIndex], !=, literal[null]], &&, binary_operation[member[.swaggerMethodArguments], !=, literal[null]]], &&, binary_operation[literal[0], <=, member[.bodyContentMethodParameterIndex]]], &&, binary_operation[member[.bodyContentMethodParameterIndex], <, member[swaggerMethodArguments.length]]]] begin[{]
assign[member[.result], member[.swaggerMethodArguments]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.formSubstitutions], !=, literal[null]], &&, call[formSubstitutions.isEmpty, parameter[]]], &&, binary_operation[member[.swaggerMethodArguments], !=, literal[null]]]] begin[{]
assign[member[.result], call[formSubstitutions.stream, parameter[]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[body] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[swaggerMethodArguments] operator[SEP] {
identifier[Object] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[bodyContentMethodParameterIndex] operator[!=] Other[null] operator[&&] identifier[swaggerMethodArguments] operator[!=] Other[null] operator[&&] Other[0] operator[<=] identifier[bodyContentMethodParameterIndex] operator[&&] identifier[bodyContentMethodParameterIndex] operator[<] identifier[swaggerMethodArguments] operator[SEP] identifier[length] operator[SEP] {
identifier[result] operator[=] identifier[swaggerMethodArguments] operator[SEP] identifier[bodyContentMethodParameterIndex] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[formSubstitutions] operator[!=] Other[null] operator[&&] operator[!] identifier[formSubstitutions] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[swaggerMethodArguments] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[formSubstitutions] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[s] operator[->] identifier[serializeFormData] operator[SEP] identifier[s] operator[SEP] identifier[urlParameterName] operator[SEP] operator[SEP] , identifier[swaggerMethodArguments] operator[SEP] identifier[s] operator[SEP] identifier[methodParameterIndex] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[joining] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static List<EntryElement> makeEntryElementList(Object... value) {
List<EntryElement> valueElements = new ArrayList<EntryElement>();
for (Object o : value) {
Class<?> type = ClassUtils.primitiveToWrapper(o.getClass());
EntryElement entryElement = new EntryElement(type.getName(), o.toString());
valueElements.add(entryElement);
}
return valueElements;
} | class class_name[name] begin[{]
method[makeEntryElementList, return_type[type[List]], modifier[public static], parameter[value]] begin[{]
local_variable[type[List], valueElements]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None)], member=primitiveToWrapper, postfix_operators=[], prefix_operators=[], qualifier=ClassUtils, selectors=[], type_arguments=None), name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EntryElement, sub_type=None)), name=entryElement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EntryElement, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entryElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=valueElements, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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)
return[member[.valueElements]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[EntryElement] operator[>] identifier[makeEntryElementList] operator[SEP] identifier[Object] operator[...] identifier[value] operator[SEP] {
identifier[List] operator[<] identifier[EntryElement] operator[>] identifier[valueElements] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[EntryElement] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[value] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[=] identifier[ClassUtils] operator[SEP] identifier[primitiveToWrapper] operator[SEP] identifier[o] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[EntryElement] identifier[entryElement] operator[=] Keyword[new] identifier[EntryElement] operator[SEP] identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[o] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[valueElements] operator[SEP] identifier[add] operator[SEP] identifier[entryElement] operator[SEP] operator[SEP]
}
Keyword[return] identifier[valueElements] operator[SEP]
}
|
@SuppressWarnings("unchecked")
protected ResultQueueEntry<T> toResultQueueEntryForEquals(Object obj) {
if (!(obj instanceof ResultQueueEntry) || obj == null) {
return null;
}
ResultQueueEntry<T> other = (ResultQueueEntry<T>) obj;
return type == other.type && getClass() == other.getClass() ? other : null;
} | class class_name[name] begin[{]
method[toResultQueueEntryForEquals, return_type[type[ResultQueueEntry]], modifier[protected], parameter[obj]] begin[{]
if[binary_operation[binary_operation[member[.obj], instanceof, type[ResultQueueEntry]], ||, binary_operation[member[.obj], ==, literal[null]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ResultQueueEntry], other]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[]), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[], type_arguments=None), operator===), operator=&&), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] identifier[ResultQueueEntry] operator[<] identifier[T] operator[>] identifier[toResultQueueEntryForEquals] operator[SEP] identifier[Object] identifier[obj] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[obj] Keyword[instanceof] identifier[ResultQueueEntry] operator[SEP] operator[||] identifier[obj] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[ResultQueueEntry] operator[<] identifier[T] operator[>] identifier[other] operator[=] operator[SEP] identifier[ResultQueueEntry] operator[<] identifier[T] operator[>] operator[SEP] identifier[obj] operator[SEP] Keyword[return] identifier[type] operator[==] identifier[other] operator[SEP] identifier[type] operator[&&] identifier[getClass] operator[SEP] operator[SEP] operator[==] identifier[other] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[?] identifier[other] operator[:] Other[null] operator[SEP]
}
|
public String getRelation(int position) {
if (position < 0 || position >= path.size())
throw new IndexOutOfBoundsException("Invalid relation: " +position);
DependencyRelation r = path.get(position);
return r.relation();
} | class class_name[name] begin[{]
method[getRelation, return_type[type[String]], modifier[public], parameter[position]] begin[{]
if[binary_operation[binary_operation[member[.position], <, literal[0]], ||, binary_operation[member[.position], >=, call[path.size, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid relation: "), operandr=MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[DependencyRelation], r]
return[call[r.relation, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getRelation] operator[SEP] Keyword[int] identifier[position] operator[SEP] {
Keyword[if] operator[SEP] identifier[position] operator[<] Other[0] operator[||] identifier[position] operator[>=] identifier[path] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] literal[String] operator[+] identifier[position] operator[SEP] operator[SEP] identifier[DependencyRelation] identifier[r] operator[=] identifier[path] operator[SEP] identifier[get] operator[SEP] identifier[position] operator[SEP] operator[SEP] Keyword[return] identifier[r] operator[SEP] identifier[relation] operator[SEP] operator[SEP] operator[SEP]
}
|
public void throwException(final Type type, final String msg) {
newInstance(type);
dup();
push(msg);
invokeConstructor(type, Method.getMethod("void <init> (String)"));
throwException();
} | class class_name[name] begin[{]
method[throwException, return_type[void], modifier[public], parameter[type, msg]] begin[{]
call[.newInstance, parameter[member[.type]]]
call[.dup, parameter[]]
call[.push, parameter[member[.msg]]]
call[.invokeConstructor, parameter[member[.type], call[Method.getMethod, parameter[literal["void <init> (String)"]]]]]
call[.throwException, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[throwException] operator[SEP] Keyword[final] identifier[Type] identifier[type] , Keyword[final] identifier[String] identifier[msg] operator[SEP] {
identifier[newInstance] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[dup] operator[SEP] operator[SEP] operator[SEP] identifier[push] operator[SEP] identifier[msg] operator[SEP] operator[SEP] identifier[invokeConstructor] operator[SEP] identifier[type] , identifier[Method] operator[SEP] identifier[getMethod] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[throwException] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String baseName(String file, @NonNull String suffix) {
if (StringUtils.isNullOrBlank(file)) {
return StringUtils.EMPTY;
}
file = StringUtils.trim(file);
int index = indexOfLastSeparator(file);
if (index == -1) {
return file.replaceAll(Pattern.quote(suffix) + "$", "");
} else if (index == file.length() - 1) {
return baseName(file.substring(0, file.length() - 1));
}
return file.substring(index + 1).replaceAll(Pattern.quote(suffix) + "$", "");
} | class class_name[name] begin[{]
method[baseName, return_type[type[String]], modifier[public static], parameter[file, suffix]] begin[{]
if[call[StringUtils.isNullOrBlank, parameter[member[.file]]]] begin[{]
return[member[StringUtils.EMPTY]]
else begin[{]
None
end[}]
assign[member[.file], call[StringUtils.trim, parameter[member[.file]]]]
local_variable[type[int], index]
if[binary_operation[member[.index], ==, literal[1]]] begin[{]
return[call[file.replaceAll, parameter[binary_operation[call[Pattern.quote, parameter[member[.suffix]]], +, literal["$"]], literal[""]]]]
else begin[{]
if[binary_operation[member[.index], ==, binary_operation[call[file.length, parameter[]], -, literal[1]]]] begin[{]
return[call[.baseName, parameter[call[file.substring, parameter[literal[0], binary_operation[call[file.length, parameter[]], -, literal[1]]]]]]]
else begin[{]
None
end[}]
end[}]
return[call[file.substring, parameter[binary_operation[member[.index], +, literal[1]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[baseName] operator[SEP] identifier[String] identifier[file] , annotation[@] identifier[NonNull] identifier[String] identifier[suffix] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNullOrBlank] operator[SEP] identifier[file] operator[SEP] operator[SEP] {
Keyword[return] identifier[StringUtils] operator[SEP] identifier[EMPTY] operator[SEP]
}
identifier[file] operator[=] identifier[StringUtils] operator[SEP] identifier[trim] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[indexOfLastSeparator] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[file] operator[SEP] identifier[replaceAll] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[suffix] operator[SEP] operator[+] literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[index] operator[==] identifier[file] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[baseName] operator[SEP] identifier[file] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[file] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[file] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[suffix] operator[SEP] operator[+] literal[String] , literal[String] operator[SEP] operator[SEP]
}
|
private SqlNode getNthExpr(SqlNode query, int ordinal, int sourceCount) {
if (query instanceof SqlInsert) {
SqlInsert insert = (SqlInsert) query;
if (insert.getTargetColumnList() != null) {
return insert.getTargetColumnList().get(ordinal);
} else {
return getNthExpr(
insert.getSource(),
ordinal,
sourceCount);
}
} else if (query instanceof SqlUpdate) {
SqlUpdate update = (SqlUpdate) query;
if (update.getTargetColumnList() != null) {
return update.getTargetColumnList().get(ordinal);
} else if (update.getSourceExpressionList() != null) {
return update.getSourceExpressionList().get(ordinal);
} else {
return getNthExpr(
update.getSourceSelect(),
ordinal,
sourceCount);
}
} else if (query instanceof SqlSelect) {
SqlSelect select = (SqlSelect) query;
if (select.getSelectList().size() == sourceCount) {
return select.getSelectList().get(ordinal);
} else {
return query; // give up
}
} else {
return query; // give up
}
} | class class_name[name] begin[{]
method[getNthExpr, return_type[type[SqlNode]], modifier[private], parameter[query, ordinal, sourceCount]] begin[{]
if[binary_operation[member[.query], instanceof, type[SqlInsert]]] begin[{]
local_variable[type[SqlInsert], insert]
if[binary_operation[call[insert.getTargetColumnList, parameter[]], !=, literal[null]]] begin[{]
return[call[insert.getTargetColumnList, parameter[]]]
else begin[{]
return[call[.getNthExpr, parameter[call[insert.getSource, parameter[]], member[.ordinal], member[.sourceCount]]]]
end[}]
else begin[{]
if[binary_operation[member[.query], instanceof, type[SqlUpdate]]] begin[{]
local_variable[type[SqlUpdate], update]
if[binary_operation[call[update.getTargetColumnList, parameter[]], !=, literal[null]]] begin[{]
return[call[update.getTargetColumnList, parameter[]]]
else begin[{]
if[binary_operation[call[update.getSourceExpressionList, parameter[]], !=, literal[null]]] begin[{]
return[call[update.getSourceExpressionList, parameter[]]]
else begin[{]
return[call[.getNthExpr, parameter[call[update.getSourceSelect, parameter[]], member[.ordinal], member[.sourceCount]]]]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.query], instanceof, type[SqlSelect]]] begin[{]
local_variable[type[SqlSelect], select]
if[binary_operation[call[select.getSelectList, parameter[]], ==, member[.sourceCount]]] begin[{]
return[call[select.getSelectList, parameter[]]]
else begin[{]
return[member[.query]]
end[}]
else begin[{]
return[member[.query]]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] identifier[SqlNode] identifier[getNthExpr] operator[SEP] identifier[SqlNode] identifier[query] , Keyword[int] identifier[ordinal] , Keyword[int] identifier[sourceCount] operator[SEP] {
Keyword[if] operator[SEP] identifier[query] Keyword[instanceof] identifier[SqlInsert] operator[SEP] {
identifier[SqlInsert] identifier[insert] operator[=] operator[SEP] identifier[SqlInsert] operator[SEP] identifier[query] operator[SEP] Keyword[if] operator[SEP] identifier[insert] operator[SEP] identifier[getTargetColumnList] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[insert] operator[SEP] identifier[getTargetColumnList] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[getNthExpr] operator[SEP] identifier[insert] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] , identifier[ordinal] , identifier[sourceCount] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[query] Keyword[instanceof] identifier[SqlUpdate] operator[SEP] {
identifier[SqlUpdate] identifier[update] operator[=] operator[SEP] identifier[SqlUpdate] operator[SEP] identifier[query] operator[SEP] Keyword[if] operator[SEP] identifier[update] operator[SEP] identifier[getTargetColumnList] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[update] operator[SEP] identifier[getTargetColumnList] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[update] operator[SEP] identifier[getSourceExpressionList] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[update] operator[SEP] identifier[getSourceExpressionList] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[getNthExpr] operator[SEP] identifier[update] operator[SEP] identifier[getSourceSelect] operator[SEP] operator[SEP] , identifier[ordinal] , identifier[sourceCount] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[query] Keyword[instanceof] identifier[SqlSelect] operator[SEP] {
identifier[SqlSelect] identifier[select] operator[=] operator[SEP] identifier[SqlSelect] operator[SEP] identifier[query] operator[SEP] Keyword[if] operator[SEP] identifier[select] operator[SEP] identifier[getSelectList] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] identifier[sourceCount] operator[SEP] {
Keyword[return] identifier[select] operator[SEP] identifier[getSelectList] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[query] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[query] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
public static <T> Key<T> resolveKey(Class<T> injecteeClass, Class<? extends T> genericImplClass,
Type... typeVariableClasses) {
Optional<Annotation> qualifier = Annotations.on(genericImplClass)
.findAll()
.filter(AnnotationPredicates.annotationAnnotatedWith(Qualifier.class, false))
.findFirst();
TypeLiteral<T> genericInterface = (TypeLiteral<T>) TypeLiteral.get(
Types.newParameterizedType(injecteeClass, typeVariableClasses));
return qualifier.map(annotation -> Key.get(genericInterface, annotation)).orElseGet(
() -> Key.get(genericInterface));
} | class class_name[name] begin[{]
method[resolveKey, return_type[type[Key]], modifier[public static], parameter[injecteeClass, genericImplClass, typeVariableClasses]] begin[{]
local_variable[type[Optional], qualifier]
local_variable[type[TypeLiteral], genericInterface]
return[call[qualifier.map, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=genericInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=annotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=Key, selectors=[], type_arguments=None), parameters=[MemberReference(member=annotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Key] operator[<] identifier[T] operator[>] identifier[resolveKey] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[injecteeClass] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[genericImplClass] , identifier[Type] operator[...] identifier[typeVariableClasses] operator[SEP] {
identifier[Optional] operator[<] identifier[Annotation] operator[>] identifier[qualifier] operator[=] identifier[Annotations] operator[SEP] identifier[on] operator[SEP] identifier[genericImplClass] operator[SEP] operator[SEP] identifier[findAll] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[AnnotationPredicates] operator[SEP] identifier[annotationAnnotatedWith] operator[SEP] identifier[Qualifier] operator[SEP] Keyword[class] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP] identifier[TypeLiteral] operator[<] identifier[T] operator[>] identifier[genericInterface] operator[=] operator[SEP] identifier[TypeLiteral] operator[<] identifier[T] operator[>] operator[SEP] identifier[TypeLiteral] operator[SEP] identifier[get] operator[SEP] identifier[Types] operator[SEP] identifier[newParameterizedType] operator[SEP] identifier[injecteeClass] , identifier[typeVariableClasses] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[qualifier] operator[SEP] identifier[map] operator[SEP] identifier[annotation] operator[->] identifier[Key] operator[SEP] identifier[get] operator[SEP] identifier[genericInterface] , identifier[annotation] operator[SEP] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[Key] operator[SEP] identifier[get] operator[SEP] identifier[genericInterface] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.