code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
private boolean shouldUseTempFolderForDestination(String destination) {
destination = removeLeadingSlash(destination);
for (String tempFolderDestination : m_tempFolderDestinations) {
tempFolderDestination = removeLeadingSlash(tempFolderDestination);
if (CmsStringUtil.isPrefixPath(tempFolderDestination, destination)) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[shouldUseTempFolderForDestination, return_type[type[boolean]], modifier[private], parameter[destination]] begin[{]
assign[member[.destination], call[.removeLeadingSlash, parameter[member[.destination]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tempFolderDestination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=tempFolderDestination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeLeadingSlash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tempFolderDestination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isPrefixPath, postfix_operators=[], prefix_operators=[], qualifier=CmsStringUtil, 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=m_tempFolderDestinations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tempFolderDestination)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[shouldUseTempFolderForDestination] operator[SEP] identifier[String] identifier[destination] operator[SEP] {
identifier[destination] operator[=] identifier[removeLeadingSlash] operator[SEP] identifier[destination] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[tempFolderDestination] operator[:] identifier[m_tempFolderDestinations] operator[SEP] {
identifier[tempFolderDestination] operator[=] identifier[removeLeadingSlash] operator[SEP] identifier[tempFolderDestination] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CmsStringUtil] operator[SEP] identifier[isPrefixPath] operator[SEP] identifier[tempFolderDestination] , identifier[destination] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
protected final boolean reindex( String workspaceName,
NodeKey key,
Path path,
Name primaryType,
Set<Name> mixinTypes,
Properties properties,
boolean queryable ) {
if (predicate.matchesType(primaryType, mixinTypes)) {
reindexNode(workspaceName, key, path, primaryType, mixinTypes, properties, queryable);
return true;
}
return false;
} | class class_name[name] begin[{]
method[reindex, return_type[type[boolean]], modifier[final protected], parameter[workspaceName, key, path, primaryType, mixinTypes, properties, queryable]] begin[{]
if[call[predicate.matchesType, parameter[member[.primaryType], member[.mixinTypes]]]] begin[{]
call[.reindexNode, parameter[member[.workspaceName], member[.key], member[.path], member[.primaryType], member[.mixinTypes], member[.properties], member[.queryable]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[protected] Keyword[final] Keyword[boolean] identifier[reindex] operator[SEP] identifier[String] identifier[workspaceName] , identifier[NodeKey] identifier[key] , identifier[Path] identifier[path] , identifier[Name] identifier[primaryType] , identifier[Set] operator[<] identifier[Name] operator[>] identifier[mixinTypes] , identifier[Properties] identifier[properties] , Keyword[boolean] identifier[queryable] operator[SEP] {
Keyword[if] operator[SEP] identifier[predicate] operator[SEP] identifier[matchesType] operator[SEP] identifier[primaryType] , identifier[mixinTypes] operator[SEP] operator[SEP] {
identifier[reindexNode] operator[SEP] identifier[workspaceName] , identifier[key] , identifier[path] , identifier[primaryType] , identifier[mixinTypes] , identifier[properties] , identifier[queryable] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setAll(int[] samples, int count, int start, int skip,
long frameNumber, EncodedElement result) {
// assert(start == 0);
this.samples = samples;
this.count = count;
this.start = start;
this.skip = skip;
this.frameNumber = frameNumber;
this.result = result;
valid = false;
this.encodedSamples = 0;
} | class class_name[name] begin[{]
method[setAll, return_type[void], modifier[public], parameter[samples, count, start, skip, frameNumber, result]] begin[{]
assign[THIS[member[None.samples]], member[.samples]]
assign[THIS[member[None.count]], member[.count]]
assign[THIS[member[None.start]], member[.start]]
assign[THIS[member[None.skip]], member[.skip]]
assign[THIS[member[None.frameNumber]], member[.frameNumber]]
assign[THIS[member[None.result]], member[.result]]
assign[member[.valid], literal[false]]
assign[THIS[member[None.encodedSamples]], literal[0]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAll] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[samples] , Keyword[int] identifier[count] , Keyword[int] identifier[start] , Keyword[int] identifier[skip] , Keyword[long] identifier[frameNumber] , identifier[EncodedElement] identifier[result] operator[SEP] {
Keyword[this] operator[SEP] identifier[samples] operator[=] identifier[samples] operator[SEP] Keyword[this] operator[SEP] identifier[count] operator[=] identifier[count] operator[SEP] Keyword[this] operator[SEP] identifier[start] operator[=] identifier[start] operator[SEP] Keyword[this] operator[SEP] identifier[skip] operator[=] identifier[skip] operator[SEP] Keyword[this] operator[SEP] identifier[frameNumber] operator[=] identifier[frameNumber] operator[SEP] Keyword[this] operator[SEP] identifier[result] operator[=] identifier[result] operator[SEP] identifier[valid] operator[=] literal[boolean] operator[SEP] Keyword[this] operator[SEP] identifier[encodedSamples] operator[=] Other[0] operator[SEP]
}
|
private static void validate(String name, Collection<Geometry> geometries, int extent) {
if (name == null) {
throw new IllegalArgumentException("layer name is null");
}
if (geometries == null) {
throw new IllegalArgumentException("geometry collection is null");
}
if (extent <= 0) {
throw new IllegalArgumentException("extent is less than or equal to 0");
}
} | class class_name[name] begin[{]
method[validate, return_type[void], modifier[private static], parameter[name, geometries, extent]] begin[{]
if[binary_operation[member[.name], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="layer name is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.geometries], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="geometry collection is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.extent], <=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="extent is less than or equal to 0")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[validate] operator[SEP] identifier[String] identifier[name] , identifier[Collection] operator[<] identifier[Geometry] operator[>] identifier[geometries] , Keyword[int] identifier[extent] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[geometries] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[extent] operator[<=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
private static <E, F extends E, C extends Collection<F>> C collectionFilter(C collection, Iterable<? extends E> elements, Class<F> clazz) {
for (E e : elements) {
//if (clazz.isAssignableFrom(e.getClass()))
if (clazz.isInstance(e))
collection.add(clazz.cast(e));
}
return collection;
} | class class_name[name] begin[{]
method[collectionFilter, return_type[type[C]], modifier[private static], parameter[collection, elements, clazz]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isInstance, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cast, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=collection, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=elements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
return[member[.collection]]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[E] , identifier[F] Keyword[extends] identifier[E] , identifier[C] Keyword[extends] identifier[Collection] operator[<] identifier[F] operator[>] operator[>] identifier[C] identifier[collectionFilter] operator[SEP] identifier[C] identifier[collection] , identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[E] operator[>] identifier[elements] , identifier[Class] operator[<] identifier[F] operator[>] identifier[clazz] operator[SEP] {
Keyword[for] operator[SEP] identifier[E] identifier[e] operator[:] identifier[elements] operator[SEP] {
Keyword[if] operator[SEP] identifier[clazz] operator[SEP] identifier[isInstance] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[add] operator[SEP] identifier[clazz] operator[SEP] identifier[cast] operator[SEP] identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[collection] operator[SEP]
}
|
@Nonnull
public FineUploader5Form setElementID (@Nonnull @Nonempty final String sElementID)
{
ValueEnforcer.notEmpty (sElementID, "ElementID");
m_sFormElementID = sElementID;
return this;
} | class class_name[name] begin[{]
method[setElementID, return_type[type[FineUploader5Form]], modifier[public], parameter[sElementID]] begin[{]
call[ValueEnforcer.notEmpty, parameter[member[.sElementID], literal["ElementID"]]]
assign[member[.m_sFormElementID], member[.sElementID]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] identifier[FineUploader5Form] identifier[setElementID] operator[SEP] annotation[@] identifier[Nonnull] annotation[@] identifier[Nonempty] Keyword[final] identifier[String] identifier[sElementID] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notEmpty] operator[SEP] identifier[sElementID] , literal[String] operator[SEP] operator[SEP] identifier[m_sFormElementID] operator[=] identifier[sElementID] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Long getLongProperty(String pstrSection, String pstrProp)
{
Long lngRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) lngRet = new Long(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return lngRet;
} | class class_name[name] begin[{]
method[getLongProperty, return_type[type[Long]], modifier[public], parameter[pstrSection, pstrProp]] begin[{]
local_variable[type[Long], lngRet]
local_variable[type[String], strVal]
local_variable[type[INIProperty], objProp]
local_variable[type[INISection], objSec]
assign[member[.objSec], Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=mhmapSections, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=pstrSection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=INISection, sub_type=None))]
if[binary_operation[member[.objSec], !=, literal[null]]] begin[{]
assign[member[.objProp], call[objSec.getProperty, parameter[member[.pstrProp]]]]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=objProp, 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=strVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getPropValue, postfix_operators=[], prefix_operators=[], qualifier=objProp, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=strVal, 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=StatementExpression(expression=Assignment(expressionl=MemberReference(member=lngRet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=strVal, 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=Long, sub_type=None))), label=None))]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=NFExIgnore, types=['NumberFormatException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=objProp, 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=StatementExpression(expression=Assignment(expressionl=MemberReference(member=objProp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None))], label=None, resources=None)
assign[member[.objSec], literal[null]]
else begin[{]
None
end[}]
return[member[.lngRet]]
end[}]
END[}] | Keyword[public] identifier[Long] identifier[getLongProperty] operator[SEP] identifier[String] identifier[pstrSection] , identifier[String] identifier[pstrProp] operator[SEP] {
identifier[Long] identifier[lngRet] operator[=] Other[null] operator[SEP] identifier[String] identifier[strVal] operator[=] Other[null] operator[SEP] identifier[INIProperty] identifier[objProp] operator[=] Other[null] operator[SEP] identifier[INISection] identifier[objSec] operator[=] Other[null] operator[SEP] identifier[objSec] operator[=] operator[SEP] identifier[INISection] operator[SEP] Keyword[this] operator[SEP] identifier[mhmapSections] operator[SEP] identifier[get] operator[SEP] identifier[pstrSection] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[objSec] operator[!=] Other[null] operator[SEP] {
identifier[objProp] operator[=] identifier[objSec] operator[SEP] identifier[getProperty] operator[SEP] identifier[pstrProp] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[objProp] operator[!=] Other[null] operator[SEP] {
identifier[strVal] operator[=] identifier[objProp] operator[SEP] identifier[getPropValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strVal] operator[!=] Other[null] operator[SEP] identifier[lngRet] operator[=] Keyword[new] identifier[Long] operator[SEP] identifier[strVal] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[NFExIgnore] operator[SEP] {
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[objProp] operator[!=] Other[null] operator[SEP] identifier[objProp] operator[=] Other[null] operator[SEP]
}
identifier[objSec] operator[=] Other[null] operator[SEP]
}
Keyword[return] identifier[lngRet] operator[SEP]
}
|
public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type, String formatName) {
if (type == null) {
throw new IllegalArgumentException("type == null!");
}
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new CanEncodeImageAndFormatFilter(type, formatName), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageWriterIterator(iter);
} | class class_name[name] begin[{]
method[getImageWriters, return_type[type[Iterator]], modifier[public static], parameter[type, formatName]] begin[{]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type == null!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.formatName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="formatName == null!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Iterator], iter]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=iter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ImageWriterSpi, sub_type=None)), ClassCreator(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formatName, 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=CanEncodeImageAndFormatFilter, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getServiceProviders, postfix_operators=[], prefix_operators=[], qualifier=theRegistry, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=HashSet, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalArgumentException']))], finally_block=None, label=None, resources=None)
return[ClassCreator(arguments=[MemberReference(member=iter, 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=ImageWriterIterator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Iterator] operator[<] identifier[ImageWriter] operator[>] identifier[getImageWriters] operator[SEP] identifier[ImageTypeSpecifier] identifier[type] , identifier[String] identifier[formatName] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[formatName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Iterator] identifier[iter] operator[SEP] Keyword[try] {
identifier[iter] operator[=] identifier[theRegistry] operator[SEP] identifier[getServiceProviders] operator[SEP] identifier[ImageWriterSpi] operator[SEP] Keyword[class] , Keyword[new] identifier[CanEncodeImageAndFormatFilter] operator[SEP] identifier[type] , identifier[formatName] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
Keyword[return] Keyword[new] identifier[HashSet] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ImageWriterIterator] operator[SEP] identifier[iter] operator[SEP] operator[SEP]
}
|
public static org.postgis.Geometry convert(Geometry geometry) {
if (geometry instanceof Point) {
return convert((Point) geometry);
} else if (geometry instanceof LinearRing) {
return convert((LinearRing) geometry);
} else if (geometry instanceof LineString) {
return convert((LineString) geometry);
} else if (geometry instanceof MultiLineString) {
return convert((MultiLineString) geometry);
} else if (geometry instanceof Polygon) {
return convert((Polygon) geometry);
} else if (geometry instanceof PolyHedralSurface) {
return convert((PolyHedralSurface) geometry);
} else if (geometry instanceof MultiPoint) {
return convert((MultiPoint) geometry);
} else if (geometry instanceof MultiPolygon) {
return convert((MultiPolygon) geometry);
} else if (geometry instanceof GeometryCollection) {
return convert((GeometryCollection) geometry);
} else {
throw new IllegalArgumentException(geometry.getClass().getName());
}
} | class class_name[name] begin[{]
method[convert, return_type[type[org]], modifier[public static], parameter[geometry]] begin[{]
if[binary_operation[member[.geometry], instanceof, type[Point]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Point, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[LinearRing]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LinearRing, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[LineString]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LineString, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[MultiLineString]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MultiLineString, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[Polygon]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Polygon, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[PolyHedralSurface]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PolyHedralSurface, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[MultiPoint]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MultiPoint, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[MultiPolygon]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MultiPolygon, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[GeometryCollection]]] begin[{]
return[call[.convert, parameter[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=GeometryCollection, sub_type=None))]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=geometry, selectors=[MethodInvocation(arguments=[], member=getName, 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=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[org] operator[SEP] identifier[postgis] operator[SEP] identifier[Geometry] identifier[convert] operator[SEP] identifier[Geometry] identifier[geometry] operator[SEP] {
Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[Point] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[Point] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[LinearRing] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[LinearRing] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[LineString] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[LineString] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[MultiLineString] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[MultiLineString] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[Polygon] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[Polygon] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[PolyHedralSurface] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[PolyHedralSurface] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[MultiPoint] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[MultiPoint] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[MultiPolygon] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[MultiPolygon] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[GeometryCollection] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] operator[SEP] identifier[GeometryCollection] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[geometry] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public long getLastModified() {
return AccessController.doPrivileged(new PrivilegedAction<Long>() {
@Override
public Long run() {
return file.lastModified();
}
});
} | class class_name[name] begin[{]
method[getLastModified, return_type[type[long]], modifier[public], parameter[]] begin[{]
return[call[AccessController.doPrivileged, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None), throws=None, 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=Long, sub_type=None))], dimensions=None, name=PrivilegedAction, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[getLastModified] operator[SEP] operator[SEP] {
Keyword[return] identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] Keyword[new] identifier[PrivilegedAction] operator[<] identifier[Long] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Long] identifier[run] operator[SEP] operator[SEP] {
Keyword[return] identifier[file] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public final Mono<Boolean> hasElement(T value) {
Objects.requireNonNull(value, "value");
return any(t -> Objects.equals(value, t));
} | class class_name[name] begin[{]
method[hasElement, return_type[type[Mono]], modifier[final public], parameter[value]] begin[{]
call[Objects.requireNonNull, parameter[member[.value], literal["value"]]]
return[call[.any, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Objects, selectors=[], type_arguments=None), parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Mono] operator[<] identifier[Boolean] operator[>] identifier[hasElement] operator[SEP] identifier[T] identifier[value] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[value] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[any] operator[SEP] identifier[t] operator[->] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[value] , identifier[t] operator[SEP] operator[SEP] operator[SEP]
}
|
public void
writeU16(int val) {
check(val, 16);
need(2);
array[pos++] = (byte)((val >>> 8) & 0xFF);
array[pos++] = (byte)(val & 0xFF);
} | class class_name[name] begin[{]
method[writeU16, return_type[void], modifier[public], parameter[val]] begin[{]
call[.check, parameter[member[.val], literal[16]]]
call[.need, parameter[literal[2]]]
assign[member[.array], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), type=BasicType(dimensions=[], name=byte))]
assign[member[.array], Cast(expression=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), type=BasicType(dimensions=[], name=byte))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeU16] operator[SEP] Keyword[int] identifier[val] operator[SEP] {
identifier[check] operator[SEP] identifier[val] , Other[16] operator[SEP] operator[SEP] identifier[need] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[pos] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[val] operator[>] operator[>] operator[>] Other[8] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[pos] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[val] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
|
protected UIOutput createVerbatimComponent() {
assert(null != getFacesContext());
UIOutput verbatim;
Application application = getFacesContext().getApplication();
verbatim = (UIOutput)
application.createComponent("javax.faces.HtmlOutputText");
verbatim.setTransient(true);
verbatim.getAttributes().put("escape", Boolean.FALSE);
verbatim.setId(getFacesContext().getViewRoot().createUniqueId());
return verbatim;
} | class class_name[name] begin[{]
method[createVerbatimComponent, return_type[type[UIOutput]], modifier[protected], parameter[]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MethodInvocation(arguments=[], member=getFacesContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=!=), label=None, value=None)
local_variable[type[UIOutput], verbatim]
local_variable[type[Application], application]
assign[member[.verbatim], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="javax.faces.HtmlOutputText")], member=createComponent, postfix_operators=[], prefix_operators=[], qualifier=application, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=UIOutput, sub_type=None))]
call[verbatim.setTransient, parameter[literal[true]]]
call[verbatim.getAttributes, parameter[]]
call[verbatim.setId, parameter[call[.getFacesContext, parameter[]]]]
return[member[.verbatim]]
end[}]
END[}] | Keyword[protected] identifier[UIOutput] identifier[createVerbatimComponent] operator[SEP] operator[SEP] {
Keyword[assert] operator[SEP] Other[null] operator[!=] identifier[getFacesContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[UIOutput] identifier[verbatim] operator[SEP] identifier[Application] identifier[application] operator[=] identifier[getFacesContext] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] identifier[verbatim] operator[=] operator[SEP] identifier[UIOutput] operator[SEP] identifier[application] operator[SEP] identifier[createComponent] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[verbatim] operator[SEP] identifier[setTransient] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[verbatim] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[Boolean] operator[SEP] identifier[FALSE] operator[SEP] operator[SEP] identifier[verbatim] operator[SEP] identifier[setId] operator[SEP] identifier[getFacesContext] operator[SEP] operator[SEP] operator[SEP] identifier[getViewRoot] operator[SEP] operator[SEP] operator[SEP] identifier[createUniqueId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[verbatim] operator[SEP]
}
|
synchronized void offer(TransactionTask task)
{
Iv2Trace.logTransactionTaskQueueOffer(task);
TransactionState txnState = task.getTransactionState();
if (!m_backlog.isEmpty()) {
/*
* This branch happens during regular execution when a multi-part is in progress.
* The first task for the multi-part is the head of the queue, and all the single parts
* are being queued behind it. The txnid check catches tasks that are part of the multi-part
* and immediately queues them for execution. If any multi-part txn with smaller txnId shows up,
* it must from repair process, just let it through.
*/
if (txnState.isSinglePartition() ){
m_backlog.addLast(task);
return;
}
//It is possible a RO MP read with higher TxnId could be executed before a RO MP reader with lower TxnId
//so do not offer them to the site task queue in the same time, place it in the backlog instead. However,
//if it is an MP Write with a lower TxnId than the TxnId at the head of the backlog it could be a repair
//task so put the MP Write task into the Scoreboard or the SiteTaskQueue
TransactionTask headTask = m_backlog.getFirst();
if (txnState.isReadOnly() && headTask.getTransactionState().isReadOnly() ?
TxnEgo.getSequence(task.getTxnId()) != TxnEgo.getSequence(headTask.getTxnId()) :
TxnEgo.getSequence(task.getTxnId()) > TxnEgo.getSequence(headTask.getTxnId())) {
m_backlog.addLast(task);
} else if (task.needCoordination() && m_scoreboardEnabled) {
/*
* This branch coordinates FragmentTask or CompletedTransactionTask,
* holds the tasks until all the sites on the node receive the task.
* Task with newer spHandle will
*/
coordinatedTaskQueueOffer(task);
} else {
taskQueueOffer(task);
}
} else {
/*
* Base case nothing queued nothing in progress
* If the task is a multipart then put an entry in the backlog which
* will act as a barrier for single parts, queuing them for execution after the
* multipart
*/
if (!txnState.isSinglePartition()) {
m_backlog.addLast(task);
}
/*
* This branch coordinates FragmentTask or CompletedTransactionTask,
* holds the tasks until all the sites on the node receive the task.
* Task with newer spHandle will
*/
if (task.needCoordination() && m_scoreboardEnabled) {
coordinatedTaskQueueOffer(task);
} else {
taskQueueOffer(task);
}
}
} | class class_name[name] begin[{]
method[offer, return_type[void], modifier[synchronized], parameter[task]] begin[{]
call[Iv2Trace.logTransactionTaskQueueOffer, parameter[member[.task]]]
local_variable[type[TransactionState], txnState]
if[call[m_backlog.isEmpty, parameter[]]] begin[{]
if[call[txnState.isSinglePartition, parameter[]]] begin[{]
call[m_backlog.addLast, parameter[member[.task]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[TransactionTask], headTask]
if[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isReadOnly, postfix_operators=[], prefix_operators=[], qualifier=txnState, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getTransactionState, postfix_operators=[], prefix_operators=[], qualifier=headTask, selectors=[MethodInvocation(arguments=[], member=isReadOnly, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), if_false=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTxnId, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=getSequence, postfix_operators=[], prefix_operators=[], qualifier=TxnEgo, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTxnId, postfix_operators=[], prefix_operators=[], qualifier=headTask, selectors=[], type_arguments=None)], member=getSequence, postfix_operators=[], prefix_operators=[], qualifier=TxnEgo, selectors=[], type_arguments=None), operator=>), if_true=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTxnId, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None)], member=getSequence, postfix_operators=[], prefix_operators=[], qualifier=TxnEgo, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTxnId, postfix_operators=[], prefix_operators=[], qualifier=headTask, selectors=[], type_arguments=None)], member=getSequence, postfix_operators=[], prefix_operators=[], qualifier=TxnEgo, selectors=[], type_arguments=None), operator=!=))] begin[{]
call[m_backlog.addLast, parameter[member[.task]]]
else begin[{]
if[binary_operation[call[task.needCoordination, parameter[]], &&, member[.m_scoreboardEnabled]]] begin[{]
call[.coordinatedTaskQueueOffer, parameter[member[.task]]]
else begin[{]
call[.taskQueueOffer, parameter[member[.task]]]
end[}]
end[}]
else begin[{]
if[call[txnState.isSinglePartition, parameter[]]] begin[{]
call[m_backlog.addLast, parameter[member[.task]]]
else begin[{]
None
end[}]
if[binary_operation[call[task.needCoordination, parameter[]], &&, member[.m_scoreboardEnabled]]] begin[{]
call[.coordinatedTaskQueueOffer, parameter[member[.task]]]
else begin[{]
call[.taskQueueOffer, parameter[member[.task]]]
end[}]
end[}]
end[}]
END[}] | Keyword[synchronized] Keyword[void] identifier[offer] operator[SEP] identifier[TransactionTask] identifier[task] operator[SEP] {
identifier[Iv2Trace] operator[SEP] identifier[logTransactionTaskQueueOffer] operator[SEP] identifier[task] operator[SEP] operator[SEP] identifier[TransactionState] identifier[txnState] operator[=] identifier[task] operator[SEP] identifier[getTransactionState] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m_backlog] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[txnState] operator[SEP] identifier[isSinglePartition] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_backlog] operator[SEP] identifier[addLast] operator[SEP] identifier[task] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[TransactionTask] identifier[headTask] operator[=] identifier[m_backlog] operator[SEP] identifier[getFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[txnState] operator[SEP] identifier[isReadOnly] operator[SEP] operator[SEP] operator[&&] identifier[headTask] operator[SEP] identifier[getTransactionState] operator[SEP] operator[SEP] operator[SEP] identifier[isReadOnly] operator[SEP] operator[SEP] operator[?] identifier[TxnEgo] operator[SEP] identifier[getSequence] operator[SEP] identifier[task] operator[SEP] identifier[getTxnId] operator[SEP] operator[SEP] operator[SEP] operator[!=] identifier[TxnEgo] operator[SEP] identifier[getSequence] operator[SEP] identifier[headTask] operator[SEP] identifier[getTxnId] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[TxnEgo] operator[SEP] identifier[getSequence] operator[SEP] identifier[task] operator[SEP] identifier[getTxnId] operator[SEP] operator[SEP] operator[SEP] operator[>] identifier[TxnEgo] operator[SEP] identifier[getSequence] operator[SEP] identifier[headTask] operator[SEP] identifier[getTxnId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_backlog] operator[SEP] identifier[addLast] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[needCoordination] operator[SEP] operator[SEP] operator[&&] identifier[m_scoreboardEnabled] operator[SEP] {
identifier[coordinatedTaskQueueOffer] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[taskQueueOffer] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[txnState] operator[SEP] identifier[isSinglePartition] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_backlog] operator[SEP] identifier[addLast] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[task] operator[SEP] identifier[needCoordination] operator[SEP] operator[SEP] operator[&&] identifier[m_scoreboardEnabled] operator[SEP] {
identifier[coordinatedTaskQueueOffer] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[taskQueueOffer] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
}
}
|
@Override
public void keep(String key)
{
_checkFlashScopeDisabled();
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
Object value = requestMap.get(key);
// if the key does not exist in the requestMap,
// try to get it from the execute FlashMap
if (value == null)
{
Map<String, Object> executeMap = _getExecuteFlashMap(facesContext);
// Null-check, because in the GET request of a POST-REDIRECT-GET
// pattern there is no execute map
if (executeMap != null)
{
value = executeMap.get(key);
// Store it on request map so we can get it later. For example,
// this is used by org.apache.myfaces.el.FlashELResolver to return
// the value that has been promoted.
requestMap.put(key, value);
}
}
// put it in the render FlashMap
_getRenderFlashMap(facesContext).put(key, value);
facesContext.getApplication().publishEvent(facesContext,
PostKeepFlashValueEvent.class, key);
} | class class_name[name] begin[{]
method[keep, return_type[void], modifier[public], parameter[key]] begin[{]
call[._checkFlashScopeDisabled, parameter[]]
local_variable[type[FacesContext], facesContext]
local_variable[type[Map], requestMap]
local_variable[type[Object], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
local_variable[type[Map], executeMap]
if[binary_operation[member[.executeMap], !=, literal[null]]] begin[{]
assign[member[.value], call[executeMap.get, parameter[member[.key]]]]
call[requestMap.put, parameter[member[.key], member[.value]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[._getRenderFlashMap, parameter[member[.facesContext]]]
call[facesContext.getApplication, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[keep] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[_checkFlashScopeDisabled] operator[SEP] operator[SEP] operator[SEP] identifier[FacesContext] identifier[facesContext] operator[=] identifier[FacesContext] operator[SEP] identifier[getCurrentInstance] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[requestMap] operator[=] identifier[facesContext] operator[SEP] identifier[getExternalContext] operator[SEP] operator[SEP] operator[SEP] identifier[getRequestMap] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[value] operator[=] identifier[requestMap] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[executeMap] operator[=] identifier[_getExecuteFlashMap] operator[SEP] identifier[facesContext] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[executeMap] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[executeMap] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[requestMap] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
identifier[_getRenderFlashMap] operator[SEP] identifier[facesContext] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] identifier[facesContext] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] identifier[publishEvent] operator[SEP] identifier[facesContext] , identifier[PostKeepFlashValueEvent] operator[SEP] Keyword[class] , identifier[key] operator[SEP] operator[SEP]
}
|
public static boolean needsHeatmapJs(final Options options) {
return
options.getChart() != null &&
(options.getChart().getType() == SeriesType.HEATMAP);
} | class class_name[name] begin[{]
method[needsHeatmapJs, return_type[type[boolean]], modifier[public static], parameter[options]] begin[{]
return[binary_operation[binary_operation[call[options.getChart, parameter[]], !=, literal[null]], &&, binary_operation[call[options.getChart, parameter[]], ==, member[SeriesType.HEATMAP]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[needsHeatmapJs] operator[SEP] Keyword[final] identifier[Options] identifier[options] operator[SEP] {
Keyword[return] identifier[options] operator[SEP] identifier[getChart] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[SEP] identifier[options] operator[SEP] identifier[getChart] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[SeriesType] operator[SEP] identifier[HEATMAP] operator[SEP] operator[SEP]
}
|
public CompactionParserResult parse (FileSystemDataset dataset) {
CompactionParserResult result = new CompactionParserResult();
result.srcBaseDir = getSrcBaseDir (state);
result.srcSubDir = getSrcSubDir (state);
result.dstBaseDir = getDstBaseDir (state);
result.dstSubDir = getDstSubDir (state);
parseTimeAndDatasetName(dataset, result);
result.dstAbsoluteDir = Joiner.on("/").join (result.dstBaseDir,
result.datasetName,
result.dstSubDir,
result.timeString);
return result;
} | class class_name[name] begin[{]
method[parse, return_type[type[CompactionParserResult]], modifier[public], parameter[dataset]] begin[{]
local_variable[type[CompactionParserResult], result]
assign[member[result.srcBaseDir], call[.getSrcBaseDir, parameter[member[.state]]]]
assign[member[result.srcSubDir], call[.getSrcSubDir, parameter[member[.state]]]]
assign[member[result.dstBaseDir], call[.getDstBaseDir, parameter[member[.state]]]]
assign[member[result.dstSubDir], call[.getDstSubDir, parameter[member[.state]]]]
call[.parseTimeAndDatasetName, parameter[member[.dataset], member[.result]]]
assign[member[result.dstAbsoluteDir], call[Joiner.on, parameter[literal["/"]]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[CompactionParserResult] identifier[parse] operator[SEP] identifier[FileSystemDataset] identifier[dataset] operator[SEP] {
identifier[CompactionParserResult] identifier[result] operator[=] Keyword[new] identifier[CompactionParserResult] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[srcBaseDir] operator[=] identifier[getSrcBaseDir] operator[SEP] identifier[state] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[srcSubDir] operator[=] identifier[getSrcSubDir] operator[SEP] identifier[state] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[dstBaseDir] operator[=] identifier[getDstBaseDir] operator[SEP] identifier[state] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[dstSubDir] operator[=] identifier[getDstSubDir] operator[SEP] identifier[state] operator[SEP] operator[SEP] identifier[parseTimeAndDatasetName] operator[SEP] identifier[dataset] , identifier[result] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[dstAbsoluteDir] operator[=] identifier[Joiner] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[join] operator[SEP] identifier[result] operator[SEP] identifier[dstBaseDir] , identifier[result] operator[SEP] identifier[datasetName] , identifier[result] operator[SEP] identifier[dstSubDir] , identifier[result] operator[SEP] identifier[timeString] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public String convertIfcConstructionProductResourceTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} | class class_name[name] begin[{]
method[convertIfcConstructionProductResourceTypeEnumToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[convertIfcConstructionProductResourceTypeEnumToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void value(AjaxRequestTarget ajaxRequestTarget, int value)
{
ajaxRequestTarget.appendJavaScript(this.value(value).render().toString());
} | class class_name[name] begin[{]
method[value, return_type[void], modifier[public], parameter[ajaxRequestTarget, value]] begin[{]
call[ajaxRequestTarget.appendJavaScript, parameter[THIS[call[None.value, parameter[member[.value]]]call[None.render, parameter[]]call[None.toString, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[value] operator[SEP] identifier[AjaxRequestTarget] identifier[ajaxRequestTarget] , Keyword[int] identifier[value] operator[SEP] {
identifier[ajaxRequestTarget] operator[SEP] identifier[appendJavaScript] operator[SEP] Keyword[this] operator[SEP] identifier[value] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[render] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public com.google.protobuf.ByteString
getVariableNameBytes() {
java.lang.Object ref = variableName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
variableName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} | class class_name[name] begin[{]
method[getVariableNameBytes, return_type[type[com]], modifier[public], parameter[]] begin[{]
local_variable[type[java], ref]
if[binary_operation[member[.ref], instanceof, type[java]]] begin[{]
local_variable[type[com], b]
assign[member[.variableName_], member[.b]]
return[member[.b]]
else begin[{]
return[Cast(expression=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=google, sub_type=ReferenceType(arguments=None, dimensions=None, name=protobuf, sub_type=ReferenceType(arguments=None, dimensions=None, name=ByteString, sub_type=None)))))]
end[}]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] identifier[getVariableNameBytes] operator[SEP] operator[SEP] {
identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Object] identifier[ref] operator[=] identifier[variableName_] operator[SEP] Keyword[if] operator[SEP] identifier[ref] Keyword[instanceof] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] {
identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] identifier[b] operator[=] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] operator[SEP] identifier[copyFromUtf8] operator[SEP] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] identifier[ref] operator[SEP] operator[SEP] identifier[variableName_] operator[=] identifier[b] operator[SEP] Keyword[return] identifier[b] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] operator[SEP] identifier[ref] operator[SEP]
}
}
|
private void executeWffBMTask(final byte[] message)
throws UnsupportedEncodingException {
final List<NameValue> nameValues = WffBinaryMessageUtil.VERSION_1
.parse(message);
final NameValue task = nameValues.get(0);
final byte taskValue = task.getValues()[0][0];
if (Task.TASK.getValueByte() == task.getName()[0]) {
// IM stands for Invoke Method
if (taskValue == Task.INVOKE_ASYNC_METHOD.getValueByte()) {
invokeAsychMethod(nameValues);
} else if (taskValue == Task.INVOKE_CUSTOM_SERVER_METHOD
.getValueByte()) {
invokeCustomServerMethod(nameValues);
} else if (taskValue == Task.REMOVE_BROWSER_PAGE.getValueByte()) {
removeBrowserPageFromContext(nameValues);
}
}
} | class class_name[name] begin[{]
method[executeWffBMTask, return_type[void], modifier[private], parameter[message]] begin[{]
local_variable[type[List], nameValues]
local_variable[type[NameValue], task]
local_variable[type[byte], taskValue]
if[binary_operation[call[Task.TASK.getValueByte, parameter[]], ==, call[task.getName, parameter[]]]] begin[{]
if[binary_operation[member[.taskValue], ==, call[Task.INVOKE_ASYNC_METHOD.getValueByte, parameter[]]]] begin[{]
call[.invokeAsychMethod, parameter[member[.nameValues]]]
else begin[{]
if[binary_operation[member[.taskValue], ==, call[Task.INVOKE_CUSTOM_SERVER_METHOD.getValueByte, parameter[]]]] begin[{]
call[.invokeCustomServerMethod, parameter[member[.nameValues]]]
else begin[{]
if[binary_operation[member[.taskValue], ==, call[Task.REMOVE_BROWSER_PAGE.getValueByte, parameter[]]]] begin[{]
call[.removeBrowserPageFromContext, parameter[member[.nameValues]]]
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[executeWffBMTask] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[message] operator[SEP] Keyword[throws] identifier[UnsupportedEncodingException] {
Keyword[final] identifier[List] operator[<] identifier[NameValue] operator[>] identifier[nameValues] operator[=] identifier[WffBinaryMessageUtil] operator[SEP] identifier[VERSION_1] operator[SEP] identifier[parse] operator[SEP] identifier[message] operator[SEP] operator[SEP] Keyword[final] identifier[NameValue] identifier[task] operator[=] identifier[nameValues] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] identifier[taskValue] operator[=] identifier[task] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Task] operator[SEP] identifier[TASK] operator[SEP] identifier[getValueByte] operator[SEP] operator[SEP] operator[==] identifier[task] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[taskValue] operator[==] identifier[Task] operator[SEP] identifier[INVOKE_ASYNC_METHOD] operator[SEP] identifier[getValueByte] operator[SEP] operator[SEP] operator[SEP] {
identifier[invokeAsychMethod] operator[SEP] identifier[nameValues] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[taskValue] operator[==] identifier[Task] operator[SEP] identifier[INVOKE_CUSTOM_SERVER_METHOD] operator[SEP] identifier[getValueByte] operator[SEP] operator[SEP] operator[SEP] {
identifier[invokeCustomServerMethod] operator[SEP] identifier[nameValues] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[taskValue] operator[==] identifier[Task] operator[SEP] identifier[REMOVE_BROWSER_PAGE] operator[SEP] identifier[getValueByte] operator[SEP] operator[SEP] operator[SEP] {
identifier[removeBrowserPageFromContext] operator[SEP] identifier[nameValues] operator[SEP] operator[SEP]
}
}
}
|
private static int lineSeparatorIndex(char[] array, int length) {
for (int k = 0; k < length; k++) {
if (isLineSeparator(array[k])) {
return k;
}
}
return -1;
} | class class_name[name] begin[{]
method[lineSeparatorIndex, return_type[type[int]], modifier[private static], parameter[array, length]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=isLineSeparator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[1]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[lineSeparatorIndex] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[length] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] Other[0] operator[SEP] identifier[k] operator[<] identifier[length] operator[SEP] identifier[k] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[isLineSeparator] operator[SEP] identifier[array] operator[SEP] identifier[k] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[k] operator[SEP]
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public static <P extends Enum<P>> JSONObject optJSONObject(final JSONObject json, P e,
boolean emptyForNull) {
JSONObject jsonObject = optJSONObject(json, e);
if (jsonObject == null && emptyForNull) {
jsonObject = EMPTY_OBJECT;
}
return jsonObject;
} | class class_name[name] begin[{]
method[optJSONObject, return_type[type[JSONObject]], modifier[public static], parameter[json, e, emptyForNull]] begin[{]
local_variable[type[JSONObject], jsonObject]
if[binary_operation[binary_operation[member[.jsonObject], ==, literal[null]], &&, member[.emptyForNull]]] begin[{]
assign[member[.jsonObject], member[.EMPTY_OBJECT]]
else begin[{]
None
end[}]
return[member[.jsonObject]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[P] Keyword[extends] identifier[Enum] operator[<] identifier[P] operator[>] operator[>] identifier[JSONObject] identifier[optJSONObject] operator[SEP] Keyword[final] identifier[JSONObject] identifier[json] , identifier[P] identifier[e] , Keyword[boolean] identifier[emptyForNull] operator[SEP] {
identifier[JSONObject] identifier[jsonObject] operator[=] identifier[optJSONObject] operator[SEP] identifier[json] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonObject] operator[==] Other[null] operator[&&] identifier[emptyForNull] operator[SEP] {
identifier[jsonObject] operator[=] identifier[EMPTY_OBJECT] operator[SEP]
}
Keyword[return] identifier[jsonObject] operator[SEP]
}
|
public static <TExpression> BsonField first(final String fieldName, final TExpression expression) {
return accumulator("$first", fieldName, expression);
} | class class_name[name] begin[{]
method[first, return_type[type[BsonField]], modifier[public static], parameter[fieldName, expression]] begin[{]
return[call[.accumulator, parameter[literal["$first"], member[.fieldName], member[.expression]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[TExpression] operator[>] identifier[BsonField] identifier[first] operator[SEP] Keyword[final] identifier[String] identifier[fieldName] , Keyword[final] identifier[TExpression] identifier[expression] operator[SEP] {
Keyword[return] identifier[accumulator] operator[SEP] literal[String] , identifier[fieldName] , identifier[expression] operator[SEP] operator[SEP]
}
|
protected String mergeTemplate (String template, Object... data)
throws IOException
{
return mergeTemplate(template, createMap(data));
} | class class_name[name] begin[{]
method[mergeTemplate, return_type[type[String]], modifier[protected], parameter[template, data]] begin[{]
return[call[.mergeTemplate, parameter[member[.template], call[.createMap, parameter[member[.data]]]]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[mergeTemplate] operator[SEP] identifier[String] identifier[template] , identifier[Object] operator[...] identifier[data] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[mergeTemplate] operator[SEP] identifier[template] , identifier[createMap] operator[SEP] identifier[data] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void save(T item) {
Serializable idValue = memoryStore.getOrGenerateIdValue(item);
memoryStore.save(idValue, cryptoEntityUtil.encrypt(item));
} | class class_name[name] begin[{]
method[save, return_type[void], modifier[public], parameter[item]] begin[{]
local_variable[type[Serializable], idValue]
call[memoryStore.save, parameter[member[.idValue], call[cryptoEntityUtil.encrypt, parameter[member[.item]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[save] operator[SEP] identifier[T] identifier[item] operator[SEP] {
identifier[Serializable] identifier[idValue] operator[=] identifier[memoryStore] operator[SEP] identifier[getOrGenerateIdValue] operator[SEP] identifier[item] operator[SEP] operator[SEP] identifier[memoryStore] operator[SEP] identifier[save] operator[SEP] identifier[idValue] , identifier[cryptoEntityUtil] operator[SEP] identifier[encrypt] operator[SEP] identifier[item] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void deleteTrait(String guid, String traitNameToBeDeleted) throws AtlasException {
guid = ParamChecker.notEmpty(guid, "entity id");
traitNameToBeDeleted = ParamChecker.notEmpty(traitNameToBeDeleted, "trait name");
// ensure trait type is already registered with the TS
if (!typeSystem.isRegistered(traitNameToBeDeleted)) {
final String msg = String.format("trait=%s should be defined in type system before it can be deleted",
traitNameToBeDeleted);
LOG.error(msg);
throw new TypeNotFoundException(msg);
}
repository.deleteTrait(guid, traitNameToBeDeleted);
onTraitDeletedFromEntity(repository.getEntityDefinition(guid), traitNameToBeDeleted);
} | class class_name[name] begin[{]
method[deleteTrait, return_type[void], modifier[public], parameter[guid, traitNameToBeDeleted]] begin[{]
assign[member[.guid], call[ParamChecker.notEmpty, parameter[member[.guid], literal["entity id"]]]]
assign[member[.traitNameToBeDeleted], call[ParamChecker.notEmpty, parameter[member[.traitNameToBeDeleted], literal["trait name"]]]]
if[call[typeSystem.isRegistered, parameter[member[.traitNameToBeDeleted]]]] begin[{]
local_variable[type[String], msg]
call[LOG.error, parameter[member[.msg]]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, 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=TypeNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[repository.deleteTrait, parameter[member[.guid], member[.traitNameToBeDeleted]]]
call[.onTraitDeletedFromEntity, parameter[call[repository.getEntityDefinition, parameter[member[.guid]]], member[.traitNameToBeDeleted]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[deleteTrait] operator[SEP] identifier[String] identifier[guid] , identifier[String] identifier[traitNameToBeDeleted] operator[SEP] Keyword[throws] identifier[AtlasException] {
identifier[guid] operator[=] identifier[ParamChecker] operator[SEP] identifier[notEmpty] operator[SEP] identifier[guid] , literal[String] operator[SEP] operator[SEP] identifier[traitNameToBeDeleted] operator[=] identifier[ParamChecker] operator[SEP] identifier[notEmpty] operator[SEP] identifier[traitNameToBeDeleted] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[typeSystem] operator[SEP] identifier[isRegistered] operator[SEP] identifier[traitNameToBeDeleted] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[msg] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[traitNameToBeDeleted] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[msg] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[TypeNotFoundException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
identifier[repository] operator[SEP] identifier[deleteTrait] operator[SEP] identifier[guid] , identifier[traitNameToBeDeleted] operator[SEP] operator[SEP] identifier[onTraitDeletedFromEntity] operator[SEP] identifier[repository] operator[SEP] identifier[getEntityDefinition] operator[SEP] identifier[guid] operator[SEP] , identifier[traitNameToBeDeleted] operator[SEP] operator[SEP]
}
|
protected static Map<String, HttpString> httpStrings() {
final Map<String, HttpString> results = new HashMap<>();
final Class[] classs = {Headers.class, Methods.class, Protocols.class};
for (Class<?> c : classs) {
for (Field field : c.getDeclaredFields()) {
if (field.getType().equals(HttpString.class)) {
field.setAccessible(true);
HttpString result = null;
try {
result = (HttpString) field.get(null);
results.put(result.toString(), result);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}
return results;
} | class class_name[name] begin[{]
method[httpStrings, return_type[type[Map]], modifier[static protected], parameter[]] begin[{]
local_variable[type[Map], results]
local_variable[type[Class], classs]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HttpString, sub_type=None))], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpString, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=get, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=HttpString, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=results, 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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException']))], finally_block=None, label=None, resources=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclaredFields, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=classs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)
return[member[.results]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[HttpString] operator[>] identifier[httpStrings] operator[SEP] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[HttpString] operator[>] identifier[results] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Class] operator[SEP] operator[SEP] identifier[classs] operator[=] {
identifier[Headers] operator[SEP] Keyword[class] , identifier[Methods] operator[SEP] Keyword[class] , identifier[Protocols] operator[SEP] Keyword[class]
} operator[SEP] Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[c] operator[:] identifier[classs] operator[SEP] {
Keyword[for] operator[SEP] identifier[Field] identifier[field] operator[:] identifier[c] operator[SEP] identifier[getDeclaredFields] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[HttpString] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[field] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[HttpString] identifier[result] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[result] operator[=] operator[SEP] identifier[HttpString] operator[SEP] identifier[field] operator[SEP] identifier[get] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[put] operator[SEP] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[result] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] identifier[results] operator[SEP]
}
|
public int read(User registrar) throws IdentityException, InvalidArgumentException {
if (registrar == null) {
throw new InvalidArgumentException("Registrar should be a valid member");
}
String readIdURL = "";
try {
readIdURL = HFCA_IDENTITY + "/" + enrollmentID;
logger.debug(format("identity url: %s, registrar: %s", readIdURL, registrar.getName()));
JsonObject result = client.httpGet(readIdURL, registrar);
statusCode = result.getInt("statusCode");
if (statusCode < 400) {
type = result.getString("type");
maxEnrollments = result.getInt("max_enrollments");
affiliation = result.getString("affiliation");
JsonArray attributes = result.getJsonArray("attrs");
Collection<Attribute> attrs = new ArrayList<Attribute>();
if (attributes != null && !attributes.isEmpty()) {
for (int i = 0; i < attributes.size(); i++) {
JsonObject attribute = attributes.getJsonObject(i);
Attribute attr = new Attribute(attribute.getString("name"), attribute.getString("value"), attribute.getBoolean("ecert", false));
attrs.add(attr);
}
}
this.attrs = attrs;
logger.debug(format("identity url: %s, registrar: %s done.", readIdURL, registrar));
}
this.deleted = false;
return statusCode;
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while getting user '%s' from url '%s': %s", e.getStatusCode(), getEnrollmentId(), readIdURL, e.getMessage());
IdentityException identityException = new IdentityException(msg, e);
logger.error(msg);
throw identityException;
} catch (Exception e) {
String msg = format("Error while getting user '%s' from url '%s': %s", enrollmentID, readIdURL, e.getMessage());
IdentityException identityException = new IdentityException(msg, e);
logger.error(msg);
throw identityException;
}
} | class class_name[name] begin[{]
method[read, return_type[type[int]], modifier[public], parameter[registrar]] begin[{]
if[binary_operation[member[.registrar], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Registrar should be a valid member")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], readIdURL]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=readIdURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=HFCA_IDENTITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MemberReference(member=enrollmentID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="identity url: %s, registrar: %s"), MemberReference(member=readIdURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=registrar, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=readIdURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=registrar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=httpGet, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="statusCode")], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=400), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxEnrollments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="max_enrollments")], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=affiliation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="affiliation")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="attrs")], member=getJsonArray, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), name=attributes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonArray, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=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=Attribute, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=attrs)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=attributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=attributes, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJsonObject, postfix_operators=[], prefix_operators=[], qualifier=attributes, selectors=[], type_arguments=None), name=attribute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ecert"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getBoolean, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None)), name=attr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=attr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=attrs, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=attributes, 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)])), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=attrs, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=attrs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="identity url: %s, registrar: %s done."), MemberReference(member=readIdURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=registrar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=deleted, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), ReturnStatement(expression=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[Code: %d] - Error while getting user '%s' from url '%s': %s"), MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getEnrollmentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=readIdURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=IdentityException, sub_type=None)), name=identityException)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IdentityException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=identityException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['HTTPException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while getting user '%s' from url '%s': %s"), MemberReference(member=enrollmentID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=readIdURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=IdentityException, sub_type=None)), name=identityException)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IdentityException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=identityException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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[int] identifier[read] operator[SEP] identifier[User] identifier[registrar] operator[SEP] Keyword[throws] identifier[IdentityException] , identifier[InvalidArgumentException] {
Keyword[if] operator[SEP] identifier[registrar] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[readIdURL] operator[=] literal[String] operator[SEP] Keyword[try] {
identifier[readIdURL] operator[=] identifier[HFCA_IDENTITY] operator[+] literal[String] operator[+] identifier[enrollmentID] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[readIdURL] , identifier[registrar] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[JsonObject] identifier[result] operator[=] identifier[client] operator[SEP] identifier[httpGet] operator[SEP] identifier[readIdURL] , identifier[registrar] operator[SEP] operator[SEP] identifier[statusCode] operator[=] identifier[result] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[statusCode] operator[<] Other[400] operator[SEP] {
identifier[type] operator[=] identifier[result] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[maxEnrollments] operator[=] identifier[result] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[affiliation] operator[=] identifier[result] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[JsonArray] identifier[attributes] operator[=] identifier[result] operator[SEP] identifier[getJsonArray] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[Attribute] operator[>] identifier[attrs] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Attribute] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributes] operator[!=] Other[null] operator[&&] operator[!] identifier[attributes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[attributes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[JsonObject] identifier[attribute] operator[=] identifier[attributes] operator[SEP] identifier[getJsonObject] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[Attribute] identifier[attr] operator[=] Keyword[new] identifier[Attribute] operator[SEP] identifier[attribute] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[attribute] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[attribute] operator[SEP] identifier[getBoolean] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[attrs] operator[SEP] identifier[add] operator[SEP] identifier[attr] operator[SEP] operator[SEP]
}
}
Keyword[this] operator[SEP] identifier[attrs] operator[=] identifier[attrs] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[readIdURL] , identifier[registrar] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[deleted] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[statusCode] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[HTTPException] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] , identifier[getEnrollmentId] operator[SEP] operator[SEP] , identifier[readIdURL] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[IdentityException] identifier[identityException] operator[=] Keyword[new] identifier[IdentityException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[msg] operator[SEP] operator[SEP] Keyword[throw] identifier[identityException] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[enrollmentID] , identifier[readIdURL] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[IdentityException] identifier[identityException] operator[=] Keyword[new] identifier[IdentityException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[msg] operator[SEP] operator[SEP] Keyword[throw] identifier[identityException] operator[SEP]
}
}
|
public void afterPropertyChange(String propertyName) {
if(propertyName.startsWith(RtfProperty.CHARACTER)) {
} else {
if(propertyName.startsWith(RtfProperty.PARAGRAPH)) {
} else {
if(propertyName.startsWith(RtfProperty.SECTION)) {
} else {
if(propertyName.startsWith(RtfProperty.DOCUMENT)) {
}
}
}
}
} | class class_name[name] begin[{]
method[afterPropertyChange, return_type[void], modifier[public], parameter[propertyName]] begin[{]
if[call[propertyName.startsWith, parameter[member[RtfProperty.CHARACTER]]]] begin[{]
else begin[{]
if[call[propertyName.startsWith, parameter[member[RtfProperty.PARAGRAPH]]]] begin[{]
else begin[{]
if[call[propertyName.startsWith, parameter[member[RtfProperty.SECTION]]]] begin[{]
else begin[{]
if[call[propertyName.startsWith, parameter[member[RtfProperty.DOCUMENT]]]] begin[{]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[afterPropertyChange] operator[SEP] identifier[String] identifier[propertyName] operator[SEP] {
Keyword[if] operator[SEP] identifier[propertyName] operator[SEP] identifier[startsWith] operator[SEP] identifier[RtfProperty] operator[SEP] identifier[CHARACTER] operator[SEP] operator[SEP] {
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[propertyName] operator[SEP] identifier[startsWith] operator[SEP] identifier[RtfProperty] operator[SEP] identifier[PARAGRAPH] operator[SEP] operator[SEP] {
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[propertyName] operator[SEP] identifier[startsWith] operator[SEP] identifier[RtfProperty] operator[SEP] identifier[SECTION] operator[SEP] operator[SEP] {
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[propertyName] operator[SEP] identifier[startsWith] operator[SEP] identifier[RtfProperty] operator[SEP] identifier[DOCUMENT] operator[SEP] operator[SEP] {
}
}
}
}
}
|
private void txtBorderWidthFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtBorderWidthFocusLost
// TODO: the name (and label?) of this text box no longer matches its purpose
if (txtBorderWidth.getText().matches("[0-9]+")) {
quietZoneHorizontal = Integer.parseInt(txtBorderWidth.getText());
encodeData();
} else {
txtBorderWidth.setText(String.valueOf(quietZoneHorizontal));
}
} | class class_name[name] begin[{]
method[txtBorderWidthFocusLost, return_type[void], modifier[private], parameter[evt]] begin[{]
if[call[txtBorderWidth.getText, parameter[]]] begin[{]
assign[member[.quietZoneHorizontal], call[Integer.parseInt, parameter[call[txtBorderWidth.getText, parameter[]]]]]
call[.encodeData, parameter[]]
else begin[{]
call[txtBorderWidth.setText, parameter[call[String.valueOf, parameter[member[.quietZoneHorizontal]]]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[txtBorderWidthFocusLost] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[FocusEvent] identifier[evt] operator[SEP] {
Keyword[if] operator[SEP] identifier[txtBorderWidth] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] identifier[matches] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[quietZoneHorizontal] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[txtBorderWidth] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[encodeData] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[txtBorderWidth] operator[SEP] identifier[setText] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[quietZoneHorizontal] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void doCollectStats(final TSDB tsdb, final StatsCollector collector,
final boolean canonical) {
collector.addHostTag(canonical);
ConnectionManager.collectStats(collector);
RpcHandler.collectStats(collector);
RpcManager.collectStats(collector);
collectThreadStats(collector);
tsdb.collectStats(collector);
} | class class_name[name] begin[{]
method[doCollectStats, return_type[void], modifier[private], parameter[tsdb, collector, canonical]] begin[{]
call[collector.addHostTag, parameter[member[.canonical]]]
call[ConnectionManager.collectStats, parameter[member[.collector]]]
call[RpcHandler.collectStats, parameter[member[.collector]]]
call[RpcManager.collectStats, parameter[member[.collector]]]
call[.collectThreadStats, parameter[member[.collector]]]
call[tsdb.collectStats, parameter[member[.collector]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[doCollectStats] operator[SEP] Keyword[final] identifier[TSDB] identifier[tsdb] , Keyword[final] identifier[StatsCollector] identifier[collector] , Keyword[final] Keyword[boolean] identifier[canonical] operator[SEP] {
identifier[collector] operator[SEP] identifier[addHostTag] operator[SEP] identifier[canonical] operator[SEP] operator[SEP] identifier[ConnectionManager] operator[SEP] identifier[collectStats] operator[SEP] identifier[collector] operator[SEP] operator[SEP] identifier[RpcHandler] operator[SEP] identifier[collectStats] operator[SEP] identifier[collector] operator[SEP] operator[SEP] identifier[RpcManager] operator[SEP] identifier[collectStats] operator[SEP] identifier[collector] operator[SEP] operator[SEP] identifier[collectThreadStats] operator[SEP] identifier[collector] operator[SEP] operator[SEP] identifier[tsdb] operator[SEP] identifier[collectStats] operator[SEP] identifier[collector] operator[SEP] operator[SEP]
}
|
public static <T> int binarySearch (
T[] array, int offset, int length, Comparable<? super T> key)
{
int low = offset, high = offset+length-1;
while (low <= high) {
int mid = (low + high) >>> 1;
int cmp = key.compareTo(array[mid]);
if (cmp > 0) {
low = mid + 1;
} else if (cmp < 0) {
high = mid - 1;
} else {
return mid; // key found
}
}
return -(low + 1); // key not found.
} | class class_name[name] begin[{]
method[binarySearch, return_type[type[int]], modifier[public static], parameter[array, offset, length, key]] begin[{]
local_variable[type[int], low]
while[binary_operation[member[.low], <=, member[.high]]] begin[{]
local_variable[type[int], mid]
local_variable[type[int], cmp]
if[binary_operation[member[.cmp], >, literal[0]]] begin[{]
assign[member[.low], binary_operation[member[.mid], +, literal[1]]]
else begin[{]
if[binary_operation[member[.cmp], <, literal[0]]] begin[{]
assign[member[.high], binary_operation[member[.mid], -, literal[1]]]
else begin[{]
return[member[.mid]]
end[}]
end[}]
end[}]
return[binary_operation[member[.low], +, literal[1]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[int] identifier[binarySearch] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] , identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[key] operator[SEP] {
Keyword[int] identifier[low] operator[=] identifier[offset] , identifier[high] operator[=] identifier[offset] operator[+] identifier[length] operator[-] Other[1] operator[SEP] Keyword[while] operator[SEP] identifier[low] operator[<=] identifier[high] operator[SEP] {
Keyword[int] identifier[mid] operator[=] operator[SEP] identifier[low] operator[+] identifier[high] operator[SEP] operator[>] operator[>] operator[>] Other[1] operator[SEP] Keyword[int] identifier[cmp] operator[=] identifier[key] operator[SEP] identifier[compareTo] operator[SEP] identifier[array] operator[SEP] identifier[mid] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmp] operator[>] Other[0] operator[SEP] {
identifier[low] operator[=] identifier[mid] operator[+] Other[1] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cmp] operator[<] Other[0] operator[SEP] {
identifier[high] operator[=] identifier[mid] operator[-] Other[1] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[mid] operator[SEP]
}
}
Keyword[return] operator[-] operator[SEP] identifier[low] operator[+] Other[1] operator[SEP] operator[SEP]
}
|
public Query resolve(final InternalQName tableName, final boolean includeInheritedTables)
throws InvalidQueryException, RepositoryException
{
final List<Term> terms = new ArrayList<Term>();
Query query = null;
try
{
final String nodeTypeStringName = locationFactory.createJCRName(tableName).getAsString();
if (isMixin(tableName))
{
// search for nodes where jcr:mixinTypes is set to this mixin
Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(mixinTypesField, nodeTypeStringName));
terms.add(t);
}
else
{
// search for nodes where jcr:primaryType is set to this type
Term t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(primaryTypeField, nodeTypeStringName));
terms.add(t);
}
if (includeInheritedTables)
{
// now search for all node types that are derived from base
final Set<InternalQName> allTypes = getSubTypes(tableName);
for (final InternalQName descendantNt : allTypes)
{
final String ntName = locationFactory.createJCRName(descendantNt).getAsString();
Term t;
if (isMixin(descendantNt))
{
// search on jcr:mixinTypes
t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(mixinTypesField, ntName));
}
else
{
// search on jcr:primaryType
t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(primaryTypeField, ntName));
}
terms.add(t);
}
}
}
catch (final NoSuchNodeTypeException e)
{
throw new InvalidQueryException(e.getMessage(), e);
}
if (terms.size() == 0)
{
// exception occured
query = new BooleanQuery();
}
else if (terms.size() == 1)
{
query = new JcrTermQuery(terms.get(0));
}
else
{
final BooleanQuery b = new BooleanQuery();
for (final Object element : terms)
{
// b.add(new TermQuery((Term) element), Occur.SHOULD);
b.add(new JcrTermQuery((Term)element), Occur.SHOULD);
}
query = b;
}
return query;
} | class class_name[name] begin[{]
method[resolve, return_type[type[Query]], modifier[public], parameter[tableName, includeInheritedTables]] begin[{]
local_variable[type[List], terms]
local_variable[type[Query], query]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createJCRName, postfix_operators=[], prefix_operators=[], qualifier=locationFactory, selectors=[MethodInvocation(arguments=[], member=getAsString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=nodeTypeStringName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isMixin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=PROPERTIES, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[MemberReference(member=primaryTypeField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nodeTypeStringName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createNamedValue, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Term, sub_type=None)), name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=terms, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=PROPERTIES, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[MemberReference(member=mixinTypesField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nodeTypeStringName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createNamedValue, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Term, sub_type=None)), name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=terms, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MemberReference(member=includeInheritedTables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSubTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=allTypes)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InternalQName, sub_type=None))], dimensions=[], name=Set, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=descendantNt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createJCRName, postfix_operators=[], prefix_operators=[], qualifier=locationFactory, selectors=[MethodInvocation(arguments=[], member=getAsString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=ntName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=descendantNt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isMixin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=PROPERTIES, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[MemberReference(member=primaryTypeField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ntName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createNamedValue, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Term, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=PROPERTIES, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[MemberReference(member=mixinTypesField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ntName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createNamedValue, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Term, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=terms, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=allTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=descendantNt)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InternalQName, sub_type=None))), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=InvalidQueryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchNodeTypeException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[terms.size, parameter[]], ==, literal[0]]] begin[{]
assign[member[.query], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BooleanQuery, sub_type=None))]
else begin[{]
if[binary_operation[call[terms.size, parameter[]], ==, literal[1]]] begin[{]
assign[member[.query], ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=terms, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JcrTermQuery, sub_type=None))]
else begin[{]
local_variable[type[BooleanQuery], b]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Cast(expression=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JcrTermQuery, sub_type=None)), MemberReference(member=SHOULD, postfix_operators=[], prefix_operators=[], qualifier=Occur, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=terms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
assign[member[.query], member[.b]]
end[}]
end[}]
return[member[.query]]
end[}]
END[}] | Keyword[public] identifier[Query] identifier[resolve] operator[SEP] Keyword[final] identifier[InternalQName] identifier[tableName] , Keyword[final] Keyword[boolean] identifier[includeInheritedTables] operator[SEP] Keyword[throws] identifier[InvalidQueryException] , identifier[RepositoryException] {
Keyword[final] identifier[List] operator[<] identifier[Term] operator[>] identifier[terms] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Term] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Query] identifier[query] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[String] identifier[nodeTypeStringName] operator[=] identifier[locationFactory] operator[SEP] identifier[createJCRName] operator[SEP] identifier[tableName] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isMixin] operator[SEP] identifier[tableName] operator[SEP] operator[SEP] {
identifier[Term] identifier[t] operator[=] Keyword[new] identifier[Term] operator[SEP] identifier[FieldNames] operator[SEP] identifier[PROPERTIES] , identifier[FieldNames] operator[SEP] identifier[createNamedValue] operator[SEP] identifier[mixinTypesField] , identifier[nodeTypeStringName] operator[SEP] operator[SEP] operator[SEP] identifier[terms] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Term] identifier[t] operator[=] Keyword[new] identifier[Term] operator[SEP] identifier[FieldNames] operator[SEP] identifier[PROPERTIES] , identifier[FieldNames] operator[SEP] identifier[createNamedValue] operator[SEP] identifier[primaryTypeField] , identifier[nodeTypeStringName] operator[SEP] operator[SEP] operator[SEP] identifier[terms] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[includeInheritedTables] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[InternalQName] operator[>] identifier[allTypes] operator[=] identifier[getSubTypes] operator[SEP] identifier[tableName] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[InternalQName] identifier[descendantNt] operator[:] identifier[allTypes] operator[SEP] {
Keyword[final] identifier[String] identifier[ntName] operator[=] identifier[locationFactory] operator[SEP] identifier[createJCRName] operator[SEP] identifier[descendantNt] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] identifier[Term] identifier[t] operator[SEP] Keyword[if] operator[SEP] identifier[isMixin] operator[SEP] identifier[descendantNt] operator[SEP] operator[SEP] {
identifier[t] operator[=] Keyword[new] identifier[Term] operator[SEP] identifier[FieldNames] operator[SEP] identifier[PROPERTIES] , identifier[FieldNames] operator[SEP] identifier[createNamedValue] operator[SEP] identifier[mixinTypesField] , identifier[ntName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[t] operator[=] Keyword[new] identifier[Term] operator[SEP] identifier[FieldNames] operator[SEP] identifier[PROPERTIES] , identifier[FieldNames] operator[SEP] identifier[createNamedValue] operator[SEP] identifier[primaryTypeField] , identifier[ntName] operator[SEP] operator[SEP] operator[SEP]
}
identifier[terms] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NoSuchNodeTypeException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidQueryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[terms] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[query] operator[=] Keyword[new] identifier[BooleanQuery] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[terms] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[query] operator[=] Keyword[new] identifier[JcrTermQuery] operator[SEP] identifier[terms] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[BooleanQuery] identifier[b] operator[=] Keyword[new] identifier[BooleanQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Object] identifier[element] operator[:] identifier[terms] operator[SEP] {
identifier[b] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[JcrTermQuery] operator[SEP] operator[SEP] identifier[Term] operator[SEP] identifier[element] operator[SEP] , identifier[Occur] operator[SEP] identifier[SHOULD] operator[SEP] operator[SEP]
}
identifier[query] operator[=] identifier[b] operator[SEP]
}
Keyword[return] identifier[query] operator[SEP]
}
|
public App findApplication(HttpServletRequest req, HttpServletResponse res)
{
ServletApplication application = null;
String strDatatype = BaseHttpTask.getParam(req, DBParams.DATATYPE, null); // Raw data (such as in image from the DB)
if (strDatatype != null) // NOTE: I hope there isn't an issue with getting a param before setting the data type, but I have no choice.
{ // Special case - if asking for a datatype, don't need a session, use a default application!
return this.getNonUserApplication();
}
// First, see if you are in a current session, if not create one
HttpSession session = req.getSession();
String strUserNameOrID = BaseHttpTask.cleanParam(req.getParameterValues(DBParams.USER_NAME), false, null);
if (strUserNameOrID == null)
strUserNameOrID = BaseHttpTask.cleanParam(req.getParameterValues(DBParams.USER_ID), false, null);
if (!session.isNew())
{ // Session in progress
application = (ServletApplication)session.getAttribute(DBParams.APPLICATION); // Get the currently instantiate app getValue(APPLICATION); //
if (application != null)
{ // Always
String systemName = BaseHttpTask.cleanParam(req.getParameterValues(DBConstants.SYSTEM_NAME), false, null);
if (systemName != null)
if (!Utility.getSystemSuffix(systemName, application.getProperty(DBConstants.DEFAULT_SYSTEM_NAME)).equalsIgnoreCase(Utility.getSystemSuffix(application.getProperty(DBConstants.SYSTEM_NAME), application.getProperty(DBConstants.DEFAULT_SYSTEM_NAME))))
if (strUserNameOrID == null)
strUserNameOrID = DBConstants.BLANK; // Change in system name means new app.
if (strUserNameOrID != null) // user= means new user
{
boolean bNewUser = false;
if ((strUserNameOrID.length() == 0) && (BaseHttpTask.cleanParam(req.getParameterValues(DBParams.PASSWORD), false, null) == null)) // This means logout
bNewUser = true; // Different user or up the security level
if (strUserNameOrID.length() > 0)
{
if ((BaseHttpTask.cleanParam(req.getParameterValues(DBParams.PASSWORD), false, null) != null)
&& (BaseHttpTask.cleanParam(req.getParameterValues(DBParams.PASSWORD), false, null).length() > 0))
bNewUser = true; // Supplying a password = sign on to new
if ((BaseHttpTask.cleanParam(req.getParameterValues(DBParams.AUTH_TOKEN), false, null) != null)
&& (BaseHttpTask.cleanParam(req.getParameterValues(DBParams.AUTH_TOKEN), false, null).length() > 0))
bNewUser = true; // Supplying authentication = sign on to new
if ((!strUserNameOrID.equalsIgnoreCase(application.getProperty(DBParams.USER_NAME)))
&& (!strUserNameOrID.equalsIgnoreCase(application.getProperty(DBParams.USER_ID))))
bNewUser = true;
if (systemName != null)
if (!Utility.getSystemSuffix(systemName, application.getProperty(DBConstants.DEFAULT_SYSTEM_NAME)).equalsIgnoreCase(Utility.getSystemSuffix(application.getProperty(DBConstants.SYSTEM_NAME), application.getProperty(DBConstants.DEFAULT_SYSTEM_NAME))))
bNewUser = true;
}
if (bNewUser)
{ // They want to change users
session.removeAttribute(DBParams.APPLICATION); // This also frees the application (through the xxx interface) //removeValue(APPLICATION); //
application = null;
}
}
if (application != null)
{
application = this.changeCookie(application, req, res);
application.addTask(this, null); // Will be removed on exit
this.setApplication(application);
return application; // Return the current application
}
}
}
Utility.getLogger().info("New session");
// Next, see if they are changing their userID/username
if (strUserNameOrID != null) // Note user= means "new user"
{ // Special logic - change User name/ID
Map<String,Object> properties = new Hashtable<String,Object>();
Map<String,Object> appProperties = this.getApplicationProperties(false);
if (appProperties != null)
properties.putAll(appProperties);
this.addDatabaseProperties(properties);
properties.remove(Params.USER_ID); // Being careful
properties.put(Params.USER_NAME, strUserNameOrID);
application = new ServletApplication(null, properties, null); // Read/Create the new user ID/Name
if (this.getApplication() == null)
{
application.addTask(this, null);
this.setApplication(application);
}
int iLoginError = DBConstants.NORMAL_RETURN;
if ((strUserNameOrID.length() > 0)
&& (!strUserNameOrID.equalsIgnoreCase(application.getProperty(DBParams.USER_ID)))
&& (!strUserNameOrID.equalsIgnoreCase(application.getProperty(DBParams.USER_NAME))))
iLoginError = DBConstants.ERROR_RETURN; // Invalid user - Show the sign-up screen
else
{
String strPassword = BaseHttpTask.cleanParam(req.getParameterValues(DBParams.PASSWORD), false, null);
if ((strPassword != null) && (strPassword.length() > 0))
{
try {
byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes); // TODO (don) Fix this
char[] chars = Base64.encode(bytes);
strPassword = new String(chars);
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
strPassword = null;
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
strPassword = null;
}
}
if ((strPassword == null) || (strPassword.length() == 0))
{
strPassword = BaseHttpTask.cleanParam(req.getParameterValues(DBParams.AUTH_TOKEN), false, null);
strPassword = application.authenticateToken(strPassword); // TODO(don) HACK - For now, authentication is the SHA password! See MainApplication/139
}
if ((strPassword != null) && (strPassword.length() > 0))
{
String strDomain = Utility.getDomainFromURL(BaseHttpTask.getParam(req, DBParams.URL), null);
iLoginError = application.login(this, strUserNameOrID, strPassword, strDomain);
}
}
if (iLoginError != DBConstants.NORMAL_RETURN)
{
application.login(this, null, null, null);
application.setProperty(Params.SECURITY_LEVEL, Integer.toString(Constants.LOGIN_USER)); // This will cause a security error, which will display the login screen
if (iLoginError == DBConstants.ERROR_RETURN)
application.setProperty(Params.SECURITY_MAP, Application.CREATE_USER_REQUIRED);
else
application.setProperty(Params.SECURITY_MAP, Application.LOGIN_REQUIRED);
}
}
application = this.changeCookie(application, req, res);
session.setAttribute(DBParams.APPLICATION, application); // Cache the preferences, so I can save my session putValue(APPLICATION, application);
// Note: Application will be notified of session termination in valueUnbound method
application.addTask(this, null); // Will be removed on session destroy
this.setApplication(application);
return application;
} | class class_name[name] begin[{]
method[findApplication, return_type[type[App]], modifier[public], parameter[req, res]] begin[{]
local_variable[type[ServletApplication], application]
local_variable[type[String], strDatatype]
if[binary_operation[member[.strDatatype], !=, literal[null]]] begin[{]
return[THIS[call[None.getNonUserApplication, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[HttpSession], session]
local_variable[type[String], strUserNameOrID]
if[binary_operation[member[.strUserNameOrID], ==, literal[null]]] begin[{]
assign[member[.strUserNameOrID], call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.USER_ID]]], literal[false], literal[null]]]]
else begin[{]
None
end[}]
if[call[session.isNew, parameter[]]] begin[{]
assign[member[.application], Cast(expression=MethodInvocation(arguments=[MemberReference(member=APPLICATION, postfix_operators=[], prefix_operators=[], qualifier=DBParams, selectors=[])], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ServletApplication, sub_type=None))]
if[binary_operation[member[.application], !=, literal[null]]] begin[{]
local_variable[type[String], systemName]
if[binary_operation[member[.systemName], !=, literal[null]]] begin[{]
if[call[Utility.getSystemSuffix, parameter[member[.systemName], call[application.getProperty, parameter[member[DBConstants.DEFAULT_SYSTEM_NAME]]]]]] begin[{]
if[binary_operation[member[.strUserNameOrID], ==, literal[null]]] begin[{]
assign[member[.strUserNameOrID], member[DBConstants.BLANK]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.strUserNameOrID], !=, literal[null]]] begin[{]
local_variable[type[boolean], bNewUser]
if[binary_operation[binary_operation[call[strUserNameOrID.length, parameter[]], ==, literal[0]], &&, binary_operation[call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.PASSWORD]]], literal[false], literal[null]]], ==, literal[null]]]] begin[{]
assign[member[.bNewUser], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[strUserNameOrID.length, parameter[]], >, literal[0]]] begin[{]
if[binary_operation[binary_operation[call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.PASSWORD]]], literal[false], literal[null]]], !=, literal[null]], &&, binary_operation[call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.PASSWORD]]], literal[false], literal[null]]], >, literal[0]]]] begin[{]
assign[member[.bNewUser], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.AUTH_TOKEN]]], literal[false], literal[null]]], !=, literal[null]], &&, binary_operation[call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.AUTH_TOKEN]]], literal[false], literal[null]]], >, literal[0]]]] begin[{]
assign[member[.bNewUser], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[strUserNameOrID.equalsIgnoreCase, parameter[call[application.getProperty, parameter[member[DBParams.USER_NAME]]]]], &&, call[strUserNameOrID.equalsIgnoreCase, parameter[call[application.getProperty, parameter[member[DBParams.USER_ID]]]]]]] begin[{]
assign[member[.bNewUser], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.systemName], !=, literal[null]]] begin[{]
if[call[Utility.getSystemSuffix, parameter[member[.systemName], call[application.getProperty, parameter[member[DBConstants.DEFAULT_SYSTEM_NAME]]]]]] begin[{]
assign[member[.bNewUser], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[member[.bNewUser]] begin[{]
call[session.removeAttribute, parameter[member[DBParams.APPLICATION]]]
assign[member[.application], literal[null]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.application], !=, literal[null]]] begin[{]
assign[member[.application], THIS[call[None.changeCookie, parameter[member[.application], member[.req], member[.res]]]]]
call[application.addTask, parameter[THIS[], literal[null]]]
THIS[call[None.setApplication, parameter[member[.application]]]]
return[member[.application]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[Utility.getLogger, parameter[]]
if[binary_operation[member[.strUserNameOrID], !=, literal[null]]] begin[{]
local_variable[type[Map], properties]
local_variable[type[Map], appProperties]
if[binary_operation[member[.appProperties], !=, literal[null]]] begin[{]
call[properties.putAll, parameter[member[.appProperties]]]
else begin[{]
None
end[}]
THIS[call[None.addDatabaseProperties, parameter[member[.properties]]]]
call[properties.remove, parameter[member[Params.USER_ID]]]
call[properties.put, parameter[member[Params.USER_NAME], member[.strUserNameOrID]]]
assign[member[.application], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServletApplication, sub_type=None))]
if[binary_operation[THIS[call[None.getApplication, parameter[]]], ==, literal[null]]] begin[{]
call[application.addTask, parameter[THIS[], literal[null]]]
THIS[call[None.setApplication, parameter[member[.application]]]]
else begin[{]
None
end[}]
local_variable[type[int], iLoginError]
if[binary_operation[binary_operation[binary_operation[call[strUserNameOrID.length, parameter[]], >, literal[0]], &&, call[strUserNameOrID.equalsIgnoreCase, parameter[call[application.getProperty, parameter[member[DBParams.USER_ID]]]]]], &&, call[strUserNameOrID.equalsIgnoreCase, parameter[call[application.getProperty, parameter[member[DBParams.USER_NAME]]]]]]] begin[{]
assign[member[.iLoginError], member[DBConstants.ERROR_RETURN]]
else begin[{]
local_variable[type[String], strPassword]
if[binary_operation[binary_operation[member[.strPassword], !=, literal[null]], &&, binary_operation[call[strPassword.length, parameter[]], >, literal[0]]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=DEFAULT_ENCODING, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=strPassword, selectors=[], type_arguments=None), name=bytes)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeSHA, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[], type_arguments=None), name=chars)], modifiers=set(), type=BasicType(dimensions=[None], name=char)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=chars, 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=String, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NoSuchAlgorithmException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.strPassword], ==, literal[null]], ||, binary_operation[call[strPassword.length, parameter[]], ==, literal[0]]]] begin[{]
assign[member[.strPassword], call[BaseHttpTask.cleanParam, parameter[call[req.getParameterValues, parameter[member[DBParams.AUTH_TOKEN]]], literal[false], literal[null]]]]
assign[member[.strPassword], call[application.authenticateToken, parameter[member[.strPassword]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.strPassword], !=, literal[null]], &&, binary_operation[call[strPassword.length, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[String], strDomain]
assign[member[.iLoginError], call[application.login, parameter[THIS[], member[.strUserNameOrID], member[.strPassword], member[.strDomain]]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.iLoginError], !=, member[DBConstants.NORMAL_RETURN]]] begin[{]
call[application.login, parameter[THIS[], literal[null], literal[null], literal[null]]]
call[application.setProperty, parameter[member[Params.SECURITY_LEVEL], call[Integer.toString, parameter[member[Constants.LOGIN_USER]]]]]
if[binary_operation[member[.iLoginError], ==, member[DBConstants.ERROR_RETURN]]] begin[{]
call[application.setProperty, parameter[member[Params.SECURITY_MAP], member[Application.CREATE_USER_REQUIRED]]]
else begin[{]
call[application.setProperty, parameter[member[Params.SECURITY_MAP], member[Application.LOGIN_REQUIRED]]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.application], THIS[call[None.changeCookie, parameter[member[.application], member[.req], member[.res]]]]]
call[session.setAttribute, parameter[member[DBParams.APPLICATION], member[.application]]]
call[application.addTask, parameter[THIS[], literal[null]]]
THIS[call[None.setApplication, parameter[member[.application]]]]
return[member[.application]]
end[}]
END[}] | Keyword[public] identifier[App] identifier[findApplication] operator[SEP] identifier[HttpServletRequest] identifier[req] , identifier[HttpServletResponse] identifier[res] operator[SEP] {
identifier[ServletApplication] identifier[application] operator[=] Other[null] operator[SEP] identifier[String] identifier[strDatatype] operator[=] identifier[BaseHttpTask] operator[SEP] identifier[getParam] operator[SEP] identifier[req] , identifier[DBParams] operator[SEP] identifier[DATATYPE] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strDatatype] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[getNonUserApplication] operator[SEP] operator[SEP] operator[SEP]
}
identifier[HttpSession] identifier[session] operator[=] identifier[req] operator[SEP] identifier[getSession] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strUserNameOrID] operator[=] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[USER_NAME] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strUserNameOrID] operator[==] Other[null] operator[SEP] identifier[strUserNameOrID] operator[=] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[USER_ID] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[session] operator[SEP] identifier[isNew] operator[SEP] operator[SEP] operator[SEP] {
identifier[application] operator[=] operator[SEP] identifier[ServletApplication] operator[SEP] identifier[session] operator[SEP] identifier[getAttribute] operator[SEP] identifier[DBParams] operator[SEP] identifier[APPLICATION] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[application] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[systemName] operator[=] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBConstants] operator[SEP] identifier[SYSTEM_NAME] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[systemName] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Utility] operator[SEP] identifier[getSystemSuffix] operator[SEP] identifier[systemName] , identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBConstants] operator[SEP] identifier[DEFAULT_SYSTEM_NAME] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[Utility] operator[SEP] identifier[getSystemSuffix] operator[SEP] identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBConstants] operator[SEP] identifier[SYSTEM_NAME] operator[SEP] , identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBConstants] operator[SEP] identifier[DEFAULT_SYSTEM_NAME] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strUserNameOrID] operator[==] Other[null] operator[SEP] identifier[strUserNameOrID] operator[=] identifier[DBConstants] operator[SEP] identifier[BLANK] operator[SEP] Keyword[if] operator[SEP] identifier[strUserNameOrID] operator[!=] Other[null] operator[SEP] {
Keyword[boolean] identifier[bNewUser] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[strUserNameOrID] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[PASSWORD] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] identifier[bNewUser] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[strUserNameOrID] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[PASSWORD] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[PASSWORD] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] identifier[bNewUser] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[AUTH_TOKEN] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[AUTH_TOKEN] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] identifier[bNewUser] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[!] identifier[strUserNameOrID] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[USER_NAME] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[strUserNameOrID] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[USER_ID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bNewUser] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[systemName] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Utility] operator[SEP] identifier[getSystemSuffix] operator[SEP] identifier[systemName] , identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBConstants] operator[SEP] identifier[DEFAULT_SYSTEM_NAME] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[Utility] operator[SEP] identifier[getSystemSuffix] operator[SEP] identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBConstants] operator[SEP] identifier[SYSTEM_NAME] operator[SEP] , identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBConstants] operator[SEP] identifier[DEFAULT_SYSTEM_NAME] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bNewUser] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[bNewUser] operator[SEP] {
identifier[session] operator[SEP] identifier[removeAttribute] operator[SEP] identifier[DBParams] operator[SEP] identifier[APPLICATION] operator[SEP] operator[SEP] identifier[application] operator[=] Other[null] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[application] operator[!=] Other[null] operator[SEP] {
identifier[application] operator[=] Keyword[this] operator[SEP] identifier[changeCookie] operator[SEP] identifier[application] , identifier[req] , identifier[res] operator[SEP] operator[SEP] identifier[application] operator[SEP] identifier[addTask] operator[SEP] Keyword[this] , Other[null] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setApplication] operator[SEP] identifier[application] operator[SEP] operator[SEP] Keyword[return] identifier[application] operator[SEP]
}
}
}
identifier[Utility] operator[SEP] identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strUserNameOrID] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[=] Keyword[new] identifier[Hashtable] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[appProperties] operator[=] Keyword[this] operator[SEP] identifier[getApplicationProperties] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[appProperties] operator[!=] Other[null] operator[SEP] identifier[properties] operator[SEP] identifier[putAll] operator[SEP] identifier[appProperties] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addDatabaseProperties] operator[SEP] identifier[properties] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[remove] operator[SEP] identifier[Params] operator[SEP] identifier[USER_ID] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[Params] operator[SEP] identifier[USER_NAME] , identifier[strUserNameOrID] operator[SEP] operator[SEP] identifier[application] operator[=] Keyword[new] identifier[ServletApplication] operator[SEP] Other[null] , identifier[properties] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[application] operator[SEP] identifier[addTask] operator[SEP] Keyword[this] , Other[null] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setApplication] operator[SEP] identifier[application] operator[SEP] operator[SEP]
}
Keyword[int] identifier[iLoginError] operator[=] identifier[DBConstants] operator[SEP] identifier[NORMAL_RETURN] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[strUserNameOrID] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[strUserNameOrID] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[USER_ID] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[strUserNameOrID] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[application] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[USER_NAME] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[iLoginError] operator[=] identifier[DBConstants] operator[SEP] identifier[ERROR_RETURN] operator[SEP] Keyword[else] {
identifier[String] identifier[strPassword] operator[=] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[PASSWORD] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[strPassword] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[strPassword] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[strPassword] operator[SEP] identifier[getBytes] operator[SEP] identifier[Base64] operator[SEP] identifier[DEFAULT_ENCODING] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[Base64] operator[SEP] identifier[encodeSHA] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[chars] operator[=] identifier[Base64] operator[SEP] identifier[encode] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] identifier[strPassword] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[chars] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] identifier[strPassword] operator[=] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] identifier[strPassword] operator[=] Other[null] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[strPassword] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[strPassword] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] {
identifier[strPassword] operator[=] identifier[BaseHttpTask] operator[SEP] identifier[cleanParam] operator[SEP] identifier[req] operator[SEP] identifier[getParameterValues] operator[SEP] identifier[DBParams] operator[SEP] identifier[AUTH_TOKEN] operator[SEP] , literal[boolean] , Other[null] operator[SEP] operator[SEP] identifier[strPassword] operator[=] identifier[application] operator[SEP] identifier[authenticateToken] operator[SEP] identifier[strPassword] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[strPassword] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[strPassword] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
identifier[String] identifier[strDomain] operator[=] identifier[Utility] operator[SEP] identifier[getDomainFromURL] operator[SEP] identifier[BaseHttpTask] operator[SEP] identifier[getParam] operator[SEP] identifier[req] , identifier[DBParams] operator[SEP] identifier[URL] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[iLoginError] operator[=] identifier[application] operator[SEP] identifier[login] operator[SEP] Keyword[this] , identifier[strUserNameOrID] , identifier[strPassword] , identifier[strDomain] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[iLoginError] operator[!=] identifier[DBConstants] operator[SEP] identifier[NORMAL_RETURN] operator[SEP] {
identifier[application] operator[SEP] identifier[login] operator[SEP] Keyword[this] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[application] operator[SEP] identifier[setProperty] operator[SEP] identifier[Params] operator[SEP] identifier[SECURITY_LEVEL] , identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[Constants] operator[SEP] identifier[LOGIN_USER] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iLoginError] operator[==] identifier[DBConstants] operator[SEP] identifier[ERROR_RETURN] operator[SEP] identifier[application] operator[SEP] identifier[setProperty] operator[SEP] identifier[Params] operator[SEP] identifier[SECURITY_MAP] , identifier[Application] operator[SEP] identifier[CREATE_USER_REQUIRED] operator[SEP] operator[SEP] Keyword[else] identifier[application] operator[SEP] identifier[setProperty] operator[SEP] identifier[Params] operator[SEP] identifier[SECURITY_MAP] , identifier[Application] operator[SEP] identifier[LOGIN_REQUIRED] operator[SEP] operator[SEP]
}
}
identifier[application] operator[=] Keyword[this] operator[SEP] identifier[changeCookie] operator[SEP] identifier[application] , identifier[req] , identifier[res] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[setAttribute] operator[SEP] identifier[DBParams] operator[SEP] identifier[APPLICATION] , identifier[application] operator[SEP] operator[SEP] identifier[application] operator[SEP] identifier[addTask] operator[SEP] Keyword[this] , Other[null] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setApplication] operator[SEP] identifier[application] operator[SEP] operator[SEP] Keyword[return] identifier[application] operator[SEP]
}
|
public void objectTerminated(Object object, Exception e)
{
// Allows to unblock all terminating threads
synchronized (terminatedLock)
{
if (terminated)
{
return;
}
terminated = true;
}
engine.removeTerminationListener(this);
if (streamManager != null)
{
streamManager.removeTerminationListener(this);
}
if (notificationManager != null)
{
notificationManager.removeTerminationListener(this);
}
// Request terminate
requestTerminateImpl(object);
try
{
waitTerminatedImpl(object);
} catch (InterruptedException ex)
{
// OK, interrrputed
}
fireObjectTerminated(e);
} | class class_name[name] begin[{]
method[objectTerminated, return_type[void], modifier[public], parameter[object, e]] begin[{]
SYNCHRONIZED[member[.terminatedLock]] BEGIN[{]
if[member[.terminated]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.terminated], literal[true]]
END[}]
call[engine.removeTerminationListener, parameter[THIS[]]]
if[binary_operation[member[.streamManager], !=, literal[null]]] begin[{]
call[streamManager.removeTerminationListener, parameter[THIS[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.notificationManager], !=, literal[null]]] begin[{]
call[notificationManager.removeTerminationListener, parameter[THIS[]]]
else begin[{]
None
end[}]
call[.requestTerminateImpl, parameter[member[.object]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=waitTerminatedImpl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
call[.fireObjectTerminated, parameter[member[.e]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[objectTerminated] operator[SEP] identifier[Object] identifier[object] , identifier[Exception] identifier[e] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[terminatedLock] operator[SEP] {
Keyword[if] operator[SEP] identifier[terminated] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[terminated] operator[=] literal[boolean] operator[SEP]
}
identifier[engine] operator[SEP] identifier[removeTerminationListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[streamManager] operator[!=] Other[null] operator[SEP] {
identifier[streamManager] operator[SEP] identifier[removeTerminationListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[notificationManager] operator[!=] Other[null] operator[SEP] {
identifier[notificationManager] operator[SEP] identifier[removeTerminationListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
identifier[requestTerminateImpl] operator[SEP] identifier[object] operator[SEP] operator[SEP] Keyword[try] {
identifier[waitTerminatedImpl] operator[SEP] identifier[object] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[ex] operator[SEP] {
}
identifier[fireObjectTerminated] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
|
public ContentPermissionManager getContentPermissionManager() {
if (contentPermissionManager != null) {
return contentPermissionManager;
}
contentPermissionManager = (ContentPermissionManager) ContainerManager.getComponent("contentPermissionManager");
return contentPermissionManager;
} | class class_name[name] begin[{]
method[getContentPermissionManager, return_type[type[ContentPermissionManager]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.contentPermissionManager], !=, literal[null]]] begin[{]
return[member[.contentPermissionManager]]
else begin[{]
None
end[}]
assign[member[.contentPermissionManager], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="contentPermissionManager")], member=getComponent, postfix_operators=[], prefix_operators=[], qualifier=ContainerManager, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ContentPermissionManager, sub_type=None))]
return[member[.contentPermissionManager]]
end[}]
END[}] | Keyword[public] identifier[ContentPermissionManager] identifier[getContentPermissionManager] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[contentPermissionManager] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[contentPermissionManager] operator[SEP]
}
identifier[contentPermissionManager] operator[=] operator[SEP] identifier[ContentPermissionManager] operator[SEP] identifier[ContainerManager] operator[SEP] identifier[getComponent] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[contentPermissionManager] operator[SEP]
}
|
protected HtmlTree getClassUseHeader() {
String cltype = configuration.getText(classdoc.isInterface()?
"doclet.Interface":"doclet.Class");
String clname = classdoc.qualifiedName();
String title = configuration.getText("doclet.Window_ClassUse_Header",
cltype, clname);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
ContentBuilder headContent = new ContentBuilder();
headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
headContent.addContent(new HtmlTree(HtmlTag.BR));
headContent.addContent(clname);
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
true, HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
} | class class_name[name] begin[{]
method[getClassUseHeader, return_type[type[HtmlTree]], modifier[protected], parameter[]] begin[{]
local_variable[type[String], cltype]
local_variable[type[String], clname]
local_variable[type[String], title]
local_variable[type[HtmlTree], bodyTree]
local_variable[type[HtmlTree], htmlTree]
call[.addTop, parameter[member[.htmlTree]]]
call[.addNavLinks, parameter[literal[true], member[.htmlTree]]]
if[call[configuration.allowTag, parameter[member[HtmlTag.HEADER]]]] begin[{]
call[bodyTree.addContent, parameter[member[.htmlTree]]]
else begin[{]
None
end[}]
local_variable[type[ContentBuilder], headContent]
call[headContent.addContent, parameter[call[.getResource, parameter[literal["doclet.ClassUse_Title"], member[.cltype]]]]]
call[headContent.addContent, parameter[ClassCreator(arguments=[MemberReference(member=BR, postfix_operators=[], prefix_operators=[], qualifier=HtmlTag, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HtmlTree, sub_type=None))]]
call[headContent.addContent, parameter[member[.clname]]]
local_variable[type[Content], heading]
local_variable[type[Content], div]
if[call[configuration.allowTag, parameter[member[HtmlTag.MAIN]]]] begin[{]
call[mainTree.addContent, parameter[member[.div]]]
else begin[{]
call[bodyTree.addContent, parameter[member[.div]]]
end[}]
return[member[.bodyTree]]
end[}]
END[}] | Keyword[protected] identifier[HtmlTree] identifier[getClassUseHeader] operator[SEP] operator[SEP] {
identifier[String] identifier[cltype] operator[=] identifier[configuration] operator[SEP] identifier[getText] operator[SEP] identifier[classdoc] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[clname] operator[=] identifier[classdoc] operator[SEP] identifier[qualifiedName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[title] operator[=] identifier[configuration] operator[SEP] identifier[getText] operator[SEP] literal[String] , identifier[cltype] , identifier[clname] operator[SEP] operator[SEP] identifier[HtmlTree] identifier[bodyTree] operator[=] identifier[getBody] operator[SEP] literal[boolean] , identifier[getWindowTitle] operator[SEP] identifier[title] operator[SEP] operator[SEP] operator[SEP] identifier[HtmlTree] identifier[htmlTree] operator[=] operator[SEP] identifier[configuration] operator[SEP] identifier[allowTag] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[HEADER] operator[SEP] operator[SEP] operator[?] identifier[HtmlTree] operator[SEP] identifier[HEADER] operator[SEP] operator[SEP] operator[:] identifier[bodyTree] operator[SEP] identifier[addTop] operator[SEP] identifier[htmlTree] operator[SEP] operator[SEP] identifier[addNavLinks] operator[SEP] literal[boolean] , identifier[htmlTree] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[configuration] operator[SEP] identifier[allowTag] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[HEADER] operator[SEP] operator[SEP] {
identifier[bodyTree] operator[SEP] identifier[addContent] operator[SEP] identifier[htmlTree] operator[SEP] operator[SEP]
}
identifier[ContentBuilder] identifier[headContent] operator[=] Keyword[new] identifier[ContentBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[headContent] operator[SEP] identifier[addContent] operator[SEP] identifier[getResource] operator[SEP] literal[String] , identifier[cltype] operator[SEP] operator[SEP] operator[SEP] identifier[headContent] operator[SEP] identifier[addContent] operator[SEP] Keyword[new] identifier[HtmlTree] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[BR] operator[SEP] operator[SEP] operator[SEP] identifier[headContent] operator[SEP] identifier[addContent] operator[SEP] identifier[clname] operator[SEP] operator[SEP] identifier[Content] identifier[heading] operator[=] identifier[HtmlTree] operator[SEP] identifier[HEADING] operator[SEP] identifier[HtmlConstants] operator[SEP] identifier[CLASS_PAGE_HEADING] , literal[boolean] , identifier[HtmlStyle] operator[SEP] identifier[title] , identifier[headContent] operator[SEP] operator[SEP] identifier[Content] identifier[div] operator[=] identifier[HtmlTree] operator[SEP] identifier[DIV] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[header] , identifier[heading] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[configuration] operator[SEP] identifier[allowTag] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[MAIN] operator[SEP] operator[SEP] {
identifier[mainTree] operator[SEP] identifier[addContent] operator[SEP] identifier[div] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bodyTree] operator[SEP] identifier[addContent] operator[SEP] identifier[div] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bodyTree] operator[SEP]
}
|
public OptionGroupOptionSetting withMinimumEngineVersionPerAllowedValue(MinimumEngineVersionPerAllowedValue... minimumEngineVersionPerAllowedValue) {
if (this.minimumEngineVersionPerAllowedValue == null) {
setMinimumEngineVersionPerAllowedValue(new com.amazonaws.internal.SdkInternalList<MinimumEngineVersionPerAllowedValue>(
minimumEngineVersionPerAllowedValue.length));
}
for (MinimumEngineVersionPerAllowedValue ele : minimumEngineVersionPerAllowedValue) {
this.minimumEngineVersionPerAllowedValue.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withMinimumEngineVersionPerAllowedValue, return_type[type[OptionGroupOptionSetting]], modifier[public], parameter[minimumEngineVersionPerAllowedValue]] begin[{]
if[binary_operation[THIS[member[None.minimumEngineVersionPerAllowedValue]], ==, literal[null]]] begin[{]
call[.setMinimumEngineVersionPerAllowedValue, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=minimumEngineVersionPerAllowedValue, selectors=[])], 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=MinimumEngineVersionPerAllowedValue, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=minimumEngineVersionPerAllowedValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=minimumEngineVersionPerAllowedValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MinimumEngineVersionPerAllowedValue, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[OptionGroupOptionSetting] identifier[withMinimumEngineVersionPerAllowedValue] operator[SEP] identifier[MinimumEngineVersionPerAllowedValue] operator[...] identifier[minimumEngineVersionPerAllowedValue] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[minimumEngineVersionPerAllowedValue] operator[==] Other[null] operator[SEP] {
identifier[setMinimumEngineVersionPerAllowedValue] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[MinimumEngineVersionPerAllowedValue] operator[>] operator[SEP] identifier[minimumEngineVersionPerAllowedValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[MinimumEngineVersionPerAllowedValue] identifier[ele] operator[:] identifier[minimumEngineVersionPerAllowedValue] operator[SEP] {
Keyword[this] operator[SEP] identifier[minimumEngineVersionPerAllowedValue] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static double getLowerBoundForBoverA(final long a, final long b, final double f) {
checkInputs(a, b, f);
if (a == 0) { return 0.0; }
if (f == 1.0) { return (double) b / a; }
return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f));
} | class class_name[name] begin[{]
method[getLowerBoundForBoverA, return_type[type[double]], modifier[public static], parameter[a, b, f]] begin[{]
call[.checkInputs, parameter[member[.a], member[.b], member[.f]]]
if[binary_operation[member[.a], ==, literal[0]]] begin[{]
return[literal[0.0]]
else begin[{]
None
end[}]
if[binary_operation[member[.f], ==, literal[1.0]]] begin[{]
return[binary_operation[Cast(expression=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double)), /, member[.a]]]
else begin[{]
None
end[}]
return[call[.approximateLowerBoundOnP, parameter[member[.a], member[.b], binary_operation[member[.NUM_STD_DEVS], *, call[.hackyAdjuster, parameter[member[.f]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[getLowerBoundForBoverA] operator[SEP] Keyword[final] Keyword[long] identifier[a] , Keyword[final] Keyword[long] identifier[b] , Keyword[final] Keyword[double] identifier[f] operator[SEP] {
identifier[checkInputs] operator[SEP] identifier[a] , identifier[b] , identifier[f] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[Float] operator[SEP]
}
Keyword[if] operator[SEP] identifier[f] operator[==] literal[Float] operator[SEP] {
Keyword[return] operator[SEP] Keyword[double] operator[SEP] identifier[b] operator[/] identifier[a] operator[SEP]
}
Keyword[return] identifier[approximateLowerBoundOnP] operator[SEP] identifier[a] , identifier[b] , identifier[NUM_STD_DEVS] operator[*] identifier[hackyAdjuster] operator[SEP] identifier[f] operator[SEP] operator[SEP] operator[SEP]
}
|
public static long max( long []array , int offset , int length ) {
long max = -Long.MAX_VALUE;
for (int i = 0; i < length; i++) {
long tmp = array[offset+i];
if( tmp > max ) {
max = tmp;
}
}
return max;
} | class class_name[name] begin[{]
method[max, return_type[type[long]], modifier[public static], parameter[array, offset, length]] begin[{]
local_variable[type[long], max]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), name=tmp)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, 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[member[.max]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[max] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] {
Keyword[long] identifier[max] operator[=] operator[-] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[long] identifier[tmp] operator[=] identifier[array] operator[SEP] identifier[offset] operator[+] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tmp] operator[>] identifier[max] operator[SEP] {
identifier[max] operator[=] identifier[tmp] operator[SEP]
}
}
Keyword[return] identifier[max] operator[SEP]
}
|
public HttpHealthCheckedEndpointGroup build() {
return new HttpHealthCheckedEndpointGroup(clientFactory, delegate, protocol, healthCheckPath,
healthCheckPort, retryInterval, configurator);
} | class class_name[name] begin[{]
method[build, return_type[type[HttpHealthCheckedEndpointGroup]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=clientFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delegate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=protocol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=healthCheckPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=healthCheckPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=retryInterval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=configurator, 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=HttpHealthCheckedEndpointGroup, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[HttpHealthCheckedEndpointGroup] identifier[build] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[HttpHealthCheckedEndpointGroup] operator[SEP] identifier[clientFactory] , identifier[delegate] , identifier[protocol] , identifier[healthCheckPath] , identifier[healthCheckPort] , identifier[retryInterval] , identifier[configurator] operator[SEP] operator[SEP]
}
|
@Override
public DeleteDatastoreResult deleteDatastore(DeleteDatastoreRequest request) {
request = beforeClientExecution(request);
return executeDeleteDatastore(request);
} | class class_name[name] begin[{]
method[deleteDatastore, return_type[type[DeleteDatastoreResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteDatastore, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DeleteDatastoreResult] identifier[deleteDatastore] operator[SEP] identifier[DeleteDatastoreRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteDatastore] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public MultiFileResource add(File... files) {
for (File file : files) {
this.add(new FileResource(file));
}
return this;
} | class class_name[name] begin[{]
method[add, return_type[type[MultiFileResource]], modifier[public], parameter[files]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[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=FileResource, sub_type=None))], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, 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)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[MultiFileResource] identifier[add] operator[SEP] identifier[File] operator[...] identifier[files] operator[SEP] {
Keyword[for] operator[SEP] identifier[File] identifier[file] operator[:] identifier[files] operator[SEP] {
Keyword[this] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[FileResource] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@SuppressWarnings({"unchecked"})
public static <T> T read(InputStream jsonInputStream, String jsonPath, Predicate... filters) throws IOException {
return new ParseContextImpl().parse(jsonInputStream).read(jsonPath, filters);
} | class class_name[name] begin[{]
method[read, return_type[type[T]], modifier[public static], parameter[jsonInputStream, jsonPath, filters]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=jsonInputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=jsonPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ParseContextImpl, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String]
} operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[read] operator[SEP] identifier[InputStream] identifier[jsonInputStream] , identifier[String] identifier[jsonPath] , identifier[Predicate] operator[...] identifier[filters] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] Keyword[new] identifier[ParseContextImpl] operator[SEP] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[jsonInputStream] operator[SEP] operator[SEP] identifier[read] operator[SEP] identifier[jsonPath] , identifier[filters] operator[SEP] operator[SEP]
}
|
public static LanguageExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (LANGUAGE_EXTENSION_ID == extension.getId())
return (LanguageExtension)extension;
}
return null;
} | class class_name[name] begin[{]
method[findFirst, return_type[type[LanguageExtension]], modifier[public static], parameter[extensions]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LANGUAGE_EXTENSION_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=extension, selectors=[], type_arguments=None), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=Cast(expression=MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LanguageExtension, sub_type=None)), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=extensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=extension)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Extension, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[LanguageExtension] identifier[findFirst] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[Extension] operator[>] identifier[extensions] operator[SEP] {
Keyword[for] operator[SEP] identifier[Extension] identifier[extension] operator[:] identifier[extensions] operator[SEP] {
Keyword[if] operator[SEP] identifier[LANGUAGE_EXTENSION_ID] operator[==] identifier[extension] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[LanguageExtension] operator[SEP] identifier[extension] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public List<byte[]> lookup() {
try {
return lookupAsync().join();
} catch (InterruptedException e) {
LOG.error("Interrupted performing lookup", e);
Thread.currentThread().interrupt();
return null;
} catch (DeferredGroupException e) {
final Throwable ex = Exceptions.getCause(e);
if (ex instanceof NoSuchUniqueName) {
throw (NoSuchUniqueName)ex;
}
throw new RuntimeException("Unexpected exception", ex);
} catch (NoSuchUniqueName e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
} | class class_name[name] begin[{]
method[lookup, return_type[type[List]], modifier[public], parameter[]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=lookupAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=join, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Interrupted performing lookup"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=Exceptions, selectors=[], type_arguments=None), name=ex)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=NoSuchUniqueName, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=Cast(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=NoSuchUniqueName, sub_type=None)), label=None)])), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected exception"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DeferredGroupException'])), CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchUniqueName'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected exception"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[List] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[lookup] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[lookupAsync] operator[SEP] operator[SEP] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DeferredGroupException] identifier[e] operator[SEP] {
Keyword[final] identifier[Throwable] identifier[ex] operator[=] identifier[Exceptions] operator[SEP] identifier[getCause] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[NoSuchUniqueName] operator[SEP] {
Keyword[throw] operator[SEP] identifier[NoSuchUniqueName] operator[SEP] identifier[ex] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchUniqueName] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public String replace(String content, String selector, String replacement) {
return replaceAll(content, Collections.singletonMap(selector, replacement));
} | class class_name[name] begin[{]
method[replace, return_type[type[String]], modifier[public], parameter[content, selector, replacement]] begin[{]
return[call[.replaceAll, parameter[member[.content], call[Collections.singletonMap, parameter[member[.selector], member[.replacement]]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[replace] operator[SEP] identifier[String] identifier[content] , identifier[String] identifier[selector] , identifier[String] identifier[replacement] operator[SEP] {
Keyword[return] identifier[replaceAll] operator[SEP] identifier[content] , identifier[Collections] operator[SEP] identifier[singletonMap] operator[SEP] identifier[selector] , identifier[replacement] operator[SEP] operator[SEP] operator[SEP]
}
|
public long time(final Stat name) {
name.requiresTimer();
final Stopwatch stopwatch = tracker.getTimers().get(name);
return stopwatch == null ? 0 : stopwatch.elapsed(TimeUnit.MILLISECONDS);
} | class class_name[name] begin[{]
method[time, return_type[type[long]], modifier[public], parameter[name]] begin[{]
call[name.requiresTimer, parameter[]]
local_variable[type[Stopwatch], stopwatch]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=stopwatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=elapsed, postfix_operators=[], prefix_operators=[], qualifier=stopwatch, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[time] operator[SEP] Keyword[final] identifier[Stat] identifier[name] operator[SEP] {
identifier[name] operator[SEP] identifier[requiresTimer] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Stopwatch] identifier[stopwatch] operator[=] identifier[tracker] operator[SEP] identifier[getTimers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[stopwatch] operator[==] Other[null] operator[?] Other[0] operator[:] identifier[stopwatch] operator[SEP] identifier[elapsed] operator[SEP] identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
|
public static PathMappingResult of(String path, @Nullable String query) {
return of(path, query, ImmutableMap.of());
} | class class_name[name] begin[{]
method[of, return_type[type[PathMappingResult]], modifier[public static], parameter[path, query]] begin[{]
return[call[.of, parameter[member[.path], member[.query], call[ImmutableMap.of, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PathMappingResult] identifier[of] operator[SEP] identifier[String] identifier[path] , annotation[@] identifier[Nullable] identifier[String] identifier[query] operator[SEP] {
Keyword[return] identifier[of] operator[SEP] identifier[path] , identifier[query] , identifier[ImmutableMap] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void putContext(@SuppressWarnings("rawtypes") Class key,
Object contextObject) {
if (wrappedContext == null) {
super.putContext(key, contextObject);
} else {
wrappedContext.putContext(key, contextObject);
}
} | class class_name[name] begin[{]
method[putContext, return_type[void], modifier[public], parameter[key, contextObject]] begin[{]
if[binary_operation[member[.wrappedContext], ==, literal[null]]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contextObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putContext, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
else begin[{]
call[wrappedContext.putContext, parameter[member[.key], member[.contextObject]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[putContext] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Class] identifier[key] , identifier[Object] identifier[contextObject] operator[SEP] {
Keyword[if] operator[SEP] identifier[wrappedContext] operator[==] Other[null] operator[SEP] {
Keyword[super] operator[SEP] identifier[putContext] operator[SEP] identifier[key] , identifier[contextObject] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[wrappedContext] operator[SEP] identifier[putContext] operator[SEP] identifier[key] , identifier[contextObject] operator[SEP] operator[SEP]
}
}
|
@Override
public void enlargeFile(long toEnlarge) throws IOException {
size += (long) Math.ceil((double) toEnlarge / incrementSize) * incrementSize;
logger.debug("Enlarge filesize of {} to {}", osFile, size);
contentEnd = size;
accessFile.setLength(size);
// TODO check buffer size
// if there are more chunks than the index can contain
if ((size - contentStart) / chunkSize > indexSize) {
logger.error("File-Enlargement not possible. The index becomes too large.");
throw new IOException("File-Enlargement not possible. The index becomes too large.");
}
calcIndexInformations();
} | class class_name[name] begin[{]
method[enlargeFile, return_type[void], modifier[public], parameter[toEnlarge]] begin[{]
assign[member[.size], binary_operation[Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MemberReference(member=toEnlarge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double)), operandr=MemberReference(member=incrementSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)], member=ceil, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=long)), *, member[.incrementSize]]]
call[logger.debug, parameter[literal["Enlarge filesize of {} to {}"], member[.osFile], member[.size]]]
assign[member[.contentEnd], member[.size]]
call[accessFile.setLength, parameter[member[.size]]]
if[binary_operation[binary_operation[binary_operation[member[.size], -, member[.contentStart]], /, member[.chunkSize]], >, member[.indexSize]]] begin[{]
call[logger.error, parameter[literal["File-Enlargement not possible. The index becomes too large."]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="File-Enlargement not possible. The index becomes too large.")], 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[}]
call[.calcIndexInformations, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[enlargeFile] operator[SEP] Keyword[long] identifier[toEnlarge] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[size] operator[+=] operator[SEP] Keyword[long] operator[SEP] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] operator[SEP] Keyword[double] operator[SEP] identifier[toEnlarge] operator[/] identifier[incrementSize] operator[SEP] operator[*] identifier[incrementSize] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[osFile] , identifier[size] operator[SEP] operator[SEP] identifier[contentEnd] operator[=] identifier[size] operator[SEP] identifier[accessFile] operator[SEP] identifier[setLength] operator[SEP] identifier[size] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[size] operator[-] identifier[contentStart] operator[SEP] operator[/] identifier[chunkSize] operator[>] identifier[indexSize] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[calcIndexInformations] operator[SEP] operator[SEP] operator[SEP]
}
|
public MustacheEngineBuilder addResolver(Resolver resolver) {
checkArgumentNotNull(resolver);
checkNotBuilt();
this.resolvers.add(resolver);
return this;
} | class class_name[name] begin[{]
method[addResolver, return_type[type[MustacheEngineBuilder]], modifier[public], parameter[resolver]] begin[{]
call[.checkArgumentNotNull, parameter[member[.resolver]]]
call[.checkNotBuilt, parameter[]]
THIS[member[None.resolvers]call[None.add, parameter[member[.resolver]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[MustacheEngineBuilder] identifier[addResolver] operator[SEP] identifier[Resolver] identifier[resolver] operator[SEP] {
identifier[checkArgumentNotNull] operator[SEP] identifier[resolver] operator[SEP] operator[SEP] identifier[checkNotBuilt] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[resolvers] operator[SEP] identifier[add] operator[SEP] identifier[resolver] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public ElementDefinitionDt setRepresentation(java.util.List<BoundCodeDt<PropertyRepresentationEnum>> theValue) {
myRepresentation = theValue;
return this;
} | class class_name[name] begin[{]
method[setRepresentation, return_type[type[ElementDefinitionDt]], modifier[public], parameter[theValue]] begin[{]
assign[member[.myRepresentation], member[.theValue]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ElementDefinitionDt] identifier[setRepresentation] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[BoundCodeDt] operator[<] identifier[PropertyRepresentationEnum] operator[>] operator[>] identifier[theValue] operator[SEP] {
identifier[myRepresentation] operator[=] identifier[theValue] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static Calendar previousInterval(final long ts, final int interval,
final int unit, final TimeZone tz) {
if (ts < 0) {
throw new IllegalArgumentException("Timestamp cannot be less than zero");
}
if (interval < 1) {
throw new IllegalArgumentException("Interval must be greater than zero");
}
int unit_override = unit;
int interval_override = interval;
final Calendar calendar;
if (tz == null) {
calendar = Calendar.getInstance(timezones.get(UTC_ID));
} else {
calendar = Calendar.getInstance(tz);
}
switch (unit_override) {
case Calendar.MILLISECOND:
if (1000 % interval_override == 0) {
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
if (interval_override > 1000) {
calendar.add(Calendar.MILLISECOND, -interval_override);
}
} else {
// from top of minute
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
}
break;
case Calendar.SECOND:
if (60 % interval_override == 0) {
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
if (interval_override > 60) {
calendar.add(Calendar.SECOND, -interval_override);
}
} else {
// from top of hour
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
}
break;
case Calendar.MINUTE:
if (60 % interval_override == 0) {
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
if (interval_override > 60) {
calendar.add(Calendar.MINUTE, -interval_override);
}
} else {
// from top of day
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
}
break;
case Calendar.HOUR_OF_DAY:
if (24 % interval_override == 0) {
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
if (interval_override > 24) {
calendar.add(Calendar.HOUR_OF_DAY, -interval_override);
}
} else {
// from top of month
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
}
break;
case Calendar.DAY_OF_MONTH:
if (interval_override == 1) {
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
} else {
// from top of year
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, 0);
}
break;
case Calendar.DAY_OF_WEEK:
if (2 % interval_override == 0) {
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());
} else {
// from top of year
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());
}
unit_override = Calendar.DAY_OF_MONTH;
interval_override = 7;
break;
case Calendar.WEEK_OF_YEAR:
// from top of year
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, 0);
break;
case Calendar.MONTH:
case Calendar.YEAR:
calendar.setTimeInMillis(ts);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.MONTH, 0);
break;
default:
throw new IllegalArgumentException("Unexpected unit_overrides of type: "
+ unit_override);
}
if (calendar.getTimeInMillis() == ts) {
return calendar;
}
// TODO optimize a bit. We probably don't need to go past then back.
while (calendar.getTimeInMillis() <= ts) {
calendar.add(unit_override, interval_override);
}
calendar.add(unit_override, -interval_override);
return calendar;
} | class class_name[name] begin[{]
method[previousInterval, return_type[type[Calendar]], modifier[public static], parameter[ts, interval, unit, tz]] begin[{]
if[binary_operation[member[.ts], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timestamp cannot be less than zero")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.interval], <, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Interval must be greater than zero")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], unit_override]
local_variable[type[int], interval_override]
local_variable[type[Calendar], calendar]
if[binary_operation[member[.tz], ==, literal[null]]] begin[{]
assign[member[.calendar], call[Calendar.getInstance, parameter[call[timezones.get, parameter[member[.UTC_ID]]]]]]
else begin[{]
assign[member[.calendar], call[Calendar.getInstance, parameter[member[.tz]]]]
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operandr=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=interval_override, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), operandr=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=interval_override, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), operandr=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=interval_override, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operandr=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=interval_override, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=DAY_OF_WEEK, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_WEEK, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MethodInvocation(arguments=[], member=getFirstDayOfWeek, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_WEEK, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MethodInvocation(arguments=[], member=getFirstDayOfWeek, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=unit_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=interval_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=WEEK_OF_YEAR, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=YEAR, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTimeInMillis, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=set, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected unit_overrides of type: "), operandr=MemberReference(member=unit_override, 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=IllegalArgumentException, sub_type=None)), label=None)])], expression=MemberReference(member=unit_override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
if[binary_operation[call[calendar.getTimeInMillis, parameter[]], ==, member[.ts]]] begin[{]
return[member[.calendar]]
else begin[{]
None
end[}]
while[binary_operation[call[calendar.getTimeInMillis, parameter[]], <=, member[.ts]]] begin[{]
call[calendar.add, parameter[member[.unit_override], member[.interval_override]]]
end[}]
call[calendar.add, parameter[member[.unit_override], member[.interval_override]]]
return[member[.calendar]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Calendar] identifier[previousInterval] operator[SEP] Keyword[final] Keyword[long] identifier[ts] , Keyword[final] Keyword[int] identifier[interval] , Keyword[final] Keyword[int] identifier[unit] , Keyword[final] identifier[TimeZone] identifier[tz] operator[SEP] {
Keyword[if] operator[SEP] identifier[ts] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[interval] operator[<] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[int] identifier[unit_override] operator[=] identifier[unit] operator[SEP] Keyword[int] identifier[interval_override] operator[=] identifier[interval] operator[SEP] Keyword[final] identifier[Calendar] identifier[calendar] operator[SEP] Keyword[if] operator[SEP] identifier[tz] operator[==] Other[null] operator[SEP] {
identifier[calendar] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] identifier[timezones] operator[SEP] identifier[get] operator[SEP] identifier[UTC_ID] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[calendar] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] identifier[tz] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[unit_override] operator[SEP] {
Keyword[case] identifier[Calendar] operator[SEP] identifier[MILLISECOND] operator[:] Keyword[if] operator[SEP] Other[1000] operator[%] identifier[interval_override] operator[==] Other[0] operator[SEP] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interval_override] operator[>] Other[1000] operator[SEP] {
identifier[calendar] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , operator[-] identifier[interval_override] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[SECOND] operator[:] Keyword[if] operator[SEP] Other[60] operator[%] identifier[interval_override] operator[==] Other[0] operator[SEP] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interval_override] operator[>] Other[60] operator[SEP] {
identifier[calendar] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , operator[-] identifier[interval_override] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[MINUTE] operator[:] Keyword[if] operator[SEP] Other[60] operator[%] identifier[interval_override] operator[==] Other[0] operator[SEP] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interval_override] operator[>] Other[60] operator[SEP] {
identifier[calendar] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , operator[-] identifier[interval_override] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] operator[:] Keyword[if] operator[SEP] Other[24] operator[%] identifier[interval_override] operator[==] Other[0] operator[SEP] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interval_override] operator[>] Other[24] operator[SEP] {
identifier[calendar] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , operator[-] identifier[interval_override] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] , Other[1] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] operator[:] Keyword[if] operator[SEP] identifier[interval_override] operator[==] Other[1] operator[SEP] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] , Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] , Other[1] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , Other[0] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[DAY_OF_WEEK] operator[:] Keyword[if] operator[SEP] Other[2] operator[%] identifier[interval_override] operator[==] Other[0] operator[SEP] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_WEEK] , identifier[calendar] operator[SEP] identifier[getFirstDayOfWeek] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_WEEK] , identifier[calendar] operator[SEP] identifier[getFirstDayOfWeek] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[unit_override] operator[=] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] operator[SEP] identifier[interval_override] operator[=] Other[7] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[WEEK_OF_YEAR] operator[:] identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] , Other[1] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , Other[0] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[MONTH] operator[:] Keyword[case] identifier[Calendar] operator[SEP] identifier[YEAR] operator[:] identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[ts] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , Other[0] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] , Other[1] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , Other[0] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[unit_override] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[calendar] operator[SEP] identifier[getTimeInMillis] operator[SEP] operator[SEP] operator[==] identifier[ts] operator[SEP] {
Keyword[return] identifier[calendar] operator[SEP]
}
Keyword[while] operator[SEP] identifier[calendar] operator[SEP] identifier[getTimeInMillis] operator[SEP] operator[SEP] operator[<=] identifier[ts] operator[SEP] {
identifier[calendar] operator[SEP] identifier[add] operator[SEP] identifier[unit_override] , identifier[interval_override] operator[SEP] operator[SEP]
}
identifier[calendar] operator[SEP] identifier[add] operator[SEP] identifier[unit_override] , operator[-] identifier[interval_override] operator[SEP] operator[SEP] Keyword[return] identifier[calendar] operator[SEP]
}
|
@NonNull
public RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId) {
Resources resources = picasso.context.getResources();
int targetWidth = resources.getDimensionPixelSize(targetWidthResId);
int targetHeight = resources.getDimensionPixelSize(targetHeightResId);
return resize(targetWidth, targetHeight);
} | class class_name[name] begin[{]
method[resizeDimen, return_type[type[RequestCreator]], modifier[public], parameter[targetWidthResId, targetHeightResId]] begin[{]
local_variable[type[Resources], resources]
local_variable[type[int], targetWidth]
local_variable[type[int], targetHeight]
return[call[.resize, parameter[member[.targetWidth], member[.targetHeight]]]]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] identifier[RequestCreator] identifier[resizeDimen] operator[SEP] Keyword[int] identifier[targetWidthResId] , Keyword[int] identifier[targetHeightResId] operator[SEP] {
identifier[Resources] identifier[resources] operator[=] identifier[picasso] operator[SEP] identifier[context] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[targetWidth] operator[=] identifier[resources] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[targetWidthResId] operator[SEP] operator[SEP] Keyword[int] identifier[targetHeight] operator[=] identifier[resources] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[targetHeightResId] operator[SEP] operator[SEP] Keyword[return] identifier[resize] operator[SEP] identifier[targetWidth] , identifier[targetHeight] operator[SEP] operator[SEP]
}
|
public Iterator<V> valueIterator(@SuppressWarnings("unused") K name) {
List<V> empty = Collections.emptyList();
return empty.iterator();
} | class class_name[name] begin[{]
method[valueIterator, return_type[type[Iterator]], modifier[public], parameter[name]] begin[{]
local_variable[type[List], empty]
return[call[empty.iterator, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[Iterator] operator[<] identifier[V] operator[>] identifier[valueIterator] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[K] identifier[name] operator[SEP] {
identifier[List] operator[<] identifier[V] operator[>] identifier[empty] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[empty] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
|
protected int levelOffset(Context context) {
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case OPERATION_BEFORE:
case OPERATION_AFTER:
levelOffset = 1;
break;
case OPERATION_BEGIN:
case OPERATION_END:
levelOffset = increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEFORE:
case OPERATION_DESCRIPTION_AFTER:
case OPERATION_PARAMETERS_BEFORE:
case OPERATION_PARAMETERS_AFTER:
case OPERATION_RESPONSES_BEFORE:
case OPERATION_RESPONSES_AFTER:
case OPERATION_SECURITY_BEFORE:
case OPERATION_SECURITY_AFTER:
levelOffset = increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEGIN:
case OPERATION_DESCRIPTION_END:
case OPERATION_PARAMETERS_BEGIN:
case OPERATION_PARAMETERS_END:
case OPERATION_RESPONSES_BEGIN:
case OPERATION_RESPONSES_END:
case OPERATION_SECURITY_BEGIN:
case OPERATION_SECURITY_END:
levelOffset = 3;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | class class_name[name] begin[{]
method[levelOffset, return_type[type[int]], modifier[protected], parameter[context]] begin[{]
local_variable[type[int], levelOffset]
SwitchStatement(cases=[SwitchStatementCase(case=['DOCUMENT_BEFORE', 'DOCUMENT_AFTER'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=levelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DOCUMENT_BEGIN', 'DOCUMENT_END', 'OPERATION_BEFORE', 'OPERATION_AFTER'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=levelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OPERATION_BEGIN', 'OPERATION_END'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=levelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=increaseLevelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OPERATION_DESCRIPTION_BEFORE', 'OPERATION_DESCRIPTION_AFTER', 'OPERATION_PARAMETERS_BEFORE', 'OPERATION_PARAMETERS_AFTER', 'OPERATION_RESPONSES_BEFORE', 'OPERATION_RESPONSES_AFTER', 'OPERATION_SECURITY_BEFORE', 'OPERATION_SECURITY_AFTER'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=levelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=increaseLevelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OPERATION_DESCRIPTION_BEGIN', 'OPERATION_DESCRIPTION_END', 'OPERATION_PARAMETERS_BEGIN', 'OPERATION_PARAMETERS_END', 'OPERATION_RESPONSES_BEGIN', 'OPERATION_RESPONSES_END', 'OPERATION_SECURITY_BEGIN', 'OPERATION_SECURITY_END'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=levelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown position '%s'"), MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)])], expression=MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[]), label=None)
return[member[.levelOffset]]
end[}]
END[}] | Keyword[protected] Keyword[int] identifier[levelOffset] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
Keyword[int] identifier[levelOffset] operator[SEP] Keyword[switch] operator[SEP] identifier[context] operator[SEP] identifier[position] operator[SEP] {
Keyword[case] identifier[DOCUMENT_BEFORE] operator[:] Keyword[case] identifier[DOCUMENT_AFTER] operator[:] identifier[levelOffset] operator[=] Other[0] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DOCUMENT_BEGIN] operator[:] Keyword[case] identifier[DOCUMENT_END] operator[:] Keyword[case] identifier[OPERATION_BEFORE] operator[:] Keyword[case] identifier[OPERATION_AFTER] operator[:] identifier[levelOffset] operator[=] Other[1] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OPERATION_BEGIN] operator[:] Keyword[case] identifier[OPERATION_END] operator[:] identifier[levelOffset] operator[=] identifier[increaseLevelOffset] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OPERATION_DESCRIPTION_BEFORE] operator[:] Keyword[case] identifier[OPERATION_DESCRIPTION_AFTER] operator[:] Keyword[case] identifier[OPERATION_PARAMETERS_BEFORE] operator[:] Keyword[case] identifier[OPERATION_PARAMETERS_AFTER] operator[:] Keyword[case] identifier[OPERATION_RESPONSES_BEFORE] operator[:] Keyword[case] identifier[OPERATION_RESPONSES_AFTER] operator[:] Keyword[case] identifier[OPERATION_SECURITY_BEFORE] operator[:] Keyword[case] identifier[OPERATION_SECURITY_AFTER] operator[:] identifier[levelOffset] operator[=] identifier[increaseLevelOffset] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[OPERATION_DESCRIPTION_BEGIN] operator[:] Keyword[case] identifier[OPERATION_DESCRIPTION_END] operator[:] Keyword[case] identifier[OPERATION_PARAMETERS_BEGIN] operator[:] Keyword[case] identifier[OPERATION_PARAMETERS_END] operator[:] Keyword[case] identifier[OPERATION_RESPONSES_BEGIN] operator[:] Keyword[case] identifier[OPERATION_RESPONSES_END] operator[:] Keyword[case] identifier[OPERATION_SECURITY_BEGIN] operator[:] Keyword[case] identifier[OPERATION_SECURITY_END] operator[:] identifier[levelOffset] operator[=] Other[3] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[context] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[levelOffset] operator[SEP]
}
|
public ArrayList<File> getFiles() {
//TODO Why ArrayList, change to list when in a proper IDE
final JsArray<FileJS> filesJS = getFilesNative(getElement());
final ArrayList<File> files = new ArrayList<File>();
if (filesJS != null) {
for (int i = 0; i < filesJS.length(); i++) {
files.add(filesJS.get(i));
}
}
return files;
} | class class_name[name] begin[{]
method[getFiles, return_type[type[ArrayList]], modifier[public], parameter[]] begin[{]
local_variable[type[JsArray], filesJS]
local_variable[type[ArrayList], files]
if[binary_operation[member[.filesJS], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=filesJS, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=files, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=filesJS, 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[}]
return[member[.files]]
end[}]
END[}] | Keyword[public] identifier[ArrayList] operator[<] identifier[File] operator[>] identifier[getFiles] operator[SEP] operator[SEP] {
Keyword[final] identifier[JsArray] operator[<] identifier[FileJS] operator[>] identifier[filesJS] operator[=] identifier[getFilesNative] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ArrayList] operator[<] identifier[File] operator[>] identifier[files] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[File] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[filesJS] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[filesJS] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[files] operator[SEP] identifier[add] operator[SEP] identifier[filesJS] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[files] operator[SEP]
}
|
public static void runExample(
AdManagerServices adManagerServices, AdManagerSession session, long customFieldId)
throws RemoteException {
// Get the CustomFieldService.
CustomFieldServiceInterface customFieldService =
adManagerServices.get(session, CustomFieldServiceInterface.class);
// Create a statement to select a custom field.
StatementBuilder statementBuilder = new StatementBuilder()
.where("WHERE id = :id")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("id", customFieldId);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get custom fields by statement.
CustomFieldPage page =
customFieldService.getCustomFieldsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (CustomField customField : page.getResults()) {
System.out.printf(
"%d) Custom field with ID %d will be deactivated.%n", i++, customField.getId());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of custom fields to be deactivated: %d%n", totalResultSetSize);
if (totalResultSetSize > 0) {
// Remove limit and offset from statement.
statementBuilder.removeLimitAndOffset();
// Create action.
com.google.api.ads.admanager.axis.v201808.DeactivateCustomFields action =
new com.google.api.ads.admanager.axis.v201808.DeactivateCustomFields();
// Perform action.
UpdateResult result = customFieldService.performCustomFieldAction(
action, statementBuilder.toStatement());
if (result != null && result.getNumChanges() > 0) {
System.out.printf("Number of custom fields deactivated: %d%n", result.getNumChanges());
} else {
System.out.println("No custom fields were deactivated.");
}
}
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adManagerServices, session, customFieldId]] begin[{]
local_variable[type[CustomFieldServiceInterface], customFieldService]
local_variable[type[StatementBuilder], statementBuilder]
local_variable[type[int], totalResultSetSize]
do[binary_operation[call[statementBuilder.getOffset, parameter[]], <, member[.totalResultSetSize]]] begin[{]
local_variable[type[CustomFieldPage], page]
if[binary_operation[call[page.getResults, parameter[]], !=, literal[null]]] begin[{]
assign[member[.totalResultSetSize], call[page.getTotalResultSetSize, parameter[]]]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%d) Custom field with ID %d will be deactivated.%n"), MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=customField, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResults, postfix_operators=[], prefix_operators=[], qualifier=page, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=customField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CustomField, sub_type=None))), label=None)
else begin[{]
None
end[}]
call[statementBuilder.increaseOffsetBy, parameter[member[StatementBuilder.SUGGESTED_PAGE_LIMIT]]]
end[}]
call[System.out.printf, parameter[literal["Number of custom fields to be deactivated: %d%n"], member[.totalResultSetSize]]]
if[binary_operation[member[.totalResultSetSize], >, literal[0]]] begin[{]
call[statementBuilder.removeLimitAndOffset, parameter[]]
local_variable[type[com], action]
local_variable[type[UpdateResult], result]
if[binary_operation[binary_operation[member[.result], !=, literal[null]], &&, binary_operation[call[result.getNumChanges, parameter[]], >, literal[0]]]] begin[{]
call[System.out.printf, parameter[literal["Number of custom fields deactivated: %d%n"], call[result.getNumChanges, parameter[]]]]
else begin[{]
call[System.out.println, parameter[literal["No custom fields were deactivated."]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdManagerServices] identifier[adManagerServices] , identifier[AdManagerSession] identifier[session] , Keyword[long] identifier[customFieldId] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[CustomFieldServiceInterface] identifier[customFieldService] operator[=] identifier[adManagerServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[CustomFieldServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[StatementBuilder] identifier[statementBuilder] operator[=] Keyword[new] identifier[StatementBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[where] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[orderBy] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[limit] operator[SEP] identifier[StatementBuilder] operator[SEP] identifier[SUGGESTED_PAGE_LIMIT] operator[SEP] operator[SEP] identifier[withBindVariableValue] operator[SEP] literal[String] , identifier[customFieldId] operator[SEP] operator[SEP] Keyword[int] identifier[totalResultSetSize] operator[=] Other[0] operator[SEP] Keyword[do] {
identifier[CustomFieldPage] identifier[page] operator[=] identifier[customFieldService] operator[SEP] identifier[getCustomFieldsByStatement] operator[SEP] identifier[statementBuilder] operator[SEP] identifier[toStatement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[page] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[totalResultSetSize] operator[=] identifier[page] operator[SEP] identifier[getTotalResultSetSize] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[page] operator[SEP] identifier[getStartIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CustomField] identifier[customField] operator[:] identifier[page] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[i] operator[++] , identifier[customField] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[statementBuilder] operator[SEP] identifier[increaseOffsetBy] operator[SEP] identifier[StatementBuilder] operator[SEP] identifier[SUGGESTED_PAGE_LIMIT] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[statementBuilder] operator[SEP] identifier[getOffset] operator[SEP] operator[SEP] operator[<] identifier[totalResultSetSize] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[totalResultSetSize] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[totalResultSetSize] operator[>] Other[0] operator[SEP] {
identifier[statementBuilder] operator[SEP] identifier[removeLimitAndOffset] operator[SEP] operator[SEP] operator[SEP] 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[DeactivateCustomFields] identifier[action] operator[=] Keyword[new] 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[DeactivateCustomFields] operator[SEP] operator[SEP] operator[SEP] identifier[UpdateResult] identifier[result] operator[=] identifier[customFieldService] operator[SEP] identifier[performCustomFieldAction] operator[SEP] identifier[action] , identifier[statementBuilder] operator[SEP] identifier[toStatement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[&&] identifier[result] operator[SEP] identifier[getNumChanges] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[result] operator[SEP] identifier[getNumChanges] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public GetArtistRequest.Builder getArtist(String id) {
return new GetArtistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.id(id);
} | class class_name[name] begin[{]
method[getArtist, return_type[type[GetArtistRequest]], modifier[public], parameter[id]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=accessToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=httpManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDefaults, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=GetArtistRequest, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))]
end[}]
END[}] | Keyword[public] identifier[GetArtistRequest] operator[SEP] identifier[Builder] identifier[getArtist] operator[SEP] identifier[String] identifier[id] operator[SEP] {
Keyword[return] Keyword[new] identifier[GetArtistRequest] operator[SEP] identifier[Builder] operator[SEP] identifier[accessToken] operator[SEP] operator[SEP] identifier[setDefaults] operator[SEP] identifier[httpManager] , identifier[scheme] , identifier[host] , identifier[port] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
|
public static void stdDev(Planar<GrayU8> input, GrayU8 output, @Nullable GrayU8 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | class class_name[name] begin[{]
method[stdDev, return_type[void], modifier[public static], parameter[input, output, avg]] begin[{]
call[.stdDev, parameter[member[.input], member[.output], member[.avg], literal[0], binary_operation[call[input.getNumBands, parameter[]], -, literal[1]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[stdDev] operator[SEP] identifier[Planar] operator[<] identifier[GrayU8] operator[>] identifier[input] , identifier[GrayU8] identifier[output] , annotation[@] identifier[Nullable] identifier[GrayU8] identifier[avg] operator[SEP] {
identifier[stdDev] operator[SEP] identifier[input] , identifier[output] , identifier[avg] , Other[0] , identifier[input] operator[SEP] identifier[getNumBands] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
private boolean tryAddModule(
IAggregator aggregator,
List<String> list,
String bundleRoot,
IResource bundleRootRes,
String locale,
String resource,
Collection<String> availableLocales)
throws IOException {
if (availableLocales != null && !availableLocales.contains(locale)) {
return false;
}
boolean result = false;
URI uri = bundleRootRes.getURI();
URI testUri = uri.resolve(locale + "/" + resource + ".js"); //$NON-NLS-1$ //$NON-NLS-2$
IResource testResource = aggregator.newResource(testUri);
if (availableLocales != null || testResource.exists()) {
String mid = bundleRoot+"/"+locale+"/"+resource; //$NON-NLS-1$ //$NON-NLS-2$
list.add(mid);
result = true;
}
return result;
} | class class_name[name] begin[{]
method[tryAddModule, return_type[type[boolean]], modifier[private], parameter[aggregator, list, bundleRoot, bundleRootRes, locale, resource, availableLocales]] begin[{]
if[binary_operation[binary_operation[member[.availableLocales], !=, literal[null]], &&, call[availableLocales.contains, parameter[member[.locale]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[boolean], result]
local_variable[type[URI], uri]
local_variable[type[URI], testUri]
local_variable[type[IResource], testResource]
if[binary_operation[binary_operation[member[.availableLocales], !=, literal[null]], ||, call[testResource.exists, parameter[]]]] begin[{]
local_variable[type[String], mid]
call[list.add, parameter[member[.mid]]]
assign[member[.result], literal[true]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[tryAddModule] operator[SEP] identifier[IAggregator] identifier[aggregator] , identifier[List] operator[<] identifier[String] operator[>] identifier[list] , identifier[String] identifier[bundleRoot] , identifier[IResource] identifier[bundleRootRes] , identifier[String] identifier[locale] , identifier[String] identifier[resource] , identifier[Collection] operator[<] identifier[String] operator[>] identifier[availableLocales] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[availableLocales] operator[!=] Other[null] operator[&&] operator[!] identifier[availableLocales] operator[SEP] identifier[contains] operator[SEP] identifier[locale] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[result] operator[=] literal[boolean] operator[SEP] identifier[URI] identifier[uri] operator[=] identifier[bundleRootRes] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] operator[SEP] identifier[URI] identifier[testUri] operator[=] identifier[uri] operator[SEP] identifier[resolve] operator[SEP] identifier[locale] operator[+] literal[String] operator[+] identifier[resource] operator[+] literal[String] operator[SEP] operator[SEP] identifier[IResource] identifier[testResource] operator[=] identifier[aggregator] operator[SEP] identifier[newResource] operator[SEP] identifier[testUri] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[availableLocales] operator[!=] Other[null] operator[||] identifier[testResource] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[mid] operator[=] identifier[bundleRoot] operator[+] literal[String] operator[+] identifier[locale] operator[+] literal[String] operator[+] identifier[resource] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[mid] operator[SEP] operator[SEP] identifier[result] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void addLast(E e) {
if (e == null)
throw new NullPointerException();
elements[tail] = e;
if ( (tail = (tail + 1) & (elements.length - 1)) == head)
doubleCapacity();
} | class class_name[name] begin[{]
method[addLast, return_type[void], modifier[public], parameter[e]] begin[{]
if[binary_operation[member[.e], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.elements], member[.e]]
if[binary_operation[assign[member[.tail], binary_operation[binary_operation[member[.tail], +, literal[1]], &, binary_operation[member[elements.length], -, literal[1]]]], ==, member[.head]]] begin[{]
call[.doubleCapacity, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addLast] operator[SEP] identifier[E] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP] identifier[elements] operator[SEP] identifier[tail] operator[SEP] operator[=] identifier[e] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[tail] operator[=] operator[SEP] identifier[tail] operator[+] Other[1] operator[SEP] operator[&] operator[SEP] identifier[elements] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] operator[==] identifier[head] operator[SEP] identifier[doubleCapacity] operator[SEP] operator[SEP] operator[SEP]
}
|
@SafeVarargs
public static long[] removeAll(final long[] a, final long... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_LONG_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final LongList list = LongList.of(a.clone());
list.removeAll(LongList.of(elements));
return list.trimToSize().array();
} | class class_name[name] begin[{]
method[removeAll, return_type[type[long]], modifier[public static], parameter[a, elements]] begin[{]
if[call[N.isNullOrEmpty, parameter[member[.a]]]] begin[{]
return[member[N.EMPTY_LONG_ARRAY]]
else begin[{]
if[call[N.isNullOrEmpty, parameter[member[.elements]]]] begin[{]
return[call[a.clone, parameter[]]]
else begin[{]
if[binary_operation[member[elements.length], ==, literal[1]]] begin[{]
return[call[.removeAllOccurrences, parameter[member[.a], member[.elements]]]]
else begin[{]
None
end[}]
end[}]
end[}]
local_variable[type[LongList], list]
call[list.removeAll, parameter[call[LongList.of, parameter[member[.elements]]]]]
return[call[list.trimToSize, parameter[]]]
end[}]
END[}] | annotation[@] identifier[SafeVarargs] Keyword[public] Keyword[static] Keyword[long] operator[SEP] operator[SEP] identifier[removeAll] operator[SEP] Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[a] , Keyword[final] Keyword[long] operator[...] identifier[elements] operator[SEP] {
Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[a] operator[SEP] operator[SEP] {
Keyword[return] identifier[N] operator[SEP] identifier[EMPTY_LONG_ARRAY] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[elements] operator[SEP] operator[SEP] {
Keyword[return] identifier[a] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[elements] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[removeAllOccurrences] operator[SEP] identifier[a] , identifier[elements] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[LongList] identifier[list] operator[=] identifier[LongList] operator[SEP] identifier[of] operator[SEP] identifier[a] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[removeAll] operator[SEP] identifier[LongList] operator[SEP] identifier[of] operator[SEP] identifier[elements] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[list] operator[SEP] identifier[trimToSize] operator[SEP] operator[SEP] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
|
public Set<ConstraintViolation> validate(DataSetInfo info) {
Set<ConstraintViolation> errors = new LinkedHashSet<ConstraintViolation>();
try {
if (info.isMandatory() && get(info.getDataSetNumber()) == null) {
errors.add(new ConstraintViolation(info, ConstraintViolation.MANDATORY_MISSING));
}
if (!info.isRepeatable() && getAll(info.getDataSetNumber()).size() > 1) {
errors.add(new ConstraintViolation(info, ConstraintViolation.REPEATABLE_REPEATED));
}
} catch (SerializationException e) {
errors.add(new ConstraintViolation(info, ConstraintViolation.INVALID_VALUE));
}
return errors;
} | class class_name[name] begin[{]
method[validate, return_type[type[Set]], modifier[public], parameter[info]] begin[{]
local_variable[type[Set], errors]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isMandatory, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDataSetNumber, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MANDATORY_MISSING, postfix_operators=[], prefix_operators=[], qualifier=ConstraintViolation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstraintViolation, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isRepeatable, postfix_operators=[], prefix_operators=['!'], qualifier=info, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDataSetNumber, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=getAll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=size, 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=1), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=REPEATABLE_REPEATED, postfix_operators=[], prefix_operators=[], qualifier=ConstraintViolation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstraintViolation, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=INVALID_VALUE, postfix_operators=[], prefix_operators=[], qualifier=ConstraintViolation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstraintViolation, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SerializationException']))], finally_block=None, label=None, resources=None)
return[member[.errors]]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[ConstraintViolation] operator[>] identifier[validate] operator[SEP] identifier[DataSetInfo] identifier[info] operator[SEP] {
identifier[Set] operator[<] identifier[ConstraintViolation] operator[>] identifier[errors] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[ConstraintViolation] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[info] operator[SEP] identifier[isMandatory] operator[SEP] operator[SEP] operator[&&] identifier[get] operator[SEP] identifier[info] operator[SEP] identifier[getDataSetNumber] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ConstraintViolation] operator[SEP] identifier[info] , identifier[ConstraintViolation] operator[SEP] identifier[MANDATORY_MISSING] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[info] operator[SEP] identifier[isRepeatable] operator[SEP] operator[SEP] operator[&&] identifier[getAll] operator[SEP] identifier[info] operator[SEP] identifier[getDataSetNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ConstraintViolation] operator[SEP] identifier[info] , identifier[ConstraintViolation] operator[SEP] identifier[REPEATABLE_REPEATED] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SerializationException] identifier[e] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ConstraintViolation] operator[SEP] identifier[info] , identifier[ConstraintViolation] operator[SEP] identifier[INVALID_VALUE] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[errors] operator[SEP]
}
|
public JwwfServer startAndJoin() {
try {
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
}
return this;
} | class class_name[name] begin[{]
method[startAndJoin, return_type[type[JwwfServer]], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=server, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=join, postfix_operators=[], prefix_operators=[], qualifier=server, 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=['Exception']))], finally_block=None, label=None, resources=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JwwfServer] identifier[startAndJoin] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[server] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[server] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public void prepareInsert(final SQLInsert _insert,
final Attribute _attribute,
final Object... _values)
throws SQLException
{
checkSQLColumnSize(_attribute, 1);
try {
_insert.column(_attribute.getSqlColNames().get(0),
Context.getThreadContext().getPerson().getId());
} catch (final EFapsException e) {
throw new SQLException("could not fetch current context person id", e);
}
} | class class_name[name] begin[{]
method[prepareInsert, return_type[void], modifier[public], parameter[_insert, _attribute, _values]] begin[{]
call[.checkSQLColumnSize, parameter[member[._attribute], literal[1]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSqlColNames, postfix_operators=[], prefix_operators=[], qualifier=_attribute, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getThreadContext, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[MethodInvocation(arguments=[], member=getPerson, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=column, postfix_operators=[], prefix_operators=[], qualifier=_insert, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="could not fetch current context person id"), 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=SQLException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EFapsException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[prepareInsert] operator[SEP] Keyword[final] identifier[SQLInsert] identifier[_insert] , Keyword[final] identifier[Attribute] identifier[_attribute] , Keyword[final] identifier[Object] operator[...] identifier[_values] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkSQLColumnSize] operator[SEP] identifier[_attribute] , Other[1] operator[SEP] operator[SEP] Keyword[try] {
identifier[_insert] operator[SEP] identifier[column] operator[SEP] identifier[_attribute] operator[SEP] identifier[getSqlColNames] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[Context] operator[SEP] identifier[getThreadContext] operator[SEP] operator[SEP] operator[SEP] identifier[getPerson] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[EFapsException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
private static <T> void updateAppLinkDataTable(Map<String, Set<T>> table,
boolean add,
String key,
T value,
String tracePrefix) // F743-26072
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Set<T> values = table.get(key);
if (add)
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": adding " + key + " = " + value);
if (values == null)
{
values = new LinkedHashSet<T>();
table.put(key, values);
}
values.add(value);
}
else
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": removing " + key + " = " + value);
if (values != null) // d657052
{
values.remove(value);
if (values.size() == 0) // d657052
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": removing " + key);
table.remove(key);
}
}
else
{
if (isTraceOn && tc.isDebugEnabled() && tracePrefix != null)
Tr.debug(tc, tracePrefix + ": key not found: " + key);
}
}
} | class class_name[name] begin[{]
method[updateAppLinkDataTable, return_type[void], modifier[private static], parameter[table, add, key, value, tracePrefix]] begin[{]
local_variable[type[boolean], isTraceOn]
local_variable[type[Set], values]
if[member[.add]] begin[{]
if[binary_operation[binary_operation[member[.isTraceOn], &&, call[tc.isDebugEnabled, parameter[]]], &&, binary_operation[member[.tracePrefix], !=, literal[null]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[member[.tracePrefix], +, literal[": adding "]], +, member[.key]], +, literal[" = "]], +, member[.value]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.values], ==, literal[null]]] begin[{]
assign[member[.values], 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=T, sub_type=None))], dimensions=None, name=LinkedHashSet, sub_type=None))]
call[table.put, parameter[member[.key], member[.values]]]
else begin[{]
None
end[}]
call[values.add, parameter[member[.value]]]
else begin[{]
if[binary_operation[binary_operation[member[.isTraceOn], &&, call[tc.isDebugEnabled, parameter[]]], &&, binary_operation[member[.tracePrefix], !=, literal[null]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[member[.tracePrefix], +, literal[": removing "]], +, member[.key]], +, literal[" = "]], +, member[.value]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.values], !=, literal[null]]] begin[{]
call[values.remove, parameter[member[.value]]]
if[binary_operation[call[values.size, parameter[]], ==, literal[0]]] begin[{]
if[binary_operation[binary_operation[member[.isTraceOn], &&, call[tc.isDebugEnabled, parameter[]]], &&, binary_operation[member[.tracePrefix], !=, literal[null]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[member[.tracePrefix], +, literal[": removing "]], +, member[.key]]]]
else begin[{]
None
end[}]
call[table.remove, parameter[member[.key]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.isTraceOn], &&, call[tc.isDebugEnabled, parameter[]]], &&, binary_operation[member[.tracePrefix], !=, literal[null]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[member[.tracePrefix], +, literal[": key not found: "]], +, member[.key]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[updateAppLinkDataTable] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[T] operator[>] operator[>] identifier[table] , Keyword[boolean] identifier[add] , identifier[String] identifier[key] , identifier[T] identifier[value] , identifier[String] identifier[tracePrefix] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[T] operator[>] identifier[values] operator[=] identifier[table] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[add] operator[SEP] {
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tracePrefix] operator[!=] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[tracePrefix] operator[+] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[==] Other[null] operator[SEP] {
identifier[values] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[values] operator[SEP] operator[SEP]
}
identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tracePrefix] operator[!=] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[tracePrefix] operator[+] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[!=] Other[null] operator[SEP] {
identifier[values] operator[SEP] identifier[remove] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tracePrefix] operator[!=] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[tracePrefix] operator[+] literal[String] operator[+] identifier[key] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tracePrefix] operator[!=] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[tracePrefix] operator[+] literal[String] operator[+] identifier[key] operator[SEP] operator[SEP]
}
}
}
|
public static boolean sameDimensions(Matrix A, Matrix B)
{
return A.rows() == B.rows() && A.cols() == B.cols();
} | class class_name[name] begin[{]
method[sameDimensions, return_type[type[boolean]], modifier[public static], parameter[A, B]] begin[{]
return[binary_operation[binary_operation[call[A.rows, parameter[]], ==, call[B.rows, parameter[]]], &&, binary_operation[call[A.cols, parameter[]], ==, call[B.cols, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[sameDimensions] operator[SEP] identifier[Matrix] identifier[A] , identifier[Matrix] identifier[B] operator[SEP] {
Keyword[return] identifier[A] operator[SEP] identifier[rows] operator[SEP] operator[SEP] operator[==] identifier[B] operator[SEP] identifier[rows] operator[SEP] operator[SEP] operator[&&] identifier[A] operator[SEP] identifier[cols] operator[SEP] operator[SEP] operator[==] identifier[B] operator[SEP] identifier[cols] operator[SEP] operator[SEP] operator[SEP]
}
|
public void putNextEntry(ZipEntry e) throws IOException {
ensureOpen();
if (current != null) {
closeEntry(); // close previous entry
}
if (e.time == -1) {
e.setTime(System.currentTimeMillis());
}
if (e.method == -1) {
e.method = method; // use default method
}
// store size, compressed size, and crc-32 in LOC header
e.flag = 0;
switch (e.method) {
case DEFLATED:
// store size, compressed size, and crc-32 in data descriptor
// immediately following the compressed entry data
if (e.size == -1 || e.csize == -1 || e.crc == -1)
e.flag = 8;
break;
case STORED:
// compressed size, uncompressed size, and crc-32 must all be
// set for entries using STORED compression method
if (e.size == -1) {
e.size = e.csize;
} else if (e.csize == -1) {
e.csize = e.size;
} else if (e.size != e.csize) {
throw new ZipException(
"STORED entry where compressed != uncompressed size");
}
if (e.size == -1 || e.crc == -1) {
throw new ZipException(
"STORED entry missing size, compressed size, or crc-32");
}
break;
default:
throw new ZipException("unsupported compression method");
}
if (! names.add(e.name)) {
throw new ZipException("duplicate entry: " + e.name);
}
if (zc.isUTF8())
e.flag |= EFS;
current = new XEntry(e, written);
xentries.add(current);
writeLOC(current);
} | class class_name[name] begin[{]
method[putNextEntry, return_type[void], modifier[public], parameter[e]] begin[{]
call[.ensureOpen, parameter[]]
if[binary_operation[member[.current], !=, literal[null]]] begin[{]
call[.closeEntry, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[e.time], ==, literal[1]]] begin[{]
call[e.setTime, parameter[call[System.currentTimeMillis, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[e.method], ==, literal[1]]] begin[{]
assign[member[e.method], member[.method]]
else begin[{]
None
end[}]
assign[member[e.flag], literal[0]]
SwitchStatement(cases=[SwitchStatementCase(case=['DEFLATED'], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), operandr=BinaryOperation(operandl=MemberReference(member=csize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=crc, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), operator=||), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=flag, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['STORED'], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=csize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=MemberReference(member=csize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="STORED entry where compressed != uncompressed size")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ZipException, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=csize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), type==, value=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), type==, value=MemberReference(member=csize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[])), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), operandr=BinaryOperation(operandl=MemberReference(member=crc, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="STORED entry missing size, compressed size, or crc-32")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ZipException, sub_type=None)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unsupported compression method")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ZipException, sub_type=None)), label=None)])], expression=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), label=None)
if[call[names.add, parameter[member[e.name]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="duplicate entry: "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ZipException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[zc.isUTF8, parameter[]]] begin[{]
assign[member[e.flag], member[.EFS]]
else begin[{]
None
end[}]
assign[member[.current], ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=written, 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=XEntry, sub_type=None))]
call[xentries.add, parameter[member[.current]]]
call[.writeLOC, parameter[member[.current]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[putNextEntry] operator[SEP] identifier[ZipEntry] identifier[e] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ensureOpen] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[current] operator[!=] Other[null] operator[SEP] {
identifier[closeEntry] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[time] operator[==] operator[-] Other[1] operator[SEP] {
identifier[e] operator[SEP] identifier[setTime] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[method] operator[==] operator[-] Other[1] operator[SEP] {
identifier[e] operator[SEP] identifier[method] operator[=] identifier[method] operator[SEP]
}
identifier[e] operator[SEP] identifier[flag] operator[=] Other[0] operator[SEP] Keyword[switch] operator[SEP] identifier[e] operator[SEP] identifier[method] operator[SEP] {
Keyword[case] identifier[DEFLATED] operator[:] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[size] operator[==] operator[-] Other[1] operator[||] identifier[e] operator[SEP] identifier[csize] operator[==] operator[-] Other[1] operator[||] identifier[e] operator[SEP] identifier[crc] operator[==] operator[-] Other[1] operator[SEP] identifier[e] operator[SEP] identifier[flag] operator[=] Other[8] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[STORED] operator[:] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[size] operator[==] operator[-] Other[1] operator[SEP] {
identifier[e] operator[SEP] identifier[size] operator[=] identifier[e] operator[SEP] identifier[csize] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[csize] operator[==] operator[-] Other[1] operator[SEP] {
identifier[e] operator[SEP] identifier[csize] operator[=] identifier[e] operator[SEP] identifier[size] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[size] operator[!=] identifier[e] operator[SEP] identifier[csize] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ZipException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[size] operator[==] operator[-] Other[1] operator[||] identifier[e] operator[SEP] identifier[crc] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ZipException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[ZipException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[names] operator[SEP] identifier[add] operator[SEP] identifier[e] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ZipException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[zc] operator[SEP] identifier[isUTF8] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[flag] operator[|=] identifier[EFS] operator[SEP] identifier[current] operator[=] Keyword[new] identifier[XEntry] operator[SEP] identifier[e] , identifier[written] operator[SEP] operator[SEP] identifier[xentries] operator[SEP] identifier[add] operator[SEP] identifier[current] operator[SEP] operator[SEP] identifier[writeLOC] operator[SEP] identifier[current] operator[SEP] operator[SEP]
}
|
public void marshall(Robot robot, ProtocolMarshaller protocolMarshaller) {
if (robot == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(robot.getArn(), ARN_BINDING);
protocolMarshaller.marshall(robot.getName(), NAME_BINDING);
protocolMarshaller.marshall(robot.getFleetArn(), FLEETARN_BINDING);
protocolMarshaller.marshall(robot.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(robot.getGreenGrassGroupId(), GREENGRASSGROUPID_BINDING);
protocolMarshaller.marshall(robot.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(robot.getArchitecture(), ARCHITECTURE_BINDING);
protocolMarshaller.marshall(robot.getLastDeploymentJob(), LASTDEPLOYMENTJOB_BINDING);
protocolMarshaller.marshall(robot.getLastDeploymentTime(), LASTDEPLOYMENTTIME_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[robot, protocolMarshaller]] begin[{]
if[binary_operation[member[.robot], ==, 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=getArn, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=ARN_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=robot, 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=getFleetArn, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=FLEETARN_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=getStatus, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=STATUS_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=getGreenGrassGroupId, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=GREENGRASSGROUPID_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=getCreatedAt, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=CREATEDAT_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=getArchitecture, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=ARCHITECTURE_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=getLastDeploymentJob, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=LASTDEPLOYMENTJOB_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=getLastDeploymentTime, postfix_operators=[], prefix_operators=[], qualifier=robot, selectors=[], type_arguments=None), MemberReference(member=LASTDEPLOYMENTTIME_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[Robot] identifier[robot] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[robot] 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[robot] operator[SEP] identifier[getArn] operator[SEP] operator[SEP] , identifier[ARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getFleetArn] operator[SEP] operator[SEP] , identifier[FLEETARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] , identifier[STATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getGreenGrassGroupId] operator[SEP] operator[SEP] , identifier[GREENGRASSGROUPID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getCreatedAt] operator[SEP] operator[SEP] , identifier[CREATEDAT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getArchitecture] operator[SEP] operator[SEP] , identifier[ARCHITECTURE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getLastDeploymentJob] operator[SEP] operator[SEP] , identifier[LASTDEPLOYMENTJOB_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[robot] operator[SEP] identifier[getLastDeploymentTime] operator[SEP] operator[SEP] , identifier[LASTDEPLOYMENTTIME_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 int getTurns(final AdjacencyGraph adjacencyGraph, final String part)
{
int direction = 0;
int turns = 1;
char[] parts = part.toCharArray();
for (int i1 = 0; i1 < parts.length; i1++)
{
Character character = parts[i1];
if (i1 + 1 >= parts.length)
{
continue;
}
Character next_character = parts[i1 + 1];
if (adjacencyGraph.getKeyMap().containsKey(character))
{
String[] tmp_neighbors = adjacencyGraph.getKeyMap().get(character);
for (int i2 = 0; i2 < tmp_neighbors.length; i2++)
{
if (tmp_neighbors[i2] == null)
{
continue;
}
for (Character neighbor_char : tmp_neighbors[i2].toCharArray())
{
if (next_character.equals(neighbor_char))
{
if (direction == 0)
{
direction = i2;
}
else if (direction != i2)
{
turns++;
direction = i2;
}
}
}
}
}
}
return turns;
} | class class_name[name] begin[{]
method[getTurns, return_type[type[int]], modifier[public static], parameter[adjacencyGraph, part]] begin[{]
local_variable[type[int], direction]
local_variable[type[int], turns]
local_variable[type[char], parts]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=character)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=parts, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), name=next_character)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getKeyMap, postfix_operators=[], prefix_operators=[], qualifier=adjacencyGraph, selectors=[MethodInvocation(arguments=[MemberReference(member=character, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKeyMap, postfix_operators=[], prefix_operators=[], qualifier=adjacencyGraph, selectors=[MethodInvocation(arguments=[MemberReference(member=character, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=tmp_neighbors)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tmp_neighbors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i2, 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=[ContinueStatement(goto=None, label=None)])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=neighbor_char, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=next_character, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=direction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=direction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=turns, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=direction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=direction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=tmp_neighbors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=toCharArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=neighbor_char)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tmp_neighbors, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i2)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i2, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=parts, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i1, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.turns]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getTurns] operator[SEP] Keyword[final] identifier[AdjacencyGraph] identifier[adjacencyGraph] , Keyword[final] identifier[String] identifier[part] operator[SEP] {
Keyword[int] identifier[direction] operator[=] Other[0] operator[SEP] Keyword[int] identifier[turns] operator[=] Other[1] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[part] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i1] operator[=] Other[0] operator[SEP] identifier[i1] operator[<] identifier[parts] operator[SEP] identifier[length] operator[SEP] identifier[i1] operator[++] operator[SEP] {
identifier[Character] identifier[character] operator[=] identifier[parts] operator[SEP] identifier[i1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i1] operator[+] Other[1] operator[>=] identifier[parts] operator[SEP] identifier[length] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[Character] identifier[next_character] operator[=] identifier[parts] operator[SEP] identifier[i1] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[adjacencyGraph] operator[SEP] identifier[getKeyMap] operator[SEP] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[character] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[tmp_neighbors] operator[=] identifier[adjacencyGraph] operator[SEP] identifier[getKeyMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[character] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i2] operator[=] Other[0] operator[SEP] identifier[i2] operator[<] identifier[tmp_neighbors] operator[SEP] identifier[length] operator[SEP] identifier[i2] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[tmp_neighbors] operator[SEP] identifier[i2] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Character] identifier[neighbor_char] operator[:] identifier[tmp_neighbors] operator[SEP] identifier[i2] operator[SEP] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[next_character] operator[SEP] identifier[equals] operator[SEP] identifier[neighbor_char] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[direction] operator[==] Other[0] operator[SEP] {
identifier[direction] operator[=] identifier[i2] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[direction] operator[!=] identifier[i2] operator[SEP] {
identifier[turns] operator[++] operator[SEP] identifier[direction] operator[=] identifier[i2] operator[SEP]
}
}
}
}
}
}
Keyword[return] identifier[turns] operator[SEP]
}
|
public int read(char []buffer, int offset, int length)
throws IOException
{
byte[] bytes = new byte[length];
int count = _file.read(bytes, 0, length);
for (int i = 0; i < count; i++) {
buffer[offset + i] = (char) bytes[i];
}
return count;
} | class class_name[name] begin[{]
method[read, return_type[type[int]], modifier[public], parameter[buffer, offset, length]] begin[{]
local_variable[type[byte], bytes]
local_variable[type[int], count]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), type==, value=Cast(expression=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=BasicType(dimensions=[], name=char))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, 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[member[.count]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[read] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[buffer] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] identifier[_file] operator[SEP] identifier[read] operator[SEP] identifier[bytes] , Other[0] , identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[count] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[buffer] operator[SEP] identifier[offset] operator[+] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] identifier[bytes] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[count] operator[SEP]
}
|
public void marshall(InferenceSpecification inferenceSpecification, ProtocolMarshaller protocolMarshaller) {
if (inferenceSpecification == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inferenceSpecification.getContainers(), CONTAINERS_BINDING);
protocolMarshaller.marshall(inferenceSpecification.getSupportedTransformInstanceTypes(), SUPPORTEDTRANSFORMINSTANCETYPES_BINDING);
protocolMarshaller.marshall(inferenceSpecification.getSupportedRealtimeInferenceInstanceTypes(), SUPPORTEDREALTIMEINFERENCEINSTANCETYPES_BINDING);
protocolMarshaller.marshall(inferenceSpecification.getSupportedContentTypes(), SUPPORTEDCONTENTTYPES_BINDING);
protocolMarshaller.marshall(inferenceSpecification.getSupportedResponseMIMETypes(), SUPPORTEDRESPONSEMIMETYPES_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[inferenceSpecification, protocolMarshaller]] begin[{]
if[binary_operation[member[.inferenceSpecification], ==, 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=getContainers, postfix_operators=[], prefix_operators=[], qualifier=inferenceSpecification, selectors=[], type_arguments=None), MemberReference(member=CONTAINERS_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=getSupportedTransformInstanceTypes, postfix_operators=[], prefix_operators=[], qualifier=inferenceSpecification, selectors=[], type_arguments=None), MemberReference(member=SUPPORTEDTRANSFORMINSTANCETYPES_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=getSupportedRealtimeInferenceInstanceTypes, postfix_operators=[], prefix_operators=[], qualifier=inferenceSpecification, selectors=[], type_arguments=None), MemberReference(member=SUPPORTEDREALTIMEINFERENCEINSTANCETYPES_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=getSupportedContentTypes, postfix_operators=[], prefix_operators=[], qualifier=inferenceSpecification, selectors=[], type_arguments=None), MemberReference(member=SUPPORTEDCONTENTTYPES_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=getSupportedResponseMIMETypes, postfix_operators=[], prefix_operators=[], qualifier=inferenceSpecification, selectors=[], type_arguments=None), MemberReference(member=SUPPORTEDRESPONSEMIMETYPES_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[InferenceSpecification] identifier[inferenceSpecification] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[inferenceSpecification] 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[inferenceSpecification] operator[SEP] identifier[getContainers] operator[SEP] operator[SEP] , identifier[CONTAINERS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[inferenceSpecification] operator[SEP] identifier[getSupportedTransformInstanceTypes] operator[SEP] operator[SEP] , identifier[SUPPORTEDTRANSFORMINSTANCETYPES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[inferenceSpecification] operator[SEP] identifier[getSupportedRealtimeInferenceInstanceTypes] operator[SEP] operator[SEP] , identifier[SUPPORTEDREALTIMEINFERENCEINSTANCETYPES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[inferenceSpecification] operator[SEP] identifier[getSupportedContentTypes] operator[SEP] operator[SEP] , identifier[SUPPORTEDCONTENTTYPES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[inferenceSpecification] operator[SEP] identifier[getSupportedResponseMIMETypes] operator[SEP] operator[SEP] , identifier[SUPPORTEDRESPONSEMIMETYPES_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 ClassInfoList getAnnotations() {
if (!scanResult.scanSpec.enableAnnotationInfo) {
throw new IllegalArgumentException("Please call ClassGraph#enableAnnotationInfo() before #scan()");
}
// Get all annotations on this class
final ReachableAndDirectlyRelatedClasses annotationClasses = this.filterClassInfo(RelType.CLASS_ANNOTATIONS,
/* strictWhitelist = */ false);
// Check for any @Inherited annotations on superclasses
Set<ClassInfo> inheritedSuperclassAnnotations = null;
for (final ClassInfo superclass : getSuperclasses()) {
for (final ClassInfo superclassAnnotation : superclass.filterClassInfo(RelType.CLASS_ANNOTATIONS,
/* strictWhitelist = */ false).reachableClasses) {
// Check if any of the meta-annotations on this annotation are @Inherited,
// which causes an annotation to annotate a class and all of its subclasses.
if (superclassAnnotation != null && superclassAnnotation.isInherited) {
// superclassAnnotation has an @Inherited meta-annotation
if (inheritedSuperclassAnnotations == null) {
inheritedSuperclassAnnotations = new LinkedHashSet<>();
}
inheritedSuperclassAnnotations.add(superclassAnnotation);
}
}
}
if (inheritedSuperclassAnnotations == null) {
// No inherited superclass annotations
return new ClassInfoList(annotationClasses, /* sortByName = */ true);
} else {
// Merge inherited superclass annotations and annotations on this class
inheritedSuperclassAnnotations.addAll(annotationClasses.reachableClasses);
return new ClassInfoList(inheritedSuperclassAnnotations, annotationClasses.directlyRelatedClasses,
/* sortByName = */ true);
}
} | class class_name[name] begin[{]
method[getAnnotations, return_type[type[ClassInfoList]], modifier[public], parameter[]] begin[{]
if[member[scanResult.scanSpec.enableAnnotationInfo]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Please call ClassGraph#enableAnnotationInfo() before #scan()")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ReachableAndDirectlyRelatedClasses], annotationClasses]
local_variable[type[Set], inheritedSuperclassAnnotations]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=superclassAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MemberReference(member=isInherited, postfix_operators=[], prefix_operators=[], qualifier=superclassAnnotation, selectors=[]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inheritedSuperclassAnnotations, 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=inheritedSuperclassAnnotations, 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=[], dimensions=None, name=LinkedHashSet, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=superclassAnnotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=inheritedSuperclassAnnotations, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=CLASS_ANNOTATIONS, postfix_operators=[], prefix_operators=[], qualifier=RelType, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=filterClassInfo, postfix_operators=[], prefix_operators=[], qualifier=superclass, selectors=[MemberReference(member=reachableClasses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=superclassAnnotation)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ClassInfo, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getSuperclasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=superclass)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ClassInfo, sub_type=None))), label=None)
if[binary_operation[member[.inheritedSuperclassAnnotations], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=annotationClasses, 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=ClassInfoList, sub_type=None))]
else begin[{]
call[inheritedSuperclassAnnotations.addAll, parameter[member[annotationClasses.reachableClasses]]]
return[ClassCreator(arguments=[MemberReference(member=inheritedSuperclassAnnotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=directlyRelatedClasses, postfix_operators=[], prefix_operators=[], qualifier=annotationClasses, 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=ClassInfoList, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[public] identifier[ClassInfoList] identifier[getAnnotations] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[scanResult] operator[SEP] identifier[scanSpec] operator[SEP] identifier[enableAnnotationInfo] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[ReachableAndDirectlyRelatedClasses] identifier[annotationClasses] operator[=] Keyword[this] operator[SEP] identifier[filterClassInfo] operator[SEP] identifier[RelType] operator[SEP] identifier[CLASS_ANNOTATIONS] , literal[boolean] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[ClassInfo] operator[>] identifier[inheritedSuperclassAnnotations] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ClassInfo] identifier[superclass] operator[:] identifier[getSuperclasses] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[ClassInfo] identifier[superclassAnnotation] operator[:] identifier[superclass] operator[SEP] identifier[filterClassInfo] operator[SEP] identifier[RelType] operator[SEP] identifier[CLASS_ANNOTATIONS] , literal[boolean] operator[SEP] operator[SEP] identifier[reachableClasses] operator[SEP] {
Keyword[if] operator[SEP] identifier[superclassAnnotation] operator[!=] Other[null] operator[&&] identifier[superclassAnnotation] operator[SEP] identifier[isInherited] operator[SEP] {
Keyword[if] operator[SEP] identifier[inheritedSuperclassAnnotations] operator[==] Other[null] operator[SEP] {
identifier[inheritedSuperclassAnnotations] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[inheritedSuperclassAnnotations] operator[SEP] identifier[add] operator[SEP] identifier[superclassAnnotation] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[inheritedSuperclassAnnotations] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[ClassInfoList] operator[SEP] identifier[annotationClasses] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[inheritedSuperclassAnnotations] operator[SEP] identifier[addAll] operator[SEP] identifier[annotationClasses] operator[SEP] identifier[reachableClasses] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ClassInfoList] operator[SEP] identifier[inheritedSuperclassAnnotations] , identifier[annotationClasses] operator[SEP] identifier[directlyRelatedClasses] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
public String getTableNames(boolean bAddQuotes, Map<String, Object> properties)
{
String strString = "";
strString += this.getLeftRecord().getTableNames(bAddQuotes);
String strOn = "ON";
switch (m_JoinType)
{
case DBConstants.LEFT_INNER:
if (properties.get("INNER_JOIN") != null)
strString += ' ' + (String)properties.get("INNER_JOIN") + ' ';
else
strString += ' ' + "INNER_JOIN ";
if (properties.get("INNER_JOIN_ON") != null)
strOn = (String)properties.get("INNER_JOIN_ON");
break;
case DBConstants.LEFT_OUTER:
strString += " LEFT JOIN ";
break;
}
strString += this.getRightRecord().getTableNames(bAddQuotes);
strString += ' ' + strOn + ' ';
for (int i = 1; i < m_rgiFldLeft.length; i++)
{
if (this.getLeftField(i) == null)
break;
if (i > 1)
strString += " AND ";
strString += this.getLeftFieldNameOrValue(i, bAddQuotes, true); // Include file name
strString += " = ";
strString += this.getRightField(i).getFieldName(bAddQuotes, true); // Include file name
}
return strString;
} | class class_name[name] begin[{]
method[getTableNames, return_type[type[String]], modifier[public], parameter[bAddQuotes, properties]] begin[{]
local_variable[type[String], strString]
assign[member[.strString], THIS[call[None.getLeftRecord, parameter[]]call[None.getTableNames, parameter[member[.bAddQuotes]]]]]
local_variable[type[String], strOn]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=LEFT_INNER, postfix_operators=[], prefix_operators=[], qualifier=DBConstants, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INNER_JOIN")], member=get, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INNER_JOIN "), operator=+)), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operandr=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INNER_JOIN")], member=get, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=+)), label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INNER_JOIN_ON")], member=get, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strOn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INNER_JOIN_ON")], member=get, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=LEFT_OUTER, postfix_operators=[], prefix_operators=[], qualifier=DBConstants, selectors=[])], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" LEFT JOIN ")), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=m_JoinType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
assign[member[.strString], THIS[call[None.getRightRecord, parameter[]]call[None.getTableNames, parameter[member[.bAddQuotes]]]]]
assign[member[.strString], binary_operation[binary_operation[literal[' '], +, member[.strOn]], +, literal[' ']]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLeftField, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" AND ")), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bAddQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getLeftFieldNameOrValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" = ")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=strString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRightField, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=bAddQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getFieldName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=m_rgiFldLeft, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.strString]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getTableNames] operator[SEP] Keyword[boolean] identifier[bAddQuotes] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[SEP] {
identifier[String] identifier[strString] operator[=] literal[String] operator[SEP] identifier[strString] operator[+=] Keyword[this] operator[SEP] identifier[getLeftRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getTableNames] operator[SEP] identifier[bAddQuotes] operator[SEP] operator[SEP] identifier[String] identifier[strOn] operator[=] literal[String] operator[SEP] Keyword[switch] operator[SEP] identifier[m_JoinType] operator[SEP] {
Keyword[case] identifier[DBConstants] operator[SEP] identifier[LEFT_INNER] operator[:] Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[strString] operator[+=] literal[String] operator[+] operator[SEP] identifier[String] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[else] identifier[strString] operator[+=] literal[String] operator[+] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[strOn] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DBConstants] operator[SEP] identifier[LEFT_OUTER] operator[:] identifier[strString] operator[+=] literal[String] operator[SEP] Keyword[break] operator[SEP]
}
identifier[strString] operator[+=] Keyword[this] operator[SEP] identifier[getRightRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getTableNames] operator[SEP] identifier[bAddQuotes] operator[SEP] operator[SEP] identifier[strString] operator[+=] literal[String] operator[+] identifier[strOn] operator[+] literal[String] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[m_rgiFldLeft] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getLeftField] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[break] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[>] Other[1] operator[SEP] identifier[strString] operator[+=] literal[String] operator[SEP] identifier[strString] operator[+=] Keyword[this] operator[SEP] identifier[getLeftFieldNameOrValue] operator[SEP] identifier[i] , identifier[bAddQuotes] , literal[boolean] operator[SEP] operator[SEP] identifier[strString] operator[+=] literal[String] operator[SEP] identifier[strString] operator[+=] Keyword[this] operator[SEP] identifier[getRightField] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getFieldName] operator[SEP] identifier[bAddQuotes] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[strString] operator[SEP]
}
|
@GwtIncompatible("NavigableMap")
public static <K, V> NavigableMap<K, V> synchronizedNavigableMap(
NavigableMap<K, V> navigableMap) {
return Synchronized.navigableMap(navigableMap);
} | class class_name[name] begin[{]
method[synchronizedNavigableMap, return_type[type[NavigableMap]], modifier[public static], parameter[navigableMap]] begin[{]
return[call[Synchronized.navigableMap, parameter[member[.navigableMap]]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[NavigableMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[synchronizedNavigableMap] operator[SEP] identifier[NavigableMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[navigableMap] operator[SEP] {
Keyword[return] identifier[Synchronized] operator[SEP] identifier[navigableMap] operator[SEP] identifier[navigableMap] operator[SEP] operator[SEP]
}
|
public static <T> Level0IndefiniteArrayOperator<T[],T> onArray(final T[] target) {
return new Level0IndefiniteArrayOperator<T[],T>(ExecutionTarget.forOp(target, Normalisation.NONE));
} | class class_name[name] begin[{]
method[onArray, return_type[type[Level0IndefiniteArrayOperator]], modifier[public static], parameter[target]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=Normalisation, selectors=[])], member=forOp, postfix_operators=[], prefix_operators=[], qualifier=ExecutionTarget, selectors=[], type_arguments=None)], 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=[None], name=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=Level0IndefiniteArrayOperator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Level0IndefiniteArrayOperator] operator[<] identifier[T] operator[SEP] operator[SEP] , identifier[T] operator[>] identifier[onArray] operator[SEP] Keyword[final] identifier[T] operator[SEP] operator[SEP] identifier[target] operator[SEP] {
Keyword[return] Keyword[new] identifier[Level0IndefiniteArrayOperator] operator[<] identifier[T] operator[SEP] operator[SEP] , identifier[T] operator[>] operator[SEP] identifier[ExecutionTarget] operator[SEP] identifier[forOp] operator[SEP] identifier[target] , identifier[Normalisation] operator[SEP] identifier[NONE] operator[SEP] operator[SEP] operator[SEP]
}
|
private void updateSkinMappingUsingTypeLocaleSkin(ResourceBrowser rsBrowser, JawrConfig config,
Map<String, Map<String, VariantSet>> skinMapping, Set<String> skinRootDirectories) {
String defaultSkinName = null;
String defaultLocaleName = null;
// Check if there are no directory which is contained in another root
// directory
for (Iterator<String> itRootDir = skinRootDirectories.iterator(); itRootDir.hasNext();) {
String defaultLocaleDir = PathNormalizer.asDirPath(itRootDir.next());
String defaultLocaleDirName = PathNormalizer.getPathName(defaultLocaleDir);
String localeRootDir = PathNormalizer.getParentPath(defaultLocaleDir);
String skinName = null;
String localeName = null;
if (!LocaleUtils.LOCALE_SUFFIXES.contains(defaultLocaleDirName)) { // The
// rootDir
// point
// to
// a
// skin
// directory
skinName = defaultLocaleDirName;
localeName = PathNormalizer.getPathName(localeRootDir);
localeRootDir = PathNormalizer.getParentPath(localeRootDir);
} else {
localeName = defaultLocaleDirName;
}
if (defaultSkinName == null) {
defaultSkinName = skinName;
} else if (!defaultSkinName.equals(skinName)) {
throw new BundlingProcessException(
"The default skin for the skin root directories are not the same. Please check your configuration.");
}
if (defaultLocaleName == null) {
defaultLocaleName = localeName;
} else if (!defaultLocaleName.equals(localeName)) {
throw new BundlingProcessException(
"The default locale for the skin root directories are not the same. Please check your configuration.");
}
checkRootDirectoryNotOverlap(defaultLocaleDir, skinRootDirectories);
Map<String, VariantSet> variantsMap = getVariants(rsBrowser, localeRootDir, skinName, localeName, false);
skinMapping.put(localeRootDir, variantsMap);
}
CssSkinVariantResolver skinResolver = (CssSkinVariantResolver) config.getGeneratorRegistry()
.getVariantResolver(JawrConstant.SKIN_VARIANT_TYPE);
if (skinResolver == null) {
skinResolver = new CssSkinVariantResolver(defaultSkinName, config.getSkinCookieName());
config.getGeneratorRegistry().registerVariantResolver(skinResolver);
} else {
skinResolver.setDefaultSkin(defaultSkinName);
skinResolver.setSkinCookieName(config.getSkinCookieName());
}
} | class class_name[name] begin[{]
method[updateSkinMappingUsingTypeLocaleSkin, return_type[void], modifier[private], parameter[rsBrowser, config, skinMapping, skinRootDirectories]] begin[{]
local_variable[type[String], defaultSkinName]
local_variable[type[String], defaultLocaleName]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=itRootDir, selectors=[], type_arguments=None)], member=asDirPath, postfix_operators=[], prefix_operators=[], qualifier=PathNormalizer, selectors=[], type_arguments=None), name=defaultLocaleDir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=defaultLocaleDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPathName, postfix_operators=[], prefix_operators=[], qualifier=PathNormalizer, selectors=[], type_arguments=None), name=defaultLocaleDirName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=defaultLocaleDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParentPath, postfix_operators=[], prefix_operators=[], qualifier=PathNormalizer, selectors=[], type_arguments=None), name=localeRootDir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=skinName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=localeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=defaultLocaleDirName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=LocaleUtils.LOCALE_SUFFIXES, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=localeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=defaultLocaleDirName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=skinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=defaultLocaleDirName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=localeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=localeRootDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPathName, postfix_operators=[], prefix_operators=[], qualifier=PathNormalizer, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=localeRootDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=localeRootDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParentPath, postfix_operators=[], prefix_operators=[], qualifier=PathNormalizer, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=defaultSkinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=skinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=defaultSkinName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The default skin for the skin root directories are not the same. Please check your configuration.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundlingProcessException, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=defaultSkinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=skinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=defaultLocaleName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=localeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=defaultLocaleName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The default locale for the skin root directories are not the same. Please check your configuration.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundlingProcessException, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=defaultLocaleName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=localeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=defaultLocaleDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=skinRootDirectories, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkRootDirectoryNotOverlap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rsBrowser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=localeRootDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=skinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=localeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getVariants, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=variantsMap)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=VariantSet, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=localeRootDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=variantsMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=skinMapping, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=itRootDir, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=skinRootDirectories, selectors=[], type_arguments=None), name=itRootDir)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
local_variable[type[CssSkinVariantResolver], skinResolver]
if[binary_operation[member[.skinResolver], ==, literal[null]]] begin[{]
assign[member[.skinResolver], ClassCreator(arguments=[MemberReference(member=defaultSkinName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSkinCookieName, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CssSkinVariantResolver, sub_type=None))]
call[config.getGeneratorRegistry, parameter[]]
else begin[{]
call[skinResolver.setDefaultSkin, parameter[member[.defaultSkinName]]]
call[skinResolver.setSkinCookieName, parameter[call[config.getSkinCookieName, parameter[]]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateSkinMappingUsingTypeLocaleSkin] operator[SEP] identifier[ResourceBrowser] identifier[rsBrowser] , identifier[JawrConfig] identifier[config] , identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[VariantSet] operator[>] operator[>] identifier[skinMapping] , identifier[Set] operator[<] identifier[String] operator[>] identifier[skinRootDirectories] operator[SEP] {
identifier[String] identifier[defaultSkinName] operator[=] Other[null] operator[SEP] identifier[String] identifier[defaultLocaleName] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[itRootDir] operator[=] identifier[skinRootDirectories] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[itRootDir] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[defaultLocaleDir] operator[=] identifier[PathNormalizer] operator[SEP] identifier[asDirPath] operator[SEP] identifier[itRootDir] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[defaultLocaleDirName] operator[=] identifier[PathNormalizer] operator[SEP] identifier[getPathName] operator[SEP] identifier[defaultLocaleDir] operator[SEP] operator[SEP] identifier[String] identifier[localeRootDir] operator[=] identifier[PathNormalizer] operator[SEP] identifier[getParentPath] operator[SEP] identifier[defaultLocaleDir] operator[SEP] operator[SEP] identifier[String] identifier[skinName] operator[=] Other[null] operator[SEP] identifier[String] identifier[localeName] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[LocaleUtils] operator[SEP] identifier[LOCALE_SUFFIXES] operator[SEP] identifier[contains] operator[SEP] identifier[defaultLocaleDirName] operator[SEP] operator[SEP] {
identifier[skinName] operator[=] identifier[defaultLocaleDirName] operator[SEP] identifier[localeName] operator[=] identifier[PathNormalizer] operator[SEP] identifier[getPathName] operator[SEP] identifier[localeRootDir] operator[SEP] operator[SEP] identifier[localeRootDir] operator[=] identifier[PathNormalizer] operator[SEP] identifier[getParentPath] operator[SEP] identifier[localeRootDir] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[localeName] operator[=] identifier[defaultLocaleDirName] operator[SEP]
}
Keyword[if] operator[SEP] identifier[defaultSkinName] operator[==] Other[null] operator[SEP] {
identifier[defaultSkinName] operator[=] identifier[skinName] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[defaultSkinName] operator[SEP] identifier[equals] operator[SEP] identifier[skinName] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BundlingProcessException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[defaultLocaleName] operator[==] Other[null] operator[SEP] {
identifier[defaultLocaleName] operator[=] identifier[localeName] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[defaultLocaleName] operator[SEP] identifier[equals] operator[SEP] identifier[localeName] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BundlingProcessException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[checkRootDirectoryNotOverlap] operator[SEP] identifier[defaultLocaleDir] , identifier[skinRootDirectories] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[VariantSet] operator[>] identifier[variantsMap] operator[=] identifier[getVariants] operator[SEP] identifier[rsBrowser] , identifier[localeRootDir] , identifier[skinName] , identifier[localeName] , literal[boolean] operator[SEP] operator[SEP] identifier[skinMapping] operator[SEP] identifier[put] operator[SEP] identifier[localeRootDir] , identifier[variantsMap] operator[SEP] operator[SEP]
}
identifier[CssSkinVariantResolver] identifier[skinResolver] operator[=] operator[SEP] identifier[CssSkinVariantResolver] operator[SEP] identifier[config] operator[SEP] identifier[getGeneratorRegistry] operator[SEP] operator[SEP] operator[SEP] identifier[getVariantResolver] operator[SEP] identifier[JawrConstant] operator[SEP] identifier[SKIN_VARIANT_TYPE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[skinResolver] operator[==] Other[null] operator[SEP] {
identifier[skinResolver] operator[=] Keyword[new] identifier[CssSkinVariantResolver] operator[SEP] identifier[defaultSkinName] , identifier[config] operator[SEP] identifier[getSkinCookieName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[config] operator[SEP] identifier[getGeneratorRegistry] operator[SEP] operator[SEP] operator[SEP] identifier[registerVariantResolver] operator[SEP] identifier[skinResolver] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[skinResolver] operator[SEP] identifier[setDefaultSkin] operator[SEP] identifier[defaultSkinName] operator[SEP] operator[SEP] identifier[skinResolver] operator[SEP] identifier[setSkinCookieName] operator[SEP] identifier[config] operator[SEP] identifier[getSkinCookieName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void removeConnectionEventListener(ConnectionEventListener listener) {
log.finest("removeConnectionEventListener()");
if (listener == null)
throw new IllegalArgumentException("Listener is null");
listeners.remove(listener);
} | class class_name[name] begin[{]
method[removeConnectionEventListener, return_type[void], modifier[public], parameter[listener]] begin[{]
call[log.finest, parameter[literal["removeConnectionEventListener()"]]]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Listener is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[listeners.remove, parameter[member[.listener]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeConnectionEventListener] operator[SEP] identifier[ConnectionEventListener] identifier[listener] operator[SEP] {
identifier[log] operator[SEP] identifier[finest] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[listeners] operator[SEP] identifier[remove] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
|
public static void populateAttributes(final UIComponent component,
final FacesCell fcell,
final Map<String, Map<String, String>> defaultControlMap) {
List<CellFormAttributes> inputAttrs = fcell.getInputAttrs();
String cname = findComponentNameFromClass(component);
if (cname == null) {
return;
}
Map<String, String> defaultMap = defaultControlMap.get(cname);
if (defaultMap == null) {
defaultMap = new HashMap<>();
defaultControlMap.put(cname, defaultMap);
}
for (Map.Entry<String, String> entry : defaultMap.entrySet()) {
setObjectProperty(component, entry.getKey(), entry.getValue(),
true);
}
for (CellFormAttributes attr : inputAttrs) {
String propertyName = attr.getType();
String propertyValue = attr.getValue();
if (!defaultMap.containsKey(propertyName)) {
String defaultValue = getObjectPropertyValue(component,
propertyName, true);
defaultMap.put(propertyName, defaultValue);
}
setObjectProperty(component, propertyName, propertyValue, true);
}
} | class class_name[name] begin[{]
method[populateAttributes, return_type[void], modifier[public static], parameter[component, fcell, defaultControlMap]] begin[{]
local_variable[type[List], inputAttrs]
local_variable[type[String], cname]
if[binary_operation[member[.cname], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Map], defaultMap]
if[binary_operation[member[.defaultMap], ==, literal[null]]] begin[{]
assign[member[.defaultMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None))]
call[defaultControlMap.put, parameter[member[.cname], member[.defaultMap]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setObjectProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=defaultMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=attr, selectors=[], type_arguments=None), name=propertyName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=attr, selectors=[], type_arguments=None), name=propertyValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=defaultMap, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getObjectPropertyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=defaultValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=defaultMap, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=propertyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setObjectProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=inputAttrs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=attr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CellFormAttributes, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[populateAttributes] operator[SEP] Keyword[final] identifier[UIComponent] identifier[component] , Keyword[final] identifier[FacesCell] identifier[fcell] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[defaultControlMap] operator[SEP] {
identifier[List] operator[<] identifier[CellFormAttributes] operator[>] identifier[inputAttrs] operator[=] identifier[fcell] operator[SEP] identifier[getInputAttrs] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[cname] operator[=] identifier[findComponentNameFromClass] operator[SEP] identifier[component] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cname] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[defaultMap] operator[=] identifier[defaultControlMap] operator[SEP] identifier[get] operator[SEP] identifier[cname] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[defaultMap] operator[==] Other[null] operator[SEP] {
identifier[defaultMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[defaultControlMap] operator[SEP] identifier[put] operator[SEP] identifier[cname] , identifier[defaultMap] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[defaultMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[setObjectProperty] operator[SEP] identifier[component] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[CellFormAttributes] identifier[attr] operator[:] identifier[inputAttrs] operator[SEP] {
identifier[String] identifier[propertyName] operator[=] identifier[attr] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[propertyValue] operator[=] identifier[attr] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[defaultMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] {
identifier[String] identifier[defaultValue] operator[=] identifier[getObjectPropertyValue] operator[SEP] identifier[component] , identifier[propertyName] , literal[boolean] operator[SEP] operator[SEP] identifier[defaultMap] operator[SEP] identifier[put] operator[SEP] identifier[propertyName] , identifier[defaultValue] operator[SEP] operator[SEP]
}
identifier[setObjectProperty] operator[SEP] identifier[component] , identifier[propertyName] , identifier[propertyValue] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
public DAPNode cloneDAG(CloneMap map)
throws CloneNotSupportedException
{
AttributeTable at = (AttributeTable) super.cloneDAG(map);
at._attr = new SortedTable();
for (int i = 0; i < _attr.size(); i++) {
String key = (String) _attr.getKey(i);
Attribute element = (Attribute) _attr.elementAt(i);
// clone element (don't clone key because it's a read-only String)
at._attr.put(key, (Attribute)cloneDAG(map,element));
}
return at;
} | class class_name[name] begin[{]
method[cloneDAG, return_type[type[DAPNode]], modifier[public], parameter[map]] begin[{]
local_variable[type[AttributeTable], at]
assign[member[at._attr], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SortedTable, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=_attr, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=_attr, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None)), name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MethodInvocation(arguments=[MemberReference(member=map, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cloneDAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=at._attr, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=_attr, 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[member[.at]]
end[}]
END[}] | Keyword[public] identifier[DAPNode] identifier[cloneDAG] operator[SEP] identifier[CloneMap] identifier[map] operator[SEP] Keyword[throws] identifier[CloneNotSupportedException] {
identifier[AttributeTable] identifier[at] operator[=] operator[SEP] identifier[AttributeTable] operator[SEP] Keyword[super] operator[SEP] identifier[cloneDAG] operator[SEP] identifier[map] operator[SEP] operator[SEP] identifier[at] operator[SEP] identifier[_attr] operator[=] Keyword[new] identifier[SortedTable] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[_attr] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[key] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[_attr] operator[SEP] identifier[getKey] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[Attribute] identifier[element] operator[=] operator[SEP] identifier[Attribute] operator[SEP] identifier[_attr] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[at] operator[SEP] identifier[_attr] operator[SEP] identifier[put] operator[SEP] identifier[key] , operator[SEP] identifier[Attribute] operator[SEP] identifier[cloneDAG] operator[SEP] identifier[map] , identifier[element] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[at] operator[SEP]
}
|
public static String enc(String in) {
if (in == null || in.isEmpty()) {
return "";
}
StringBuilder out = new StringBuilder();
enc(in, out);
return out.toString();
} | class class_name[name] begin[{]
method[enc, return_type[type[String]], modifier[public static], parameter[in]] begin[{]
if[binary_operation[binary_operation[member[.in], ==, literal[null]], ||, call[in.isEmpty, parameter[]]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], out]
call[.enc, parameter[member[.in], member[.out]]]
return[call[out.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[enc] operator[SEP] identifier[String] identifier[in] operator[SEP] {
Keyword[if] operator[SEP] identifier[in] operator[==] Other[null] operator[||] identifier[in] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[StringBuilder] identifier[out] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[enc] operator[SEP] identifier[in] , identifier[out] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@NonNull public <T> T peek(int index) {
//noinspection unchecked
return (T) history.get(history.size() - index - 1);
} | class class_name[name] begin[{]
method[peek, return_type[type[T]], modifier[public], parameter[index]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=history, selectors=[], type_arguments=None), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=get, postfix_operators=[], prefix_operators=[], qualifier=history, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[peek] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[history] operator[SEP] identifier[get] operator[SEP] identifier[history] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] identifier[index] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public static Map<String, Set<InetAddress>> getNetworkInterfaceAddresses(boolean includeLoopback) {
//JVM returns interfaces in a non-predictable order, so to make this more predictable
//let's have them sort by interface name (by using a TreeMap).
Map<String, Set<InetAddress>> interfaceAddressMap = new TreeMap<>();
try {
Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
while (ifaces.hasMoreElements()) {
NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
//We only care about usable interfaces.
if (!iface.isUp()) {
continue;
}
if (!includeLoopback && iface.isLoopback()) {
continue;
}
String name = iface.getName();
Enumeration<InetAddress> ifaceAdresses = iface.getInetAddresses();
while (ifaceAdresses.hasMoreElements()) {
InetAddress ia = ifaceAdresses.nextElement();
if (!includeLoopback && ia.isLoopbackAddress()) {
continue;
}
// We want to filter out mac addresses
// Let's filter out docker interfaces too
if (!ia.getHostAddress().contains(":") && !(name != null && name.toLowerCase().contains("docker"))) {
Set<InetAddress> addresses = interfaceAddressMap.get(name);
if (addresses == null) {
addresses = new LinkedHashSet<>();
}
addresses.add(ia);
interfaceAddressMap.put(name, addresses);
}
}
}
} catch (SocketException ex) {
//noop
}
return interfaceAddressMap;
} | class class_name[name] begin[{]
method[getNetworkInterfaceAddresses, return_type[type[Map]], modifier[public static], parameter[includeLoopback]] begin[{]
local_variable[type[Map], interfaceAddressMap]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNetworkInterfaces, postfix_operators=[], prefix_operators=[], qualifier=NetworkInterface, selectors=[], type_arguments=None), name=ifaces)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=ifaces, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), name=iface)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isUp, postfix_operators=[], prefix_operators=['!'], qualifier=iface, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=includeLoopback, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isLoopback, postfix_operators=[], prefix_operators=[], qualifier=iface, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=iface, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInetAddresses, postfix_operators=[], prefix_operators=[], qualifier=iface, selectors=[], type_arguments=None), name=ifaceAdresses)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None))], dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=ifaceAdresses, selectors=[], type_arguments=None), name=ia)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=includeLoopback, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=isLoopbackAddress, postfix_operators=[], prefix_operators=[], qualifier=ia, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=[], prefix_operators=['!'], qualifier=ia, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":")], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="docker")], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=interfaceAddressMap, selectors=[], type_arguments=None), name=addresses)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None))], dimensions=[], name=Set, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=addresses, 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=addresses, 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=[], dimensions=None, name=LinkedHashSet, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ia, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=addresses, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=addresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=interfaceAddressMap, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=ifaceAdresses, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=ifaces, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['SocketException']))], finally_block=None, label=None, resources=None)
return[member[.interfaceAddressMap]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[InetAddress] operator[>] operator[>] identifier[getNetworkInterfaceAddresses] operator[SEP] Keyword[boolean] identifier[includeLoopback] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[InetAddress] operator[>] operator[>] identifier[interfaceAddressMap] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Enumeration] identifier[ifaces] operator[=] identifier[NetworkInterface] operator[SEP] identifier[getNetworkInterfaces] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[ifaces] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[NetworkInterface] identifier[iface] operator[=] operator[SEP] identifier[NetworkInterface] operator[SEP] identifier[ifaces] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[iface] operator[SEP] identifier[isUp] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[includeLoopback] operator[&&] identifier[iface] operator[SEP] identifier[isLoopback] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] identifier[name] operator[=] identifier[iface] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[Enumeration] operator[<] identifier[InetAddress] operator[>] identifier[ifaceAdresses] operator[=] identifier[iface] operator[SEP] identifier[getInetAddresses] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[ifaceAdresses] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[InetAddress] identifier[ia] operator[=] identifier[ifaceAdresses] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[includeLoopback] operator[&&] identifier[ia] operator[SEP] identifier[isLoopbackAddress] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[ia] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] operator[SEP] identifier[name] operator[!=] Other[null] operator[&&] identifier[name] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[InetAddress] operator[>] identifier[addresses] operator[=] identifier[interfaceAddressMap] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[addresses] operator[==] Other[null] operator[SEP] {
identifier[addresses] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addresses] operator[SEP] identifier[add] operator[SEP] identifier[ia] operator[SEP] operator[SEP] identifier[interfaceAddressMap] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[addresses] operator[SEP] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[SocketException] identifier[ex] operator[SEP] {
}
Keyword[return] identifier[interfaceAddressMap] operator[SEP]
}
|
public static Object[] convertParameters(Object[] parms) {
if (parms == null)
return null;
if (parms.length == 0)
return parms;
// create a new array to hold the output
Object[] newParms = new Object[parms.length];
// convert empty strings to ""
for (int i = 0; i < parms.length; i++) {
if (parms[i] instanceof String && ((String) parms[i]).equals(svEmptyString)) {
newParms[i] = svEmptyStringReplacement;
} else {
newParms[i] = parms[i];
}
}
return newParms;
} | class class_name[name] begin[{]
method[convertParameters, return_type[type[Object]], modifier[public static], parameter[parms]] begin[{]
if[binary_operation[member[.parms], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[parms.length], ==, literal[0]]] begin[{]
return[member[.parms]]
else begin[{]
None
end[}]
local_variable[type[Object], newParms]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=parms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), operator=instanceof), operandr=Cast(expression=MemberReference(member=parms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newParms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=parms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newParms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=svEmptyStringReplacement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), 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=parms, 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[member[.newParms]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] operator[SEP] operator[SEP] identifier[convertParameters] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[parms] operator[SEP] {
Keyword[if] operator[SEP] identifier[parms] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[parms] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] Keyword[return] identifier[parms] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[newParms] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[parms] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[parms] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[parms] operator[SEP] identifier[i] operator[SEP] Keyword[instanceof] identifier[String] operator[&&] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[parms] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[svEmptyString] operator[SEP] operator[SEP] {
identifier[newParms] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[svEmptyStringReplacement] operator[SEP]
}
Keyword[else] {
identifier[newParms] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[parms] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[newParms] operator[SEP]
}
|
private void calculateCL(double[] x) {
if (values != null) {
rvfcalculate(x);
return;
}
//System.out.println("Checking at: "+x[0]+" "+x[1]+" "+x[2]);
value = 0.0;
if (derivative == null) {
derivative = new double[x.length];
} else {
Arrays.fill(derivative, 0.0);
}
if (derivativeNumerator == null) {
derivativeNumerator = new double[x.length];
//use dataIterable if data is null & vice versa
if(data != null) {
for (int d = 0; d < data.length; d++) {
// if (d == testMin) {
// d = testMax - 1;
// continue;
// }
int[] features = data[d];
for (int f = 0; f < features.length; f++) {
int i = indexOf(features[f], labels[d]);
if (dataweights == null) {
derivativeNumerator[i] -= 1;
} else {
derivativeNumerator[i] -= dataweights[d];
}
}
}
}
//TODO: Make sure this work as expected!!
else if(dataIterable != null) {
//int index = 0;
for (Datum<L, F> datum : dataIterable) {
// if (d == testMin) {
// d = testMax - 1;
// continue;
// }
Collection<F> features = datum.asFeatures();
for (F feature : features) {
int i = indexOf(featureIndex.indexOf(feature), labelIndex.indexOf(datum.label()));
if (dataweights == null) {
derivativeNumerator[i] -= 1;
} /*else {
derivativeNumerator[i] -= dataweights[index];
}*/
}
}
}
else {
System.err.println("Both were null! Couldn't calculate.");
System.exit(-1);
}
}
copy(derivative, derivativeNumerator);
// Arrays.fill(derivative, 0.0);
double[] sums = new double[numClasses];
double[] probs = new double[numClasses];
// double[] counts = new double[numClasses];
// Arrays.fill(counts, 0.0);
Iterator<Datum<L, F>> iter = null;
int d = -1;
if(useIterable)
iter = dataIterable.iterator();
Datum<L, F> datum = null;
while(true){
if(useIterable) {
if(!iter.hasNext()) break;
datum = iter.next();
} else {
d++;
if(d >= data.length) break;
}
// if (d == testMin) {
// d = testMax - 1;
// continue;
// }
// activation
Arrays.fill(sums, 0.0);
double total = 0;
if(!useIterable) {
int[] featuresArr = data[d];
for (int c = 0; c < numClasses; c++) {
for (int f = 0; f < featuresArr.length; f++) {
int i = indexOf(featuresArr[f], c);
sums[c] += x[i];
}
}
// expectation (slower routine replaced by fast way)
// double total = Double.NEGATIVE_INFINITY;
// for (int c=0; c<numClasses; c++) {
// total = SloppyMath.logAdd(total, sums[c]);
// }
total = ArrayMath.logSum(sums);
for (int c = 0; c < numClasses; c++) {
probs[c] = Math.exp(sums[c] - total);
if (dataweights != null) {
probs[c] *= dataweights[d];
}
for (int f = 0; f < featuresArr.length; f++) {
int i = indexOf(featuresArr[f], c);
derivative[i] += probs[c];
}
}
} else {
Collection<F> features = datum.asFeatures();
for (int c = 0; c < numClasses; c++) {
for (F feature : features) {
int i = indexOf(featureIndex.indexOf(feature), c);
sums[c] += x[i];
}
}
// expectation (slower routine replaced by fast way)
// double total = Double.NEGATIVE_INFINITY;
// for (int c=0; c<numClasses; c++) {
// total = SloppyMath.logAdd(total, sums[c]);
// }
total = ArrayMath.logSum(sums);
for (int c = 0; c < numClasses; c++) {
probs[c] = Math.exp(sums[c] - total);
if (dataweights != null) {
probs[c] *= dataweights[d];
}
for (F feature : features) {
int i = indexOf(featureIndex.indexOf(feature), c);
derivative[i] += probs[c];
}
}
}
int labelindex;
if(useIterable)
labelindex = labelIndex.indexOf(datum.label());
else
labelindex = labels[d];
double dV = sums[labelindex] - total;
if (dataweights != null) {
dV *= dataweights[d];
}
value -= dV;
}
value += prior.compute(x, derivative);
} | class class_name[name] begin[{]
method[calculateCL, return_type[void], modifier[private], parameter[x]] begin[{]
if[binary_operation[member[.values], !=, literal[null]]] begin[{]
call[.rvfcalculate, parameter[member[.x]]]
return[None]
else begin[{]
None
end[}]
assign[member[.value], literal[0.0]]
if[binary_operation[member[.derivative], ==, literal[null]]] begin[{]
assign[member[.derivative], ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=x, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double))]
else begin[{]
call[Arrays.fill, parameter[member[.derivative], literal[0.0]]]
end[}]
if[binary_operation[member[.derivativeNumerator], ==, literal[null]]] begin[{]
assign[member[.derivativeNumerator], ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=x, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double))]
if[binary_operation[member[.data], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=features)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=features, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dataweights, 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=Assignment(expressionl=MemberReference(member=derivativeNumerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=-=, value=MemberReference(member=dataweights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=derivativeNumerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=-=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=features, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=f, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=d, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
if[binary_operation[member[.dataIterable], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=asFeatures, postfix_operators=[], prefix_operators=[], qualifier=datum, selectors=[], type_arguments=None), name=features)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=F, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=featureIndex, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=label, postfix_operators=[], prefix_operators=[], qualifier=datum, selectors=[], type_arguments=None)], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=labelIndex, selectors=[], type_arguments=None)], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dataweights, 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=derivativeNumerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=-=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=features, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=F, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dataIterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=datum)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=L, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=F, sub_type=None))], dimensions=[], name=Datum, sub_type=None))), label=None)
else begin[{]
call[System.err.println, parameter[literal["Both were null! Couldn't calculate."]]]
call[System.exit, parameter[literal[1]]]
end[}]
end[}]
else begin[{]
None
end[}]
call[.copy, parameter[member[.derivative], member[.derivativeNumerator]]]
local_variable[type[double], sums]
local_variable[type[double], probs]
local_variable[type[Iterator], iter]
local_variable[type[int], d]
if[member[.useIterable]] begin[{]
assign[member[.iter], call[dataIterable.iterator, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Datum], datum]
while[literal[true]] begin[{]
if[member[.useIterable]] begin[{]
if[call[iter.hasNext, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.datum], call[iter.next, parameter[]]]
else begin[{]
member[.d]
if[binary_operation[member[.d], >=, member[data.length]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
call[Arrays.fill, parameter[member[.sums], literal[0.0]]]
local_variable[type[double], total]
if[member[.useIterable]] begin[{]
local_variable[type[int], featuresArr]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=featuresArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sums, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=featuresArr, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=f, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numClasses, 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=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=c, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.total], call[ArrayMath.logSum, parameter[member[.sums]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=probs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=sums, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=exp, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dataweights, 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=probs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=*=, value=MemberReference(member=dataweights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=featuresArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=derivative, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=MemberReference(member=probs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=featuresArr, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=f, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numClasses, 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=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=c, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
local_variable[type[Collection], features]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=featureIndex, selectors=[], type_arguments=None), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sums, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=features, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=F, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numClasses, 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=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=c, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.total], call[ArrayMath.logSum, parameter[member[.sums]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=probs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=sums, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=exp, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dataweights, 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=probs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=*=, value=MemberReference(member=dataweights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=featureIndex, selectors=[], type_arguments=None), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=derivative, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=MemberReference(member=probs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=features, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=F, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numClasses, 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=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=c, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
local_variable[type[int], labelindex]
if[member[.useIterable]] begin[{]
assign[member[.labelindex], call[labelIndex.indexOf, parameter[call[datum.label, parameter[]]]]]
else begin[{]
assign[member[.labelindex], member[.labels]]
end[}]
local_variable[type[double], dV]
if[binary_operation[member[.dataweights], !=, literal[null]]] begin[{]
assign[member[.dV], member[.dataweights]]
else begin[{]
None
end[}]
assign[member[.value], member[.dV]]
end[}]
assign[member[.value], call[prior.compute, parameter[member[.x], member[.derivative]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[calculateCL] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[x] operator[SEP] {
Keyword[if] operator[SEP] identifier[values] operator[!=] Other[null] operator[SEP] {
identifier[rvfcalculate] operator[SEP] identifier[x] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[value] operator[=] literal[Float] operator[SEP] Keyword[if] operator[SEP] identifier[derivative] operator[==] Other[null] operator[SEP] {
identifier[derivative] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[x] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[derivative] , literal[Float] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[derivativeNumerator] operator[==] Other[null] operator[SEP] {
identifier[derivativeNumerator] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[x] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[d] operator[=] Other[0] operator[SEP] identifier[d] operator[<] identifier[data] operator[SEP] identifier[length] operator[SEP] identifier[d] operator[++] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[features] operator[=] identifier[data] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] Other[0] operator[SEP] identifier[f] operator[<] identifier[features] operator[SEP] identifier[length] operator[SEP] identifier[f] operator[++] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOf] operator[SEP] identifier[features] operator[SEP] identifier[f] operator[SEP] , identifier[labels] operator[SEP] identifier[d] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataweights] operator[==] Other[null] operator[SEP] {
identifier[derivativeNumerator] operator[SEP] identifier[i] operator[SEP] operator[-=] Other[1] operator[SEP]
}
Keyword[else] {
identifier[derivativeNumerator] operator[SEP] identifier[i] operator[SEP] operator[-=] identifier[dataweights] operator[SEP] identifier[d] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[dataIterable] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Datum] operator[<] identifier[L] , identifier[F] operator[>] identifier[datum] operator[:] identifier[dataIterable] operator[SEP] {
identifier[Collection] operator[<] identifier[F] operator[>] identifier[features] operator[=] identifier[datum] operator[SEP] identifier[asFeatures] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[F] identifier[feature] operator[:] identifier[features] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOf] operator[SEP] identifier[featureIndex] operator[SEP] identifier[indexOf] operator[SEP] identifier[feature] operator[SEP] , identifier[labelIndex] operator[SEP] identifier[indexOf] operator[SEP] identifier[datum] operator[SEP] identifier[label] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataweights] operator[==] Other[null] operator[SEP] {
identifier[derivativeNumerator] operator[SEP] identifier[i] operator[SEP] operator[-=] Other[1] operator[SEP]
}
}
}
}
Keyword[else] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
}
identifier[copy] operator[SEP] identifier[derivative] , identifier[derivativeNumerator] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[sums] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[numClasses] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[probs] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[numClasses] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Datum] operator[<] identifier[L] , identifier[F] operator[>] operator[>] identifier[iter] operator[=] Other[null] operator[SEP] Keyword[int] identifier[d] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[useIterable] operator[SEP] identifier[iter] operator[=] identifier[dataIterable] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[Datum] operator[<] identifier[L] , identifier[F] operator[>] identifier[datum] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[useIterable] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] identifier[datum] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[d] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[>=] identifier[data] operator[SEP] identifier[length] operator[SEP] Keyword[break] operator[SEP]
}
identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[sums] , literal[Float] operator[SEP] operator[SEP] Keyword[double] identifier[total] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[useIterable] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[featuresArr] operator[=] identifier[data] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[c] operator[=] Other[0] operator[SEP] identifier[c] operator[<] identifier[numClasses] operator[SEP] identifier[c] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] Other[0] operator[SEP] identifier[f] operator[<] identifier[featuresArr] operator[SEP] identifier[length] operator[SEP] identifier[f] operator[++] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOf] operator[SEP] identifier[featuresArr] operator[SEP] identifier[f] operator[SEP] , identifier[c] operator[SEP] operator[SEP] identifier[sums] operator[SEP] identifier[c] operator[SEP] operator[+=] identifier[x] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
identifier[total] operator[=] identifier[ArrayMath] operator[SEP] identifier[logSum] operator[SEP] identifier[sums] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[c] operator[=] Other[0] operator[SEP] identifier[c] operator[<] identifier[numClasses] operator[SEP] identifier[c] operator[++] operator[SEP] {
identifier[probs] operator[SEP] identifier[c] operator[SEP] operator[=] identifier[Math] operator[SEP] identifier[exp] operator[SEP] identifier[sums] operator[SEP] identifier[c] operator[SEP] operator[-] identifier[total] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataweights] operator[!=] Other[null] operator[SEP] {
identifier[probs] operator[SEP] identifier[c] operator[SEP] operator[*=] identifier[dataweights] operator[SEP] identifier[d] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] Other[0] operator[SEP] identifier[f] operator[<] identifier[featuresArr] operator[SEP] identifier[length] operator[SEP] identifier[f] operator[++] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOf] operator[SEP] identifier[featuresArr] operator[SEP] identifier[f] operator[SEP] , identifier[c] operator[SEP] operator[SEP] identifier[derivative] operator[SEP] identifier[i] operator[SEP] operator[+=] identifier[probs] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[Collection] operator[<] identifier[F] operator[>] identifier[features] operator[=] identifier[datum] operator[SEP] identifier[asFeatures] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[c] operator[=] Other[0] operator[SEP] identifier[c] operator[<] identifier[numClasses] operator[SEP] identifier[c] operator[++] operator[SEP] {
Keyword[for] operator[SEP] identifier[F] identifier[feature] operator[:] identifier[features] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOf] operator[SEP] identifier[featureIndex] operator[SEP] identifier[indexOf] operator[SEP] identifier[feature] operator[SEP] , identifier[c] operator[SEP] operator[SEP] identifier[sums] operator[SEP] identifier[c] operator[SEP] operator[+=] identifier[x] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
identifier[total] operator[=] identifier[ArrayMath] operator[SEP] identifier[logSum] operator[SEP] identifier[sums] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[c] operator[=] Other[0] operator[SEP] identifier[c] operator[<] identifier[numClasses] operator[SEP] identifier[c] operator[++] operator[SEP] {
identifier[probs] operator[SEP] identifier[c] operator[SEP] operator[=] identifier[Math] operator[SEP] identifier[exp] operator[SEP] identifier[sums] operator[SEP] identifier[c] operator[SEP] operator[-] identifier[total] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataweights] operator[!=] Other[null] operator[SEP] {
identifier[probs] operator[SEP] identifier[c] operator[SEP] operator[*=] identifier[dataweights] operator[SEP] identifier[d] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[F] identifier[feature] operator[:] identifier[features] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[indexOf] operator[SEP] identifier[featureIndex] operator[SEP] identifier[indexOf] operator[SEP] identifier[feature] operator[SEP] , identifier[c] operator[SEP] operator[SEP] identifier[derivative] operator[SEP] identifier[i] operator[SEP] operator[+=] identifier[probs] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
}
Keyword[int] identifier[labelindex] operator[SEP] Keyword[if] operator[SEP] identifier[useIterable] operator[SEP] identifier[labelindex] operator[=] identifier[labelIndex] operator[SEP] identifier[indexOf] operator[SEP] identifier[datum] operator[SEP] identifier[label] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[labelindex] operator[=] identifier[labels] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[double] identifier[dV] operator[=] identifier[sums] operator[SEP] identifier[labelindex] operator[SEP] operator[-] identifier[total] operator[SEP] Keyword[if] operator[SEP] identifier[dataweights] operator[!=] Other[null] operator[SEP] {
identifier[dV] operator[*=] identifier[dataweights] operator[SEP] identifier[d] operator[SEP] operator[SEP]
}
identifier[value] operator[-=] identifier[dV] operator[SEP]
}
identifier[value] operator[+=] identifier[prior] operator[SEP] identifier[compute] operator[SEP] identifier[x] , identifier[derivative] operator[SEP] operator[SEP]
}
|
public static SqlRunner create(DataSource ds, String driverClassName) {
return new SqlRunner(ds, DialectFactory.newDialect(driverClassName));
} | class class_name[name] begin[{]
method[create, return_type[type[SqlRunner]], modifier[public static], parameter[ds, driverClassName]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=ds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=driverClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newDialect, postfix_operators=[], prefix_operators=[], qualifier=DialectFactory, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SqlRunner, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SqlRunner] identifier[create] operator[SEP] identifier[DataSource] identifier[ds] , identifier[String] identifier[driverClassName] operator[SEP] {
Keyword[return] Keyword[new] identifier[SqlRunner] operator[SEP] identifier[ds] , identifier[DialectFactory] operator[SEP] identifier[newDialect] operator[SEP] identifier[driverClassName] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean overlaps(Location location) {
if (location.getBeginPosition()>=getBeginPosition() && location.getBeginPosition() <= getEndPosition())
return true;
if(location.getBeginPosition() <= getBeginPosition() && location.getEndPosition()>=getBeginPosition())
return true;
else {
return false;
}
} | class class_name[name] begin[{]
method[overlaps, return_type[type[boolean]], modifier[public], parameter[location]] begin[{]
if[binary_operation[binary_operation[call[location.getBeginPosition, parameter[]], >=, call[.getBeginPosition, parameter[]]], &&, binary_operation[call[location.getBeginPosition, parameter[]], <=, call[.getEndPosition, parameter[]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[location.getBeginPosition, parameter[]], <=, call[.getBeginPosition, parameter[]]], &&, binary_operation[call[location.getEndPosition, parameter[]], >=, call[.getBeginPosition, parameter[]]]]] begin[{]
return[literal[true]]
else begin[{]
return[literal[false]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[overlaps] operator[SEP] identifier[Location] identifier[location] operator[SEP] {
Keyword[if] operator[SEP] identifier[location] operator[SEP] identifier[getBeginPosition] operator[SEP] operator[SEP] operator[>=] identifier[getBeginPosition] operator[SEP] operator[SEP] operator[&&] identifier[location] operator[SEP] identifier[getBeginPosition] operator[SEP] operator[SEP] operator[<=] identifier[getEndPosition] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[SEP] identifier[getBeginPosition] operator[SEP] operator[SEP] operator[<=] identifier[getBeginPosition] operator[SEP] operator[SEP] operator[&&] identifier[location] operator[SEP] identifier[getEndPosition] operator[SEP] operator[SEP] operator[>=] identifier[getBeginPosition] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
@Override
public void visit(NodeVisitor v) {
if (v.visit(this)) {
for (AstNode e : getElements()) {
e.visit(v);
}
}
} | class class_name[name] begin[{]
method[visit, return_type[void], modifier[public], parameter[v]] begin[{]
if[call[v.visit, parameter[THIS[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visit, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AstNode, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visit] operator[SEP] identifier[NodeVisitor] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[v] operator[SEP] identifier[visit] operator[SEP] Keyword[this] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[AstNode] identifier[e] operator[:] identifier[getElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[e] operator[SEP] identifier[visit] operator[SEP] identifier[v] operator[SEP] operator[SEP]
}
}
}
|
public void addConfigurationListener(NodeConfigListener listener) {
StanzaListener conListener = new NodeConfigTranslator(listener);
configEventToListenerMap.put(listener, conListener);
pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.configuration.toString()));
} | class class_name[name] begin[{]
method[addConfigurationListener, return_type[void], modifier[public], parameter[listener]] begin[{]
local_variable[type[StanzaListener], conListener]
call[configEventToListenerMap.put, parameter[member[.listener], member[.conListener]]]
call[pubSubManager.getConnection, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addConfigurationListener] operator[SEP] identifier[NodeConfigListener] identifier[listener] operator[SEP] {
identifier[StanzaListener] identifier[conListener] operator[=] Keyword[new] identifier[NodeConfigTranslator] operator[SEP] identifier[listener] operator[SEP] operator[SEP] identifier[configEventToListenerMap] operator[SEP] identifier[put] operator[SEP] identifier[listener] , identifier[conListener] operator[SEP] operator[SEP] identifier[pubSubManager] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] identifier[addSyncStanzaListener] operator[SEP] identifier[conListener] , Keyword[new] identifier[EventContentFilter] operator[SEP] identifier[EventElementType] operator[SEP] identifier[configuration] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public DeleteUserPermissionsBoundaryResult deleteUserPermissionsBoundary(DeleteUserPermissionsBoundaryRequest request) {
request = beforeClientExecution(request);
return executeDeleteUserPermissionsBoundary(request);
} | class class_name[name] begin[{]
method[deleteUserPermissionsBoundary, return_type[type[DeleteUserPermissionsBoundaryResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteUserPermissionsBoundary, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DeleteUserPermissionsBoundaryResult] identifier[deleteUserPermissionsBoundary] operator[SEP] identifier[DeleteUserPermissionsBoundaryRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteUserPermissionsBoundary] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected Map<String, List<MtasParserObject>> createCurrentList() {
Map<String, List<MtasParserObject>> currentList = new HashMap<>();
currentList.put(MAPPING_TYPE_RELATION, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_RELATION_ANNOTATION,
new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_REF, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_GROUP, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_GROUP_ANNOTATION,
new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_WORD, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_WORD_ANNOTATION,
new ArrayList<MtasParserObject>());
return currentList;
} | class class_name[name] begin[{]
method[createCurrentList, return_type[type[Map]], modifier[protected], parameter[]] begin[{]
local_variable[type[Map], currentList]
call[currentList.put, parameter[member[.MAPPING_TYPE_RELATION], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
call[currentList.put, parameter[member[.MAPPING_TYPE_RELATION_ANNOTATION], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
call[currentList.put, parameter[member[.MAPPING_TYPE_REF], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
call[currentList.put, parameter[member[.MAPPING_TYPE_GROUP], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
call[currentList.put, parameter[member[.MAPPING_TYPE_GROUP_ANNOTATION], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
call[currentList.put, parameter[member[.MAPPING_TYPE_WORD], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
call[currentList.put, parameter[member[.MAPPING_TYPE_WORD_ANNOTATION], 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=MtasParserObject, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]
return[member[.currentList]]
end[}]
END[}] | Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[MtasParserObject] operator[>] operator[>] identifier[createCurrentList] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[MtasParserObject] operator[>] operator[>] identifier[currentList] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_RELATION] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_RELATION_ANNOTATION] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_REF] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_GROUP] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_GROUP_ANNOTATION] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_WORD] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[currentList] operator[SEP] identifier[put] operator[SEP] identifier[MAPPING_TYPE_WORD_ANNOTATION] , Keyword[new] identifier[ArrayList] operator[<] identifier[MtasParserObject] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[currentList] operator[SEP]
}
|
public static dnsaddrec[] get_filtered(nitro_service service, String filter) throws Exception{
dnsaddrec obj = new dnsaddrec();
options option = new options();
option.set_filter(filter);
dnsaddrec[] response = (dnsaddrec[]) obj.getfiltered(service, option);
return response;
} | class class_name[name] begin[{]
method[get_filtered, return_type[type[dnsaddrec]], modifier[public static], parameter[service, filter]] begin[{]
local_variable[type[dnsaddrec], obj]
local_variable[type[options], option]
call[option.set_filter, parameter[member[.filter]]]
local_variable[type[dnsaddrec], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[dnsaddrec] operator[SEP] operator[SEP] identifier[get_filtered] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[filter] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[dnsaddrec] identifier[obj] operator[=] Keyword[new] identifier[dnsaddrec] operator[SEP] operator[SEP] operator[SEP] identifier[options] identifier[option] operator[=] Keyword[new] identifier[options] operator[SEP] operator[SEP] operator[SEP] identifier[option] operator[SEP] identifier[set_filter] operator[SEP] identifier[filter] operator[SEP] operator[SEP] identifier[dnsaddrec] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[dnsaddrec] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[getfiltered] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public static final int compare(final Object obj0, final Object obj1)
throws ELException {
return compare(null, obj0, obj1);
} | class class_name[name] begin[{]
method[compare, return_type[type[int]], modifier[final public static], parameter[obj0, obj1]] begin[{]
return[call[.compare, parameter[literal[null], member[.obj0], member[.obj1]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] Keyword[int] identifier[compare] operator[SEP] Keyword[final] identifier[Object] identifier[obj0] , Keyword[final] identifier[Object] identifier[obj1] operator[SEP] Keyword[throws] identifier[ELException] {
Keyword[return] identifier[compare] operator[SEP] Other[null] , identifier[obj0] , identifier[obj1] operator[SEP] operator[SEP]
}
|
public SequenceView<C> get(int index) {
int start = toStartIndex(index);
int end = index + (getWindowSize() - 1);
return getBackingSequence().getSubSequence(start, end);
} | class class_name[name] begin[{]
method[get, return_type[type[SequenceView]], modifier[public], parameter[index]] begin[{]
local_variable[type[int], start]
local_variable[type[int], end]
return[call[.getBackingSequence, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[SequenceView] operator[<] identifier[C] operator[>] identifier[get] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[int] identifier[start] operator[=] identifier[toStartIndex] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[int] identifier[end] operator[=] identifier[index] operator[+] operator[SEP] identifier[getWindowSize] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[getBackingSequence] operator[SEP] operator[SEP] operator[SEP] identifier[getSubSequence] operator[SEP] identifier[start] , identifier[end] operator[SEP] operator[SEP]
}
|
private String getPath(URL url) {
String path = url.toExternalForm();
return path.replaceAll("bundle://[^/]*/", "");
} | class class_name[name] begin[{]
method[getPath, return_type[type[String]], modifier[private], parameter[url]] begin[{]
local_variable[type[String], path]
return[call[path.replaceAll, parameter[literal["bundle://[^/]*/"], literal[""]]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getPath] operator[SEP] identifier[URL] identifier[url] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[url] operator[SEP] identifier[toExternalForm] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[path] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException {
model.get(ModelConstants.PROCESS_ENGINES);
} | class class_name[name] begin[{]
method[populateModel, return_type[void], modifier[protected], parameter[operation, model]] begin[{]
call[model.get, parameter[member[ModelConstants.PROCESS_ENGINES]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[populateModel] operator[SEP] identifier[ModelNode] identifier[operation] , identifier[ModelNode] identifier[model] operator[SEP] Keyword[throws] identifier[OperationFailedException] {
identifier[model] operator[SEP] identifier[get] operator[SEP] identifier[ModelConstants] operator[SEP] identifier[PROCESS_ENGINES] operator[SEP] operator[SEP]
}
|
private static Image uploadImage(
AdWordsServicesInterface services, AdWordsSession session, String url) throws IOException {
Image image = new Image();
image.setType(MediaMediaType.IMAGE);
image.setData(com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl(url));
MediaServiceInterface mediaService = services.get(session, MediaServiceInterface.class);
return (Image) mediaService.upload(new Media[] {image})[0];
} | class class_name[name] begin[{]
method[uploadImage, return_type[type[Image]], modifier[private static], parameter[services, session, url]] begin[{]
local_variable[type[Image], image]
call[image.setType, parameter[member[MediaMediaType.IMAGE]]]
call[image.setData, parameter[call[com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl, parameter[member[.url]]]]]
local_variable[type[MediaServiceInterface], mediaService]
return[Cast(expression=MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=image, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Media, sub_type=None))], member=upload, postfix_operators=[], prefix_operators=[], qualifier=mediaService, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Image, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Image] identifier[uploadImage] operator[SEP] identifier[AdWordsServicesInterface] identifier[services] , identifier[AdWordsSession] identifier[session] , identifier[String] identifier[url] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Image] identifier[image] operator[=] Keyword[new] identifier[Image] operator[SEP] operator[SEP] operator[SEP] identifier[image] operator[SEP] identifier[setType] operator[SEP] identifier[MediaMediaType] operator[SEP] identifier[IMAGE] operator[SEP] operator[SEP] identifier[image] operator[SEP] identifier[setData] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[common] operator[SEP] identifier[lib] operator[SEP] identifier[utils] operator[SEP] identifier[Media] operator[SEP] identifier[getMediaDataFromUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] operator[SEP] identifier[MediaServiceInterface] identifier[mediaService] operator[=] identifier[services] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[MediaServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[Image] operator[SEP] identifier[mediaService] operator[SEP] identifier[upload] operator[SEP] Keyword[new] identifier[Media] operator[SEP] operator[SEP] {
identifier[image]
} operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.