code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public boolean normalToPlane( double normX , double normY , Point2D_F64 plane ) {
// Ray pointing from camera center through pixel to ground in ground reference frame
pointing.set(normX,normY,1);
GeometryMath_F64.mult(cameraToPlane.getR(), pointing, pointing);
double height = cameraToPlane.getY();
// If the point vector and the vector from the plane have the same sign then the ray will not intersect
// the plane or the intersection is undefined
if( pointing.y*height >= 0 )
return false;
// compute the location of the point on the plane in 2D
double t = -height / pointing.y;
plane.x = pointing.z*t;
plane.y = -pointing.x*t;
return true;
}
|
class class_name[name] begin[{]
method[normalToPlane, return_type[type[boolean]], modifier[public], parameter[normX, normY, plane]] begin[{]
call[pointing.set, parameter[member[.normX], member[.normY], literal[1]]]
call[GeometryMath_F64.mult, parameter[call[cameraToPlane.getR, parameter[]], member[.pointing], member[.pointing]]]
local_variable[type[double], height]
if[binary_operation[binary_operation[member[pointing.y], *, member[.height]], >=, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[double], t]
assign[member[plane.x], binary_operation[member[pointing.z], *, member[.t]]]
assign[member[plane.y], binary_operation[member[pointing.x], *, member[.t]]]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[normalToPlane] operator[SEP] Keyword[double] identifier[normX] , Keyword[double] identifier[normY] , identifier[Point2D_F64] identifier[plane] operator[SEP] {
identifier[pointing] operator[SEP] identifier[set] operator[SEP] identifier[normX] , identifier[normY] , Other[1] operator[SEP] operator[SEP] identifier[GeometryMath_F64] operator[SEP] identifier[mult] operator[SEP] identifier[cameraToPlane] operator[SEP] identifier[getR] operator[SEP] operator[SEP] , identifier[pointing] , identifier[pointing] operator[SEP] operator[SEP] Keyword[double] identifier[height] operator[=] identifier[cameraToPlane] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pointing] operator[SEP] identifier[y] operator[*] identifier[height] operator[>=] Other[0] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[double] identifier[t] operator[=] operator[-] identifier[height] operator[/] identifier[pointing] operator[SEP] identifier[y] operator[SEP] identifier[plane] operator[SEP] identifier[x] operator[=] identifier[pointing] operator[SEP] identifier[z] operator[*] identifier[t] operator[SEP] identifier[plane] operator[SEP] identifier[y] operator[=] operator[-] identifier[pointing] operator[SEP] identifier[x] operator[*] identifier[t] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public void plus(LinearSparseVector sv, float w) {
if (sv == null)
return;
for (int i = 0; i < sv.length; i++) {
float val = (float) sv.data[i] * w;
add(sv.index[i], val);
}
}
|
class class_name[name] begin[{]
method[plus, return_type[void], modifier[public], parameter[sv, w]] begin[{]
if[binary_operation[member[.sv], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Cast(expression=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=sv, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=BasicType(dimensions=[], name=float)), operandr=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=val)], modifiers=set(), type=BasicType(dimensions=[], name=float)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=sv, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=sv, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[plus] operator[SEP] identifier[LinearSparseVector] identifier[sv] , Keyword[float] identifier[w] operator[SEP] {
Keyword[if] operator[SEP] identifier[sv] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[sv] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[float] identifier[val] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[sv] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[*] identifier[w] operator[SEP] identifier[add] operator[SEP] identifier[sv] operator[SEP] identifier[index] operator[SEP] identifier[i] operator[SEP] , identifier[val] operator[SEP] operator[SEP]
}
}
|
private String _getIdFromClientId(String clientId)
{
final char separator = getFacesContext().getNamingContainerSeparatorChar();
int lastIndex = clientId.lastIndexOf(separator);
String id = null;
if (lastIndex < 0)
{
id = clientId;
}
else if (lastIndex < (clientId.length() - 1))
{
id = clientId.substring(lastIndex + 1);
}
//else
//{
// TODO log warning for trailing colon case
//}
return id;
}
|
class class_name[name] begin[{]
method[_getIdFromClientId, return_type[type[String]], modifier[private], parameter[clientId]] begin[{]
local_variable[type[char], separator]
local_variable[type[int], lastIndex]
local_variable[type[String], id]
if[binary_operation[member[.lastIndex], <, literal[0]]] begin[{]
assign[member[.id], member[.clientId]]
else begin[{]
if[binary_operation[member[.lastIndex], <, binary_operation[call[clientId.length, parameter[]], -, literal[1]]]] begin[{]
assign[member[.id], call[clientId.substring, parameter[binary_operation[member[.lastIndex], +, literal[1]]]]]
else begin[{]
None
end[}]
end[}]
return[member[.id]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[_getIdFromClientId] operator[SEP] identifier[String] identifier[clientId] operator[SEP] {
Keyword[final] Keyword[char] identifier[separator] operator[=] identifier[getFacesContext] operator[SEP] operator[SEP] operator[SEP] identifier[getNamingContainerSeparatorChar] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[lastIndex] operator[=] identifier[clientId] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[separator] operator[SEP] operator[SEP] identifier[String] identifier[id] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[lastIndex] operator[<] Other[0] operator[SEP] {
identifier[id] operator[=] identifier[clientId] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lastIndex] operator[<] operator[SEP] identifier[clientId] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] {
identifier[id] operator[=] identifier[clientId] operator[SEP] identifier[substring] operator[SEP] identifier[lastIndex] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[id] operator[SEP]
}
|
LogMetadata removeEmptyLedgers(int skipCountFromEnd) {
val newLedgers = new ArrayList<LedgerMetadata>();
int cutoffIndex = this.ledgers.size() - skipCountFromEnd;
for (int i = 0; i < cutoffIndex; i++) {
LedgerMetadata lm = this.ledgers.get(i);
if (lm.getStatus() != LedgerMetadata.Status.Empty) {
// Not Empty or Unknown: keep it!
newLedgers.add(lm);
}
}
// Add the ones from the end, as instructed.
for (int i = cutoffIndex; i < this.ledgers.size(); i++) {
newLedgers.add(this.ledgers.get(i));
}
return new LogMetadata(this.epoch, this.enabled, Collections.unmodifiableList(newLedgers), this.truncationAddress, this.updateVersion.get());
}
|
class class_name[name] begin[{]
method[removeEmptyLedgers, return_type[type[LogMetadata]], modifier[default], parameter[skipCountFromEnd]] begin[{]
local_variable[type[val], newLedgers]
local_variable[type[int], cutoffIndex]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ledgers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=lm)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LedgerMetadata, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStatus, postfix_operators=[], prefix_operators=[], qualifier=lm, selectors=[], type_arguments=None), operandr=MemberReference(member=Empty, postfix_operators=[], prefix_operators=[], qualifier=LedgerMetadata.Status, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=newLedgers, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cutoffIndex, 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)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ledgers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=add, postfix_operators=[], prefix_operators=[], qualifier=newLedgers, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ledgers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=cutoffIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=epoch, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=enabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MethodInvocation(arguments=[MemberReference(member=newLedgers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableList, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=truncationAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=updateVersion, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LogMetadata, sub_type=None))]
end[}]
END[}]
|
identifier[LogMetadata] identifier[removeEmptyLedgers] operator[SEP] Keyword[int] identifier[skipCountFromEnd] operator[SEP] {
identifier[val] identifier[newLedgers] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[LedgerMetadata] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[cutoffIndex] operator[=] Keyword[this] operator[SEP] identifier[ledgers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] identifier[skipCountFromEnd] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[cutoffIndex] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[LedgerMetadata] identifier[lm] operator[=] Keyword[this] operator[SEP] identifier[ledgers] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lm] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[!=] identifier[LedgerMetadata] operator[SEP] identifier[Status] operator[SEP] identifier[Empty] operator[SEP] {
identifier[newLedgers] operator[SEP] identifier[add] operator[SEP] identifier[lm] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[cutoffIndex] operator[SEP] identifier[i] operator[<] Keyword[this] operator[SEP] identifier[ledgers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[newLedgers] operator[SEP] identifier[add] operator[SEP] Keyword[this] operator[SEP] identifier[ledgers] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[LogMetadata] operator[SEP] Keyword[this] operator[SEP] identifier[epoch] , Keyword[this] operator[SEP] identifier[enabled] , identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[newLedgers] operator[SEP] , Keyword[this] operator[SEP] identifier[truncationAddress] , Keyword[this] operator[SEP] identifier[updateVersion] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <E> ImmutableSortedMultiset<E> copyOfSorted(SortedMultiset<E> sortedMultiset) {
return copyOfSortedEntries(
sortedMultiset.comparator(), Lists.newArrayList(sortedMultiset.entrySet()));
}
|
class class_name[name] begin[{]
method[copyOfSorted, return_type[type[ImmutableSortedMultiset]], modifier[public static], parameter[sortedMultiset]] begin[{]
return[call[.copyOfSortedEntries, parameter[call[sortedMultiset.comparator, parameter[]], call[Lists.newArrayList, parameter[call[sortedMultiset.entrySet, parameter[]]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[ImmutableSortedMultiset] operator[<] identifier[E] operator[>] identifier[copyOfSorted] operator[SEP] identifier[SortedMultiset] operator[<] identifier[E] operator[>] identifier[sortedMultiset] operator[SEP] {
Keyword[return] identifier[copyOfSortedEntries] operator[SEP] identifier[sortedMultiset] operator[SEP] identifier[comparator] operator[SEP] operator[SEP] , identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] identifier[sortedMultiset] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI,
SimpleOutputElement elem)
throws XMLStreamException
{
if (nsURI == null || nsURI.length() == 0) {
/* Attributes never use the default namespace; missing
* prefix always leads to the empty ns... so nothing
* special is needed here.
*/
return null;
}
// Maybe the suggested prefix is properly bound?
if (suggPrefix != null) {
int status = elem.isPrefixValid(suggPrefix, nsURI, false);
if (status == SimpleOutputElement.PREFIX_OK) {
return suggPrefix;
}
/* Otherwise, if the prefix is unbound, let's just bind
* it -- if caller specified a prefix, it probably prefers
* binding that prefix even if another prefix already existed?
* The remaining case (already bound to another URI) we don't
* want to touch, at least not yet: it may or not be safe
* to change binding, so let's just not try it.
*/
if (status == SimpleOutputElement.PREFIX_UNBOUND) {
elem.addPrefix(suggPrefix, nsURI);
doWriteNamespace(suggPrefix, nsURI);
return suggPrefix;
}
}
// If not, perhaps there's another existing binding available?
String prefix = elem.getExplicitPrefix(nsURI);
if (prefix != null) { // already had a mapping for the URI... cool.
return prefix;
}
/* Nope, need to create one. First, let's see if there's a
* preference...
*/
if (suggPrefix != null) {
prefix = suggPrefix;
} else if (mSuggestedPrefixes != null) {
prefix = mSuggestedPrefixes.get(nsURI);
// note: def ns is never added to suggested prefix map
}
if (prefix != null) {
/* Can not use default namespace for attributes.
* Also, re-binding is tricky for attributes; can't
* re-bind anything that's bound on this scope... or
* used in this scope. So, to simplify life, let's not
* re-bind anything for attributes.
*/
if (prefix.length() == 0
|| (elem.getNamespaceURI(prefix) != null)) {
prefix = null;
}
}
if (prefix == null) {
if (mAutoNsSeq == null) {
mAutoNsSeq = new int[1];
mAutoNsSeq[0] = 1;
}
prefix = mCurrElem.generateMapping(mAutomaticNsPrefix, nsURI,
mAutoNsSeq);
}
// Ok; so far so good: let's now bind and output the namespace:
elem.addPrefix(prefix, nsURI);
doWriteNamespace(prefix, nsURI);
return prefix;
}
|
class class_name[name] begin[{]
method[findOrCreateAttrPrefix, return_type[type[String]], modifier[final protected], parameter[suggPrefix, nsURI, elem]] begin[{]
if[binary_operation[binary_operation[member[.nsURI], ==, literal[null]], ||, binary_operation[call[nsURI.length, parameter[]], ==, literal[0]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.suggPrefix], !=, literal[null]]] begin[{]
local_variable[type[int], status]
if[binary_operation[member[.status], ==, member[SimpleOutputElement.PREFIX_OK]]] begin[{]
return[member[.suggPrefix]]
else begin[{]
None
end[}]
if[binary_operation[member[.status], ==, member[SimpleOutputElement.PREFIX_UNBOUND]]] begin[{]
call[elem.addPrefix, parameter[member[.suggPrefix], member[.nsURI]]]
call[.doWriteNamespace, parameter[member[.suggPrefix], member[.nsURI]]]
return[member[.suggPrefix]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[String], prefix]
if[binary_operation[member[.prefix], !=, literal[null]]] begin[{]
return[member[.prefix]]
else begin[{]
None
end[}]
if[binary_operation[member[.suggPrefix], !=, literal[null]]] begin[{]
assign[member[.prefix], member[.suggPrefix]]
else begin[{]
if[binary_operation[member[.mSuggestedPrefixes], !=, literal[null]]] begin[{]
assign[member[.prefix], call[mSuggestedPrefixes.get, parameter[member[.nsURI]]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.prefix], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[call[prefix.length, parameter[]], ==, literal[0]], ||, binary_operation[call[elem.getNamespaceURI, parameter[member[.prefix]]], !=, literal[null]]]] begin[{]
assign[member[.prefix], literal[null]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.prefix], ==, literal[null]]] begin[{]
if[binary_operation[member[.mAutoNsSeq], ==, literal[null]]] begin[{]
assign[member[.mAutoNsSeq], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
assign[member[.mAutoNsSeq], literal[1]]
else begin[{]
None
end[}]
assign[member[.prefix], call[mCurrElem.generateMapping, parameter[member[.mAutomaticNsPrefix], member[.nsURI], member[.mAutoNsSeq]]]]
else begin[{]
None
end[}]
call[elem.addPrefix, parameter[member[.prefix], member[.nsURI]]]
call[.doWriteNamespace, parameter[member[.prefix], member[.nsURI]]]
return[member[.prefix]]
end[}]
END[}]
|
Keyword[protected] Keyword[final] identifier[String] identifier[findOrCreateAttrPrefix] operator[SEP] identifier[String] identifier[suggPrefix] , identifier[String] identifier[nsURI] , identifier[SimpleOutputElement] identifier[elem] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
Keyword[if] operator[SEP] identifier[nsURI] operator[==] Other[null] operator[||] identifier[nsURI] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[suggPrefix] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[status] operator[=] identifier[elem] operator[SEP] identifier[isPrefixValid] operator[SEP] identifier[suggPrefix] , identifier[nsURI] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[==] identifier[SimpleOutputElement] operator[SEP] identifier[PREFIX_OK] operator[SEP] {
Keyword[return] identifier[suggPrefix] operator[SEP]
}
Keyword[if] operator[SEP] identifier[status] operator[==] identifier[SimpleOutputElement] operator[SEP] identifier[PREFIX_UNBOUND] operator[SEP] {
identifier[elem] operator[SEP] identifier[addPrefix] operator[SEP] identifier[suggPrefix] , identifier[nsURI] operator[SEP] operator[SEP] identifier[doWriteNamespace] operator[SEP] identifier[suggPrefix] , identifier[nsURI] operator[SEP] operator[SEP] Keyword[return] identifier[suggPrefix] operator[SEP]
}
}
identifier[String] identifier[prefix] operator[=] identifier[elem] operator[SEP] identifier[getExplicitPrefix] operator[SEP] identifier[nsURI] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prefix] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[prefix] operator[SEP]
}
Keyword[if] operator[SEP] identifier[suggPrefix] operator[!=] Other[null] operator[SEP] {
identifier[prefix] operator[=] identifier[suggPrefix] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[mSuggestedPrefixes] operator[!=] Other[null] operator[SEP] {
identifier[prefix] operator[=] identifier[mSuggestedPrefixes] operator[SEP] identifier[get] operator[SEP] identifier[nsURI] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[prefix] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[||] operator[SEP] identifier[elem] operator[SEP] identifier[getNamespaceURI] operator[SEP] identifier[prefix] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[prefix] operator[=] Other[null] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[prefix] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[mAutoNsSeq] operator[==] Other[null] operator[SEP] {
identifier[mAutoNsSeq] operator[=] Keyword[new] Keyword[int] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[mAutoNsSeq] operator[SEP] Other[0] operator[SEP] operator[=] Other[1] operator[SEP]
}
identifier[prefix] operator[=] identifier[mCurrElem] operator[SEP] identifier[generateMapping] operator[SEP] identifier[mAutomaticNsPrefix] , identifier[nsURI] , identifier[mAutoNsSeq] operator[SEP] operator[SEP]
}
identifier[elem] operator[SEP] identifier[addPrefix] operator[SEP] identifier[prefix] , identifier[nsURI] operator[SEP] operator[SEP] identifier[doWriteNamespace] operator[SEP] identifier[prefix] , identifier[nsURI] operator[SEP] operator[SEP] Keyword[return] identifier[prefix] operator[SEP]
}
|
protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource)
throws CmsDbSqlException {
CmsResourceState state = CmsResource.STATE_KEEP;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
conn = m_sqlManager.getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_READ_RESOURCE_STATE");
stmt.setString(1, resource.getResourceId().toString());
res = stmt.executeQuery();
if (res.next()) {
state = CmsResourceState.valueOf(res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE")));
while (res.next()) {
// do nothing only move through all rows because of mssql odbc driver
}
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
return state;
}
|
class class_name[name] begin[{]
method[internalReadResourceState, return_type[type[CmsResourceState]], modifier[protected], parameter[dbc, projectId, resource]] begin[{]
local_variable[type[CmsResourceState], state]
local_variable[type[Connection], conn]
local_variable[type[PreparedStatement], stmt]
local_variable[type[ResultSet], res]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=dbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=projectId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="C_READ_RESOURCE_STATE")], member=getPreparedStatement, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MethodInvocation(arguments=[], member=getResourceId, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setString, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="C_RESOURCES_STATE")], member=readQuery, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None)], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=CmsResourceState, selectors=[], type_arguments=None)), label=None), WhileStatement(body=BlockStatement(label=None, statements=[]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_GENERIC_SQL_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getErrorQuery, postfix_operators=[], prefix_operators=[], qualifier=CmsDbSqlException, selectors=[], type_arguments=None)], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=CmsDbSqlException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeAll, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.state]]
end[}]
END[}]
|
Keyword[protected] identifier[CmsResourceState] identifier[internalReadResourceState] operator[SEP] identifier[CmsDbContext] identifier[dbc] , identifier[CmsUUID] identifier[projectId] , identifier[CmsResource] identifier[resource] operator[SEP] Keyword[throws] identifier[CmsDbSqlException] {
identifier[CmsResourceState] identifier[state] operator[=] identifier[CmsResource] operator[SEP] identifier[STATE_KEEP] operator[SEP] identifier[Connection] identifier[conn] operator[=] Other[null] operator[SEP] identifier[PreparedStatement] identifier[stmt] operator[=] Other[null] operator[SEP] identifier[ResultSet] identifier[res] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[conn] operator[=] identifier[m_sqlManager] operator[SEP] identifier[getConnection] operator[SEP] identifier[dbc] operator[SEP] operator[SEP] identifier[stmt] operator[=] identifier[m_sqlManager] operator[SEP] identifier[getPreparedStatement] operator[SEP] identifier[conn] , identifier[projectId] , literal[String] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[setString] operator[SEP] Other[1] , identifier[resource] operator[SEP] identifier[getResourceId] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[res] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[res] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
identifier[state] operator[=] identifier[CmsResourceState] operator[SEP] identifier[valueOf] operator[SEP] identifier[res] operator[SEP] identifier[getInt] operator[SEP] identifier[m_sqlManager] operator[SEP] identifier[readQuery] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[res] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
}
}
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CmsDbSqlException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_GENERIC_SQL_1] , identifier[CmsDbSqlException] operator[SEP] identifier[getErrorQuery] operator[SEP] identifier[stmt] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[m_sqlManager] operator[SEP] identifier[closeAll] operator[SEP] identifier[dbc] , identifier[conn] , identifier[stmt] , identifier[res] operator[SEP] operator[SEP]
}
Keyword[return] identifier[state] operator[SEP]
}
|
public String getMDBProxyClassName()
{
StringBuilder result = new StringBuilder();
// Use the package of the MDB implementation.
String packageName = packageName(ivBeanClass);
if (packageName != null) {
result.append(packageName);
result.append('.');
}
result.append(mdbProxyPrefix); // MDBProxy
result.append(ivBeanName); // First 32 characters
result.append('_');
result.append(ivHashSuffix); // 8 digit hashcode
return result.toString();
}
|
class class_name[name] begin[{]
method[getMDBProxyClassName, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[StringBuilder], result]
local_variable[type[String], packageName]
if[binary_operation[member[.packageName], !=, literal[null]]] begin[{]
call[result.append, parameter[member[.packageName]]]
call[result.append, parameter[literal['.']]]
else begin[{]
None
end[}]
call[result.append, parameter[member[.mdbProxyPrefix]]]
call[result.append, parameter[member[.ivBeanName]]]
call[result.append, parameter[literal['_']]]
call[result.append, parameter[member[.ivHashSuffix]]]
return[call[result.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getMDBProxyClassName] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[packageName] operator[=] identifier[packageName] operator[SEP] identifier[ivBeanClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[packageName] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[packageName] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[mdbProxyPrefix] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[ivBeanName] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[ivHashSuffix] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
protected final NameID decryptEncryptedId(final EncryptedID encryptedId, final Decrypter decrypter) throws SAMLException {
if (encryptedId == null) {
return null;
}
if (decrypter == null) {
logger.warn("Encrypted attributes returned, but no keystore was provided.");
return null;
}
try {
final NameID decryptedId = (NameID) decrypter.decrypt(encryptedId);
return decryptedId;
} catch (final DecryptionException e) {
throw new SAMLNameIdDecryptionException("Decryption of an EncryptedID failed.", e);
}
}
|
class class_name[name] begin[{]
method[decryptEncryptedId, return_type[type[NameID]], modifier[final protected], parameter[encryptedId, decrypter]] begin[{]
if[binary_operation[member[.encryptedId], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.decrypter], ==, literal[null]]] begin[{]
call[logger.warn, parameter[literal["Encrypted attributes returned, but no keystore was provided."]]]
return[literal[null]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=encryptedId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decrypt, postfix_operators=[], prefix_operators=[], qualifier=decrypter, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=NameID, sub_type=None)), name=decryptedId)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=NameID, sub_type=None)), ReturnStatement(expression=MemberReference(member=decryptedId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Decryption of an EncryptedID failed."), 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=SAMLNameIdDecryptionException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DecryptionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] Keyword[final] identifier[NameID] identifier[decryptEncryptedId] operator[SEP] Keyword[final] identifier[EncryptedID] identifier[encryptedId] , Keyword[final] identifier[Decrypter] identifier[decrypter] operator[SEP] Keyword[throws] identifier[SAMLException] {
Keyword[if] operator[SEP] identifier[encryptedId] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[decrypter] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[try] {
Keyword[final] identifier[NameID] identifier[decryptedId] operator[=] operator[SEP] identifier[NameID] operator[SEP] identifier[decrypter] operator[SEP] identifier[decrypt] operator[SEP] identifier[encryptedId] operator[SEP] operator[SEP] Keyword[return] identifier[decryptedId] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[DecryptionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SAMLNameIdDecryptionException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Expression<Short> lte(short value) {
String valueString = "'" + value + "'";
return new Expression<Short>(this, Operation.lte, valueString);
}
|
class class_name[name] begin[{]
method[lte, return_type[type[Expression]], modifier[public], parameter[value]] begin[{]
local_variable[type[String], valueString]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=lte, postfix_operators=[], prefix_operators=[], qualifier=Operation, selectors=[]), MemberReference(member=valueString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Short, sub_type=None))], dimensions=None, name=Expression, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Expression] operator[<] identifier[Short] operator[>] identifier[lte] operator[SEP] Keyword[short] identifier[value] operator[SEP] {
identifier[String] identifier[valueString] operator[=] literal[String] operator[+] identifier[value] operator[+] literal[String] operator[SEP] Keyword[return] Keyword[new] identifier[Expression] operator[<] identifier[Short] operator[>] operator[SEP] Keyword[this] , identifier[Operation] operator[SEP] identifier[lte] , identifier[valueString] operator[SEP] operator[SEP]
}
|
private boolean canPasteFromClipboard() {
try {
return textComponent.getTransferHandler().canImport(
textComponent,
Toolkit.getDefaultToolkit().getSystemClipboard().getContents(textComponent)
.getTransferDataFlavors());
}
catch (IllegalStateException e) {
/*
* as the javadoc of Clipboard.getContents state: the
* IllegalStateException can be thrown when the clipboard is not
* available (i.e. in use by another application), so we return
* false.
*/
return false;
}
}
|
class class_name[name] begin[{]
method[canPasteFromClipboard, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getTransferHandler, postfix_operators=[], prefix_operators=[], qualifier=textComponent, selectors=[MethodInvocation(arguments=[MemberReference(member=textComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getDefaultToolkit, postfix_operators=[], prefix_operators=[], qualifier=Toolkit, selectors=[MethodInvocation(arguments=[], member=getSystemClipboard, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=textComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getContents, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTransferDataFlavors, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=canImport, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalStateException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[canPasteFromClipboard] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[textComponent] operator[SEP] identifier[getTransferHandler] operator[SEP] operator[SEP] operator[SEP] identifier[canImport] operator[SEP] identifier[textComponent] , identifier[Toolkit] operator[SEP] identifier[getDefaultToolkit] operator[SEP] operator[SEP] operator[SEP] identifier[getSystemClipboard] operator[SEP] operator[SEP] operator[SEP] identifier[getContents] operator[SEP] identifier[textComponent] operator[SEP] operator[SEP] identifier[getTransferDataFlavors] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalStateException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public void determineCacheProvider() {
this.defaultProvider = true;
if (cacheProviderName.equals("")) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
}
if (!cacheProviderName.equals(CACHE_PROVIDER_DYNACACHE)) {
defaultProvider = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Alternate CacheProvider " + cacheProviderName + " set for " + cacheName);
}
}
}
|
class class_name[name] begin[{]
method[determineCacheProvider, return_type[void], modifier[public], parameter[]] begin[{]
assign[THIS[member[None.defaultProvider]], literal[true]]
if[call[cacheProviderName.equals, parameter[literal[""]]]] begin[{]
assign[member[.cacheProviderName], member[CacheConfig.CACHE_PROVIDER_DYNACACHE]]
else begin[{]
None
end[}]
if[call[cacheProviderName.equals, parameter[member[.CACHE_PROVIDER_DYNACACHE]]]] begin[{]
assign[member[.defaultProvider], literal[false]]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[literal["Alternate CacheProvider "], +, member[.cacheProviderName]], +, literal[" set for "]], +, member[.cacheName]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[determineCacheProvider] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[defaultProvider] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[cacheProviderName] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[cacheProviderName] operator[=] identifier[CacheConfig] operator[SEP] identifier[CACHE_PROVIDER_DYNACACHE] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[cacheProviderName] operator[SEP] identifier[equals] operator[SEP] identifier[CACHE_PROVIDER_DYNACACHE] operator[SEP] operator[SEP] {
identifier[defaultProvider] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[cacheProviderName] operator[+] literal[String] operator[+] identifier[cacheName] operator[SEP] operator[SEP]
}
}
}
|
private static void encodeFormFields(final StringBuilder sb, final String content, final Charset charset) {
urlEncode(sb, content, (charset != null) ? charset : Charsets.UTF_8, URLENCODER, true);
}
|
class class_name[name] begin[{]
method[encodeFormFields, return_type[void], modifier[private static], parameter[sb, content, charset]] begin[{]
call[.urlEncode, parameter[member[.sb], member[.content], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=Charsets, selectors=[]), if_true=MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), member[.URLENCODER], literal[true]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[encodeFormFields] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[sb] , Keyword[final] identifier[String] identifier[content] , Keyword[final] identifier[Charset] identifier[charset] operator[SEP] {
identifier[urlEncode] operator[SEP] identifier[sb] , identifier[content] , operator[SEP] identifier[charset] operator[!=] Other[null] operator[SEP] operator[?] identifier[charset] operator[:] identifier[Charsets] operator[SEP] identifier[UTF_8] , identifier[URLENCODER] , literal[boolean] operator[SEP] operator[SEP]
}
|
@UiThread
public void addMarker(@NonNull MarkerView markerView) {
if (mapView.isDestroyed() || markers.contains(markerView)) {
return;
}
if (!initialised) {
initialised = true;
mapView.addOnDidFinishRenderingFrameListener(this);
}
markerView.setProjection(mapboxMap.getProjection());
mapView.addView(markerView.getView());
markers.add(markerView);
}
|
class class_name[name] begin[{]
method[addMarker, return_type[void], modifier[public], parameter[markerView]] begin[{]
if[binary_operation[call[mapView.isDestroyed, parameter[]], ||, call[markers.contains, parameter[member[.markerView]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[member[.initialised]] begin[{]
assign[member[.initialised], literal[true]]
call[mapView.addOnDidFinishRenderingFrameListener, parameter[THIS[]]]
else begin[{]
None
end[}]
call[markerView.setProjection, parameter[call[mapboxMap.getProjection, parameter[]]]]
call[mapView.addView, parameter[call[markerView.getView, parameter[]]]]
call[markers.add, parameter[member[.markerView]]]
end[}]
END[}]
|
annotation[@] identifier[UiThread] Keyword[public] Keyword[void] identifier[addMarker] operator[SEP] annotation[@] identifier[NonNull] identifier[MarkerView] identifier[markerView] operator[SEP] {
Keyword[if] operator[SEP] identifier[mapView] operator[SEP] identifier[isDestroyed] operator[SEP] operator[SEP] operator[||] identifier[markers] operator[SEP] identifier[contains] operator[SEP] identifier[markerView] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[initialised] operator[SEP] {
identifier[initialised] operator[=] literal[boolean] operator[SEP] identifier[mapView] operator[SEP] identifier[addOnDidFinishRenderingFrameListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
identifier[markerView] operator[SEP] identifier[setProjection] operator[SEP] identifier[mapboxMap] operator[SEP] identifier[getProjection] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mapView] operator[SEP] identifier[addView] operator[SEP] identifier[markerView] operator[SEP] identifier[getView] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[markers] operator[SEP] identifier[add] operator[SEP] identifier[markerView] operator[SEP] operator[SEP]
}
|
protected void configureProfiles(ConfigurableEnvironment environment, String[] args) {
environment.getActiveProfiles(); // ensure they are initialized
// But these ones should go first (last wins in a property key clash)
Set<String> profiles = new LinkedHashSet<>(this.additionalProfiles);
profiles.addAll(Arrays.asList(environment.getActiveProfiles()));
environment.setActiveProfiles(StringUtils.toStringArray(profiles));
}
|
class class_name[name] begin[{]
method[configureProfiles, return_type[void], modifier[protected], parameter[environment, args]] begin[{]
call[environment.getActiveProfiles, parameter[]]
local_variable[type[Set], profiles]
call[profiles.addAll, parameter[call[Arrays.asList, parameter[call[environment.getActiveProfiles, parameter[]]]]]]
call[environment.setActiveProfiles, parameter[call[StringUtils.toStringArray, parameter[member[.profiles]]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[configureProfiles] operator[SEP] identifier[ConfigurableEnvironment] identifier[environment] , identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[environment] operator[SEP] identifier[getActiveProfiles] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[profiles] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] Keyword[this] operator[SEP] identifier[additionalProfiles] operator[SEP] operator[SEP] identifier[profiles] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[environment] operator[SEP] identifier[getActiveProfiles] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[environment] operator[SEP] identifier[setActiveProfiles] operator[SEP] identifier[StringUtils] operator[SEP] identifier[toStringArray] operator[SEP] identifier[profiles] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean needsTaskCommit(TaskAttemptContext context
) throws IOException {
return workPath != null && outputFileSystem.exists(workPath);
}
|
class class_name[name] begin[{]
method[needsTaskCommit, return_type[type[boolean]], modifier[public], parameter[context]] begin[{]
return[binary_operation[binary_operation[member[.workPath], !=, literal[null]], &&, call[outputFileSystem.exists, parameter[member[.workPath]]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[needsTaskCommit] operator[SEP] identifier[TaskAttemptContext] identifier[context] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[workPath] operator[!=] Other[null] operator[&&] identifier[outputFileSystem] operator[SEP] identifier[exists] operator[SEP] identifier[workPath] operator[SEP] operator[SEP]
}
|
public static void setExecutor(Executor executor) {
Validate.notNull(executor, "executor");
synchronized (LOCK) {
Settings.executor = executor;
}
}
|
class class_name[name] begin[{]
method[setExecutor, return_type[void], modifier[public static], parameter[executor]] begin[{]
call[Validate.notNull, parameter[member[.executor], literal["executor"]]]
SYNCHRONIZED[member[.LOCK]] BEGIN[{]
assign[member[Settings.executor], member[.executor]]
END[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setExecutor] operator[SEP] identifier[Executor] identifier[executor] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[executor] , literal[String] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[LOCK] operator[SEP] {
identifier[Settings] operator[SEP] identifier[executor] operator[=] identifier[executor] operator[SEP]
}
}
|
private void fireOnUnbind(ChannelEvent e) {
List<EventListener> listeners = changes.getListenerList(AMQP);
for (EventListener listener : listeners) {
ChannelListener amqpListener = (ChannelListener)listener;
amqpListener.onUnbind(e);
}
}
|
class class_name[name] begin[{]
method[fireOnUnbind, return_type[void], modifier[private], parameter[e]] begin[{]
local_variable[type[List], listeners]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ChannelListener, sub_type=None)), name=amqpListener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelListener, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onUnbind, postfix_operators=[], prefix_operators=[], qualifier=amqpListener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EventListener, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[fireOnUnbind] operator[SEP] identifier[ChannelEvent] identifier[e] operator[SEP] {
identifier[List] operator[<] identifier[EventListener] operator[>] identifier[listeners] operator[=] identifier[changes] operator[SEP] identifier[getListenerList] operator[SEP] identifier[AMQP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[EventListener] identifier[listener] operator[:] identifier[listeners] operator[SEP] {
identifier[ChannelListener] identifier[amqpListener] operator[=] operator[SEP] identifier[ChannelListener] operator[SEP] identifier[listener] operator[SEP] identifier[amqpListener] operator[SEP] identifier[onUnbind] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public void close() {
lock.lock();
try {
if (this.closed) {
return;
}
if (!this.inited) {
return;
}
if (logStatsThread != null) {
logStatsThread.interrupt();
}
if (createConnectionThread != null) {
createConnectionThread.interrupt();
}
if (destroyConnectionThread != null) {
destroyConnectionThread.interrupt();
}
if (destroySchedulerFuture != null) {
destroySchedulerFuture.cancel(true);
}
for (int i = 0; i < poolingCount; ++i) {
try {
DruidConnectionHolder connHolder = connections[i];
for (PreparedStatementHolder stmtHolder : connHolder.getStatementPool().getMap().values()) {
connHolder.getStatementPool().closeRemovedStatement(stmtHolder);
}
connHolder.getStatementPool().getMap().clear();
Connection physicalConnection = connHolder.getConnection();
physicalConnection.close();
connections[i] = null;
destroyCount.incrementAndGet();
} catch (Exception ex) {
LOG.warn("close connection error", ex);
}
}
poolingCount = 0;
// close elasticsearch client
if (this.client != null) {
this.client.close();
}
unregisterMbean();
enable = false;
notEmpty.signalAll();
notEmptySignalCount++;
this.closed = true;
this.closeTimeMillis = System.currentTimeMillis();
for (Filter filter : filters) {
filter.destroy();
}
} finally {
lock.unlock();
}
if (LOG.isInfoEnabled()) {
LOG.info("{dataSource-" + this.getID() + "} closed");
}
}
|
class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
call[lock.lock, parameter[]]
TryStatement(block=[IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=closed, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), IfStatement(condition=This(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MemberReference(member=inited, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=logStatsThread, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=interrupt, postfix_operators=[], prefix_operators=[], qualifier=logStatsThread, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=createConnectionThread, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=interrupt, postfix_operators=[], prefix_operators=[], qualifier=createConnectionThread, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=destroyConnectionThread, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=interrupt, postfix_operators=[], prefix_operators=[], qualifier=destroyConnectionThread, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=destroySchedulerFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=cancel, postfix_operators=[], prefix_operators=[], qualifier=destroySchedulerFuture, selectors=[], type_arguments=None), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=connections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=connHolder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DruidConnectionHolder, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getStatementPool, postfix_operators=[], prefix_operators=[], qualifier=connHolder, selectors=[MethodInvocation(arguments=[MemberReference(member=stmtHolder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeRemovedStatement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getStatementPool, postfix_operators=[], prefix_operators=[], qualifier=connHolder, selectors=[MethodInvocation(arguments=[], member=getMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=stmtHolder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PreparedStatementHolder, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getStatementPool, postfix_operators=[], prefix_operators=[], qualifier=connHolder, selectors=[MethodInvocation(arguments=[], member=getMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=connHolder, selectors=[], type_arguments=None), name=physicalConnection)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Connection, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=physicalConnection, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=connections, 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=null)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=incrementAndGet, postfix_operators=[], prefix_operators=[], qualifier=destroyCount, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="close connection error"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=poolingCount, 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), StatementExpression(expression=Assignment(expressionl=MemberReference(member=poolingCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=client, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), 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=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=client, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=unregisterMbean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=enable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=signalAll, postfix_operators=[], prefix_operators=[], qualifier=notEmpty, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=notEmptySignalCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=closed, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=closeTimeMillis, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None)), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Filter, sub_type=None))), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
if[call[LOG.isInfoEnabled, parameter[]]] begin[{]
call[LOG.info, parameter[binary_operation[binary_operation[literal["{dataSource-"], +, THIS[call[None.getID, parameter[]]]], +, literal["} closed"]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[closed] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[inited] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[logStatsThread] operator[!=] Other[null] operator[SEP] {
identifier[logStatsThread] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[createConnectionThread] operator[!=] Other[null] operator[SEP] {
identifier[createConnectionThread] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[destroyConnectionThread] operator[!=] Other[null] operator[SEP] {
identifier[destroyConnectionThread] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[destroySchedulerFuture] operator[!=] Other[null] operator[SEP] {
identifier[destroySchedulerFuture] operator[SEP] identifier[cancel] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[poolingCount] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[try] {
identifier[DruidConnectionHolder] identifier[connHolder] operator[=] identifier[connections] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[PreparedStatementHolder] identifier[stmtHolder] operator[:] identifier[connHolder] operator[SEP] identifier[getStatementPool] operator[SEP] operator[SEP] operator[SEP] identifier[getMap] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[connHolder] operator[SEP] identifier[getStatementPool] operator[SEP] operator[SEP] operator[SEP] identifier[closeRemovedStatement] operator[SEP] identifier[stmtHolder] operator[SEP] operator[SEP]
}
identifier[connHolder] operator[SEP] identifier[getStatementPool] operator[SEP] operator[SEP] operator[SEP] identifier[getMap] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[Connection] identifier[physicalConnection] operator[=] identifier[connHolder] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] identifier[physicalConnection] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[connections] operator[SEP] identifier[i] operator[SEP] operator[=] Other[null] operator[SEP] identifier[destroyCount] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
identifier[poolingCount] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[unregisterMbean] operator[SEP] operator[SEP] operator[SEP] identifier[enable] operator[=] literal[boolean] operator[SEP] identifier[notEmpty] operator[SEP] identifier[signalAll] operator[SEP] operator[SEP] operator[SEP] identifier[notEmptySignalCount] operator[++] operator[SEP] Keyword[this] operator[SEP] identifier[closed] operator[=] literal[boolean] operator[SEP] Keyword[this] operator[SEP] identifier[closeTimeMillis] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Filter] identifier[filter] operator[:] identifier[filters] operator[SEP] {
identifier[filter] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public static boolean matchesRobotsPattern(String pattern, String path) {
return robotsPatternToRegexp(pattern).matcher(path).matches();
}
|
class class_name[name] begin[{]
method[matchesRobotsPattern, return_type[type[boolean]], modifier[public static], parameter[pattern, path]] begin[{]
return[call[.robotsPatternToRegexp, parameter[member[.pattern]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[matchesRobotsPattern] operator[SEP] identifier[String] identifier[pattern] , identifier[String] identifier[path] operator[SEP] {
Keyword[return] identifier[robotsPatternToRegexp] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] identifier[matcher] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object readObject(final File source) throws IOException, ClassNotFoundException {
Object result = null;
FileInputStream fis = null;
BufferedInputStream bis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(source);
bis = new BufferedInputStream(fis);
ois = new ObjectInputStream(bis);
result = ois.readObject();
} finally {
StreamUtil.close(ois);
StreamUtil.close(bis);
StreamUtil.close(fis);
}
return result;
}
|
class class_name[name] begin[{]
method[readObject, return_type[type[Object]], modifier[public static], parameter[source]] begin[{]
local_variable[type[Object], result]
local_variable[type[FileInputStream], fis]
local_variable[type[BufferedInputStream], bis]
local_variable[type[ObjectInputStream], ois]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=fis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedInputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ois, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=bis, 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=ObjectInputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=ois, selectors=[], type_arguments=None)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ois, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=StreamUtil, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=StreamUtil, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=StreamUtil, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Object] identifier[readObject] operator[SEP] Keyword[final] identifier[File] identifier[source] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
identifier[Object] identifier[result] operator[=] Other[null] operator[SEP] identifier[FileInputStream] identifier[fis] operator[=] Other[null] operator[SEP] identifier[BufferedInputStream] identifier[bis] operator[=] Other[null] operator[SEP] identifier[ObjectInputStream] identifier[ois] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[fis] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[source] operator[SEP] operator[SEP] identifier[bis] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] identifier[fis] operator[SEP] operator[SEP] identifier[ois] operator[=] Keyword[new] identifier[ObjectInputStream] operator[SEP] identifier[bis] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[ois] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[StreamUtil] operator[SEP] identifier[close] operator[SEP] identifier[ois] operator[SEP] operator[SEP] identifier[StreamUtil] operator[SEP] identifier[close] operator[SEP] identifier[bis] operator[SEP] operator[SEP] identifier[StreamUtil] operator[SEP] identifier[close] operator[SEP] identifier[fis] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public boolean isSessionToken(String site, String token) {
// Add a default port
if (!site.contains(":")) {
site = site + (":80");
}
HttpSessionTokensSet siteTokens = sessionTokens.get(site);
if (siteTokens == null)
return false;
return siteTokens.isSessionToken(token);
}
|
class class_name[name] begin[{]
method[isSessionToken, return_type[type[boolean]], modifier[public], parameter[site, token]] begin[{]
if[call[site.contains, parameter[literal[":"]]]] begin[{]
assign[member[.site], binary_operation[member[.site], +, literal[":80"]]]
else begin[{]
None
end[}]
local_variable[type[HttpSessionTokensSet], siteTokens]
if[binary_operation[member[.siteTokens], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[siteTokens.isSessionToken, parameter[member[.token]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isSessionToken] operator[SEP] identifier[String] identifier[site] , identifier[String] identifier[token] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[site] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[site] operator[=] identifier[site] operator[+] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[HttpSessionTokensSet] identifier[siteTokens] operator[=] identifier[sessionTokens] operator[SEP] identifier[get] operator[SEP] identifier[site] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[siteTokens] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[siteTokens] operator[SEP] identifier[isSessionToken] operator[SEP] identifier[token] operator[SEP] operator[SEP]
}
|
public static void setGlobalScope (@Nonnull final IGlobalScope aGlobalScope)
{
ValueEnforcer.notNull (aGlobalScope, "GlobalScope");
s_aGlobalLock.locked ( () -> {
if (s_aGlobalScope != null)
throw new IllegalStateException ("Another global scope with ID '" +
s_aGlobalScope.getID () +
"' is already present. New global scope with ID '" +
aGlobalScope.getID () +
"' is not set!");
s_aGlobalScope = aGlobalScope;
aGlobalScope.initScope ();
if (ScopeHelper.debugGlobalScopeLifeCycle (LOGGER))
LOGGER.info ("Global scope '" + aGlobalScope.getID () + "' initialized!", ScopeHelper.getDebugStackTrace ());
// Invoke SPIs
ScopeSPIManager.getInstance ().onGlobalScopeBegin (aGlobalScope);
});
}
|
class class_name[name] begin[{]
method[setGlobalScope, return_type[void], modifier[public static], parameter[aGlobalScope]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aGlobalScope], literal["GlobalScope"]]]
call[s_aGlobalLock.locked, parameter[LambdaExpression(body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=s_aGlobalScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Another global scope with ID '"), operandr=MethodInvocation(arguments=[], member=getID, postfix_operators=[], prefix_operators=[], qualifier=s_aGlobalScope, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is already present. New global scope with ID '"), operator=+), operandr=MethodInvocation(arguments=[], member=getID, postfix_operators=[], prefix_operators=[], qualifier=aGlobalScope, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not set!"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=s_aGlobalScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=aGlobalScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=initScope, postfix_operators=[], prefix_operators=[], qualifier=aGlobalScope, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=LOGGER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debugGlobalScopeLifeCycle, postfix_operators=[], prefix_operators=[], qualifier=ScopeHelper, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Global scope '"), operandr=MethodInvocation(arguments=[], member=getID, postfix_operators=[], prefix_operators=[], qualifier=aGlobalScope, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' initialized!"), operator=+), MethodInvocation(arguments=[], member=getDebugStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ScopeHelper, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=ScopeSPIManager, selectors=[MethodInvocation(arguments=[MemberReference(member=aGlobalScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onGlobalScopeBegin, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], parameters=[])]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setGlobalScope] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[IGlobalScope] identifier[aGlobalScope] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aGlobalScope] , literal[String] operator[SEP] operator[SEP] identifier[s_aGlobalLock] operator[SEP] identifier[locked] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[s_aGlobalScope] operator[!=] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[s_aGlobalScope] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[aGlobalScope] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[s_aGlobalScope] operator[=] identifier[aGlobalScope] operator[SEP] identifier[aGlobalScope] operator[SEP] identifier[initScope] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ScopeHelper] operator[SEP] identifier[debugGlobalScopeLifeCycle] operator[SEP] identifier[LOGGER] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[aGlobalScope] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[ScopeHelper] operator[SEP] identifier[getDebugStackTrace] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ScopeSPIManager] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[onGlobalScopeBegin] operator[SEP] identifier[aGlobalScope] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
boolean isStarvedForMinShare(JobInfo info, TaskType taskType) {
float starvingThreshold = (float) (minTasks(info, taskType) * 0.9);
return runningTasks(info, taskType) < starvingThreshold;
}
|
class class_name[name] begin[{]
method[isStarvedForMinShare, return_type[type[boolean]], modifier[default], parameter[info, taskType]] begin[{]
local_variable[type[float], starvingThreshold]
return[binary_operation[call[.runningTasks, parameter[member[.info], member[.taskType]]], <, member[.starvingThreshold]]]
end[}]
END[}]
|
Keyword[boolean] identifier[isStarvedForMinShare] operator[SEP] identifier[JobInfo] identifier[info] , identifier[TaskType] identifier[taskType] operator[SEP] {
Keyword[float] identifier[starvingThreshold] operator[=] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[minTasks] operator[SEP] identifier[info] , identifier[taskType] operator[SEP] operator[*] literal[Float] operator[SEP] operator[SEP] Keyword[return] identifier[runningTasks] operator[SEP] identifier[info] , identifier[taskType] operator[SEP] operator[<] identifier[starvingThreshold] operator[SEP]
}
|
private void removeStateItemStreams(Transaction transaction)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeStateItemStreams", transaction );
try
{
// Clean up mqlink state stream. This is a raw itemstream so
// we do this "by hand".
if( _mqLinkStateItemStream != null && _mqLinkStateItemStream.isInStore())
{
Item item = null;
while (null != (item = _mqLinkStateItemStream.findFirstMatchingItem(null)))
{
item.remove(transaction, NO_LOCK_ID);
}
// Now remove the itemstream itself
_mqLinkStateItemStream.remove(transaction, NO_LOCK_ID);
}
// Clean up pubsub bridge state itemstream.
// Note that pubsub bridge should already have tidied up contained
// itemstreams. This does a final tidy and removes the state itemstream
// itself. Must check that this is not in store as we may have the item stream
// from a previous failed delete
if( _mqLinkPubSubBridgeItemStream != null && _mqLinkPubSubBridgeItemStream.isInStore())
{
_mqLinkPubSubBridgeItemStream.removeAll(transaction);
}
// Set refs to null removed as we may fail the delete later.
// _mqLinkStateItemStream = null;
// _mqLinkPubSubBridgeItemStream = null;
}
catch (MessageStoreException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.MQLinkHandler.removeStateItemStreams",
"1:910:1.71",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeStateItemStreams", e);
throw new SIResourceException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeStateItemStreams");
}
|
class class_name[name] begin[{]
method[removeStateItemStreams, return_type[void], modifier[private], parameter[transaction]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["removeStateItemStreams"], member[.transaction]]]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_mqLinkStateItemStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isInStore, postfix_operators=[], prefix_operators=[], qualifier=_mqLinkStateItemStream, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Item, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=transaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NO_LOCK_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=Assignment(expressionl=MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=findFirstMatchingItem, postfix_operators=[], prefix_operators=[], qualifier=_mqLinkStateItemStream, selectors=[], type_arguments=None)), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=transaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NO_LOCK_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=_mqLinkStateItemStream, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=_mqLinkPubSubBridgeItemStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isInStore, postfix_operators=[], prefix_operators=[], qualifier=_mqLinkPubSubBridgeItemStream, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=transaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeAll, postfix_operators=[], prefix_operators=[], qualifier=_mqLinkPubSubBridgeItemStream, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.MQLinkHandler.removeStateItemStreams"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:910:1.71"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="removeStateItemStreams"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), 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=SIResourceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MessageStoreException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["removeStateItemStreams"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[removeStateItemStreams] operator[SEP] identifier[Transaction] identifier[transaction] operator[SEP] Keyword[throws] identifier[SIResourceException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , identifier[transaction] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[_mqLinkStateItemStream] operator[!=] Other[null] operator[&&] identifier[_mqLinkStateItemStream] operator[SEP] identifier[isInStore] operator[SEP] operator[SEP] operator[SEP] {
identifier[Item] identifier[item] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] Other[null] operator[!=] operator[SEP] identifier[item] operator[=] identifier[_mqLinkStateItemStream] operator[SEP] identifier[findFirstMatchingItem] operator[SEP] Other[null] operator[SEP] operator[SEP] operator[SEP] {
identifier[item] operator[SEP] identifier[remove] operator[SEP] identifier[transaction] , identifier[NO_LOCK_ID] operator[SEP] operator[SEP]
}
identifier[_mqLinkStateItemStream] operator[SEP] identifier[remove] operator[SEP] identifier[transaction] , identifier[NO_LOCK_ID] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[_mqLinkPubSubBridgeItemStream] operator[!=] Other[null] operator[&&] identifier[_mqLinkPubSubBridgeItemStream] operator[SEP] identifier[isInStore] operator[SEP] operator[SEP] operator[SEP] {
identifier[_mqLinkPubSubBridgeItemStream] operator[SEP] identifier[removeAll] operator[SEP] identifier[transaction] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[MessageStoreException] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SIResourceException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
// ICU 4.8 custom deserialization.
String languageTag = (String)in.readObject();
ulocale = ULocale.forLanguageTag(languageTag);
MessagePattern.ApostropheMode aposMode = (MessagePattern.ApostropheMode)in.readObject();
if (msgPattern == null || aposMode != msgPattern.getApostropheMode()) {
msgPattern = new MessagePattern(aposMode);
}
String msg = (String)in.readObject();
if (msg != null) {
applyPattern(msg);
}
// custom formatters
for (int numFormatters = in.readInt(); numFormatters > 0; --numFormatters) {
int formatIndex = in.readInt();
Format formatter = (Format)in.readObject();
setFormat(formatIndex, formatter);
}
// skip future (int, Object) pairs
for (int numPairs = in.readInt(); numPairs > 0; --numPairs) {
in.readInt();
in.readObject();
}
}
|
class class_name[name] begin[{]
method[readObject, return_type[void], modifier[private], parameter[in]] begin[{]
call[in.defaultReadObject, parameter[]]
local_variable[type[String], languageTag]
assign[member[.ulocale], call[ULocale.forLanguageTag, parameter[member[.languageTag]]]]
local_variable[type[MessagePattern], aposMode]
if[binary_operation[binary_operation[member[.msgPattern], ==, literal[null]], ||, binary_operation[member[.aposMode], !=, call[msgPattern.getApostropheMode, parameter[]]]]] begin[{]
assign[member[.msgPattern], ClassCreator(arguments=[MemberReference(member=aposMode, 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=MessagePattern, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], msg]
if[binary_operation[member[.msg], !=, literal[null]]] begin[{]
call[.applyPattern, parameter[member[.msg]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), name=formatIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Format, sub_type=None)), name=formatter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Format, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=formatIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=numFormatters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), name=numFormatters)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=numFormatters, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=numPairs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), name=numPairs)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=numPairs, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[readObject] operator[SEP] identifier[ObjectInputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
identifier[in] operator[SEP] identifier[defaultReadObject] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[languageTag] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] identifier[ulocale] operator[=] identifier[ULocale] operator[SEP] identifier[forLanguageTag] operator[SEP] identifier[languageTag] operator[SEP] operator[SEP] identifier[MessagePattern] operator[SEP] identifier[ApostropheMode] identifier[aposMode] operator[=] operator[SEP] identifier[MessagePattern] operator[SEP] identifier[ApostropheMode] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msgPattern] operator[==] Other[null] operator[||] identifier[aposMode] operator[!=] identifier[msgPattern] operator[SEP] identifier[getApostropheMode] operator[SEP] operator[SEP] operator[SEP] {
identifier[msgPattern] operator[=] Keyword[new] identifier[MessagePattern] operator[SEP] identifier[aposMode] operator[SEP] operator[SEP]
}
identifier[String] identifier[msg] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msg] operator[!=] Other[null] operator[SEP] {
identifier[applyPattern] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[numFormatters] operator[=] identifier[in] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] identifier[numFormatters] operator[>] Other[0] operator[SEP] operator[--] identifier[numFormatters] operator[SEP] {
Keyword[int] identifier[formatIndex] operator[=] identifier[in] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] identifier[Format] identifier[formatter] operator[=] operator[SEP] identifier[Format] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] identifier[setFormat] operator[SEP] identifier[formatIndex] , identifier[formatter] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[numPairs] operator[=] identifier[in] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] identifier[numPairs] operator[>] Other[0] operator[SEP] operator[--] identifier[numPairs] operator[SEP] {
identifier[in] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Graph copyTo(Graph fromGraph, Graph toGraph) {
AllEdgesIterator eIter = fromGraph.getAllEdges();
while (eIter.next()) {
int base = eIter.getBaseNode();
int adj = eIter.getAdjNode();
toGraph.edge(base, adj).copyPropertiesFrom(eIter);
}
NodeAccess fna = fromGraph.getNodeAccess();
NodeAccess tna = toGraph.getNodeAccess();
int nodes = fromGraph.getNodes();
for (int node = 0; node < nodes; node++) {
if (tna.is3D())
tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node), fna.getElevation(node));
else
tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node));
}
return toGraph;
}
|
class class_name[name] begin[{]
method[copyTo, return_type[type[Graph]], modifier[public static], parameter[fromGraph, toGraph]] begin[{]
local_variable[type[AllEdgesIterator], eIter]
while[call[eIter.next, parameter[]]] begin[{]
local_variable[type[int], base]
local_variable[type[int], adj]
call[toGraph.edge, parameter[member[.base], member[.adj]]]
end[}]
local_variable[type[NodeAccess], fna]
local_variable[type[NodeAccess], tna]
local_variable[type[int], nodes]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=is3D, postfix_operators=[], prefix_operators=[], qualifier=tna, selectors=[], type_arguments=None), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLatitude, postfix_operators=[], prefix_operators=[], qualifier=fna, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLongitude, postfix_operators=[], prefix_operators=[], qualifier=fna, selectors=[], type_arguments=None)], member=setNode, postfix_operators=[], prefix_operators=[], qualifier=tna, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLatitude, postfix_operators=[], prefix_operators=[], qualifier=fna, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLongitude, postfix_operators=[], prefix_operators=[], qualifier=fna, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getElevation, postfix_operators=[], prefix_operators=[], qualifier=fna, selectors=[], type_arguments=None)], member=setNode, postfix_operators=[], prefix_operators=[], qualifier=tna, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nodes, 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=node)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=node, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.toGraph]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Graph] identifier[copyTo] operator[SEP] identifier[Graph] identifier[fromGraph] , identifier[Graph] identifier[toGraph] operator[SEP] {
identifier[AllEdgesIterator] identifier[eIter] operator[=] identifier[fromGraph] operator[SEP] identifier[getAllEdges] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[eIter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[base] operator[=] identifier[eIter] operator[SEP] identifier[getBaseNode] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[adj] operator[=] identifier[eIter] operator[SEP] identifier[getAdjNode] operator[SEP] operator[SEP] operator[SEP] identifier[toGraph] operator[SEP] identifier[edge] operator[SEP] identifier[base] , identifier[adj] operator[SEP] operator[SEP] identifier[copyPropertiesFrom] operator[SEP] identifier[eIter] operator[SEP] operator[SEP]
}
identifier[NodeAccess] identifier[fna] operator[=] identifier[fromGraph] operator[SEP] identifier[getNodeAccess] operator[SEP] operator[SEP] operator[SEP] identifier[NodeAccess] identifier[tna] operator[=] identifier[toGraph] operator[SEP] identifier[getNodeAccess] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[nodes] operator[=] identifier[fromGraph] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[node] operator[=] Other[0] operator[SEP] identifier[node] operator[<] identifier[nodes] operator[SEP] identifier[node] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[tna] operator[SEP] identifier[is3D] operator[SEP] operator[SEP] operator[SEP] identifier[tna] operator[SEP] identifier[setNode] operator[SEP] identifier[node] , identifier[fna] operator[SEP] identifier[getLatitude] operator[SEP] identifier[node] operator[SEP] , identifier[fna] operator[SEP] identifier[getLongitude] operator[SEP] identifier[node] operator[SEP] , identifier[fna] operator[SEP] identifier[getElevation] operator[SEP] identifier[node] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[tna] operator[SEP] identifier[setNode] operator[SEP] identifier[node] , identifier[fna] operator[SEP] identifier[getLatitude] operator[SEP] identifier[node] operator[SEP] , identifier[fna] operator[SEP] identifier[getLongitude] operator[SEP] identifier[node] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[toGraph] operator[SEP]
}
|
public static String[] tokenize( String s, char separator )
{
if( s == null || s.length() == 0 )
{
return null;
}
int start = 0;
int stop = 0;
ArrayList tokens = new ArrayList();
while( start <= s.length() )
{
stop = s.indexOf( separator, start );
if( stop == -1 )
{
stop = s.length();
}
String token = s.substring( start, stop );
tokens.add( token );
start = stop + 1;
}
return (String[])tokens.toArray( new String[tokens.size()] );
}
|
class class_name[name] begin[{]
method[tokenize, return_type[type[String]], modifier[public static], parameter[s, separator]] begin[{]
if[binary_operation[binary_operation[member[.s], ==, literal[null]], ||, binary_operation[call[s.length, parameter[]], ==, literal[0]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], start]
local_variable[type[int], stop]
local_variable[type[ArrayList], tokens]
while[binary_operation[member[.start], <=, call[s.length, parameter[]]]] begin[{]
assign[member[.stop], call[s.indexOf, parameter[member[.separator], member[.start]]]]
if[binary_operation[member[.stop], ==, literal[1]]] begin[{]
assign[member[.stop], call[s.length, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[String], token]
call[tokens.add, parameter[member[.token]]]
assign[member[.start], binary_operation[member[.stop], +, literal[1]]]
end[}]
return[Cast(expression=MethodInvocation(arguments=[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=tokens, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=tokens, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] operator[SEP] operator[SEP] identifier[tokenize] operator[SEP] identifier[String] identifier[s] , Keyword[char] identifier[separator] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[==] Other[null] operator[||] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[start] operator[=] Other[0] operator[SEP] Keyword[int] identifier[stop] operator[=] Other[0] operator[SEP] identifier[ArrayList] identifier[tokens] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[start] operator[<=] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[stop] operator[=] identifier[s] operator[SEP] identifier[indexOf] operator[SEP] identifier[separator] , identifier[start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stop] operator[==] operator[-] Other[1] operator[SEP] {
identifier[stop] operator[=] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[token] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[stop] operator[SEP] operator[SEP] identifier[tokens] operator[SEP] identifier[add] operator[SEP] identifier[token] operator[SEP] operator[SEP] identifier[start] operator[=] identifier[stop] operator[+] Other[1] operator[SEP]
}
Keyword[return] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] identifier[tokens] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[tokens] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String httpRequest(String stringUrl, String method, Map<String, String> parameters,
String input, String charset) throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod(method);
if (parameters != null) {
for (Entry<String, String> entry : parameters.entrySet()) {
conn.addRequestProperty(entry.getKey(), entry.getValue());
}
}
if (input != null) {
OutputStream output = null;
try {
output = conn.getOutputStream();
output.write(input.getBytes(charset));
} finally {
if (output != null) {
output.close();
}
}
}
return MyStreamUtils.readContent(conn.getInputStream());
}
|
class class_name[name] begin[{]
method[httpRequest, return_type[type[String]], modifier[public static], parameter[stringUrl, method, parameters, input, charset]] begin[{]
local_variable[type[URL], url]
local_variable[type[HttpURLConnection], conn]
call[conn.setDoOutput, parameter[literal[true]]]
call[conn.setRequestMethod, parameter[member[.method]]]
if[binary_operation[member[.parameters], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[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)], member=addRequestProperty, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=parameters, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], 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=String, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.input], !=, literal[null]]] begin[{]
local_variable[type[OutputStream], output]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getOutputStream, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
else begin[{]
None
end[}]
return[call[MyStreamUtils.readContent, parameter[call[conn.getInputStream, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[httpRequest] operator[SEP] identifier[String] identifier[stringUrl] , identifier[String] identifier[method] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameters] , identifier[String] identifier[input] , identifier[String] identifier[charset] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[URL] identifier[url] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[stringUrl] operator[SEP] operator[SEP] identifier[HttpURLConnection] identifier[conn] operator[=] operator[SEP] identifier[HttpURLConnection] operator[SEP] identifier[url] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] identifier[conn] operator[SEP] identifier[setDoOutput] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[conn] operator[SEP] identifier[setRequestMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parameters] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[parameters] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[conn] operator[SEP] identifier[addRequestProperty] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[input] operator[!=] Other[null] operator[SEP] {
identifier[OutputStream] identifier[output] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[output] operator[=] identifier[conn] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[output] operator[SEP] identifier[write] operator[SEP] identifier[input] operator[SEP] identifier[getBytes] operator[SEP] identifier[charset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[output] operator[!=] Other[null] operator[SEP] {
identifier[output] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[MyStreamUtils] operator[SEP] identifier[readContent] operator[SEP] identifier[conn] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean is(@NotNull String type) {
String ct = getHeader("Content-Type");
if (ct == null) {
return false;
}
// get the content type only (exclude charset)
ct = ct.split(";")[0];
// if we received an incomplete CT
if (type.indexOf('/') == -1) {
// when the content is incomplete we assume */type, e.g.:
// json -> */json
type = "*/" + type;
}
// process wildcards
if (type.contains("*")) {
String[] parts = type.split("/");
String[] ctParts = ct.split("/");
return "*".equals(parts[0]) && parts[1].equals(ctParts[1]) || "*".equals(parts[1]) && parts[0].equals(ctParts[0]);
}
return ct.contains(type);
}
|
class class_name[name] begin[{]
method[is, return_type[type[boolean]], modifier[public], parameter[type]] begin[{]
local_variable[type[String], ct]
if[binary_operation[member[.ct], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.ct], call[ct.split, parameter[literal[";"]]]]
if[binary_operation[call[type.indexOf, parameter[literal['/']]], ==, literal[1]]] begin[{]
assign[member[.type], binary_operation[literal["*/"], +, member[.type]]]
else begin[{]
None
end[}]
if[call[type.contains, parameter[literal["*"]]]] begin[{]
local_variable[type[String], parts]
local_variable[type[String], ctParts]
return[binary_operation[binary_operation[literal["*"], &&, member[.parts]], ||, binary_operation[literal["*"], &&, member[.parts]]]]
else begin[{]
None
end[}]
return[call[ct.contains, parameter[member[.type]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[is] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[type] operator[SEP] {
identifier[String] identifier[ct] operator[=] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ct] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[ct] operator[=] identifier[ct] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
identifier[type] operator[=] literal[String] operator[+] identifier[type] operator[SEP]
}
Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[type] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[ctParts] operator[=] identifier[ct] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[&&] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[ctParts] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[&&] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[ctParts] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ct] operator[SEP] identifier[contains] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
|
public static Collector<CharSequence, ?, String> commonPrefix() {
final Supplier<Pair<CharSequence, Integer>> supplier = new Supplier<Pair<CharSequence, Integer>>() {
@Override
public Pair<CharSequence, Integer> get() {
return Pair.of(null, -1);
}
};
final BiConsumer<Pair<CharSequence, Integer>, CharSequence> accumulator = new BiConsumer<Pair<CharSequence, Integer>, CharSequence>() {
@Override
public void accept(Pair<CharSequence, Integer> a, CharSequence t) {
if (a.right == -1) {
a.left = t;
a.right = t.length();
} else if (a.right > 0) {
if (t.length() < a.right) {
a.right = t.length();
}
for (int i = 0, to = a.right; i < to; i++) {
if (a.left.charAt(i) != t.charAt(i)) {
if (i > 0 && Character.isHighSurrogate(t.charAt(i - 1))
&& (Character.isLowSurrogate(t.charAt(i)) || Character.isLowSurrogate(a.left.charAt(i)))) {
i--;
}
a.right = i;
break;
}
}
}
}
};
final BinaryOperator<Pair<CharSequence, Integer>> combiner = new BinaryOperator<Pair<CharSequence, Integer>>() {
@Override
public Pair<CharSequence, Integer> apply(Pair<CharSequence, Integer> a, Pair<CharSequence, Integer> b) {
if (a.right == -1) {
return b;
}
if (b.right != -1) {
accumulator.accept(a, b.left.subSequence(0, b.right));
}
return a;
}
};
final Function<Pair<CharSequence, Integer>, String> finisher = new Function<Pair<CharSequence, Integer>, String>() {
@Override
public String apply(Pair<CharSequence, Integer> a) {
return a.left == null ? "" : a.left.subSequence(0, a.right).toString();
}
};
return new CollectorImpl<>(supplier, accumulator, combiner, finisher, CH_UNORDERED_NOID);
}
|
class class_name[name] begin[{]
method[commonPrefix, return_type[type[Collector]], modifier[public static], parameter[]] begin[{]
local_variable[type[Supplier], supplier]
local_variable[type[BiConsumer], accumulator]
local_variable[type[BinaryOperator], combiner]
local_variable[type[Function], finisher]
return[ClassCreator(arguments=[MemberReference(member=supplier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=accumulator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=combiner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=finisher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CH_UNORDERED_NOID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=CollectorImpl, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Collector] operator[<] identifier[CharSequence] , operator[?] , identifier[String] operator[>] identifier[commonPrefix] operator[SEP] operator[SEP] {
Keyword[final] identifier[Supplier] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] operator[>] identifier[supplier] operator[=] Keyword[new] identifier[Supplier] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] identifier[get] operator[SEP] operator[SEP] {
Keyword[return] identifier[Pair] operator[SEP] identifier[of] operator[SEP] Other[null] , operator[-] Other[1] operator[SEP] operator[SEP]
}
} operator[SEP] Keyword[final] identifier[BiConsumer] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] , identifier[CharSequence] operator[>] identifier[accumulator] operator[=] Keyword[new] identifier[BiConsumer] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] , identifier[CharSequence] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[accept] operator[SEP] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] identifier[a] , identifier[CharSequence] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[right] operator[==] operator[-] Other[1] operator[SEP] {
identifier[a] operator[SEP] identifier[left] operator[=] identifier[t] operator[SEP] identifier[a] operator[SEP] identifier[right] operator[=] identifier[t] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[right] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] identifier[a] operator[SEP] identifier[right] operator[SEP] {
identifier[a] operator[SEP] identifier[right] operator[=] identifier[t] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[to] operator[=] identifier[a] operator[SEP] identifier[right] operator[SEP] identifier[i] operator[<] identifier[to] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[left] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[!=] identifier[t] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[&&] identifier[Character] operator[SEP] identifier[isHighSurrogate] operator[SEP] identifier[t] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[Character] operator[SEP] identifier[isLowSurrogate] operator[SEP] identifier[t] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[||] identifier[Character] operator[SEP] identifier[isLowSurrogate] operator[SEP] identifier[a] operator[SEP] identifier[left] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[--] operator[SEP]
}
identifier[a] operator[SEP] identifier[right] operator[=] identifier[i] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
} operator[SEP] Keyword[final] identifier[BinaryOperator] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] operator[>] identifier[combiner] operator[=] Keyword[new] identifier[BinaryOperator] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] identifier[apply] operator[SEP] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] identifier[a] , identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] identifier[b] operator[SEP] {
Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[right] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[b] operator[SEP]
}
Keyword[if] operator[SEP] identifier[b] operator[SEP] identifier[right] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[accumulator] operator[SEP] identifier[accept] operator[SEP] identifier[a] , identifier[b] operator[SEP] identifier[left] operator[SEP] identifier[subSequence] operator[SEP] Other[0] , identifier[b] operator[SEP] identifier[right] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[a] operator[SEP]
}
} operator[SEP] Keyword[final] identifier[Function] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] , identifier[String] operator[>] identifier[finisher] operator[=] Keyword[new] identifier[Function] operator[<] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] , identifier[String] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[apply] operator[SEP] identifier[Pair] operator[<] identifier[CharSequence] , identifier[Integer] operator[>] identifier[a] operator[SEP] {
Keyword[return] identifier[a] operator[SEP] identifier[left] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[a] operator[SEP] identifier[left] operator[SEP] identifier[subSequence] operator[SEP] Other[0] , identifier[a] operator[SEP] identifier[right] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] Keyword[return] Keyword[new] identifier[CollectorImpl] operator[<] operator[>] operator[SEP] identifier[supplier] , identifier[accumulator] , identifier[combiner] , identifier[finisher] , identifier[CH_UNORDERED_NOID] operator[SEP] operator[SEP]
}
|
void copyouts(State old, State newState) {
Arc a;
assert old != newState;
for (a = old.outs; a != null; a = a.outchain) {
cparc(a, newState, a.to);
}
}
|
class class_name[name] begin[{]
method[copyouts, return_type[void], modifier[default], parameter[old, newState]] begin[{]
local_variable[type[Arc], a]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=newState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), label=None, value=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[])], member=cparc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=[Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=outs, postfix_operators=[], prefix_operators=[], qualifier=old, selectors=[]))], update=[Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=outchain, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]))]), label=None)
end[}]
END[}]
|
Keyword[void] identifier[copyouts] operator[SEP] identifier[State] identifier[old] , identifier[State] identifier[newState] operator[SEP] {
identifier[Arc] identifier[a] operator[SEP] Keyword[assert] identifier[old] operator[!=] identifier[newState] operator[SEP] Keyword[for] operator[SEP] identifier[a] operator[=] identifier[old] operator[SEP] identifier[outs] operator[SEP] identifier[a] operator[!=] Other[null] operator[SEP] identifier[a] operator[=] identifier[a] operator[SEP] identifier[outchain] operator[SEP] {
identifier[cparc] operator[SEP] identifier[a] , identifier[newState] , identifier[a] operator[SEP] identifier[to] operator[SEP] operator[SEP]
}
}
|
public void close() throws IOException, InterruptedException {
channel.close();
channel.join();
if (ownsPool)
pool.shutdown();
for (Closeable c : closables)
c.close();
}
|
class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
call[channel.close, parameter[]]
call[channel.join, parameter[]]
if[member[.ownsPool]] begin[{]
call[pool.shutdown, parameter[]]
else begin[{]
None
end[}]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=closables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Closeable, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[channel] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[channel] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ownsPool] operator[SEP] identifier[pool] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Closeable] identifier[c] operator[:] identifier[closables] operator[SEP] identifier[c] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
@Pure
public static Point2d L93_L1(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_93_N,
LAMBERT_93_C,
LAMBERT_93_XS,
LAMBERT_93_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
}
|
class class_name[name] begin[{]
method[L93_L1, return_type[type[Point2d]], modifier[public static], parameter[x, y]] begin[{]
local_variable[type[Point2d], ntfLambdaPhi]
return[call[.NTFLambdaPhi_NTFLambert, parameter[call[ntfLambdaPhi.getX, parameter[]], call[ntfLambdaPhi.getY, parameter[]], member[.LAMBERT_1_N], member[.LAMBERT_1_C], member[.LAMBERT_1_XS], member[.LAMBERT_1_YS]]]]
end[}]
END[}]
|
annotation[@] identifier[Pure] Keyword[public] Keyword[static] identifier[Point2d] identifier[L93_L1] operator[SEP] Keyword[double] identifier[x] , Keyword[double] identifier[y] operator[SEP] {
Keyword[final] identifier[Point2d] identifier[ntfLambdaPhi] operator[=] identifier[NTFLambert_NTFLambdaPhi] operator[SEP] identifier[x] , identifier[y] , identifier[LAMBERT_93_N] , identifier[LAMBERT_93_C] , identifier[LAMBERT_93_XS] , identifier[LAMBERT_93_YS] operator[SEP] operator[SEP] Keyword[return] identifier[NTFLambdaPhi_NTFLambert] operator[SEP] identifier[ntfLambdaPhi] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , identifier[ntfLambdaPhi] operator[SEP] identifier[getY] operator[SEP] operator[SEP] , identifier[LAMBERT_1_N] , identifier[LAMBERT_1_C] , identifier[LAMBERT_1_XS] , identifier[LAMBERT_1_YS] operator[SEP] operator[SEP]
}
|
public static DataSource getDataSource() {
if(dataSource == null) {
synchronized (JdbcHelper.class) {
if(dataSource == null) {
initialize();
}
}
}
AssertHelper.notNull(dataSource);
return dataSource;
}
|
class class_name[name] begin[{]
method[getDataSource, return_type[type[DataSource]], modifier[public static], parameter[]] begin[{]
if[binary_operation[member[.dataSource], ==, literal[null]]] begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JdbcHelper, sub_type=None))] BEGIN[{]
if[binary_operation[member[.dataSource], ==, literal[null]]] begin[{]
call[.initialize, parameter[]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
call[AssertHelper.notNull, parameter[member[.dataSource]]]
return[member[.dataSource]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DataSource] identifier[getDataSource] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[dataSource] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[JdbcHelper] operator[SEP] Keyword[class] operator[SEP] {
Keyword[if] operator[SEP] identifier[dataSource] operator[==] Other[null] operator[SEP] {
identifier[initialize] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[AssertHelper] operator[SEP] identifier[notNull] operator[SEP] identifier[dataSource] operator[SEP] operator[SEP] Keyword[return] identifier[dataSource] operator[SEP]
}
|
public static byte[] toByteArray(short s, ByteOrder bo) {
return ByteBuffer.allocate(2).order(bo).putShort(s).array();
}
|
class class_name[name] begin[{]
method[toByteArray, return_type[type[byte]], modifier[public static], parameter[s, bo]] begin[{]
return[call[ByteBuffer.allocate, parameter[literal[2]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[toByteArray] operator[SEP] Keyword[short] identifier[s] , identifier[ByteOrder] identifier[bo] operator[SEP] {
Keyword[return] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[order] operator[SEP] identifier[bo] operator[SEP] operator[SEP] identifier[putShort] operator[SEP] identifier[s] operator[SEP] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
|
public AskFuture ask(ActorRef ref, long timeout) {
return askPattern.ask(ref, timeout, null);
}
|
class class_name[name] begin[{]
method[ask, return_type[type[AskFuture]], modifier[public], parameter[ref, timeout]] begin[{]
return[call[askPattern.ask, parameter[member[.ref], member[.timeout], literal[null]]]]
end[}]
END[}]
|
Keyword[public] identifier[AskFuture] identifier[ask] operator[SEP] identifier[ActorRef] identifier[ref] , Keyword[long] identifier[timeout] operator[SEP] {
Keyword[return] identifier[askPattern] operator[SEP] identifier[ask] operator[SEP] identifier[ref] , identifier[timeout] , Other[null] operator[SEP] operator[SEP]
}
|
public void marshall(DecreaseStreamRetentionPeriodRequest decreaseStreamRetentionPeriodRequest, ProtocolMarshaller protocolMarshaller) {
if (decreaseStreamRetentionPeriodRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decreaseStreamRetentionPeriodRequest.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(decreaseStreamRetentionPeriodRequest.getRetentionPeriodHours(), RETENTIONPERIODHOURS_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[decreaseStreamRetentionPeriodRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.decreaseStreamRetentionPeriodRequest], ==, 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=getStreamName, postfix_operators=[], prefix_operators=[], qualifier=decreaseStreamRetentionPeriodRequest, selectors=[], type_arguments=None), MemberReference(member=STREAMNAME_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=getRetentionPeriodHours, postfix_operators=[], prefix_operators=[], qualifier=decreaseStreamRetentionPeriodRequest, selectors=[], type_arguments=None), MemberReference(member=RETENTIONPERIODHOURS_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[DecreaseStreamRetentionPeriodRequest] identifier[decreaseStreamRetentionPeriodRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[decreaseStreamRetentionPeriodRequest] 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[decreaseStreamRetentionPeriodRequest] operator[SEP] identifier[getStreamName] operator[SEP] operator[SEP] , identifier[STREAMNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[decreaseStreamRetentionPeriodRequest] operator[SEP] identifier[getRetentionPeriodHours] operator[SEP] operator[SEP] , identifier[RETENTIONPERIODHOURS_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 String matchListPrefix(
String objectNamePrefix, String delimiter, String objectName) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(objectName),
"objectName must not be null or empty, had args %s/%s/%s: ",
objectNamePrefix, delimiter, objectName);
// The suffix that we'll use to check for the delimiter is just the whole name if no prefix
// was supplied.
String suffix = objectName;
int suffixIndex = 0;
if (objectNamePrefix != null) {
// The underlying GCS API does return objectName when it equals the prefix, but our
// GoogleCloudStorage wrapper filters this case if the objectName also ends with
// PATH_DELIMITER.
if (!objectName.startsWith(objectNamePrefix)
|| (objectName.equals(objectNamePrefix) && objectNamePrefix.endsWith(PATH_DELIMITER))) {
return null;
} else {
suffixIndex = objectNamePrefix.length();
suffix = objectName.substring(suffixIndex);
}
}
if (!Strings.isNullOrEmpty(delimiter) && suffix.contains(delimiter)) {
// Return the full prefix and suffix up through first occurrence of delimiter after
// the prefix, inclusive of the delimiter.
objectName = objectName.substring(
0, objectName.indexOf(delimiter, suffixIndex) + delimiter.length());
}
return objectName;
}
|
class class_name[name] begin[{]
method[matchListPrefix, return_type[type[String]], modifier[public static], parameter[objectNamePrefix, delimiter, objectName]] begin[{]
call[Preconditions.checkArgument, parameter[call[Strings.isNullOrEmpty, parameter[member[.objectName]]], literal["objectName must not be null or empty, had args %s/%s/%s: "], member[.objectNamePrefix], member[.delimiter], member[.objectName]]]
local_variable[type[String], suffix]
local_variable[type[int], suffixIndex]
if[binary_operation[member[.objectNamePrefix], !=, literal[null]]] begin[{]
if[binary_operation[call[objectName.startsWith, parameter[member[.objectNamePrefix]]], ||, binary_operation[call[objectName.equals, parameter[member[.objectNamePrefix]]], &&, call[objectNamePrefix.endsWith, parameter[member[.PATH_DELIMITER]]]]]] begin[{]
return[literal[null]]
else begin[{]
assign[member[.suffixIndex], call[objectNamePrefix.length, parameter[]]]
assign[member[.suffix], call[objectName.substring, parameter[member[.suffixIndex]]]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[Strings.isNullOrEmpty, parameter[member[.delimiter]]], &&, call[suffix.contains, parameter[member[.delimiter]]]]] begin[{]
assign[member[.objectName], call[objectName.substring, parameter[literal[0], binary_operation[call[objectName.indexOf, parameter[member[.delimiter], member[.suffixIndex]]], +, call[delimiter.length, parameter[]]]]]]
else begin[{]
None
end[}]
return[member[.objectName]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[matchListPrefix] operator[SEP] identifier[String] identifier[objectNamePrefix] , identifier[String] identifier[delimiter] , identifier[String] identifier[objectName] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[Strings] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[objectName] operator[SEP] , literal[String] , identifier[objectNamePrefix] , identifier[delimiter] , identifier[objectName] operator[SEP] operator[SEP] identifier[String] identifier[suffix] operator[=] identifier[objectName] operator[SEP] Keyword[int] identifier[suffixIndex] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[objectNamePrefix] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[objectName] operator[SEP] identifier[startsWith] operator[SEP] identifier[objectNamePrefix] operator[SEP] operator[||] operator[SEP] identifier[objectName] operator[SEP] identifier[equals] operator[SEP] identifier[objectNamePrefix] operator[SEP] operator[&&] identifier[objectNamePrefix] operator[SEP] identifier[endsWith] operator[SEP] identifier[PATH_DELIMITER] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
identifier[suffixIndex] operator[=] identifier[objectNamePrefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[suffix] operator[=] identifier[objectName] operator[SEP] identifier[substring] operator[SEP] identifier[suffixIndex] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[Strings] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[delimiter] operator[SEP] operator[&&] identifier[suffix] operator[SEP] identifier[contains] operator[SEP] identifier[delimiter] operator[SEP] operator[SEP] {
identifier[objectName] operator[=] identifier[objectName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[objectName] operator[SEP] identifier[indexOf] operator[SEP] identifier[delimiter] , identifier[suffixIndex] operator[SEP] operator[+] identifier[delimiter] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[objectName] operator[SEP]
}
|
public static String getIPAddr() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface interfaceN = (NetworkInterface) interfaces.nextElement();
Enumeration<InetAddress> ienum = interfaceN.getInetAddresses();
while (ienum.hasMoreElements()) {
InetAddress ipaddr = (InetAddress) ienum.nextElement();
if (ipaddr instanceof Inet4Address) {
if (ipaddr.getHostAddress().toString().startsWith("127") || ipaddr.getHostAddress().toString().startsWith("192")) {
continue;
} else {
return ipaddr.getHostAddress();
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
|
class class_name[name] begin[{]
method[getIPAddr, return_type[type[String]], modifier[public static], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNetworkInterfaces, postfix_operators=[], prefix_operators=[], qualifier=NetworkInterface, selectors=[], type_arguments=None), name=interfaces)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=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=interfaces, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), name=interfaceN)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInetAddresses, postfix_operators=[], prefix_operators=[], qualifier=interfaceN, selectors=[], type_arguments=None), name=ienum)], 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=Cast(expression=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=ienum, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None)), name=ipaddr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ipaddr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Inet4Address, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=[], prefix_operators=[], qualifier=ipaddr, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="127")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=[], prefix_operators=[], qualifier=ipaddr, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="192")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=[], prefix_operators=[], qualifier=ipaddr, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)]))]))]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=ienum, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=interfaces, 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[literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getIPAddr] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[Enumeration] operator[<] identifier[NetworkInterface] operator[>] identifier[interfaces] operator[=] identifier[NetworkInterface] operator[SEP] identifier[getNetworkInterfaces] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[interfaces] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[NetworkInterface] identifier[interfaceN] operator[=] operator[SEP] identifier[NetworkInterface] operator[SEP] identifier[interfaces] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] identifier[Enumeration] operator[<] identifier[InetAddress] operator[>] identifier[ienum] operator[=] identifier[interfaceN] operator[SEP] identifier[getInetAddresses] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[ienum] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[InetAddress] identifier[ipaddr] operator[=] operator[SEP] identifier[InetAddress] operator[SEP] identifier[ienum] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ipaddr] Keyword[instanceof] identifier[Inet4Address] operator[SEP] {
Keyword[if] operator[SEP] identifier[ipaddr] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[ipaddr] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[ipaddr] operator[SEP] identifier[getHostAddress] 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] Other[null] operator[SEP]
}
|
public void constructPoolLocator(ClientCacheFactory factory)
{
List<URI> list = this.getLocatorUrlList();
if(list != null && !list.isEmpty())
{
for (URI uri : list)
{
factory.addPoolLocator(uri.getHost(), uri.getPort());
}
}
else
{
factory.addPoolLocator(this.host, this.port);
}
}
|
class class_name[name] begin[{]
method[constructPoolLocator, return_type[void], modifier[public], parameter[factory]] begin[{]
local_variable[type[List], list]
if[binary_operation[binary_operation[member[.list], !=, literal[null]], &&, call[list.isEmpty, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getHost, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getPort, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None)], member=addPoolLocator, postfix_operators=[], prefix_operators=[], qualifier=factory, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=uri)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None))), label=None)
else begin[{]
call[factory.addPoolLocator, parameter[THIS[member[None.host]], THIS[member[None.port]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[constructPoolLocator] operator[SEP] identifier[ClientCacheFactory] identifier[factory] operator[SEP] {
identifier[List] operator[<] identifier[URI] operator[>] identifier[list] operator[=] Keyword[this] operator[SEP] identifier[getLocatorUrlList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[!=] Other[null] operator[&&] operator[!] identifier[list] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[URI] identifier[uri] operator[:] identifier[list] operator[SEP] {
identifier[factory] operator[SEP] identifier[addPoolLocator] operator[SEP] identifier[uri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] , identifier[uri] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[factory] operator[SEP] identifier[addPoolLocator] operator[SEP] Keyword[this] operator[SEP] identifier[host] , Keyword[this] operator[SEP] identifier[port] operator[SEP] operator[SEP]
}
}
|
public boolean smoothSlideViewTo(View child, int finalLeft, int finalTop) {
mCapturedView = child;
mActivePointerId = INVALID_POINTER;
return forceSettleCapturedViewAt(finalLeft, finalTop, 0, 0);
}
|
class class_name[name] begin[{]
method[smoothSlideViewTo, return_type[type[boolean]], modifier[public], parameter[child, finalLeft, finalTop]] begin[{]
assign[member[.mCapturedView], member[.child]]
assign[member[.mActivePointerId], member[.INVALID_POINTER]]
return[call[.forceSettleCapturedViewAt, parameter[member[.finalLeft], member[.finalTop], literal[0], literal[0]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[smoothSlideViewTo] operator[SEP] identifier[View] identifier[child] , Keyword[int] identifier[finalLeft] , Keyword[int] identifier[finalTop] operator[SEP] {
identifier[mCapturedView] operator[=] identifier[child] operator[SEP] identifier[mActivePointerId] operator[=] identifier[INVALID_POINTER] operator[SEP] Keyword[return] identifier[forceSettleCapturedViewAt] operator[SEP] identifier[finalLeft] , identifier[finalTop] , Other[0] , Other[0] operator[SEP] operator[SEP]
}
|
public void setStart(int index, Date value)
{
set(selectField(AssignmentFieldLists.CUSTOM_START, index), value);
}
|
class class_name[name] begin[{]
method[setStart, return_type[void], modifier[public], parameter[index, value]] begin[{]
call[.set, parameter[call[.selectField, parameter[member[AssignmentFieldLists.CUSTOM_START], member[.index]]], member[.value]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setStart] operator[SEP] Keyword[int] identifier[index] , identifier[Date] identifier[value] operator[SEP] {
identifier[set] operator[SEP] identifier[selectField] operator[SEP] identifier[AssignmentFieldLists] operator[SEP] identifier[CUSTOM_START] , identifier[index] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
|
public Iterable<DColumn> getColumnSlice(String storeName, String rowKey, String startCol, String endCol) {
DRow row = new DRow(m_tenant, storeName, rowKey);
return row.getColumns(startCol, endCol, 1024);
}
|
class class_name[name] begin[{]
method[getColumnSlice, return_type[type[Iterable]], modifier[public], parameter[storeName, rowKey, startCol, endCol]] begin[{]
local_variable[type[DRow], row]
return[call[row.getColumns, parameter[member[.startCol], member[.endCol], literal[1024]]]]
end[}]
END[}]
|
Keyword[public] identifier[Iterable] operator[<] identifier[DColumn] operator[>] identifier[getColumnSlice] operator[SEP] identifier[String] identifier[storeName] , identifier[String] identifier[rowKey] , identifier[String] identifier[startCol] , identifier[String] identifier[endCol] operator[SEP] {
identifier[DRow] identifier[row] operator[=] Keyword[new] identifier[DRow] operator[SEP] identifier[m_tenant] , identifier[storeName] , identifier[rowKey] operator[SEP] operator[SEP] Keyword[return] identifier[row] operator[SEP] identifier[getColumns] operator[SEP] identifier[startCol] , identifier[endCol] , Other[1024] operator[SEP] operator[SEP]
}
|
public void invalidateAll(boolean remote) throws SecurityException {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
String logString = "(" + remote + ") for app " + appName + " id " + getId();
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, "invalidateAll", logString);
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(invalidateAllPerm);
}
SessionContextRegistry.getInstance().invalidateAll(getId(), _sessCtx.getAppName(), this, remote, false); // false
// indicates
// request
// was
// not
// remotely
// initiated
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, "invalidateAll");
}
}
|
class class_name[name] begin[{]
method[invalidateAll, return_type[void], modifier[public], parameter[remote]] begin[{]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINER]]]]] begin[{]
local_variable[type[String], logString]
call[LoggingUtil.SESSION_LOGGER_CORE.entering, parameter[member[.methodClassName], literal["invalidateAll"], member[.logString]]]
else begin[{]
None
end[}]
local_variable[type[SecurityManager], sm]
if[binary_operation[member[.sm], !=, literal[null]]] begin[{]
call[sm.checkPermission, parameter[member[.invalidateAllPerm]]]
else begin[{]
None
end[}]
call[SessionContextRegistry.getInstance, parameter[]]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[LoggingUtil.SESSION_LOGGER_CORE.exiting, parameter[member[.methodClassName], literal["invalidateAll"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[invalidateAll] operator[SEP] Keyword[boolean] identifier[remote] operator[SEP] Keyword[throws] identifier[SecurityException] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINER] operator[SEP] operator[SEP] {
identifier[String] identifier[logString] operator[=] literal[String] operator[+] identifier[remote] operator[+] literal[String] operator[+] identifier[appName] operator[+] literal[String] operator[+] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[entering] operator[SEP] identifier[methodClassName] , literal[String] , identifier[logString] operator[SEP] operator[SEP]
}
identifier[SecurityManager] identifier[sm] operator[=] identifier[System] operator[SEP] identifier[getSecurityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sm] operator[!=] Other[null] operator[SEP] {
identifier[sm] operator[SEP] identifier[checkPermission] operator[SEP] identifier[invalidateAllPerm] operator[SEP] operator[SEP]
}
identifier[SessionContextRegistry] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[invalidateAll] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[_sessCtx] operator[SEP] identifier[getAppName] operator[SEP] operator[SEP] , Keyword[this] , identifier[remote] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[exiting] operator[SEP] identifier[methodClassName] , literal[String] operator[SEP] operator[SEP]
}
}
|
public BlockMeta moveBlockMeta(BlockMeta blockMeta, TempBlockMeta tempBlockMeta)
throws BlockDoesNotExistException, WorkerOutOfSpaceException, BlockAlreadyExistsException {
StorageDir srcDir = blockMeta.getParentDir();
StorageDir dstDir = tempBlockMeta.getParentDir();
srcDir.removeBlockMeta(blockMeta);
BlockMeta newBlockMeta =
new BlockMeta(blockMeta.getBlockId(), blockMeta.getBlockSize(), dstDir);
dstDir.removeTempBlockMeta(tempBlockMeta);
dstDir.addBlockMeta(newBlockMeta);
return newBlockMeta;
}
|
class class_name[name] begin[{]
method[moveBlockMeta, return_type[type[BlockMeta]], modifier[public], parameter[blockMeta, tempBlockMeta]] begin[{]
local_variable[type[StorageDir], srcDir]
local_variable[type[StorageDir], dstDir]
call[srcDir.removeBlockMeta, parameter[member[.blockMeta]]]
local_variable[type[BlockMeta], newBlockMeta]
call[dstDir.removeTempBlockMeta, parameter[member[.tempBlockMeta]]]
call[dstDir.addBlockMeta, parameter[member[.newBlockMeta]]]
return[member[.newBlockMeta]]
end[}]
END[}]
|
Keyword[public] identifier[BlockMeta] identifier[moveBlockMeta] operator[SEP] identifier[BlockMeta] identifier[blockMeta] , identifier[TempBlockMeta] identifier[tempBlockMeta] operator[SEP] Keyword[throws] identifier[BlockDoesNotExistException] , identifier[WorkerOutOfSpaceException] , identifier[BlockAlreadyExistsException] {
identifier[StorageDir] identifier[srcDir] operator[=] identifier[blockMeta] operator[SEP] identifier[getParentDir] operator[SEP] operator[SEP] operator[SEP] identifier[StorageDir] identifier[dstDir] operator[=] identifier[tempBlockMeta] operator[SEP] identifier[getParentDir] operator[SEP] operator[SEP] operator[SEP] identifier[srcDir] operator[SEP] identifier[removeBlockMeta] operator[SEP] identifier[blockMeta] operator[SEP] operator[SEP] identifier[BlockMeta] identifier[newBlockMeta] operator[=] Keyword[new] identifier[BlockMeta] operator[SEP] identifier[blockMeta] operator[SEP] identifier[getBlockId] operator[SEP] operator[SEP] , identifier[blockMeta] operator[SEP] identifier[getBlockSize] operator[SEP] operator[SEP] , identifier[dstDir] operator[SEP] operator[SEP] identifier[dstDir] operator[SEP] identifier[removeTempBlockMeta] operator[SEP] identifier[tempBlockMeta] operator[SEP] operator[SEP] identifier[dstDir] operator[SEP] identifier[addBlockMeta] operator[SEP] identifier[newBlockMeta] operator[SEP] operator[SEP] Keyword[return] identifier[newBlockMeta] operator[SEP]
}
|
public final void setAnimation(Animation enter, Animation exit) {
setAnimation((enter != null) ? enter.getCssName() : Animation.NO_ANIMATION.getCssName(),
(exit != null) ? exit.getCssName() : Animation.NO_ANIMATION.getCssName());
}
|
class class_name[name] begin[{]
method[setAnimation, return_type[void], modifier[final public], parameter[enter, exit]] begin[{]
call[.setAnimation, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=enter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[], member=getCssName, postfix_operators=[], prefix_operators=[], qualifier=Animation.NO_ANIMATION, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=getCssName, postfix_operators=[], prefix_operators=[], qualifier=enter, selectors=[], type_arguments=None)), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=exit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[], member=getCssName, postfix_operators=[], prefix_operators=[], qualifier=Animation.NO_ANIMATION, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=getCssName, postfix_operators=[], prefix_operators=[], qualifier=exit, selectors=[], type_arguments=None))]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[setAnimation] operator[SEP] identifier[Animation] identifier[enter] , identifier[Animation] identifier[exit] operator[SEP] {
identifier[setAnimation] operator[SEP] operator[SEP] identifier[enter] operator[!=] Other[null] operator[SEP] operator[?] identifier[enter] operator[SEP] identifier[getCssName] operator[SEP] operator[SEP] operator[:] identifier[Animation] operator[SEP] identifier[NO_ANIMATION] operator[SEP] identifier[getCssName] operator[SEP] operator[SEP] , operator[SEP] identifier[exit] operator[!=] Other[null] operator[SEP] operator[?] identifier[exit] operator[SEP] identifier[getCssName] operator[SEP] operator[SEP] operator[:] identifier[Animation] operator[SEP] identifier[NO_ANIMATION] operator[SEP] identifier[getCssName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static Resource getOrCreateResource(final Resource parent, final PathElement element) {
synchronized (parent) {
if (parent.hasChild(element)) {
return parent.requireChild(element);
} else {
final Resource resource = Resource.Factory.create();
parent.registerChild(element, resource);
return resource;
}
}
}
|
class class_name[name] begin[{]
method[getOrCreateResource, return_type[type[Resource]], modifier[private static], parameter[parent, element]] begin[{]
SYNCHRONIZED[member[.parent]] BEGIN[{]
if[call[parent.hasChild, parameter[member[.element]]]] begin[{]
return[call[parent.requireChild, parameter[member[.element]]]]
else begin[{]
local_variable[type[Resource], resource]
call[parent.registerChild, parameter[member[.element], member[.resource]]]
return[member[.resource]]
end[}]
END[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Resource] identifier[getOrCreateResource] operator[SEP] Keyword[final] identifier[Resource] identifier[parent] , Keyword[final] identifier[PathElement] identifier[element] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[parent] operator[SEP] {
Keyword[if] operator[SEP] identifier[parent] operator[SEP] identifier[hasChild] operator[SEP] identifier[element] operator[SEP] operator[SEP] {
Keyword[return] identifier[parent] operator[SEP] identifier[requireChild] operator[SEP] identifier[element] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[Resource] identifier[resource] operator[=] identifier[Resource] operator[SEP] identifier[Factory] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[registerChild] operator[SEP] identifier[element] , identifier[resource] operator[SEP] operator[SEP] Keyword[return] identifier[resource] operator[SEP]
}
}
}
|
public static DoubleVector subview(DoubleVector vector, int offset,
int length) {
if (vector == null)
throw new NullPointerException("Cannot create view of a " +
"null vector");
return new DoubleVectorView(vector, offset, length);
}
|
class class_name[name] begin[{]
method[subview, return_type[type[DoubleVector]], modifier[public static], parameter[vector, offset, length]] begin[{]
if[binary_operation[member[.vector], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot create view of a "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="null vector"), operator=+)], 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[}]
return[ClassCreator(arguments=[MemberReference(member=vector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, 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=DoubleVectorView, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DoubleVector] identifier[subview] operator[SEP] identifier[DoubleVector] identifier[vector] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] {
Keyword[if] operator[SEP] identifier[vector] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[DoubleVectorView] operator[SEP] identifier[vector] , identifier[offset] , identifier[length] operator[SEP] operator[SEP]
}
|
public void setIpv4Addresses(java.util.Collection<String> ipv4Addresses) {
if (ipv4Addresses == null) {
this.ipv4Addresses = null;
return;
}
this.ipv4Addresses = new java.util.ArrayList<String>(ipv4Addresses);
}
|
class class_name[name] begin[{]
method[setIpv4Addresses, return_type[void], modifier[public], parameter[ipv4Addresses]] begin[{]
if[binary_operation[member[.ipv4Addresses], ==, literal[null]]] begin[{]
assign[THIS[member[None.ipv4Addresses]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.ipv4Addresses]], ClassCreator(arguments=[MemberReference(member=ipv4Addresses, 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=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setIpv4Addresses] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[ipv4Addresses] operator[SEP] {
Keyword[if] operator[SEP] identifier[ipv4Addresses] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[ipv4Addresses] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[ipv4Addresses] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[ipv4Addresses] operator[SEP] operator[SEP]
}
|
public String transform(String name, Instrumentation types, String version) {
StringBuilder builder = new StringBuilder();
builder.append(types.isCompile() ? "COMPILE\r\n" : "NOCOMPILE\r\n");
for (int ruleno = 0; ruleno < types.getRules().size(); ruleno++) {
InstrumentRule r = types.getRules().get(ruleno);
if (r.getClass() == JVM.class) {
JVM rule = (JVM) r;
// Check version
if (!rule.isVersionValid(version)) {
continue;
}
builder.append("\r\n");
builder.append("RULE ");
builder.append(name);
builder.append('(');
builder.append(ruleno + 1);
builder.append(") ");
builder.append(rule.getRuleName());
builder.append("\r\n");
if (rule.getClassName() != null) {
builder.append("CLASS ");
builder.append(rule.getClassName());
builder.append("\r\n");
} else if (rule.getInterfaceName() != null) {
builder.append("INTERFACE ");
builder.append(rule.getInterfaceName());
builder.append("\r\n");
}
builder.append("METHOD ");
builder.append(rule.getMethodName());
// Check if single parameter is "*", representing 'any' parameters
if (rule.getParameterTypes().size() != 1 || !rule.getParameterTypes().get(0).equals("*")) {
builder.append('(');
for (int i = 0; i < rule.getParameterTypes().size(); i++) {
if (i > 0) {
builder.append(',');
}
builder.append(rule.getParameterTypes().get(i));
}
builder.append(')');
}
builder.append("\r\n");
builder.append("HELPER ");
if (rule.getHelper() == null) {
builder.append(RuleHelper.class.getName());
} else {
builder.append(rule.getHelper());
}
builder.append("\r\n");
builder.append("AT ");
builder.append(rule.getLocation());
builder.append("\r\n");
if (rule.isCompile() != types.isCompile()) {
builder.append(rule.isCompile() ? "COMPILE\r\n" : "NOCOMPILE\r\n");
}
if (!rule.getBinds().isEmpty()) {
builder.append("BIND ");
for (int i = 0; i < rule.getBinds().size(); i++) {
InstrumentBind bind = rule.getBinds().get(i);
if (i > 0) {
builder.append(" ");
}
builder.append(bind.getName());
builder.append(" : ");
builder.append(bind.getType());
builder.append(" = ");
builder.append(bind.getExpression());
builder.append(";\r\n");
}
}
builder.append("IF ");
if (rule.getCondition() == null) {
builder.append("TRUE");
} else {
builder.append(rule.getCondition());
}
builder.append("\r\n");
builder.append("DO\r\n");
for (int i = 0; i < rule.getActions().size(); i++) {
InstrumentAction action = rule.getActions().get(i);
builder.append(" ");
InstrumentActionTransformer transformer = transformers.get(action.getClass());
if (transformer != null) {
builder.append(transformer.convertToRuleAction(rule.getActions().get(i)));
if (i < rule.getActions().size() - 1) {
builder.append(";");
}
builder.append("\r\n");
} else {
System.err.println("Transformer for action '" + action.getClass() + "' not found");
}
}
builder.append("ENDRULE\r\n\r\n");
}
}
return builder.toString();
}
|
class class_name[name] begin[{]
method[transform, return_type[type[String]], modifier[public], parameter[name, types, version]] begin[{]
local_variable[type[StringBuilder], builder]
call[builder.append, parameter[TernaryExpression(condition=MethodInvocation(arguments=[], member=isCompile, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NOCOMPILE\r\n"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="COMPILE\r\n"))]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRules, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[MethodInvocation(arguments=[MemberReference(member=ruleno, 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=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InstrumentRule, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JVM, sub_type=None)), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JVM, sub_type=None)), name=rule)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JVM, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isVersionValid, postfix_operators=[], prefix_operators=['!'], qualifier=rule, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RULE ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='(')], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=ruleno, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRuleName, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getInterfaceName, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERFACE ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInterfaceName, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CLASS ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="METHOD ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMethodName, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=rule, 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=!=), operandr=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=['!'], qualifier=rule, 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), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='(')], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=')')], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="HELPER ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHelper, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getHelper, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=RuleHelper, sub_type=None))], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AT ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isCompile, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isCompile, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[], type_arguments=None), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[TernaryExpression(condition=MethodInvocation(arguments=[], member=isCompile, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NOCOMPILE\r\n"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="COMPILE\r\n"))], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=getBinds, postfix_operators=[], prefix_operators=['!'], qualifier=rule, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BIND ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBinds, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[MemberReference(member=i, 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=bind)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InstrumentBind, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=bind, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" : ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=bind, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" = ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExpression, postfix_operators=[], prefix_operators=[], qualifier=bind, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getBinds, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="IF ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCondition, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCondition, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TRUE")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DO\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[MemberReference(member=i, 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=action)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InstrumentAction, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=transformers, selectors=[], type_arguments=None), name=transformer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InstrumentActionTransformer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=transformer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Transformer for action '"), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' not found"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=convertToRuleAction, postfix_operators=[], prefix_operators=[], qualifier=transformer, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=rule, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ENDRULE\r\n\r\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ruleno, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getRules, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ruleno)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ruleno, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[builder.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[transform] operator[SEP] identifier[String] identifier[name] , identifier[Instrumentation] identifier[types] , identifier[String] identifier[version] operator[SEP] {
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[types] operator[SEP] identifier[isCompile] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ruleno] operator[=] Other[0] operator[SEP] identifier[ruleno] operator[<] identifier[types] operator[SEP] identifier[getRules] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[ruleno] operator[++] operator[SEP] {
identifier[InstrumentRule] identifier[r] operator[=] identifier[types] operator[SEP] identifier[getRules] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[ruleno] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[==] identifier[JVM] operator[SEP] Keyword[class] operator[SEP] {
identifier[JVM] identifier[rule] operator[=] operator[SEP] identifier[JVM] operator[SEP] identifier[r] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[rule] operator[SEP] identifier[isVersionValid] operator[SEP] identifier[version] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[ruleno] operator[+] Other[1] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getRuleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[getInterfaceName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getInterfaceName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[||] operator[!] identifier[rule] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[rule] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[getHelper] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[RuleHelper] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getHelper] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[isCompile] operator[SEP] operator[SEP] operator[!=] identifier[types] operator[SEP] identifier[isCompile] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[isCompile] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[rule] operator[SEP] identifier[getBinds] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[rule] operator[SEP] identifier[getBinds] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[InstrumentBind] identifier[bind] operator[=] identifier[rule] operator[SEP] identifier[getBinds] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[bind] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[bind] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[bind] operator[SEP] identifier[getExpression] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[getCondition] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[rule] operator[SEP] identifier[getCondition] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[rule] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[InstrumentAction] identifier[action] operator[=] identifier[rule] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[InstrumentActionTransformer] identifier[transformer] operator[=] identifier[transformers] operator[SEP] identifier[get] operator[SEP] identifier[action] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[transformer] operator[!=] Other[null] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[transformer] operator[SEP] identifier[convertToRuleAction] operator[SEP] identifier[rule] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<] identifier[rule] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[action] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<String> getGroups(final DirContext dirContext, final LdapUser ldapUser) throws NamingException {
LOGGER.debug("Retrieving groups for: " + ldapUser.getDN());
final List<String> groupDns = new ArrayList<>();
final String searchFilter = variableSubstitution(USER_GROUPS_FILTER, ldapUser);
final SearchControls sc = new SearchControls();
sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
final NamingEnumeration<SearchResult> ne = dirContext.search(BASE_DN, searchFilter, sc);
while (hasMoreEnum(ne)) {
final SearchResult result = ne.next();
groupDns.add(result.getNameInNamespace());
LOGGER.debug("Found group: " + result.getNameInNamespace() + " for user: " + ldapUser.getDN());
}
closeQuietly(ne);
return groupDns;
}
|
class class_name[name] begin[{]
method[getGroups, return_type[type[List]], modifier[public], parameter[dirContext, ldapUser]] begin[{]
call[LOGGER.debug, parameter[binary_operation[literal["Retrieving groups for: "], +, call[ldapUser.getDN, parameter[]]]]]
local_variable[type[List], groupDns]
local_variable[type[String], searchFilter]
local_variable[type[SearchControls], sc]
call[sc.setSearchScope, parameter[member[SearchControls.SUBTREE_SCOPE]]]
local_variable[type[NamingEnumeration], ne]
while[call[.hasMoreEnum, parameter[member[.ne]]]] begin[{]
local_variable[type[SearchResult], result]
call[groupDns.add, parameter[call[result.getNameInNamespace, parameter[]]]]
call[LOGGER.debug, parameter[binary_operation[binary_operation[binary_operation[literal["Found group: "], +, call[result.getNameInNamespace, parameter[]]], +, literal[" for user: "]], +, call[ldapUser.getDN, parameter[]]]]]
end[}]
call[.closeQuietly, parameter[member[.ne]]]
return[member[.groupDns]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getGroups] operator[SEP] Keyword[final] identifier[DirContext] identifier[dirContext] , Keyword[final] identifier[LdapUser] identifier[ldapUser] operator[SEP] Keyword[throws] identifier[NamingException] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[ldapUser] operator[SEP] identifier[getDN] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[groupDns] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[searchFilter] operator[=] identifier[variableSubstitution] operator[SEP] identifier[USER_GROUPS_FILTER] , identifier[ldapUser] operator[SEP] operator[SEP] Keyword[final] identifier[SearchControls] identifier[sc] operator[=] Keyword[new] identifier[SearchControls] operator[SEP] operator[SEP] operator[SEP] identifier[sc] operator[SEP] identifier[setSearchScope] operator[SEP] identifier[SearchControls] operator[SEP] identifier[SUBTREE_SCOPE] operator[SEP] operator[SEP] Keyword[final] identifier[NamingEnumeration] operator[<] identifier[SearchResult] operator[>] identifier[ne] operator[=] identifier[dirContext] operator[SEP] identifier[search] operator[SEP] identifier[BASE_DN] , identifier[searchFilter] , identifier[sc] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[hasMoreEnum] operator[SEP] identifier[ne] operator[SEP] operator[SEP] {
Keyword[final] identifier[SearchResult] identifier[result] operator[=] identifier[ne] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[groupDns] operator[SEP] identifier[add] operator[SEP] identifier[result] operator[SEP] identifier[getNameInNamespace] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[result] operator[SEP] identifier[getNameInNamespace] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[ldapUser] operator[SEP] identifier[getDN] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[closeQuietly] operator[SEP] identifier[ne] operator[SEP] operator[SEP] Keyword[return] identifier[groupDns] operator[SEP]
}
|
public final void registerLink(final AbstractItemLink newLink, final AbstractItem item)
{
register(newLink);
_setMembership(newLink, item);
}
|
class class_name[name] begin[{]
method[registerLink, return_type[void], modifier[final public], parameter[newLink, item]] begin[{]
call[.register, parameter[member[.newLink]]]
call[._setMembership, parameter[member[.newLink], member[.item]]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[registerLink] operator[SEP] Keyword[final] identifier[AbstractItemLink] identifier[newLink] , Keyword[final] identifier[AbstractItem] identifier[item] operator[SEP] {
identifier[register] operator[SEP] identifier[newLink] operator[SEP] operator[SEP] identifier[_setMembership] operator[SEP] identifier[newLink] , identifier[item] operator[SEP] operator[SEP]
}
|
public static Money of(BigDecimal number, String currencyCode, MonetaryContext monetaryContext) {
return new Money(number, Monetary.getCurrency(currencyCode), monetaryContext);
}
|
class class_name[name] begin[{]
method[of, return_type[type[Money]], modifier[public static], parameter[number, currencyCode, monetaryContext]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=currencyCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCurrency, postfix_operators=[], prefix_operators=[], qualifier=Monetary, selectors=[], type_arguments=None), MemberReference(member=monetaryContext, 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=Money, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Money] identifier[of] operator[SEP] identifier[BigDecimal] identifier[number] , identifier[String] identifier[currencyCode] , identifier[MonetaryContext] identifier[monetaryContext] operator[SEP] {
Keyword[return] Keyword[new] identifier[Money] operator[SEP] identifier[number] , identifier[Monetary] operator[SEP] identifier[getCurrency] operator[SEP] identifier[currencyCode] operator[SEP] , identifier[monetaryContext] operator[SEP] operator[SEP]
}
|
public void addFeature(String feature) {
if (feature == null) {
throw new IllegalArgumentException("Invalid null argument passed for addFeature");
}
feature = feature.trim();
if (!feature.isEmpty()) {
Feature newFeature = new Feature();
newFeature.addText(feature);
featureList.add(newFeature);
}
}
|
class class_name[name] begin[{]
method[addFeature, return_type[void], modifier[public], parameter[feature]] begin[{]
if[binary_operation[member[.feature], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid null argument passed for addFeature")], 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[}]
assign[member[.feature], call[feature.trim, parameter[]]]
if[call[feature.isEmpty, parameter[]]] begin[{]
local_variable[type[Feature], newFeature]
call[newFeature.addText, parameter[member[.feature]]]
call[featureList.add, parameter[member[.newFeature]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addFeature] operator[SEP] identifier[String] identifier[feature] operator[SEP] {
Keyword[if] operator[SEP] identifier[feature] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[feature] operator[=] identifier[feature] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[feature] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Feature] identifier[newFeature] operator[=] Keyword[new] identifier[Feature] operator[SEP] operator[SEP] operator[SEP] identifier[newFeature] operator[SEP] identifier[addText] operator[SEP] identifier[feature] operator[SEP] operator[SEP] identifier[featureList] operator[SEP] identifier[add] operator[SEP] identifier[newFeature] operator[SEP] operator[SEP]
}
}
|
ServerMember update(Status status, Instant time) {
if (this.status != status) {
this.status = Assert.notNull(status, "status");
if (time.isAfter(updated)) {
this.updated = Assert.notNull(time, "time");
}
if (statusChangeListeners != null) {
statusChangeListeners.accept(status);
}
}
return this;
}
|
class class_name[name] begin[{]
method[update, return_type[type[ServerMember]], modifier[default], parameter[status, time]] begin[{]
if[binary_operation[THIS[member[None.status]], !=, member[.status]]] begin[{]
assign[THIS[member[None.status]], call[Assert.notNull, parameter[member[.status], literal["status"]]]]
if[call[time.isAfter, parameter[member[.updated]]]] begin[{]
assign[THIS[member[None.updated]], call[Assert.notNull, parameter[member[.time], literal["time"]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.statusChangeListeners], !=, literal[null]]] begin[{]
call[statusChangeListeners.accept, parameter[member[.status]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}]
|
identifier[ServerMember] identifier[update] operator[SEP] identifier[Status] identifier[status] , identifier[Instant] identifier[time] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[status] operator[!=] identifier[status] operator[SEP] {
Keyword[this] operator[SEP] identifier[status] operator[=] identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[status] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[time] operator[SEP] identifier[isAfter] operator[SEP] identifier[updated] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[updated] operator[=] identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[time] , literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[statusChangeListeners] operator[!=] Other[null] operator[SEP] {
identifier[statusChangeListeners] operator[SEP] identifier[accept] operator[SEP] identifier[status] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static PeriodType yearMonthDay() {
PeriodType type = cYMD;
if (type == null) {
type = new PeriodType(
"YearMonthDay",
new DurationFieldType[] {
DurationFieldType.years(), DurationFieldType.months(),
DurationFieldType.days(),
},
new int[] { 0, 1, -1, 2, -1, -1, -1, -1, }
);
cYMD = type;
}
return type;
}
|
class class_name[name] begin[{]
method[yearMonthDay, return_type[type[PeriodType]], modifier[public static], parameter[]] begin[{]
local_variable[type[PeriodType], type]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
assign[member[.type], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="YearMonthDay"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=years, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=months, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=days, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DurationFieldType, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PeriodType, sub_type=None))]
assign[member[.cYMD], member[.type]]
else begin[{]
None
end[}]
return[member[.type]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[PeriodType] identifier[yearMonthDay] operator[SEP] operator[SEP] {
identifier[PeriodType] identifier[type] operator[=] identifier[cYMD] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[PeriodType] operator[SEP] literal[String] , Keyword[new] identifier[DurationFieldType] operator[SEP] operator[SEP] {
identifier[DurationFieldType] operator[SEP] identifier[years] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[months] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[days] operator[SEP] operator[SEP] ,
} , Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
Other[0] , Other[1] , operator[-] Other[1] , Other[2] , operator[-] Other[1] , operator[-] Other[1] , operator[-] Other[1] , operator[-] Other[1] ,
} operator[SEP] operator[SEP] identifier[cYMD] operator[=] identifier[type] operator[SEP]
}
Keyword[return] identifier[type] operator[SEP]
}
|
private PDDocument removeText(PDPage page) throws IOException {
PDFStreamParser parser = new PDFStreamParser(page);
parser.parse();
List<Object> tokens = parser.getTokens();
List<Object> newTokens = new ArrayList<>();
for (Object token : tokens) {
if (token instanceof Operator) {
Operator op = (Operator) token;
if (op.getName().equals("TJ") || op.getName().equals("Tj")) {
//remove the one argument to this operator
newTokens.remove(newTokens.size() - 1);
continue;
}
}
newTokens.add(token);
}
PDDocument document = new PDDocument();
document.addPage(page);
PDStream newContents = new PDStream(document);
OutputStream out = newContents.createOutputStream(COSName.FLATE_DECODE);
ContentStreamWriter writer = new ContentStreamWriter(out);
writer.writeTokens(newTokens);
out.close();
page.setContents(newContents);
return document;
}
|
class class_name[name] begin[{]
method[removeText, return_type[type[PDDocument]], modifier[private], parameter[page]] begin[{]
local_variable[type[PDFStreamParser], parser]
call[parser.parse, parameter[]]
local_variable[type[List], tokens]
local_variable[type[List], newTokens]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Operator, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Operator, sub_type=None)), name=op)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Operator, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=op, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TJ")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=op, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Tj")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=newTokens, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=newTokens, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=newTokens, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=token)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
local_variable[type[PDDocument], document]
call[document.addPage, parameter[member[.page]]]
local_variable[type[PDStream], newContents]
local_variable[type[OutputStream], out]
local_variable[type[ContentStreamWriter], writer]
call[writer.writeTokens, parameter[member[.newTokens]]]
call[out.close, parameter[]]
call[page.setContents, parameter[member[.newContents]]]
return[member[.document]]
end[}]
END[}]
|
Keyword[private] identifier[PDDocument] identifier[removeText] operator[SEP] identifier[PDPage] identifier[page] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[PDFStreamParser] identifier[parser] operator[=] Keyword[new] identifier[PDFStreamParser] operator[SEP] identifier[page] operator[SEP] operator[SEP] identifier[parser] operator[SEP] identifier[parse] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[tokens] operator[=] identifier[parser] operator[SEP] identifier[getTokens] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[newTokens] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[token] operator[:] identifier[tokens] operator[SEP] {
Keyword[if] operator[SEP] identifier[token] Keyword[instanceof] identifier[Operator] operator[SEP] {
identifier[Operator] identifier[op] operator[=] operator[SEP] identifier[Operator] operator[SEP] identifier[token] operator[SEP] Keyword[if] operator[SEP] identifier[op] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[op] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[newTokens] operator[SEP] identifier[remove] operator[SEP] identifier[newTokens] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
identifier[newTokens] operator[SEP] identifier[add] operator[SEP] identifier[token] operator[SEP] operator[SEP]
}
identifier[PDDocument] identifier[document] operator[=] Keyword[new] identifier[PDDocument] operator[SEP] operator[SEP] operator[SEP] identifier[document] operator[SEP] identifier[addPage] operator[SEP] identifier[page] operator[SEP] operator[SEP] identifier[PDStream] identifier[newContents] operator[=] Keyword[new] identifier[PDStream] operator[SEP] identifier[document] operator[SEP] operator[SEP] identifier[OutputStream] identifier[out] operator[=] identifier[newContents] operator[SEP] identifier[createOutputStream] operator[SEP] identifier[COSName] operator[SEP] identifier[FLATE_DECODE] operator[SEP] operator[SEP] identifier[ContentStreamWriter] identifier[writer] operator[=] Keyword[new] identifier[ContentStreamWriter] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[writeTokens] operator[SEP] identifier[newTokens] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[page] operator[SEP] identifier[setContents] operator[SEP] identifier[newContents] operator[SEP] operator[SEP] Keyword[return] identifier[document] operator[SEP]
}
|
public static Double getDouble(Config config, String path) {
try {
Object obj = config.getAnyRef(path);
return obj instanceof Number ? ((Number) obj).doubleValue() : null;
} catch (ConfigException.Missing | ConfigException.WrongType e) {
if (e instanceof ConfigException.WrongType) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
}
|
class class_name[name] begin[{]
method[getDouble, return_type[type[Double]], modifier[public static], parameter[config, path]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAnyRef, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), name=obj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None), operator=instanceof), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=Cast(expression=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ConfigException, sub_type=ReferenceType(arguments=None, dimensions=None, name=WrongType, sub_type=None)), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], 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=['ConfigException.Missing', 'ConfigException.WrongType']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Double] identifier[getDouble] operator[SEP] identifier[Config] identifier[config] , identifier[String] identifier[path] operator[SEP] {
Keyword[try] {
identifier[Object] identifier[obj] operator[=] identifier[config] operator[SEP] identifier[getAnyRef] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[obj] Keyword[instanceof] identifier[Number] operator[?] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ConfigException] operator[SEP] identifier[Missing] operator[|] identifier[ConfigException] operator[SEP] identifier[WrongType] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[ConfigException] operator[SEP] identifier[WrongType] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
}
|
@Override
public DatanodeDescriptor[] chooseTarget(FSInodeInfo srcInode,
int numOfReplicas,
DatanodeDescriptor writer, List<DatanodeDescriptor> chosenNodes,
List<Node> excludesNodes, long blocksize) {
if (numOfReplicas == 0 || clusterMap.getNumOfLeaves() == 0) {
return new DatanodeDescriptor[0];
}
int[] result = getActualReplicas(numOfReplicas, chosenNodes);
numOfReplicas = result[0];
int maxNodesPerRack = result[1];
HashMap<Node, Node> excludedNodes = new HashMap<Node, Node>();
List<DatanodeDescriptor> results = new ArrayList<DatanodeDescriptor>(
chosenNodes.size() + numOfReplicas);
updateExcludedAndChosen(null, excludedNodes, results, chosenNodes);
if (!clusterMap.contains(writer)) {
writer = null;
}
DatanodeDescriptor localNode = super.chooseTarget(numOfReplicas, writer,
excludedNodes, blocksize, maxNodesPerRack, results,
chosenNodes.isEmpty());
return this.finalizeTargets(results, chosenNodes, writer, localNode);
}
|
class class_name[name] begin[{]
method[chooseTarget, return_type[type[DatanodeDescriptor]], modifier[public], parameter[srcInode, numOfReplicas, writer, chosenNodes, excludesNodes, blocksize]] begin[{]
if[binary_operation[binary_operation[member[.numOfReplicas], ==, literal[0]], ||, binary_operation[call[clusterMap.getNumOfLeaves, parameter[]], ==, literal[0]]]] begin[{]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DatanodeDescriptor, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[int], result]
assign[member[.numOfReplicas], member[.result]]
local_variable[type[int], maxNodesPerRack]
local_variable[type[HashMap], excludedNodes]
local_variable[type[List], results]
call[.updateExcludedAndChosen, parameter[literal[null], member[.excludedNodes], member[.results], member[.chosenNodes]]]
if[call[clusterMap.contains, parameter[member[.writer]]]] begin[{]
assign[member[.writer], literal[null]]
else begin[{]
None
end[}]
local_variable[type[DatanodeDescriptor], localNode]
return[THIS[call[None.finalizeTargets, parameter[member[.results], member[.chosenNodes], member[.writer], member[.localNode]]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[DatanodeDescriptor] operator[SEP] operator[SEP] identifier[chooseTarget] operator[SEP] identifier[FSInodeInfo] identifier[srcInode] , Keyword[int] identifier[numOfReplicas] , identifier[DatanodeDescriptor] identifier[writer] , identifier[List] operator[<] identifier[DatanodeDescriptor] operator[>] identifier[chosenNodes] , identifier[List] operator[<] identifier[Node] operator[>] identifier[excludesNodes] , Keyword[long] identifier[blocksize] operator[SEP] {
Keyword[if] operator[SEP] identifier[numOfReplicas] operator[==] Other[0] operator[||] identifier[clusterMap] operator[SEP] identifier[getNumOfLeaves] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[DatanodeDescriptor] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[getActualReplicas] operator[SEP] identifier[numOfReplicas] , identifier[chosenNodes] operator[SEP] operator[SEP] identifier[numOfReplicas] operator[=] identifier[result] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[maxNodesPerRack] operator[=] identifier[result] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[Node] , identifier[Node] operator[>] identifier[excludedNodes] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[Node] , identifier[Node] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[DatanodeDescriptor] operator[>] identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[DatanodeDescriptor] operator[>] operator[SEP] identifier[chosenNodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[numOfReplicas] operator[SEP] operator[SEP] identifier[updateExcludedAndChosen] operator[SEP] Other[null] , identifier[excludedNodes] , identifier[results] , identifier[chosenNodes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[clusterMap] operator[SEP] identifier[contains] operator[SEP] identifier[writer] operator[SEP] operator[SEP] {
identifier[writer] operator[=] Other[null] operator[SEP]
}
identifier[DatanodeDescriptor] identifier[localNode] operator[=] Keyword[super] operator[SEP] identifier[chooseTarget] operator[SEP] identifier[numOfReplicas] , identifier[writer] , identifier[excludedNodes] , identifier[blocksize] , identifier[maxNodesPerRack] , identifier[results] , identifier[chosenNodes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[finalizeTargets] operator[SEP] identifier[results] , identifier[chosenNodes] , identifier[writer] , identifier[localNode] operator[SEP] operator[SEP]
}
|
private static List<BuiltInQProfile> reduceBuiltInQualityProfiles(Context context) throws SQLException {
ListMultimap<String, BuiltInQProfile> builtInQPByLanguages = ArrayListMultimap.create();
List<BuiltInQProfile> builtInQProfiles = context.prepareSelect("SELECT kee, language, name FROM rules_profiles WHERE is_built_in = ?")
.setBoolean(1, true)
.list(row -> new BuiltInQProfile(row.getString(1), row.getString(2), row.getString(3)));
builtInQProfiles.forEach(builtInQProfile -> builtInQPByLanguages.put(builtInQProfile.language, builtInQProfile));
// Filter all built in quality profiles to have only one by language
// And prefer the one named "Sonar Way"
builtInQPByLanguages.keySet().forEach(l -> {
List<BuiltInQProfile> qps = builtInQPByLanguages.get(l);
if (qps.size() > 1) {
BuiltInQProfile sonarWay = qps.stream().filter(qp -> qp.name.equals("Sonar way"))
.findFirst()
.orElse(qps.get(0));
qps.forEach(qp -> {
if (qp.kee.equals(sonarWay.kee)) {
return;
}
builtInQProfiles.remove(qp);
});
}
});
return builtInQProfiles;
}
|
class class_name[name] begin[{]
method[reduceBuiltInQualityProfiles, return_type[type[List]], modifier[private static], parameter[context]] begin[{]
local_variable[type[ListMultimap], builtInQPByLanguages]
local_variable[type[List], builtInQProfiles]
call[builtInQProfiles.forEach, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=builtInQProfile, selectors=[]), MemberReference(member=builtInQProfile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=builtInQPByLanguages, selectors=[], type_arguments=None), parameters=[MemberReference(member=builtInQProfile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[builtInQPByLanguages.keySet, parameter[]]
return[member[.builtInQProfiles]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[List] operator[<] identifier[BuiltInQProfile] operator[>] identifier[reduceBuiltInQualityProfiles] operator[SEP] identifier[Context] identifier[context] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[ListMultimap] operator[<] identifier[String] , identifier[BuiltInQProfile] operator[>] identifier[builtInQPByLanguages] operator[=] identifier[ArrayListMultimap] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[BuiltInQProfile] operator[>] identifier[builtInQProfiles] operator[=] identifier[context] operator[SEP] identifier[prepareSelect] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[setBoolean] operator[SEP] Other[1] , literal[boolean] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[row] operator[->] Keyword[new] identifier[BuiltInQProfile] operator[SEP] identifier[row] operator[SEP] identifier[getString] operator[SEP] Other[1] operator[SEP] , identifier[row] operator[SEP] identifier[getString] operator[SEP] Other[2] operator[SEP] , identifier[row] operator[SEP] identifier[getString] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builtInQProfiles] operator[SEP] identifier[forEach] operator[SEP] identifier[builtInQProfile] operator[->] identifier[builtInQPByLanguages] operator[SEP] identifier[put] operator[SEP] identifier[builtInQProfile] operator[SEP] identifier[language] , identifier[builtInQProfile] operator[SEP] operator[SEP] operator[SEP] identifier[builtInQPByLanguages] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[l] operator[->] {
identifier[List] operator[<] identifier[BuiltInQProfile] operator[>] identifier[qps] operator[=] identifier[builtInQPByLanguages] operator[SEP] identifier[get] operator[SEP] identifier[l] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[qps] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[BuiltInQProfile] identifier[sonarWay] operator[=] identifier[qps] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[qp] operator[->] identifier[qp] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] identifier[qps] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[qps] operator[SEP] identifier[forEach] operator[SEP] identifier[qp] operator[->] {
Keyword[if] operator[SEP] identifier[qp] operator[SEP] identifier[kee] operator[SEP] identifier[equals] operator[SEP] identifier[sonarWay] operator[SEP] identifier[kee] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[builtInQProfiles] operator[SEP] identifier[remove] operator[SEP] identifier[qp] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[return] identifier[builtInQProfiles] operator[SEP]
}
|
private String getSharedAccessCanonicalName() {
String accountName = this.getServiceClient().getCredentials().getAccountName();
String queueName = this.getName();
return String.format("/%s/%s/%s", SR.QUEUE, accountName, queueName);
}
|
class class_name[name] begin[{]
method[getSharedAccessCanonicalName, return_type[type[String]], modifier[private], parameter[]] begin[{]
local_variable[type[String], accountName]
local_variable[type[String], queueName]
return[call[String.format, parameter[literal["/%s/%s/%s"], member[SR.QUEUE], member[.accountName], member[.queueName]]]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[getSharedAccessCanonicalName] operator[SEP] operator[SEP] {
identifier[String] identifier[accountName] operator[=] Keyword[this] operator[SEP] identifier[getServiceClient] operator[SEP] operator[SEP] operator[SEP] identifier[getCredentials] operator[SEP] operator[SEP] operator[SEP] identifier[getAccountName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[queueName] operator[=] Keyword[this] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[SR] operator[SEP] identifier[QUEUE] , identifier[accountName] , identifier[queueName] operator[SEP] operator[SEP]
}
|
boolean deleteAllTriggerOf(String appPackageName) {
String where = Contract.COLUMN_APP_IDENTIFIER + " = ?";
String[] whereArgs = { appPackageName };
int c = getReadableDatabase().delete(Contract.TABLE_NAME, where, whereArgs);
return c > 0;
}
|
class class_name[name] begin[{]
method[deleteAllTriggerOf, return_type[type[boolean]], modifier[default], parameter[appPackageName]] begin[{]
local_variable[type[String], where]
local_variable[type[String], whereArgs]
local_variable[type[int], c]
return[binary_operation[member[.c], >, literal[0]]]
end[}]
END[}]
|
Keyword[boolean] identifier[deleteAllTriggerOf] operator[SEP] identifier[String] identifier[appPackageName] operator[SEP] {
identifier[String] identifier[where] operator[=] identifier[Contract] operator[SEP] identifier[COLUMN_APP_IDENTIFIER] operator[+] literal[String] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[whereArgs] operator[=] {
identifier[appPackageName]
} operator[SEP] Keyword[int] identifier[c] operator[=] identifier[getReadableDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[delete] operator[SEP] identifier[Contract] operator[SEP] identifier[TABLE_NAME] , identifier[where] , identifier[whereArgs] operator[SEP] operator[SEP] Keyword[return] identifier[c] operator[>] Other[0] operator[SEP]
}
|
public void setAsynchConsumerCallback(int requestNumber,
int maxActiveMessages,
long messageLockExpiry,
int batchsize,
OrderingContext orderContext,
boolean stoppable,
int maxSequentialFailures,
long hiddenMessageDelay)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setAsynchConsumerCallback",
new Object[]
{
requestNumber,
maxActiveMessages,
messageLockExpiry,
batchsize,
orderContext,
stoppable,
maxSequentialFailures,
hiddenMessageDelay});
SIErrorException e = new SIErrorException(nls.getFormattedMessage("PROTOCOL_ERROR_SICO2003", null, null));
FFDCFilter.processException(e, CLASS_NAME + ".setAsynchConsumerCallback",CommsConstants.CATCONSUMER_SETASYNCHCALLBACK_01,this);
SibTr.error(tc, "PROTOCOL_ERROR_SICO2003", e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setAsynchConsumerCallback");
// Re-throw this exception so that the client will informed if required
throw e;
}
|
class class_name[name] begin[{]
method[setAsynchConsumerCallback, return_type[void], modifier[public], parameter[requestNumber, maxActiveMessages, messageLockExpiry, batchsize, orderContext, stoppable, maxSequentialFailures, hiddenMessageDelay]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setAsynchConsumerCallback"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=requestNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=messageLockExpiry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=batchsize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=orderContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stoppable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxSequentialFailures, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hiddenMessageDelay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[SIErrorException], e]
call[FFDCFilter.processException, parameter[member[.e], binary_operation[member[.CLASS_NAME], +, literal[".setAsynchConsumerCallback"]], member[CommsConstants.CATCONSUMER_SETASYNCHCALLBACK_01], THIS[]]]
call[SibTr.error, parameter[member[.tc], literal["PROTOCOL_ERROR_SICO2003"], member[.e]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setAsynchConsumerCallback"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setAsynchConsumerCallback] operator[SEP] Keyword[int] identifier[requestNumber] , Keyword[int] identifier[maxActiveMessages] , Keyword[long] identifier[messageLockExpiry] , Keyword[int] identifier[batchsize] , identifier[OrderingContext] identifier[orderContext] , Keyword[boolean] identifier[stoppable] , Keyword[int] identifier[maxSequentialFailures] , Keyword[long] identifier[hiddenMessageDelay] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[requestNumber] , identifier[maxActiveMessages] , identifier[messageLockExpiry] , identifier[batchsize] , identifier[orderContext] , identifier[stoppable] , identifier[maxSequentialFailures] , identifier[hiddenMessageDelay]
} operator[SEP] operator[SEP] identifier[SIErrorException] identifier[e] operator[=] Keyword[new] identifier[SIErrorException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , identifier[CLASS_NAME] operator[+] literal[String] , identifier[CommsConstants] operator[SEP] identifier[CATCONSUMER_SETASYNCHCALLBACK_01] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
|
@GwtIncompatible("incompatible method")
public static byte[] uuidToByteArray(final UUID src, final byte[] dst, final int dstPos, final int nBytes) {
if (0 == nBytes) {
return dst;
}
if (nBytes > 16) {
throw new IllegalArgumentException("nBytes is greater than 16");
}
longToByteArray(src.getMostSignificantBits(), 0, dst, dstPos, nBytes > 8 ? 8 : nBytes);
if (nBytes >= 8) {
longToByteArray(src.getLeastSignificantBits(), 0, dst, dstPos + 8, nBytes - 8);
}
return dst;
}
|
class class_name[name] begin[{]
method[uuidToByteArray, return_type[type[byte]], modifier[public static], parameter[src, dst, dstPos, nBytes]] begin[{]
if[binary_operation[literal[0], ==, member[.nBytes]]] begin[{]
return[member[.dst]]
else begin[{]
None
end[}]
if[binary_operation[member[.nBytes], >, literal[16]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="nBytes is greater than 16")], 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[.longToByteArray, parameter[call[src.getMostSignificantBits, parameter[]], literal[0], member[.dst], member[.dstPos], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=nBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>), if_false=MemberReference(member=nBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8))]]
if[binary_operation[member[.nBytes], >=, literal[8]]] begin[{]
call[.longToByteArray, parameter[call[src.getLeastSignificantBits, parameter[]], literal[0], member[.dst], binary_operation[member[.dstPos], +, literal[8]], binary_operation[member[.nBytes], -, literal[8]]]]
else begin[{]
None
end[}]
return[member[.dst]]
end[}]
END[}]
|
annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[uuidToByteArray] operator[SEP] Keyword[final] identifier[UUID] identifier[src] , Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[dst] , Keyword[final] Keyword[int] identifier[dstPos] , Keyword[final] Keyword[int] identifier[nBytes] operator[SEP] {
Keyword[if] operator[SEP] Other[0] operator[==] identifier[nBytes] operator[SEP] {
Keyword[return] identifier[dst] operator[SEP]
}
Keyword[if] operator[SEP] identifier[nBytes] operator[>] Other[16] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[longToByteArray] operator[SEP] identifier[src] operator[SEP] identifier[getMostSignificantBits] operator[SEP] operator[SEP] , Other[0] , identifier[dst] , identifier[dstPos] , identifier[nBytes] operator[>] Other[8] operator[?] Other[8] operator[:] identifier[nBytes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nBytes] operator[>=] Other[8] operator[SEP] {
identifier[longToByteArray] operator[SEP] identifier[src] operator[SEP] identifier[getLeastSignificantBits] operator[SEP] operator[SEP] , Other[0] , identifier[dst] , identifier[dstPos] operator[+] Other[8] , identifier[nBytes] operator[-] Other[8] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dst] operator[SEP]
}
|
@Override
public final void setReportNAN(Boolean value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setReportNAN", value);
if (value != null) {
getApi().setField(JsApiAccess.REPORTNAN_VALUE, value);
}
else {
getApi().setChoiceField(JsApiAccess.REPORTNAN, JsApiAccess.IS_REPORTNAN_UNSET);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setReportNAN");
}
|
class class_name[name] begin[{]
method[setReportNAN, return_type[void], modifier[final public], parameter[value]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setReportNAN"], member[.value]]]
else begin[{]
None
end[}]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
call[.getApi, parameter[]]
else begin[{]
call[.getApi, parameter[]]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setReportNAN"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setReportNAN] operator[SEP] identifier[Boolean] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTNAN_VALUE] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[setChoiceField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[REPORTNAN] , identifier[JsApiAccess] operator[SEP] identifier[IS_REPORTNAN_UNSET] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
@Pure
public static double clampToNearestBounds(double value, double minBounds, double maxBounds) {
assert minBounds <= maxBounds : AssertMessages.lowerEqualParameters(1, minBounds, 2, maxBounds);
final double center = (minBounds + maxBounds) / 2;
if (value <= center) {
return minBounds;
}
return maxBounds;
}
|
class class_name[name] begin[{]
method[clampToNearestBounds, return_type[type[double]], modifier[public static], parameter[value, minBounds, maxBounds]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=minBounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxBounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), label=None, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=minBounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), MemberReference(member=maxBounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lowerEqualParameters, postfix_operators=[], prefix_operators=[], qualifier=AssertMessages, selectors=[], type_arguments=None))
local_variable[type[double], center]
if[binary_operation[member[.value], <=, member[.center]]] begin[{]
return[member[.minBounds]]
else begin[{]
None
end[}]
return[member[.maxBounds]]
end[}]
END[}]
|
annotation[@] identifier[Pure] Keyword[public] Keyword[static] Keyword[double] identifier[clampToNearestBounds] operator[SEP] Keyword[double] identifier[value] , Keyword[double] identifier[minBounds] , Keyword[double] identifier[maxBounds] operator[SEP] {
Keyword[assert] identifier[minBounds] operator[<=] identifier[maxBounds] operator[:] identifier[AssertMessages] operator[SEP] identifier[lowerEqualParameters] operator[SEP] Other[1] , identifier[minBounds] , Other[2] , identifier[maxBounds] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[center] operator[=] operator[SEP] identifier[minBounds] operator[+] identifier[maxBounds] operator[SEP] operator[/] Other[2] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[<=] identifier[center] operator[SEP] {
Keyword[return] identifier[minBounds] operator[SEP]
}
Keyword[return] identifier[maxBounds] operator[SEP]
}
|
@GuardedBy("masterBlockInfo")
private Optional<BlockInfo> generateBlockInfo(long blockId) throws UnavailableException {
if (mSafeModeManager.isInSafeMode()) {
throw new UnavailableException(ExceptionMessage.MASTER_IN_SAFEMODE.getMessage());
}
BlockMeta block;
List<BlockLocation> blockLocations;
try (LockResource lr = lockBlock(blockId)) {
Optional<BlockMeta> blockOpt = mBlockStore.getBlock(blockId);
if (!blockOpt.isPresent()) {
return Optional.empty();
}
block = blockOpt.get();
blockLocations = new ArrayList<>(mBlockStore.getLocations(blockId));
}
// Sort the block locations by their alias ordinal in the master storage tier mapping
Collections.sort(blockLocations,
Comparator.comparingInt(o -> mGlobalStorageTierAssoc.getOrdinal(o.getTier())));
List<alluxio.wire.BlockLocation> locations = new ArrayList<>();
for (BlockLocation location : blockLocations) {
MasterWorkerInfo workerInfo =
mWorkers.getFirstByField(ID_INDEX, location.getWorkerId());
if (workerInfo != null) {
// worker metadata is intentionally not locked here because:
// - it would be an incorrect order (correct order is lock worker first, then block)
// - only uses getters of final variables
locations.add(new alluxio.wire.BlockLocation().setWorkerId(location.getWorkerId())
.setWorkerAddress(workerInfo.getWorkerAddress())
.setTierAlias(location.getTier()));
}
}
return Optional.of(
new BlockInfo().setBlockId(blockId).setLength(block.getLength()).setLocations(locations));
}
|
class class_name[name] begin[{]
method[generateBlockInfo, return_type[type[Optional]], modifier[private], parameter[blockId]] begin[{]
if[call[mSafeModeManager.isInSafeMode, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMessage.MASTER_IN_SAFEMODE, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnavailableException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[BlockMeta], block]
local_variable[type[List], blockLocations]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=blockId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBlock, postfix_operators=[], prefix_operators=[], qualifier=mBlockStore, selectors=[], type_arguments=None), name=blockOpt)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BlockMeta, sub_type=None))], dimensions=[], name=Optional, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isPresent, postfix_operators=[], prefix_operators=['!'], qualifier=blockOpt, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=blockOpt, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=blockLocations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=blockId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLocations, postfix_operators=[], prefix_operators=[], qualifier=mBlockStore, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=lr, type=ReferenceType(arguments=None, dimensions=[], name=LockResource, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=blockId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lockBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))])
call[Collections.sort, parameter[member[.blockLocations], call[Comparator.comparingInt, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTier, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None)], member=getOrdinal, postfix_operators=[], prefix_operators=[], qualifier=mGlobalStorageTierAssoc, selectors=[], type_arguments=None), parameters=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]]
local_variable[type[List], locations]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ID_INDEX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getWorkerId, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[], type_arguments=None)], member=getFirstByField, postfix_operators=[], prefix_operators=[], qualifier=mWorkers, selectors=[], type_arguments=None), name=workerInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MasterWorkerInfo, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=workerInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWorkerId, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[], type_arguments=None)], member=setWorkerId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWorkerAddress, postfix_operators=[], prefix_operators=[], qualifier=workerInfo, selectors=[], type_arguments=None)], member=setWorkerAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTier, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[], type_arguments=None)], member=setTierAlias, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=alluxio, sub_type=ReferenceType(arguments=None, dimensions=None, name=wire, sub_type=ReferenceType(arguments=None, dimensions=None, name=BlockLocation, sub_type=None))))], member=add, postfix_operators=[], prefix_operators=[], qualifier=locations, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=blockLocations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=location)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BlockLocation, sub_type=None))), label=None)
return[call[Optional.of, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=blockId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setBlockId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=block, selectors=[], type_arguments=None)], member=setLength, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=locations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLocations, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BlockInfo, sub_type=None))]]]
end[}]
END[}]
|
annotation[@] identifier[GuardedBy] operator[SEP] literal[String] operator[SEP] Keyword[private] identifier[Optional] operator[<] identifier[BlockInfo] operator[>] identifier[generateBlockInfo] operator[SEP] Keyword[long] identifier[blockId] operator[SEP] Keyword[throws] identifier[UnavailableException] {
Keyword[if] operator[SEP] identifier[mSafeModeManager] operator[SEP] identifier[isInSafeMode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnavailableException] operator[SEP] identifier[ExceptionMessage] operator[SEP] identifier[MASTER_IN_SAFEMODE] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[BlockMeta] identifier[block] operator[SEP] identifier[List] operator[<] identifier[BlockLocation] operator[>] identifier[blockLocations] operator[SEP] Keyword[try] operator[SEP] identifier[LockResource] identifier[lr] operator[=] identifier[lockBlock] operator[SEP] identifier[blockId] operator[SEP] operator[SEP] {
identifier[Optional] operator[<] identifier[BlockMeta] operator[>] identifier[blockOpt] operator[=] identifier[mBlockStore] operator[SEP] identifier[getBlock] operator[SEP] identifier[blockId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[blockOpt] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
identifier[block] operator[=] identifier[blockOpt] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[blockLocations] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[mBlockStore] operator[SEP] identifier[getLocations] operator[SEP] identifier[blockId] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[blockLocations] , identifier[Comparator] operator[SEP] identifier[comparingInt] operator[SEP] identifier[o] operator[->] identifier[mGlobalStorageTierAssoc] operator[SEP] identifier[getOrdinal] operator[SEP] identifier[o] operator[SEP] identifier[getTier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[alluxio] operator[SEP] identifier[wire] operator[SEP] identifier[BlockLocation] operator[>] identifier[locations] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BlockLocation] identifier[location] operator[:] identifier[blockLocations] operator[SEP] {
identifier[MasterWorkerInfo] identifier[workerInfo] operator[=] identifier[mWorkers] operator[SEP] identifier[getFirstByField] operator[SEP] identifier[ID_INDEX] , identifier[location] operator[SEP] identifier[getWorkerId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[workerInfo] operator[!=] Other[null] operator[SEP] {
identifier[locations] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[alluxio] operator[SEP] identifier[wire] operator[SEP] identifier[BlockLocation] operator[SEP] operator[SEP] operator[SEP] identifier[setWorkerId] operator[SEP] identifier[location] operator[SEP] identifier[getWorkerId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setWorkerAddress] operator[SEP] identifier[workerInfo] operator[SEP] identifier[getWorkerAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setTierAlias] operator[SEP] identifier[location] operator[SEP] identifier[getTier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] Keyword[new] identifier[BlockInfo] operator[SEP] operator[SEP] operator[SEP] identifier[setBlockId] operator[SEP] identifier[blockId] operator[SEP] operator[SEP] identifier[setLength] operator[SEP] identifier[block] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setLocations] operator[SEP] identifier[locations] operator[SEP] operator[SEP] operator[SEP]
}
|
public UPnPStateVariable getStateVariable(String name) {
if (name.equals("Time"))
return time;
else if (name.equals("Result"))
return result;
else return null;
}
|
class class_name[name] begin[{]
method[getStateVariable, return_type[type[UPnPStateVariable]], modifier[public], parameter[name]] begin[{]
if[call[name.equals, parameter[literal["Time"]]]] begin[{]
return[member[.time]]
else begin[{]
if[call[name.equals, parameter[literal["Result"]]]] begin[{]
return[member[.result]]
else begin[{]
return[literal[null]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[UPnPStateVariable] identifier[getStateVariable] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[time] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] Keyword[else] Keyword[return] Other[null] operator[SEP]
}
|
public static LocalFileDataWriter create(final FileSystemContext context,
final WorkerNetAddress address,
long blockId, OutStreamOptions options) throws IOException {
AlluxioConfiguration conf = context.getClusterConf();
long chunkSize = conf.getBytes(PropertyKey.USER_LOCAL_WRITER_CHUNK_SIZE_BYTES);
Closer closer = Closer.create();
try {
final BlockWorkerClient blockWorker = context.acquireBlockWorkerClient(address);
closer.register(() -> context.releaseBlockWorkerClient(address, blockWorker));
int writerBufferSizeMessages =
conf.getInt(PropertyKey.USER_NETWORK_WRITER_BUFFER_SIZE_MESSAGES);
long fileBufferByes = conf.getBytes(PropertyKey.USER_FILE_BUFFER_BYTES);
long dataTimeout = conf.getMs(PropertyKey.USER_NETWORK_DATA_TIMEOUT_MS);
CreateLocalBlockRequest.Builder builder =
CreateLocalBlockRequest.newBuilder().setBlockId(blockId)
.setTier(options.getWriteTier()).setSpaceToReserve(fileBufferByes);
if (options.getWriteType() == WriteType.ASYNC_THROUGH
&& conf.getBoolean(PropertyKey.USER_FILE_UFS_TIER_ENABLED)) {
builder.setCleanupOnFailure(false);
}
CreateLocalBlockRequest createRequest = builder.build();
GrpcBlockingStream<CreateLocalBlockRequest, CreateLocalBlockResponse> stream =
new GrpcBlockingStream<>(blockWorker::createLocalBlock, writerBufferSizeMessages,
MoreObjects.toStringHelper(LocalFileDataWriter.class)
.add("request", createRequest)
.add("address", address)
.toString());
stream.send(createRequest, dataTimeout);
CreateLocalBlockResponse response = stream.receive(dataTimeout);
Preconditions.checkState(response != null && response.hasPath());
LocalFileBlockWriter writer =
closer.register(new LocalFileBlockWriter(response.getPath()));
return new LocalFileDataWriter(chunkSize, blockWorker,
writer, createRequest, stream, closer, fileBufferByes,
dataTimeout);
} catch (Exception e) {
throw CommonUtils.closeAndRethrow(closer, e);
}
}
|
class class_name[name] begin[{]
method[create, return_type[type[LocalFileDataWriter]], modifier[public static], parameter[context, address, blockId, options]] begin[{]
local_variable[type[AlluxioConfiguration], conf]
local_variable[type[long], chunkSize]
local_variable[type[Closer], closer]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=acquireBlockWorkerClient, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), name=blockWorker)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=BlockWorkerClient, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=blockWorker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=releaseBlockWorkerClient, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), parameters=[])], member=register, postfix_operators=[], prefix_operators=[], qualifier=closer, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=USER_NETWORK_WRITER_BUFFER_SIZE_MESSAGES, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None), name=writerBufferSizeMessages)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=USER_FILE_BUFFER_BYTES, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None), name=fileBufferByes)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=USER_NETWORK_DATA_TIMEOUT_MS, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getMs, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None), name=dataTimeout)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=CreateLocalBlockRequest, selectors=[MethodInvocation(arguments=[MemberReference(member=blockId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setBlockId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWriteTier, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None)], member=setTier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=fileBufferByes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSpaceToReserve, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockRequest, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getWriteType, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None), operandr=MemberReference(member=ASYNC_THROUGH, postfix_operators=[], prefix_operators=[], qualifier=WriteType, selectors=[]), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=USER_FILE_UFS_TIER_ENABLED, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getBoolean, postfix_operators=[], prefix_operators=[], qualifier=conf, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setCleanupOnFailure, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), name=createRequest)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockRequest, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodReference(expression=MemberReference(member=blockWorker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=createLocalBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MemberReference(member=writerBufferSizeMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalFileDataWriter, sub_type=None))], member=toStringHelper, postfix_operators=[], prefix_operators=[], qualifier=MoreObjects, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="request"), MemberReference(member=createRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="address"), MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toString, 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=[], dimensions=None, name=GrpcBlockingStream, sub_type=None)), name=stream)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockRequest, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockResponse, sub_type=None))], dimensions=[], name=GrpcBlockingStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=createRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=send, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dataTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=receive, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockResponse, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=hasPath, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operator=&&)], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalFileBlockWriter, sub_type=None))], member=register, postfix_operators=[], prefix_operators=[], qualifier=closer, selectors=[], type_arguments=None), name=writer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LocalFileBlockWriter, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=chunkSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=blockWorker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=createRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=closer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileBufferByes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataTimeout, 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=LocalFileDataWriter, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=closer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeAndRethrow, postfix_operators=[], prefix_operators=[], qualifier=CommonUtils, 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)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LocalFileDataWriter] identifier[create] operator[SEP] Keyword[final] identifier[FileSystemContext] identifier[context] , Keyword[final] identifier[WorkerNetAddress] identifier[address] , Keyword[long] identifier[blockId] , identifier[OutStreamOptions] identifier[options] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[AlluxioConfiguration] identifier[conf] operator[=] identifier[context] operator[SEP] identifier[getClusterConf] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[chunkSize] operator[=] identifier[conf] operator[SEP] identifier[getBytes] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[USER_LOCAL_WRITER_CHUNK_SIZE_BYTES] operator[SEP] operator[SEP] identifier[Closer] identifier[closer] operator[=] identifier[Closer] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[BlockWorkerClient] identifier[blockWorker] operator[=] identifier[context] operator[SEP] identifier[acquireBlockWorkerClient] operator[SEP] identifier[address] operator[SEP] operator[SEP] identifier[closer] operator[SEP] identifier[register] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[context] operator[SEP] identifier[releaseBlockWorkerClient] operator[SEP] identifier[address] , identifier[blockWorker] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[writerBufferSizeMessages] operator[=] identifier[conf] operator[SEP] identifier[getInt] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[USER_NETWORK_WRITER_BUFFER_SIZE_MESSAGES] operator[SEP] operator[SEP] Keyword[long] identifier[fileBufferByes] operator[=] identifier[conf] operator[SEP] identifier[getBytes] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[USER_FILE_BUFFER_BYTES] operator[SEP] operator[SEP] Keyword[long] identifier[dataTimeout] operator[=] identifier[conf] operator[SEP] identifier[getMs] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[USER_NETWORK_DATA_TIMEOUT_MS] operator[SEP] operator[SEP] identifier[CreateLocalBlockRequest] operator[SEP] identifier[Builder] identifier[builder] operator[=] identifier[CreateLocalBlockRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setBlockId] operator[SEP] identifier[blockId] operator[SEP] operator[SEP] identifier[setTier] operator[SEP] identifier[options] operator[SEP] identifier[getWriteTier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setSpaceToReserve] operator[SEP] identifier[fileBufferByes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[getWriteType] operator[SEP] operator[SEP] operator[==] identifier[WriteType] operator[SEP] identifier[ASYNC_THROUGH] operator[&&] identifier[conf] operator[SEP] identifier[getBoolean] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[USER_FILE_UFS_TIER_ENABLED] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[setCleanupOnFailure] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
identifier[CreateLocalBlockRequest] identifier[createRequest] operator[=] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[GrpcBlockingStream] operator[<] identifier[CreateLocalBlockRequest] , identifier[CreateLocalBlockResponse] operator[>] identifier[stream] operator[=] Keyword[new] identifier[GrpcBlockingStream] operator[<] operator[>] operator[SEP] identifier[blockWorker] operator[::] identifier[createLocalBlock] , identifier[writerBufferSizeMessages] , identifier[MoreObjects] operator[SEP] identifier[toStringHelper] operator[SEP] identifier[LocalFileDataWriter] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[createRequest] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[address] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[send] operator[SEP] identifier[createRequest] , identifier[dataTimeout] operator[SEP] operator[SEP] identifier[CreateLocalBlockResponse] identifier[response] operator[=] identifier[stream] operator[SEP] identifier[receive] operator[SEP] identifier[dataTimeout] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[response] operator[!=] Other[null] operator[&&] identifier[response] operator[SEP] identifier[hasPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LocalFileBlockWriter] identifier[writer] operator[=] identifier[closer] operator[SEP] identifier[register] operator[SEP] Keyword[new] identifier[LocalFileBlockWriter] operator[SEP] identifier[response] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LocalFileDataWriter] operator[SEP] identifier[chunkSize] , identifier[blockWorker] , identifier[writer] , identifier[createRequest] , identifier[stream] , identifier[closer] , identifier[fileBufferByes] , identifier[dataTimeout] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] identifier[CommonUtils] operator[SEP] identifier[closeAndRethrow] operator[SEP] identifier[closer] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public String getStringUtf8(final int index)
{
boundsCheck0(index, SIZE_OF_INT);
final int length = UNSAFE.getInt(byteArray, ARRAY_BASE_OFFSET + index);
return getStringUtf8(index, length);
}
|
class class_name[name] begin[{]
method[getStringUtf8, return_type[type[String]], modifier[public], parameter[index]] begin[{]
call[.boundsCheck0, parameter[member[.index], member[.SIZE_OF_INT]]]
local_variable[type[int], length]
return[call[.getStringUtf8, parameter[member[.index], member[.length]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getStringUtf8] operator[SEP] Keyword[final] Keyword[int] identifier[index] operator[SEP] {
identifier[boundsCheck0] operator[SEP] identifier[index] , identifier[SIZE_OF_INT] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[length] operator[=] identifier[UNSAFE] operator[SEP] identifier[getInt] operator[SEP] identifier[byteArray] , identifier[ARRAY_BASE_OFFSET] operator[+] identifier[index] operator[SEP] operator[SEP] Keyword[return] identifier[getStringUtf8] operator[SEP] identifier[index] , identifier[length] operator[SEP] operator[SEP]
}
|
private static <L extends Annotation> String defineLimitStatement(final SQLiteModelMethod method, final JQL result, Class<L> annotation, Map<JQLDynamicStatementType, String> dynamicReplace) {
StringBuilder builder = new StringBuilder();
int pageSize = AnnotationUtility.extractAsInt(method.getElement(), annotation, AnnotationAttributeType.PAGE_SIZE);
if (pageSize > 0) {
result.annotatedPageSize = true;
}
final One<String> pageDynamicName = new One<String>(null);
forEachParameter(method, new OnMethodParameterListener() {
@Override
public void onMethodParameter(VariableElement methodParam) {
if (methodParam.getAnnotation(BindSqlPageSize.class) != null) {
pageDynamicName.value0 = methodParam.getSimpleName().toString();
result.paramPageSize = pageDynamicName.value0;
// CONSTRAINT: @BindSqlWhereArgs can be used only on
// String[] parameter type
AssertKripton.assertTrueOrInvalidTypeForAnnotationMethodParameterException(TypeUtility.isEquals(TypeName.INT, TypeUtility.typeName(methodParam)), method.getParent().getElement(),
method.getElement(), methodParam, BindSqlPageSize.class);
}
}
});
if (pageSize > 0 || StringUtils.hasText(pageDynamicName.value0) || method.isPagedLiveData()) {
builder.append(" " + LIMIT_KEYWORD + " ");
if (pageSize > 0) {
builder.append(pageSize);
} else {
String temp0 = "#{" + JQLDynamicStatementType.DYNAMIC_PAGE_SIZE + "}";
builder.append(temp0);
dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_SIZE, temp0);
}
// define replacement string for PAGE_SIZE
String temp1 = " " + OFFSET_KEYWORD + " #{" + JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET + "}";
builder.append(temp1);
dynamicReplace.put(JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET, temp1);
}
return builder.toString();
}
|
class class_name[name] begin[{]
method[defineLimitStatement, return_type[type[String]], modifier[private static], parameter[method, result, annotation, dynamicReplace]] begin[{]
local_variable[type[StringBuilder], builder]
local_variable[type[int], pageSize]
if[binary_operation[member[.pageSize], >, literal[0]]] begin[{]
assign[member[result.annotatedPageSize], literal[true]]
else begin[{]
None
end[}]
local_variable[type[One], pageDynamicName]
call[.forEachParameter, parameter[member[.method], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BindSqlPageSize, sub_type=None))], member=getAnnotation, postfix_operators=[], prefix_operators=[], qualifier=methodParam, selectors=[], type_arguments=None), 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=value0, postfix_operators=[], prefix_operators=[], qualifier=pageDynamicName, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=methodParam, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=paramPageSize, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), type==, value=MemberReference(member=value0, postfix_operators=[], prefix_operators=[], qualifier=pageDynamicName, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=INT, postfix_operators=[], prefix_operators=[], qualifier=TypeName, selectors=[]), MethodInvocation(arguments=[MemberReference(member=methodParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=typeName, postfix_operators=[], prefix_operators=[], qualifier=TypeUtility, selectors=[], type_arguments=None)], member=isEquals, postfix_operators=[], prefix_operators=[], qualifier=TypeUtility, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[], member=getElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getElement, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), MemberReference(member=methodParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BindSqlPageSize, sub_type=None))], member=assertTrueOrInvalidTypeForAnnotationMethodParameterException, postfix_operators=[], prefix_operators=[], qualifier=AssertKripton, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=onMethodParameter, parameters=[FormalParameter(annotations=[], modifiers=set(), name=methodParam, type=ReferenceType(arguments=None, dimensions=[], name=VariableElement, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OnMethodParameterListener, sub_type=None))]]
if[binary_operation[binary_operation[binary_operation[member[.pageSize], >, literal[0]], ||, call[StringUtils.hasText, parameter[member[pageDynamicName.value0]]]], ||, call[method.isPagedLiveData, parameter[]]]] begin[{]
call[builder.append, parameter[binary_operation[binary_operation[literal[" "], +, member[.LIMIT_KEYWORD]], +, literal[" "]]]]
if[binary_operation[member[.pageSize], >, literal[0]]] begin[{]
call[builder.append, parameter[member[.pageSize]]]
else begin[{]
local_variable[type[String], temp0]
call[builder.append, parameter[member[.temp0]]]
call[dynamicReplace.put, parameter[member[JQLDynamicStatementType.DYNAMIC_PAGE_SIZE], member[.temp0]]]
end[}]
local_variable[type[String], temp1]
call[builder.append, parameter[member[.temp1]]]
call[dynamicReplace.put, parameter[member[JQLDynamicStatementType.DYNAMIC_PAGE_OFFSET], member[.temp1]]]
else begin[{]
None
end[}]
return[call[builder.toString, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] operator[<] identifier[L] Keyword[extends] identifier[Annotation] operator[>] identifier[String] identifier[defineLimitStatement] operator[SEP] Keyword[final] identifier[SQLiteModelMethod] identifier[method] , Keyword[final] identifier[JQL] identifier[result] , identifier[Class] operator[<] identifier[L] operator[>] identifier[annotation] , identifier[Map] operator[<] identifier[JQLDynamicStatementType] , identifier[String] operator[>] identifier[dynamicReplace] operator[SEP] {
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[pageSize] operator[=] identifier[AnnotationUtility] operator[SEP] identifier[extractAsInt] operator[SEP] identifier[method] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] , identifier[annotation] , identifier[AnnotationAttributeType] operator[SEP] identifier[PAGE_SIZE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pageSize] operator[>] Other[0] operator[SEP] {
identifier[result] operator[SEP] identifier[annotatedPageSize] operator[=] literal[boolean] operator[SEP]
}
Keyword[final] identifier[One] operator[<] identifier[String] operator[>] identifier[pageDynamicName] operator[=] Keyword[new] identifier[One] operator[<] identifier[String] operator[>] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[forEachParameter] operator[SEP] identifier[method] , Keyword[new] identifier[OnMethodParameterListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onMethodParameter] operator[SEP] identifier[VariableElement] identifier[methodParam] operator[SEP] {
Keyword[if] operator[SEP] identifier[methodParam] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[BindSqlPageSize] operator[SEP] Keyword[class] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[pageDynamicName] operator[SEP] identifier[value0] operator[=] identifier[methodParam] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[paramPageSize] operator[=] identifier[pageDynamicName] operator[SEP] identifier[value0] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[assertTrueOrInvalidTypeForAnnotationMethodParameterException] operator[SEP] identifier[TypeUtility] operator[SEP] identifier[isEquals] operator[SEP] identifier[TypeName] operator[SEP] identifier[INT] , identifier[TypeUtility] operator[SEP] identifier[typeName] operator[SEP] identifier[methodParam] operator[SEP] operator[SEP] , identifier[method] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] , identifier[method] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] , identifier[methodParam] , identifier[BindSqlPageSize] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pageSize] operator[>] Other[0] operator[||] identifier[StringUtils] operator[SEP] identifier[hasText] operator[SEP] identifier[pageDynamicName] operator[SEP] identifier[value0] operator[SEP] operator[||] identifier[method] operator[SEP] identifier[isPagedLiveData] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[LIMIT_KEYWORD] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pageSize] operator[>] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[pageSize] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[temp0] operator[=] literal[String] operator[+] identifier[JQLDynamicStatementType] operator[SEP] identifier[DYNAMIC_PAGE_SIZE] operator[+] literal[String] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[temp0] operator[SEP] operator[SEP] identifier[dynamicReplace] operator[SEP] identifier[put] operator[SEP] identifier[JQLDynamicStatementType] operator[SEP] identifier[DYNAMIC_PAGE_SIZE] , identifier[temp0] operator[SEP] operator[SEP]
}
identifier[String] identifier[temp1] operator[=] literal[String] operator[+] identifier[OFFSET_KEYWORD] operator[+] literal[String] operator[+] identifier[JQLDynamicStatementType] operator[SEP] identifier[DYNAMIC_PAGE_OFFSET] operator[+] literal[String] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[temp1] operator[SEP] operator[SEP] identifier[dynamicReplace] operator[SEP] identifier[put] operator[SEP] identifier[JQLDynamicStatementType] operator[SEP] identifier[DYNAMIC_PAGE_OFFSET] , identifier[temp1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
protected org.bouncycastle.crypto.CipherParameters getBcCipherParameter(AsymmetricCipherParameters parameters)
{
if (parameters instanceof BcAsymmetricKeyParameters) {
return ((BcAsymmetricKeyParameters) parameters).getParameters();
}
// TODO: convert parameters to compatible ones
throw new UnsupportedOperationException("Cipher parameters are incompatible with this signer: "
+ parameters.getClass().getName());
}
|
class class_name[name] begin[{]
method[getBcCipherParameter, return_type[type[org]], modifier[protected], parameter[parameters]] begin[{]
if[binary_operation[member[.parameters], instanceof, type[BcAsymmetricKeyParameters]]] begin[{]
return[Cast(expression=MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BcAsymmetricKeyParameters, sub_type=None))]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cipher parameters are incompatible with this signer: "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=parameters, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[protected] identifier[org] operator[SEP] identifier[bouncycastle] operator[SEP] identifier[crypto] operator[SEP] identifier[CipherParameters] identifier[getBcCipherParameter] operator[SEP] identifier[AsymmetricCipherParameters] identifier[parameters] operator[SEP] {
Keyword[if] operator[SEP] identifier[parameters] Keyword[instanceof] identifier[BcAsymmetricKeyParameters] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[BcAsymmetricKeyParameters] operator[SEP] identifier[parameters] operator[SEP] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] identifier[parameters] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String toMapString(Map self, int maxSize) {
return (self == null) ? "null" : InvokerHelper.toMapString(self, maxSize);
}
|
class class_name[name] begin[{]
method[toMapString, return_type[type[String]], modifier[public static], parameter[self, maxSize]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=self, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=self, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toMapString, postfix_operators=[], prefix_operators=[], qualifier=InvokerHelper, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="null"))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[toMapString] operator[SEP] identifier[Map] identifier[self] , Keyword[int] identifier[maxSize] operator[SEP] {
Keyword[return] operator[SEP] identifier[self] operator[==] Other[null] operator[SEP] operator[?] literal[String] operator[:] identifier[InvokerHelper] operator[SEP] identifier[toMapString] operator[SEP] identifier[self] , identifier[maxSize] operator[SEP] operator[SEP]
}
|
private void checkLoopback() {
Integer current = readLockCount.get();
if (current != null) {
assert current.intValue() > 0 : "readLockCount is set, but to 0";
throw EjbLogger.ROOT_LOGGER.failToUpgradeToWriteLock();
}
}
|
class class_name[name] begin[{]
method[checkLoopback, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[Integer], current]
if[binary_operation[member[.current], !=, literal[null]]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=intValue, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), label=None, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="readLockCount is set, but to 0"))
ThrowStatement(expression=MethodInvocation(arguments=[], member=failToUpgradeToWriteLock, postfix_operators=[], prefix_operators=[], qualifier=EjbLogger.ROOT_LOGGER, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[checkLoopback] operator[SEP] operator[SEP] {
identifier[Integer] identifier[current] operator[=] identifier[readLockCount] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[current] operator[!=] Other[null] operator[SEP] {
Keyword[assert] identifier[current] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[>] Other[0] operator[:] literal[String] operator[SEP] Keyword[throw] identifier[EjbLogger] operator[SEP] identifier[ROOT_LOGGER] operator[SEP] identifier[failToUpgradeToWriteLock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void shiftRightArray8(int[] values, int rightShifts, Slice result)
{
if (values.length != NUMBER_OF_INTS * 2) {
throw new IllegalArgumentException("Incorrect values length");
}
if (rightShifts == 0) {
for (int i = NUMBER_OF_INTS; i < 2 * NUMBER_OF_INTS; i++) {
if (values[i] != 0) {
throwOverflowException();
}
}
for (int i = 0; i < NUMBER_OF_INTS; i++) {
setRawInt(result, i, values[i]);
}
return;
}
int wordShifts = rightShifts / 32;
int bitShiftsInWord = rightShifts % 32;
int shiftRestore = 32 - bitShiftsInWord;
// check round-ups before settings values to result.
// be aware that result could be the same object as decimal.
boolean roundCarry;
if (bitShiftsInWord == 0) {
roundCarry = values[wordShifts - 1] < 0;
}
else {
roundCarry = (values[wordShifts] & (1 << (bitShiftsInWord - 1))) != 0;
}
int r0 = values[0 + wordShifts];
int r1 = values[1 + wordShifts];
int r2 = values[2 + wordShifts];
int r3 = values[3 + wordShifts];
int r4 = wordShifts >= 4 ? 0 : values[4 + wordShifts];
int r5 = wordShifts >= 3 ? 0 : values[5 + wordShifts];
int r6 = wordShifts >= 2 ? 0 : values[6 + wordShifts];
int r7 = wordShifts >= 1 ? 0 : values[7 + wordShifts];
if (bitShiftsInWord > 0) {
r0 = (r0 >>> bitShiftsInWord) | (r1 << shiftRestore);
r1 = (r1 >>> bitShiftsInWord) | (r2 << shiftRestore);
r2 = (r2 >>> bitShiftsInWord) | (r3 << shiftRestore);
r3 = (r3 >>> bitShiftsInWord) | (r4 << shiftRestore);
}
if ((r4 >>> bitShiftsInWord) != 0 || r5 != 0 || r6 != 0 || r7 != 0) {
throwOverflowException();
}
if (r3 < 0) {
throwOverflowException();
}
// increment
if (roundCarry) {
r0++;
if (r0 == 0) {
r1++;
if (r1 == 0) {
r2++;
if (r2 == 0) {
r3++;
if (r3 < 0) {
throwOverflowException();
}
}
}
}
}
pack(result, r0, r1, r2, r3, false);
}
|
class class_name[name] begin[{]
method[shiftRightArray8, return_type[void], modifier[public static], parameter[values, rightShifts, result]] begin[{]
if[binary_operation[member[values.length], !=, binary_operation[member[.NUMBER_OF_INTS], *, literal[2]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Incorrect values length")], 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[.rightShifts], ==, literal[0]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=throwOverflowException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=MemberReference(member=NUMBER_OF_INTS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=NUMBER_OF_INTS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=setRawInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NUMBER_OF_INTS, 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[None]
else begin[{]
None
end[}]
local_variable[type[int], wordShifts]
local_variable[type[int], bitShiftsInWord]
local_variable[type[int], shiftRestore]
local_variable[type[boolean], roundCarry]
if[binary_operation[member[.bitShiftsInWord], ==, literal[0]]] begin[{]
assign[member[.roundCarry], binary_operation[member[.values], <, literal[0]]]
else begin[{]
assign[member[.roundCarry], binary_operation[binary_operation[member[.values], &, binary_operation[literal[1], <<, binary_operation[member[.bitShiftsInWord], -, literal[1]]]], !=, literal[0]]]
end[}]
local_variable[type[int], r0]
local_variable[type[int], r1]
local_variable[type[int], r2]
local_variable[type[int], r3]
local_variable[type[int], r4]
local_variable[type[int], r5]
local_variable[type[int], r6]
local_variable[type[int], r7]
if[binary_operation[member[.bitShiftsInWord], >, literal[0]]] begin[{]
assign[member[.r0], binary_operation[binary_operation[member[.r0], >>>, member[.bitShiftsInWord]], |, binary_operation[member[.r1], <<, member[.shiftRestore]]]]
assign[member[.r1], binary_operation[binary_operation[member[.r1], >>>, member[.bitShiftsInWord]], |, binary_operation[member[.r2], <<, member[.shiftRestore]]]]
assign[member[.r2], binary_operation[binary_operation[member[.r2], >>>, member[.bitShiftsInWord]], |, binary_operation[member[.r3], <<, member[.shiftRestore]]]]
assign[member[.r3], binary_operation[binary_operation[member[.r3], >>>, member[.bitShiftsInWord]], |, binary_operation[member[.r4], <<, member[.shiftRestore]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.r4], >>>, member[.bitShiftsInWord]], !=, literal[0]], ||, binary_operation[member[.r5], !=, literal[0]]], ||, binary_operation[member[.r6], !=, literal[0]]], ||, binary_operation[member[.r7], !=, literal[0]]]] begin[{]
call[.throwOverflowException, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.r3], <, literal[0]]] begin[{]
call[.throwOverflowException, parameter[]]
else begin[{]
None
end[}]
if[member[.roundCarry]] begin[{]
member[.r0]
if[binary_operation[member[.r0], ==, literal[0]]] begin[{]
member[.r1]
if[binary_operation[member[.r1], ==, literal[0]]] begin[{]
member[.r2]
if[binary_operation[member[.r2], ==, literal[0]]] begin[{]
member[.r3]
if[binary_operation[member[.r3], <, literal[0]]] begin[{]
call[.throwOverflowException, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[.pack, parameter[member[.result], member[.r0], member[.r1], member[.r2], member[.r3], literal[false]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[shiftRightArray8] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[values] , Keyword[int] identifier[rightShifts] , identifier[Slice] identifier[result] operator[SEP] {
Keyword[if] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[!=] identifier[NUMBER_OF_INTS] operator[*] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rightShifts] operator[==] Other[0] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[NUMBER_OF_INTS] operator[SEP] identifier[i] operator[<] Other[2] operator[*] identifier[NUMBER_OF_INTS] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[throwOverflowException] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[NUMBER_OF_INTS] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[setRawInt] operator[SEP] identifier[result] , identifier[i] , identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[int] identifier[wordShifts] operator[=] identifier[rightShifts] operator[/] Other[32] operator[SEP] Keyword[int] identifier[bitShiftsInWord] operator[=] identifier[rightShifts] operator[%] Other[32] operator[SEP] Keyword[int] identifier[shiftRestore] operator[=] Other[32] operator[-] identifier[bitShiftsInWord] operator[SEP] Keyword[boolean] identifier[roundCarry] operator[SEP] Keyword[if] operator[SEP] identifier[bitShiftsInWord] operator[==] Other[0] operator[SEP] {
identifier[roundCarry] operator[=] identifier[values] operator[SEP] identifier[wordShifts] operator[-] Other[1] operator[SEP] operator[<] Other[0] operator[SEP]
}
Keyword[else] {
identifier[roundCarry] operator[=] operator[SEP] identifier[values] operator[SEP] identifier[wordShifts] operator[SEP] operator[&] operator[SEP] Other[1] operator[<<] operator[SEP] identifier[bitShiftsInWord] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP]
}
Keyword[int] identifier[r0] operator[=] identifier[values] operator[SEP] Other[0] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r1] operator[=] identifier[values] operator[SEP] Other[1] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r2] operator[=] identifier[values] operator[SEP] Other[2] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r3] operator[=] identifier[values] operator[SEP] Other[3] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r4] operator[=] identifier[wordShifts] operator[>=] Other[4] operator[?] Other[0] operator[:] identifier[values] operator[SEP] Other[4] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r5] operator[=] identifier[wordShifts] operator[>=] Other[3] operator[?] Other[0] operator[:] identifier[values] operator[SEP] Other[5] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r6] operator[=] identifier[wordShifts] operator[>=] Other[2] operator[?] Other[0] operator[:] identifier[values] operator[SEP] Other[6] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[int] identifier[r7] operator[=] identifier[wordShifts] operator[>=] Other[1] operator[?] Other[0] operator[:] identifier[values] operator[SEP] Other[7] operator[+] identifier[wordShifts] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bitShiftsInWord] operator[>] Other[0] operator[SEP] {
identifier[r0] operator[=] operator[SEP] identifier[r0] operator[>] operator[>] operator[>] identifier[bitShiftsInWord] operator[SEP] operator[|] operator[SEP] identifier[r1] operator[<<] identifier[shiftRestore] operator[SEP] operator[SEP] identifier[r1] operator[=] operator[SEP] identifier[r1] operator[>] operator[>] operator[>] identifier[bitShiftsInWord] operator[SEP] operator[|] operator[SEP] identifier[r2] operator[<<] identifier[shiftRestore] operator[SEP] operator[SEP] identifier[r2] operator[=] operator[SEP] identifier[r2] operator[>] operator[>] operator[>] identifier[bitShiftsInWord] operator[SEP] operator[|] operator[SEP] identifier[r3] operator[<<] identifier[shiftRestore] operator[SEP] operator[SEP] identifier[r3] operator[=] operator[SEP] identifier[r3] operator[>] operator[>] operator[>] identifier[bitShiftsInWord] operator[SEP] operator[|] operator[SEP] identifier[r4] operator[<<] identifier[shiftRestore] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[r4] operator[>] operator[>] operator[>] identifier[bitShiftsInWord] operator[SEP] operator[!=] Other[0] operator[||] identifier[r5] operator[!=] Other[0] operator[||] identifier[r6] operator[!=] Other[0] operator[||] identifier[r7] operator[!=] Other[0] operator[SEP] {
identifier[throwOverflowException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[r3] operator[<] Other[0] operator[SEP] {
identifier[throwOverflowException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[roundCarry] operator[SEP] {
identifier[r0] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[r0] operator[==] Other[0] operator[SEP] {
identifier[r1] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[r1] operator[==] Other[0] operator[SEP] {
identifier[r2] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[r2] operator[==] Other[0] operator[SEP] {
identifier[r3] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[r3] operator[<] Other[0] operator[SEP] {
identifier[throwOverflowException] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
identifier[pack] operator[SEP] identifier[result] , identifier[r0] , identifier[r1] , identifier[r2] , identifier[r3] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public int write(ByteBuffer src) {
int toTransfer = Math.min(src.remaining(), data.length - offset);
src.get(data, offset, toTransfer);
offset += toTransfer;
return toTransfer;
}
|
class class_name[name] begin[{]
method[write, return_type[type[int]], modifier[public], parameter[src]] begin[{]
local_variable[type[int], toTransfer]
call[src.get, parameter[member[.data], member[.offset], member[.toTransfer]]]
assign[member[.offset], member[.toTransfer]]
return[member[.toTransfer]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[write] operator[SEP] identifier[ByteBuffer] identifier[src] operator[SEP] {
Keyword[int] identifier[toTransfer] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[src] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] , identifier[data] operator[SEP] identifier[length] operator[-] identifier[offset] operator[SEP] operator[SEP] identifier[src] operator[SEP] identifier[get] operator[SEP] identifier[data] , identifier[offset] , identifier[toTransfer] operator[SEP] operator[SEP] identifier[offset] operator[+=] identifier[toTransfer] operator[SEP] Keyword[return] identifier[toTransfer] operator[SEP]
}
|
@GET @Path("/{name}")
public ReplyObject getDashboard(@PathParam("name")String name){
try{
ReplyObject ret = ReplyObject.success();
DashboardAO dashboard = getDashboardAPI().getDashboard(name);
ret.addResult("dashboard", dashboard);
return ret;
}catch(APIException e){
return ReplyObject.error(e.getMessage());
}
}
|
class class_name[name] begin[{]
method[getDashboard, return_type[type[ReplyObject]], modifier[public], parameter[name]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=success, postfix_operators=[], prefix_operators=[], qualifier=ReplyObject, selectors=[], type_arguments=None), name=ret)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ReplyObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDashboardAPI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDashboard, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=dashboard)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DashboardAO, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dashboard"), MemberReference(member=dashboard, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addResult, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=ReplyObject, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['APIException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[GET] annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[ReplyObject] identifier[getDashboard] operator[SEP] annotation[@] identifier[PathParam] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[try] {
identifier[ReplyObject] identifier[ret] operator[=] identifier[ReplyObject] operator[SEP] identifier[success] operator[SEP] operator[SEP] operator[SEP] identifier[DashboardAO] identifier[dashboard] operator[=] identifier[getDashboardAPI] operator[SEP] operator[SEP] operator[SEP] identifier[getDashboard] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[addResult] operator[SEP] literal[String] , identifier[dashboard] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[APIException] identifier[e] operator[SEP] {
Keyword[return] identifier[ReplyObject] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.err.println("Usage: java opennlp.tools.english.TreebankChunker model < tokenized_sentences");
System.exit(1);
}
TreebankChunker chunker = new TreebankChunker(args[0]);
java.io.BufferedReader inReader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
for (String line = inReader.readLine(); line != null; line = inReader.readLine()) {
if (line.equals("")) {
System.out.println();
}
else {
String[] tts = line.split(" ");
String[] tokens = new String[tts.length];
String[] tags = new String[tts.length];
for (int ti=0,tn=tts.length;ti<tn;ti++) {
String[] tt = tts[ti].split("/");
tokens[ti]=tt[0];
tags[ti]=tt[1];
}
String[] chunks = chunker.chunk(tokens,tags);
//System.err.println(java.util.Arrays.asList(chunks));
for (int ci=0,cn=chunks.length;ci<cn;ci++) {
if (ci > 0 && !chunks[ci].startsWith("I-") && !chunks[ci-1].equals("O")) {
System.out.print(" ]");
}
if (chunks[ci].startsWith("B-")) {
System.out.print(" ["+chunks[ci].substring(2));
}
/*
else {
System.out.print(" ");
}
*/
System.out.print(" "+tokens[ci]+"/"+tags[ci]);
}
if (!chunks[chunks.length-1].equals("O")) {
System.out.print(" ]");
}
System.out.println();
}
}
}
|
class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[binary_operation[member[args.length], ==, literal[0]]] begin[{]
call[System.err.println, parameter[literal["Usage: java opennlp.tools.english.TreebankChunker model < tokenized_sentences"]]]
call[System.exit, parameter[literal[1]]]
else begin[{]
None
end[}]
local_variable[type[TreebankChunker], chunker]
local_variable[type[java], inReader]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=split, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=tts)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tts, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), name=tokens)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tts, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), name=tags)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=tts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ti, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=split, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=tt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=tokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ti, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=tt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ti, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=tt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ti, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=tn, 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=ti), VariableDeclarator(dimensions=[], initializer=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tts, selectors=[]), name=tn)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ti, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=chunk, postfix_operators=[], prefix_operators=[], qualifier=chunker, selectors=[], type_arguments=None), name=chunks)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MemberReference(member=chunks, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="I-")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), operandr=MemberReference(member=chunks, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="O")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ]")], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MemberReference(member=chunks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="B-")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ["), operandr=MemberReference(member=chunks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+)], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operandr=MemberReference(member=tokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+)], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ci, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cn, 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=ci), VariableDeclarator(dimensions=[], initializer=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=chunks, selectors=[]), name=cn)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ci, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), IfStatement(condition=MemberReference(member=chunks, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=chunks, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="O")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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=" ]")], member=print, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=inReader, selectors=[], type_arguments=None), name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=inReader, selectors=[], type_arguments=None))]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
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] Other[1] operator[SEP] operator[SEP]
}
identifier[TreebankChunker] identifier[chunker] operator[=] Keyword[new] identifier[TreebankChunker] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[BufferedReader] identifier[inReader] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[InputStreamReader] operator[SEP] identifier[System] operator[SEP] identifier[in] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[line] operator[=] identifier[inReader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] identifier[line] operator[!=] Other[null] operator[SEP] identifier[line] operator[=] identifier[inReader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] operator[SEP] operator[SEP] identifier[tts] operator[=] identifier[line] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[tokens] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[tts] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[tags] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[tts] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ti] operator[=] Other[0] , identifier[tn] operator[=] identifier[tts] operator[SEP] identifier[length] operator[SEP] identifier[ti] operator[<] identifier[tn] operator[SEP] identifier[ti] operator[++] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[tt] operator[=] identifier[tts] operator[SEP] identifier[ti] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokens] operator[SEP] identifier[ti] operator[SEP] operator[=] identifier[tt] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[tags] operator[SEP] identifier[ti] operator[SEP] operator[=] identifier[tt] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[chunks] operator[=] identifier[chunker] operator[SEP] identifier[chunk] operator[SEP] identifier[tokens] , identifier[tags] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ci] operator[=] Other[0] , identifier[cn] operator[=] identifier[chunks] operator[SEP] identifier[length] operator[SEP] identifier[ci] operator[<] identifier[cn] operator[SEP] identifier[ci] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[ci] operator[>] Other[0] operator[&&] operator[!] identifier[chunks] operator[SEP] identifier[ci] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[chunks] operator[SEP] identifier[ci] operator[-] Other[1] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[chunks] operator[SEP] identifier[ci] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[+] identifier[chunks] operator[SEP] identifier[ci] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[+] identifier[tokens] operator[SEP] identifier[ci] operator[SEP] operator[+] literal[String] operator[+] identifier[tags] operator[SEP] identifier[ci] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[chunks] operator[SEP] identifier[chunks] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void registerNativeFunctionHandler(String url,
HandlerDefinition handlerDefinition,
Class<? extends AbstractNativeFunctionHandler> handlerClassType)
throws SecurityException, NoSuchMethodException {
NativeFunction atmosFunction = (NativeFunction) handlerDefinition
.getHandler();
Object atmosHandler = getHandler(atmosFunction, handlerClassType);
Class<?> handlerType = (atmosHandler instanceof String) ? getApplicationContext()
.getType((String) atmosHandler) : atmosHandler.getClass();
if (atmosHandler instanceof NativeFunctionModelAndViewHandler) {
((NativeFunctionModelAndViewHandler) atmosHandler)
.setViewName(handlerMappingInfoStorage.getViewName(url));
}
final Class<?> userType = ClassUtils.getUserClass(handlerType);
Method method = userType.getMethod(
AbstractNativeFunctionHandler.HANDLER_METHOD_NAME,
HttpServletRequest.class, HttpServletResponse.class);
RequestMethodsRequestCondition requestMethodsRequestCondition = getRequestMethodsRequestCondition(handlerDefinition
.getHttpMethods());
RequestMappingInfo mapping = new RequestMappingInfo(
new PatternsRequestCondition(url),
requestMethodsRequestCondition, null, null, null,
/* new ProducesRequestCondition("application/xml") */null, null);
registerHandlerMethod(atmosHandler, method, mapping);
}
|
class class_name[name] begin[{]
method[registerNativeFunctionHandler, return_type[void], modifier[private], parameter[url, handlerDefinition, handlerClassType]] begin[{]
local_variable[type[NativeFunction], atmosFunction]
local_variable[type[Object], atmosHandler]
local_variable[type[Class], handlerType]
if[binary_operation[member[.atmosHandler], instanceof, type[NativeFunctionModelAndViewHandler]]] begin[{]
Cast(expression=MemberReference(member=atmosHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=NativeFunctionModelAndViewHandler, sub_type=None))
else begin[{]
None
end[}]
local_variable[type[Class], userType]
local_variable[type[Method], method]
local_variable[type[RequestMethodsRequestCondition], requestMethodsRequestCondition]
local_variable[type[RequestMappingInfo], mapping]
call[.registerHandlerMethod, parameter[member[.atmosHandler], member[.method], member[.mapping]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[registerNativeFunctionHandler] operator[SEP] identifier[String] identifier[url] , identifier[HandlerDefinition] identifier[handlerDefinition] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[AbstractNativeFunctionHandler] operator[>] identifier[handlerClassType] operator[SEP] Keyword[throws] identifier[SecurityException] , identifier[NoSuchMethodException] {
identifier[NativeFunction] identifier[atmosFunction] operator[=] operator[SEP] identifier[NativeFunction] operator[SEP] identifier[handlerDefinition] operator[SEP] identifier[getHandler] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[atmosHandler] operator[=] identifier[getHandler] operator[SEP] identifier[atmosFunction] , identifier[handlerClassType] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[handlerType] operator[=] operator[SEP] identifier[atmosHandler] Keyword[instanceof] identifier[String] operator[SEP] operator[?] identifier[getApplicationContext] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[atmosHandler] operator[SEP] operator[:] identifier[atmosHandler] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[atmosHandler] Keyword[instanceof] identifier[NativeFunctionModelAndViewHandler] operator[SEP] {
operator[SEP] operator[SEP] identifier[NativeFunctionModelAndViewHandler] operator[SEP] identifier[atmosHandler] operator[SEP] operator[SEP] identifier[setViewName] operator[SEP] identifier[handlerMappingInfoStorage] operator[SEP] identifier[getViewName] operator[SEP] identifier[url] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[userType] operator[=] identifier[ClassUtils] operator[SEP] identifier[getUserClass] operator[SEP] identifier[handlerType] operator[SEP] operator[SEP] identifier[Method] identifier[method] operator[=] identifier[userType] operator[SEP] identifier[getMethod] operator[SEP] identifier[AbstractNativeFunctionHandler] operator[SEP] identifier[HANDLER_METHOD_NAME] , identifier[HttpServletRequest] operator[SEP] Keyword[class] , identifier[HttpServletResponse] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[RequestMethodsRequestCondition] identifier[requestMethodsRequestCondition] operator[=] identifier[getRequestMethodsRequestCondition] operator[SEP] identifier[handlerDefinition] operator[SEP] identifier[getHttpMethods] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[RequestMappingInfo] identifier[mapping] operator[=] Keyword[new] identifier[RequestMappingInfo] operator[SEP] Keyword[new] identifier[PatternsRequestCondition] operator[SEP] identifier[url] operator[SEP] , identifier[requestMethodsRequestCondition] , Other[null] , Other[null] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[registerHandlerMethod] operator[SEP] identifier[atmosHandler] , identifier[method] , identifier[mapping] operator[SEP] operator[SEP]
}
|
public static List getChildTextList(Element elem, String childTagName)
{
NodeList nodeList = elem.getElementsByTagName(childTagName);
int len = nodeList.getLength();
if (len == 0)
{
return Collections.EMPTY_LIST;
}
List list = new ArrayList(len);
for (int i = 0; i < len; i++)
{
list.add(getElementText((Element)nodeList.item(i)));
}
return list;
}
|
class class_name[name] begin[{]
method[getChildTextList, return_type[type[List]], modifier[public static], parameter[elem, childTagName]] begin[{]
local_variable[type[NodeList], nodeList]
local_variable[type[int], len]
if[binary_operation[member[.len], ==, literal[0]]] begin[{]
return[member[Collections.EMPTY_LIST]]
else begin[{]
None
end[}]
local_variable[type[List], list]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=item, postfix_operators=[], prefix_operators=[], qualifier=nodeList, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))], member=getElementText, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.list]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] identifier[getChildTextList] operator[SEP] identifier[Element] identifier[elem] , identifier[String] identifier[childTagName] operator[SEP] {
identifier[NodeList] identifier[nodeList] operator[=] identifier[elem] operator[SEP] identifier[getElementsByTagName] operator[SEP] identifier[childTagName] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[nodeList] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[EMPTY_LIST] operator[SEP]
}
identifier[List] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[getElementText] operator[SEP] operator[SEP] identifier[Element] operator[SEP] identifier[nodeList] operator[SEP] identifier[item] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
protected void processOneMetric(List<String> resultStrings, Server server, Result result, Object value, String addTagName,
String addTagValue) {
String metricName = this.metricNameStrategy.formatName(result);
//
// Skip any non-numeric values since OpenTSDB only supports numeric metrics.
//
if (isNumeric(value)) {
StringBuilder resultString = new StringBuilder();
formatResultString(resultString, metricName, result.getEpoch() / 1000L, value);
addTags(resultString, server);
if (addTagName != null) {
addTag(resultString, addTagName, addTagValue);
}
if (!typeNames.isEmpty()) {
this.addTypeNamesTags(resultString, result);
}
resultStrings.add(resultString.toString());
} else {
log.debug("Skipping non-numeric value for metric {}; value={}", metricName, value);
}
}
|
class class_name[name] begin[{]
method[processOneMetric, return_type[void], modifier[protected], parameter[resultStrings, server, result, value, addTagName, addTagValue]] begin[{]
local_variable[type[String], metricName]
if[call[.isNumeric, parameter[member[.value]]]] begin[{]
local_variable[type[StringBuilder], resultString]
call[.formatResultString, parameter[member[.resultString], member[.metricName], binary_operation[call[result.getEpoch, parameter[]], /, literal[1000L]], member[.value]]]
call[.addTags, parameter[member[.resultString], member[.server]]]
if[binary_operation[member[.addTagName], !=, literal[null]]] begin[{]
call[.addTag, parameter[member[.resultString], member[.addTagName], member[.addTagValue]]]
else begin[{]
None
end[}]
if[call[typeNames.isEmpty, parameter[]]] begin[{]
THIS[call[None.addTypeNamesTags, parameter[member[.resultString], member[.result]]]]
else begin[{]
None
end[}]
call[resultStrings.add, parameter[call[resultString.toString, parameter[]]]]
else begin[{]
call[log.debug, parameter[literal["Skipping non-numeric value for metric {}; value={}"], member[.metricName], member[.value]]]
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[processOneMetric] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[resultStrings] , identifier[Server] identifier[server] , identifier[Result] identifier[result] , identifier[Object] identifier[value] , identifier[String] identifier[addTagName] , identifier[String] identifier[addTagValue] operator[SEP] {
identifier[String] identifier[metricName] operator[=] Keyword[this] operator[SEP] identifier[metricNameStrategy] operator[SEP] identifier[formatName] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isNumeric] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[resultString] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[formatResultString] operator[SEP] identifier[resultString] , identifier[metricName] , identifier[result] operator[SEP] identifier[getEpoch] operator[SEP] operator[SEP] operator[/] Other[1000L] , identifier[value] operator[SEP] operator[SEP] identifier[addTags] operator[SEP] identifier[resultString] , identifier[server] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[addTagName] operator[!=] Other[null] operator[SEP] {
identifier[addTag] operator[SEP] identifier[resultString] , identifier[addTagName] , identifier[addTagValue] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[typeNames] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[addTypeNamesTags] operator[SEP] identifier[resultString] , identifier[result] operator[SEP] operator[SEP]
}
identifier[resultStrings] operator[SEP] identifier[add] operator[SEP] identifier[resultString] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[metricName] , identifier[value] operator[SEP] operator[SEP]
}
}
|
static String encode(List<String> eventIds) {
checkArgument(!eventIds.isEmpty(), "Empty event ID list.");
if (eventIds.size() == 1) {
return checkValid(eventIds.get(0));
}
// Concatenate the event IDs using a simple scheme that efficiently encodes events that are the same length and
// share a common prefix.
StringBuilder buf = new StringBuilder();
String prevId = null;
for (String eventId : eventIds) {
checkValid(eventId);
int commonPrefixLength;
if (prevId == null) {
// First event ID
buf.append(eventId);
} else if (prevId.length() == eventId.length() &&
(commonPrefixLength = getCommonPrefixLength(prevId, eventId)) > 0) {
// Event ID is same length and shares a common prefix with the previous. Just add the part that's different.
buf.append(DELIM_SHARED_PREFIX).append(eventId.substring(commonPrefixLength));
} else {
buf.append(DELIM_REGULAR).append(eventId);
}
prevId = eventId;
}
return buf.toString();
}
|
class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[static], parameter[eventIds]] begin[{]
call[.checkArgument, parameter[call[eventIds.isEmpty, parameter[]], literal["Empty event ID list."]]]
if[binary_operation[call[eventIds.size, parameter[]], ==, literal[1]]] begin[{]
return[call[.checkValid, parameter[call[eventIds.get, parameter[literal[0]]]]]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], buf]
local_variable[type[String], prevId]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=eventId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkValid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=commonPrefixLength)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=prevId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=prevId, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=eventId, selectors=[], type_arguments=None), operator===), operandr=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=commonPrefixLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=prevId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=eventId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCommonPrefixLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DELIM_REGULAR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[MethodInvocation(arguments=[MemberReference(member=eventId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DELIM_SHARED_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=commonPrefixLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=eventId, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=eventId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=prevId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=eventId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=eventIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=eventId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[buf.toString, parameter[]]]
end[}]
END[}]
|
Keyword[static] identifier[String] identifier[encode] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[eventIds] operator[SEP] {
identifier[checkArgument] operator[SEP] operator[!] identifier[eventIds] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eventIds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[checkValid] operator[SEP] identifier[eventIds] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[prevId] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[eventId] operator[:] identifier[eventIds] operator[SEP] {
identifier[checkValid] operator[SEP] identifier[eventId] operator[SEP] operator[SEP] Keyword[int] identifier[commonPrefixLength] operator[SEP] Keyword[if] operator[SEP] identifier[prevId] operator[==] Other[null] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[eventId] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[prevId] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] identifier[eventId] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[commonPrefixLength] operator[=] identifier[getCommonPrefixLength] operator[SEP] identifier[prevId] , identifier[eventId] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[DELIM_SHARED_PREFIX] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[eventId] operator[SEP] identifier[substring] operator[SEP] identifier[commonPrefixLength] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[DELIM_REGULAR] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[eventId] operator[SEP] operator[SEP]
}
identifier[prevId] operator[=] identifier[eventId] operator[SEP]
}
Keyword[return] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static double Canberra(double[] p, double[] q) {
double distance = 0;
for (int i = 0; i < p.length; i++) {
distance += Math.abs(p[i] - q[i]) / (Math.abs(p[i]) + Math.abs(q[i]));
}
return distance;
}
|
class class_name[name] begin[{]
method[Canberra, return_type[type[double]], modifier[public static], parameter[p, q]] begin[{]
local_variable[type[double], distance]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operator=+), operator=/)), 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=p, 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[.distance]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] identifier[Canberra] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[p] , Keyword[double] operator[SEP] operator[SEP] identifier[q] operator[SEP] {
Keyword[double] identifier[distance] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[p] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[distance] operator[+=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[p] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[q] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[/] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[p] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[+] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[q] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[distance] operator[SEP]
}
|
public void addLink( final String path, final String target, int permissions, String username, String groupname) throws NoSuchAlgorithmException, IOException {
contents.addLink( path, target, permissions, username, groupname);
}
|
class class_name[name] begin[{]
method[addLink, return_type[void], modifier[public], parameter[path, target, permissions, username, groupname]] begin[{]
call[contents.addLink, parameter[member[.path], member[.target], member[.permissions], member[.username], member[.groupname]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addLink] operator[SEP] Keyword[final] identifier[String] identifier[path] , Keyword[final] identifier[String] identifier[target] , Keyword[int] identifier[permissions] , identifier[String] identifier[username] , identifier[String] identifier[groupname] operator[SEP] Keyword[throws] identifier[NoSuchAlgorithmException] , identifier[IOException] {
identifier[contents] operator[SEP] identifier[addLink] operator[SEP] identifier[path] , identifier[target] , identifier[permissions] , identifier[username] , identifier[groupname] operator[SEP] operator[SEP]
}
|
public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
.getFileExtensionEquality();
}
|
class class_name[name] begin[{]
method[compareFilesByExtension, return_type[type[boolean]], modifier[public static], parameter[sourceFile, fileToCompare]] begin[{]
return[call[CompareFileExtensions.compareFiles, parameter[member[.sourceFile], member[.fileToCompare], literal[true], literal[false], literal[true], literal[true], literal[true], literal[true]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[compareFilesByExtension] operator[SEP] Keyword[final] identifier[File] identifier[sourceFile] , Keyword[final] identifier[File] identifier[fileToCompare] operator[SEP] {
Keyword[return] identifier[CompareFileExtensions] operator[SEP] identifier[compareFiles] operator[SEP] identifier[sourceFile] , identifier[fileToCompare] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[getFileExtensionEquality] operator[SEP] operator[SEP] operator[SEP]
}
|
public final DSLMapParser.literal_return literal() throws RecognitionException {
DSLMapParser.literal_return retval = new DSLMapParser.literal_return();
retval.start = input.LT(1);
Object root_0 = null;
Token set24=null;
Object set24_tree=null;
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:186:5: ( ( LITERAL | COLON | LEFT_SQUARE | RIGHT_SQUARE ) )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:
{
root_0 = (Object)adaptor.nil();
set24=input.LT(1);
if ( input.LA(1)==COLON||(input.LA(1) >= LEFT_SQUARE && input.LA(1) <= LITERAL)||input.LA(1)==RIGHT_SQUARE ) {
input.consume();
if ( state.backtracking==0 ) adaptor.addChild(root_0, (Object)adaptor.create(set24));
state.errorRecovery=false;
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return retval;}
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
|
class class_name[name] begin[{]
method[literal, return_type[type[DSLMapParser]], modifier[final public], parameter[]] begin[{]
local_variable[type[DSLMapParser], retval]
assign[member[retval.start], call[input.LT, parameter[literal[1]]]]
local_variable[type[Object], root_0]
local_variable[type[Token], set24]
local_variable[type[Object], set24_tree]
TryStatement(block=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=root_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=nil, postfix_operators=[], prefix_operators=[], qualifier=adaptor, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=set24, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LT, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=MemberReference(member=COLON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=MemberReference(member=LEFT_SQUARE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=MemberReference(member=LITERAL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operator=&&), operator=||), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=MemberReference(member=RIGHT_SQUARE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), ReturnStatement(expression=MemberReference(member=retval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=root_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MethodInvocation(arguments=[MemberReference(member=set24, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=adaptor, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], member=addChild, postfix_operators=[], prefix_operators=[], qualifier=adaptor, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=errorRecovery, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]))]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=stop, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=LT, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=root_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rulePostProcessing, postfix_operators=[], prefix_operators=[], qualifier=adaptor, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[]), MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[]), MemberReference(member=stop, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[])], member=setTokenBoundaries, postfix_operators=[], prefix_operators=[], qualifier=adaptor, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=retval, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=LT, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=errorNode, postfix_operators=[], prefix_operators=[], qualifier=adaptor, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
return[member[.retval]]
end[}]
END[}]
|
Keyword[public] Keyword[final] identifier[DSLMapParser] operator[SEP] identifier[literal_return] identifier[literal] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[DSLMapParser] operator[SEP] identifier[literal_return] identifier[retval] operator[=] Keyword[new] identifier[DSLMapParser] operator[SEP] identifier[literal_return] operator[SEP] operator[SEP] operator[SEP] identifier[retval] operator[SEP] identifier[start] operator[=] identifier[input] operator[SEP] identifier[LT] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[Object] identifier[root_0] operator[=] Other[null] operator[SEP] identifier[Token] identifier[set24] operator[=] Other[null] operator[SEP] identifier[Object] identifier[set24_tree] operator[=] Other[null] operator[SEP] Keyword[try] {
{
identifier[root_0] operator[=] operator[SEP] identifier[Object] operator[SEP] identifier[adaptor] operator[SEP] identifier[nil] operator[SEP] operator[SEP] operator[SEP] identifier[set24] operator[=] identifier[input] operator[SEP] identifier[LT] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[==] identifier[COLON] operator[||] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] identifier[LEFT_SQUARE] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] identifier[LITERAL] operator[SEP] operator[||] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[==] identifier[RIGHT_SQUARE] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] identifier[adaptor] operator[SEP] identifier[addChild] operator[SEP] identifier[root_0] , operator[SEP] identifier[Object] operator[SEP] identifier[adaptor] operator[SEP] identifier[create] operator[SEP] identifier[set24] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[errorRecovery] operator[=] literal[boolean] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[SEP] {
identifier[state] operator[SEP] identifier[failed] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[retval] operator[SEP]
}
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
}
identifier[retval] operator[SEP] identifier[stop] operator[=] identifier[input] operator[SEP] identifier[LT] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[retval] operator[SEP] identifier[tree] operator[=] operator[SEP] identifier[Object] operator[SEP] identifier[adaptor] operator[SEP] identifier[rulePostProcessing] operator[SEP] identifier[root_0] operator[SEP] operator[SEP] identifier[adaptor] operator[SEP] identifier[setTokenBoundaries] operator[SEP] identifier[retval] operator[SEP] identifier[tree] , identifier[retval] operator[SEP] identifier[start] , identifier[retval] operator[SEP] identifier[stop] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP] identifier[retval] operator[SEP] identifier[tree] operator[=] operator[SEP] identifier[Object] operator[SEP] identifier[adaptor] operator[SEP] identifier[errorNode] operator[SEP] identifier[input] , identifier[retval] operator[SEP] identifier[start] , identifier[input] operator[SEP] identifier[LT] operator[SEP] operator[-] Other[1] operator[SEP] , identifier[re] operator[SEP] operator[SEP]
}
Keyword[finally] {
}
Keyword[return] identifier[retval] operator[SEP]
}
|
public String forCaseInstance(String alias, String caseId) {
return registry.getContainerId(alias, new ByCaseIdContainerLocator(caseId));
}
|
class class_name[name] begin[{]
method[forCaseInstance, return_type[type[String]], modifier[public], parameter[alias, caseId]] begin[{]
return[call[registry.getContainerId, parameter[member[.alias], ClassCreator(arguments=[MemberReference(member=caseId, 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=ByCaseIdContainerLocator, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[forCaseInstance] operator[SEP] identifier[String] identifier[alias] , identifier[String] identifier[caseId] operator[SEP] {
Keyword[return] identifier[registry] operator[SEP] identifier[getContainerId] operator[SEP] identifier[alias] , Keyword[new] identifier[ByCaseIdContainerLocator] operator[SEP] identifier[caseId] operator[SEP] operator[SEP] operator[SEP]
}
|
public Iterable<DFactory> queryByClientSecret(java.lang.String clientSecret) {
return queryByField(null, DFactoryMapper.Field.CLIENTSECRET.getFieldName(), clientSecret);
}
|
class class_name[name] begin[{]
method[queryByClientSecret, return_type[type[Iterable]], modifier[public], parameter[clientSecret]] begin[{]
return[call[.queryByField, parameter[literal[null], call[DFactoryMapper.Field.CLIENTSECRET.getFieldName, parameter[]], member[.clientSecret]]]]
end[}]
END[}]
|
Keyword[public] identifier[Iterable] operator[<] identifier[DFactory] operator[>] identifier[queryByClientSecret] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[clientSecret] operator[SEP] {
Keyword[return] identifier[queryByField] operator[SEP] Other[null] , identifier[DFactoryMapper] operator[SEP] identifier[Field] operator[SEP] identifier[CLIENTSECRET] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] , identifier[clientSecret] operator[SEP] operator[SEP]
}
|
static void insertEmptyFlag(final WritableMemory wmem, final boolean empty) {
int flags = wmem.getByte(FLAGS_BYTE);
if (empty) { flags |= EMPTY_FLAG_MASK; }
else { flags &= ~EMPTY_FLAG_MASK; }
wmem.putByte(FLAGS_BYTE, (byte) flags);
}
|
class class_name[name] begin[{]
method[insertEmptyFlag, return_type[void], modifier[static], parameter[wmem, empty]] begin[{]
local_variable[type[int], flags]
if[member[.empty]] begin[{]
assign[member[.flags], member[.EMPTY_FLAG_MASK]]
else begin[{]
assign[member[.flags], member[.EMPTY_FLAG_MASK]]
end[}]
call[wmem.putByte, parameter[member[.FLAGS_BYTE], Cast(expression=MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]]
end[}]
END[}]
|
Keyword[static] Keyword[void] identifier[insertEmptyFlag] operator[SEP] Keyword[final] identifier[WritableMemory] identifier[wmem] , Keyword[final] Keyword[boolean] identifier[empty] operator[SEP] {
Keyword[int] identifier[flags] operator[=] identifier[wmem] operator[SEP] identifier[getByte] operator[SEP] identifier[FLAGS_BYTE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[empty] operator[SEP] {
identifier[flags] operator[|=] identifier[EMPTY_FLAG_MASK] operator[SEP]
}
Keyword[else] {
identifier[flags] operator[&=] operator[~] identifier[EMPTY_FLAG_MASK] operator[SEP]
}
identifier[wmem] operator[SEP] identifier[putByte] operator[SEP] identifier[FLAGS_BYTE] , operator[SEP] Keyword[byte] operator[SEP] identifier[flags] operator[SEP] operator[SEP]
}
|
public void moveDirectory(File file, Object objParentID)
{
if (this.getScanListener() != null)
objParentID = this.getScanListener().processThisDirectory(file, objParentID);
File[] fileList = file.listFiles();
for (int i = 0; i < fileList.length; i++)
{
if (fileList[i].isDirectory())
{
if (this.getScanListener() != null)
{
if (this.getScanListener().filterDirectory(fileList[i]))
this.moveDirectory(fileList[i], objParentID);
}
else
this.moveDirectory(fileList[i], objParentID);
}
else if (fileList[i].isFile())
this.moveThisFile(fileList[i]);
}
if (this.getScanListener() != null)
this.getScanListener().postProcessThisDirectory(file, objParentID);
}
|
class class_name[name] begin[{]
method[moveDirectory, return_type[void], modifier[public], parameter[file, objParentID]] begin[{]
if[binary_operation[THIS[call[None.getScanListener, parameter[]]], !=, literal[null]]] begin[{]
assign[member[.objParentID], THIS[call[None.getScanListener, parameter[]]call[None.processThisDirectory, parameter[member[.file], member[.objParentID]]]]]
else begin[{]
None
end[}]
local_variable[type[File], fileList]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=isDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=IfStatement(condition=MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=isFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=moveThisFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getScanListener, 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=StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=objParentID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=moveDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getScanListener, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=filterDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=objParentID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=moveDirectory, 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=fileList, 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)
if[binary_operation[THIS[call[None.getScanListener, parameter[]]], !=, literal[null]]] begin[{]
THIS[call[None.getScanListener, parameter[]]call[None.postProcessThisDirectory, parameter[member[.file], member[.objParentID]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[moveDirectory] operator[SEP] identifier[File] identifier[file] , identifier[Object] identifier[objParentID] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getScanListener] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[objParentID] operator[=] Keyword[this] operator[SEP] identifier[getScanListener] operator[SEP] operator[SEP] operator[SEP] identifier[processThisDirectory] operator[SEP] identifier[file] , identifier[objParentID] operator[SEP] operator[SEP] identifier[File] operator[SEP] operator[SEP] identifier[fileList] operator[=] identifier[file] operator[SEP] identifier[listFiles] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fileList] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[fileList] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getScanListener] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getScanListener] operator[SEP] operator[SEP] operator[SEP] identifier[filterDirectory] operator[SEP] identifier[fileList] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[moveDirectory] operator[SEP] identifier[fileList] operator[SEP] identifier[i] operator[SEP] , identifier[objParentID] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[this] operator[SEP] identifier[moveDirectory] operator[SEP] identifier[fileList] operator[SEP] identifier[i] operator[SEP] , identifier[objParentID] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fileList] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[moveThisFile] operator[SEP] identifier[fileList] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getScanListener] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[getScanListener] operator[SEP] operator[SEP] operator[SEP] identifier[postProcessThisDirectory] operator[SEP] identifier[file] , identifier[objParentID] operator[SEP] operator[SEP]
}
|
private void _ws() throws
IOException
{
builder.type = Type.S;
// no need to preserve exact whitespace
// but append an S char to keep the token
// contract of always having a value
builder.append(' ');
reader.forward(NOT_WHITESPACE);
if (debug)
{
int nxt = reader.peek();
checkArgument(WHITESPACE.matches((char) reader.curChar));
if (nxt > -1)
{
checkArgument(NOT_WHITESPACE.matches((char) nxt));
}
}
}
|
class class_name[name] begin[{]
method[_ws, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[builder.type], member[Type.S]]
call[builder.append, parameter[literal[' ']]]
call[reader.forward, parameter[member[.NOT_WHITESPACE]]]
if[member[.debug]] begin[{]
local_variable[type[int], nxt]
call[.checkArgument, parameter[call[WHITESPACE.matches, parameter[Cast(expression=MemberReference(member=curChar, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[]), type=BasicType(dimensions=[], name=char))]]]]
if[binary_operation[member[.nxt], >, literal[1]]] begin[{]
call[.checkArgument, parameter[call[NOT_WHITESPACE.matches, parameter[Cast(expression=MemberReference(member=nxt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[_ws] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[builder] operator[SEP] identifier[type] operator[=] identifier[Type] operator[SEP] identifier[S] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[reader] operator[SEP] identifier[forward] operator[SEP] identifier[NOT_WHITESPACE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[debug] operator[SEP] {
Keyword[int] identifier[nxt] operator[=] identifier[reader] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] identifier[WHITESPACE] operator[SEP] identifier[matches] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[reader] operator[SEP] identifier[curChar] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nxt] operator[>] operator[-] Other[1] operator[SEP] {
identifier[checkArgument] operator[SEP] identifier[NOT_WHITESPACE] operator[SEP] identifier[matches] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[nxt] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Override
public AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener listener) {
CacheEntry<AuthConfigProvider, RegistrationContext, Collection<RegistrationListener>> entry = null;
lock.lock();
try {
if (layer != null && appContext != null)
entry = cache.get(new RegistrationID(layer, appContext)); // rule (1)
if (entry == null) {
if (appContext != null)
entry = cache.get(new RegistrationID(null, appContext)); // rule (2)
if (entry == null) {
if (layer != null)
entry = cache.get(new RegistrationID(layer, null)); // rule (3)
if (entry == null) {
entry = cache.get(new RegistrationID(null, null)); // rule (4)
}
}
}
if (listener != null && entry != null) {
entry.listeners.add(listener);
}
} finally {
lock.unlock();
}
AuthConfigProvider provider = entry == null ? null : entry.provider;
if (tc.isDebugEnabled())
Tr.debug(tc, "getConfigProvider entry", entry);
return provider;
}
|
class class_name[name] begin[{]
method[getConfigProvider, return_type[type[AuthConfigProvider]], modifier[public], parameter[layer, appContext, listener]] begin[{]
local_variable[type[CacheEntry], entry]
call[lock.lock, parameter[]]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=layer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=appContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=layer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=appContext, 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=RegistrationID, sub_type=None))], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entry, 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=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=appContext, 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=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=appContext, 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=RegistrationID, sub_type=None))], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entry, 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=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=layer, 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=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=layer, 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=RegistrationID, sub_type=None))], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entry, 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=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), 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=RegistrationID, sub_type=None))], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None)), label=None)]))]))])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=[MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=entry.listeners, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
local_variable[type[AuthConfigProvider], provider]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["getConfigProvider entry"], member[.entry]]]
else begin[{]
None
end[}]
return[member[.provider]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[AuthConfigProvider] identifier[getConfigProvider] operator[SEP] identifier[String] identifier[layer] , identifier[String] identifier[appContext] , identifier[RegistrationListener] identifier[listener] operator[SEP] {
identifier[CacheEntry] operator[<] identifier[AuthConfigProvider] , identifier[RegistrationContext] , identifier[Collection] operator[<] identifier[RegistrationListener] operator[>] operator[>] identifier[entry] operator[=] Other[null] operator[SEP] identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[layer] operator[!=] Other[null] operator[&&] identifier[appContext] operator[!=] Other[null] operator[SEP] identifier[entry] operator[=] identifier[cache] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[RegistrationID] operator[SEP] identifier[layer] , identifier[appContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[appContext] operator[!=] Other[null] operator[SEP] identifier[entry] operator[=] identifier[cache] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[RegistrationID] operator[SEP] Other[null] , identifier[appContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[layer] operator[!=] Other[null] operator[SEP] identifier[entry] operator[=] identifier[cache] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[RegistrationID] operator[SEP] identifier[layer] , Other[null] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[==] Other[null] operator[SEP] {
identifier[entry] operator[=] identifier[cache] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[RegistrationID] operator[SEP] Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[listener] operator[!=] Other[null] operator[&&] identifier[entry] operator[!=] Other[null] operator[SEP] {
identifier[entry] operator[SEP] identifier[listeners] operator[SEP] identifier[add] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
identifier[AuthConfigProvider] identifier[provider] operator[=] identifier[entry] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[entry] operator[SEP] identifier[provider] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , identifier[entry] operator[SEP] operator[SEP] Keyword[return] identifier[provider] operator[SEP]
}
|
private static void subst(final StringBuilder stringBuilder, final String from, final String to) {
int begin = 0, end = 0;
while ((end = stringBuilder.indexOf(from, end)) != -1) {
stringBuilder.delete(end, end + from.length());
stringBuilder.insert(end, to);
// update positions
begin = end + to.length();
end = begin;
}
}
|
class class_name[name] begin[{]
method[subst, return_type[void], modifier[private static], parameter[stringBuilder, from, to]] begin[{]
local_variable[type[int], begin]
while[binary_operation[assign[member[.end], call[stringBuilder.indexOf, parameter[member[.from], member[.end]]]], !=, literal[1]]] begin[{]
call[stringBuilder.delete, parameter[member[.end], binary_operation[member[.end], +, call[from.length, parameter[]]]]]
call[stringBuilder.insert, parameter[member[.end], member[.to]]]
assign[member[.begin], binary_operation[member[.end], +, call[to.length, parameter[]]]]
assign[member[.end], member[.begin]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[subst] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[stringBuilder] , Keyword[final] identifier[String] identifier[from] , Keyword[final] identifier[String] identifier[to] operator[SEP] {
Keyword[int] identifier[begin] operator[=] Other[0] , identifier[end] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[end] operator[=] identifier[stringBuilder] operator[SEP] identifier[indexOf] operator[SEP] identifier[from] , identifier[end] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[stringBuilder] operator[SEP] identifier[delete] operator[SEP] identifier[end] , identifier[end] operator[+] identifier[from] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stringBuilder] operator[SEP] identifier[insert] operator[SEP] identifier[end] , identifier[to] operator[SEP] operator[SEP] identifier[begin] operator[=] identifier[end] operator[+] identifier[to] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[end] operator[=] identifier[begin] operator[SEP]
}
}
|
public String getPackageName(ClassProject.CodeType codeType)
{
if (codeType == null)
codeType = ClassProject.CodeType.THICK;
String packageName = this.getField(ClassInfo.CLASS_PACKAGE).toString();
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassInfo.CLASS_PROJECT_ID)).getReference();
if (classProject != null)
if ((classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS) || (classProject.getEditMode() == DBConstants.EDIT_CURRENT))
packageName = classProject.getFullPackage(codeType, packageName);
return packageName;
}
|
class class_name[name] begin[{]
method[getPackageName, return_type[type[String]], modifier[public], parameter[codeType]] begin[{]
if[binary_operation[member[.codeType], ==, literal[null]]] begin[{]
assign[member[.codeType], member[ClassProject.CodeType.THICK]]
else begin[{]
None
end[}]
local_variable[type[String], packageName]
local_variable[type[ClassProject], classProject]
if[binary_operation[member[.classProject], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[call[classProject.getEditMode, parameter[]], ==, member[DBConstants.EDIT_IN_PROGRESS]], ||, binary_operation[call[classProject.getEditMode, parameter[]], ==, member[DBConstants.EDIT_CURRENT]]]] begin[{]
assign[member[.packageName], call[classProject.getFullPackage, parameter[member[.codeType], member[.packageName]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.packageName]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getPackageName] operator[SEP] identifier[ClassProject] operator[SEP] identifier[CodeType] identifier[codeType] operator[SEP] {
Keyword[if] operator[SEP] identifier[codeType] operator[==] Other[null] operator[SEP] identifier[codeType] operator[=] identifier[ClassProject] operator[SEP] identifier[CodeType] operator[SEP] identifier[THICK] operator[SEP] identifier[String] identifier[packageName] operator[=] Keyword[this] operator[SEP] identifier[getField] operator[SEP] identifier[ClassInfo] operator[SEP] identifier[CLASS_PACKAGE] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[ClassProject] identifier[classProject] operator[=] operator[SEP] identifier[ClassProject] operator[SEP] operator[SEP] operator[SEP] identifier[ReferenceField] operator[SEP] Keyword[this] operator[SEP] identifier[getField] operator[SEP] identifier[ClassInfo] operator[SEP] identifier[CLASS_PROJECT_ID] operator[SEP] operator[SEP] operator[SEP] identifier[getReference] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[classProject] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[classProject] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_IN_PROGRESS] operator[SEP] operator[||] operator[SEP] identifier[classProject] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_CURRENT] operator[SEP] operator[SEP] identifier[packageName] operator[=] identifier[classProject] operator[SEP] identifier[getFullPackage] operator[SEP] identifier[codeType] , identifier[packageName] operator[SEP] operator[SEP] Keyword[return] identifier[packageName] operator[SEP]
}
|
@Override
public boolean isMachineRunning( TargetHandlerParameters parameters, String machineId )
throws TargetException {
NovaApi novaApi = novaApi( parameters.getTargetProperties());
String zoneName = findZoneName( novaApi, parameters.getTargetProperties());
Server server = novaApi.getServerApiForZone( zoneName ).get( machineId );
boolean running = false;
if( server != null )
running = server.getStatus() == Status.ACTIVE || server.getStatus() == Status.REBOOT;
return running;
}
|
class class_name[name] begin[{]
method[isMachineRunning, return_type[type[boolean]], modifier[public], parameter[parameters, machineId]] begin[{]
local_variable[type[NovaApi], novaApi]
local_variable[type[String], zoneName]
local_variable[type[Server], server]
local_variable[type[boolean], running]
if[binary_operation[member[.server], !=, literal[null]]] begin[{]
assign[member[.running], binary_operation[binary_operation[call[server.getStatus, parameter[]], ==, member[Status.ACTIVE]], ||, binary_operation[call[server.getStatus, parameter[]], ==, member[Status.REBOOT]]]]
else begin[{]
None
end[}]
return[member[.running]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isMachineRunning] operator[SEP] identifier[TargetHandlerParameters] identifier[parameters] , identifier[String] identifier[machineId] operator[SEP] Keyword[throws] identifier[TargetException] {
identifier[NovaApi] identifier[novaApi] operator[=] identifier[novaApi] operator[SEP] identifier[parameters] operator[SEP] identifier[getTargetProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[zoneName] operator[=] identifier[findZoneName] operator[SEP] identifier[novaApi] , identifier[parameters] operator[SEP] identifier[getTargetProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Server] identifier[server] operator[=] identifier[novaApi] operator[SEP] identifier[getServerApiForZone] operator[SEP] identifier[zoneName] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[machineId] operator[SEP] operator[SEP] Keyword[boolean] identifier[running] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[server] operator[!=] Other[null] operator[SEP] identifier[running] operator[=] identifier[server] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[Status] operator[SEP] identifier[ACTIVE] operator[||] identifier[server] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[Status] operator[SEP] identifier[REBOOT] operator[SEP] Keyword[return] identifier[running] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public V put(Pair<T, I> key, V value) {
boolean isNew = keys.add(key);
int index = keys.indexOf(key);
Object old = null;
if (isNew)
values.add(index, value);
else
old = values.set(index, value);
return (V) old;
}
|
class class_name[name] begin[{]
method[put, return_type[type[V]], modifier[public], parameter[key, value]] begin[{]
local_variable[type[boolean], isNew]
local_variable[type[int], index]
local_variable[type[Object], old]
if[member[.isNew]] begin[{]
call[values.add, parameter[member[.index], member[.value]]]
else begin[{]
assign[member[.old], call[values.set, parameter[member[.index], member[.value]]]]
end[}]
return[Cast(expression=MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[V] identifier[put] operator[SEP] identifier[Pair] operator[<] identifier[T] , identifier[I] operator[>] identifier[key] , identifier[V] identifier[value] operator[SEP] {
Keyword[boolean] identifier[isNew] operator[=] identifier[keys] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[keys] operator[SEP] identifier[indexOf] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[Object] identifier[old] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[isNew] operator[SEP] identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[index] , identifier[value] operator[SEP] operator[SEP] Keyword[else] identifier[old] operator[=] identifier[values] operator[SEP] identifier[set] operator[SEP] identifier[index] , identifier[value] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[V] operator[SEP] identifier[old] operator[SEP]
}
|
public void addDateRangeFilter(String key, DateRange dateRange) {
JsonObject opObj = new JsonObject();
if (dateRange.getFromDate() != null) {
String dateGtString = BoxDateFormat.format(dateRange.getFromDate());
//workaround replacing + and - 000 at the end with 'Z'
dateGtString = dateGtString.replaceAll("(\\+|-)(?!-\\|?!\\+)\\d+$", "Z");
opObj.add("gt", dateGtString);
}
if (dateRange.getToDate() != null) {
String dateLtString = BoxDateFormat.format(dateRange.getToDate());
//workaround replacing + and - 000 at the end with 'Z'
dateLtString = dateLtString.replaceAll("(\\+|-)(?!-\\|?!\\+)\\d+$", "Z");
opObj.add("lt", dateLtString);
}
this.filtersList.add(key, opObj);
}
|
class class_name[name] begin[{]
method[addDateRangeFilter, return_type[void], modifier[public], parameter[key, dateRange]] begin[{]
local_variable[type[JsonObject], opObj]
if[binary_operation[call[dateRange.getFromDate, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[String], dateGtString]
assign[member[.dateGtString], call[dateGtString.replaceAll, parameter[literal["(\\+|-)(?!-\\|?!\\+)\\d+$"], literal["Z"]]]]
call[opObj.add, parameter[literal["gt"], member[.dateGtString]]]
else begin[{]
None
end[}]
if[binary_operation[call[dateRange.getToDate, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[String], dateLtString]
assign[member[.dateLtString], call[dateLtString.replaceAll, parameter[literal["(\\+|-)(?!-\\|?!\\+)\\d+$"], literal["Z"]]]]
call[opObj.add, parameter[literal["lt"], member[.dateLtString]]]
else begin[{]
None
end[}]
THIS[member[None.filtersList]call[None.add, parameter[member[.key], member[.opObj]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addDateRangeFilter] operator[SEP] identifier[String] identifier[key] , identifier[DateRange] identifier[dateRange] operator[SEP] {
identifier[JsonObject] identifier[opObj] operator[=] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dateRange] operator[SEP] identifier[getFromDate] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[dateGtString] operator[=] identifier[BoxDateFormat] operator[SEP] identifier[format] operator[SEP] identifier[dateRange] operator[SEP] identifier[getFromDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[dateGtString] operator[=] identifier[dateGtString] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[opObj] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[dateGtString] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[dateRange] operator[SEP] identifier[getToDate] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[dateLtString] operator[=] identifier[BoxDateFormat] operator[SEP] identifier[format] operator[SEP] identifier[dateRange] operator[SEP] identifier[getToDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[dateLtString] operator[=] identifier[dateLtString] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[opObj] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[dateLtString] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[filtersList] operator[SEP] identifier[add] operator[SEP] identifier[key] , identifier[opObj] operator[SEP] operator[SEP]
}
|
public List<CharacterAssetsLocationsResponse> postCharactersCharacterIdAssetsLocations(Integer characterId,
List<Long> requestBody, String datasource, String token) throws ApiException {
ApiResponse<List<CharacterAssetsLocationsResponse>> resp = postCharactersCharacterIdAssetsLocationsWithHttpInfo(
characterId, requestBody, datasource, token);
return resp.getData();
}
|
class class_name[name] begin[{]
method[postCharactersCharacterIdAssetsLocations, return_type[type[List]], modifier[public], parameter[characterId, requestBody, datasource, token]] begin[{]
local_variable[type[ApiResponse], resp]
return[call[resp.getData, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[CharacterAssetsLocationsResponse] operator[>] identifier[postCharactersCharacterIdAssetsLocations] operator[SEP] identifier[Integer] identifier[characterId] , identifier[List] operator[<] identifier[Long] operator[>] identifier[requestBody] , identifier[String] identifier[datasource] , identifier[String] identifier[token] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[ApiResponse] operator[<] identifier[List] operator[<] identifier[CharacterAssetsLocationsResponse] operator[>] operator[>] identifier[resp] operator[=] identifier[postCharactersCharacterIdAssetsLocationsWithHttpInfo] operator[SEP] identifier[characterId] , identifier[requestBody] , identifier[datasource] , identifier[token] operator[SEP] operator[SEP] Keyword[return] identifier[resp] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP]
}
|
private byte[] copyOf(byte[] original, int length) {
byte[] copy = new byte[length];
if (length <= original.length) {
System.arraycopy(original, 0, copy, 0, length);
}
else {
System.arraycopy(original, 0, copy, 0, original.length);
}
return copy;
}
|
class class_name[name] begin[{]
method[copyOf, return_type[type[byte]], modifier[private], parameter[original, length]] begin[{]
local_variable[type[byte], copy]
if[binary_operation[member[.length], <=, member[original.length]]] begin[{]
call[System.arraycopy, parameter[member[.original], literal[0], member[.copy], literal[0], member[.length]]]
else begin[{]
call[System.arraycopy, parameter[member[.original], literal[0], member[.copy], literal[0], member[original.length]]]
end[}]
return[member[.copy]]
end[}]
END[}]
|
Keyword[private] Keyword[byte] operator[SEP] operator[SEP] identifier[copyOf] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[original] , Keyword[int] identifier[length] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[copy] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[<=] identifier[original] operator[SEP] identifier[length] operator[SEP] {
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[original] , Other[0] , identifier[copy] , Other[0] , identifier[length] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[original] , Other[0] , identifier[copy] , Other[0] , identifier[original] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[return] identifier[copy] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.