code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
@POST
@Path("{id}/account/confirm")
@PermitAll
public Response confirmAccount(@PathParam("id") Long userId, AccountRequest request) {
checkNotNull(userId);
checkNotNull(request.getToken());
boolean isSuccess = userService.confirmAccountUsingToken(userId, request.getToken());
return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build();
} | class class_name[name] begin[{]
method[confirmAccount, return_type[type[Response]], modifier[public], parameter[userId, request]] begin[{]
call[.checkNotNull, parameter[member[.userId]]]
call[.checkNotNull, parameter[call[request.getToken, parameter[]]]]
local_variable[type[boolean], isSuccess]
return[TernaryExpression(condition=MemberReference(member=isSuccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[MemberReference(member=BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=Response.Status, selectors=[])], member=status, postfix_operators=[], prefix_operators=[], qualifier=Response, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=MethodInvocation(arguments=[], member=noContent, postfix_operators=[], prefix_operators=[], qualifier=Response, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))]
end[}]
END[}] | annotation[@] identifier[POST] annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[PermitAll] Keyword[public] identifier[Response] identifier[confirmAccount] operator[SEP] annotation[@] identifier[PathParam] operator[SEP] literal[String] operator[SEP] identifier[Long] identifier[userId] , identifier[AccountRequest] identifier[request] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[userId] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[request] operator[SEP] identifier[getToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isSuccess] operator[=] identifier[userService] operator[SEP] identifier[confirmAccountUsingToken] operator[SEP] identifier[userId] , identifier[request] operator[SEP] identifier[getToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[isSuccess] operator[?] identifier[Response] operator[SEP] identifier[noContent] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[:] identifier[Response] operator[SEP] identifier[status] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
private Boolean getOrderDirection(QueryPlanningInfo info) {
if (info.orderBy == null) {
return null;
}
String result = null;
for (OOrderByItem item : info.orderBy.getItems()) {
if (result == null) {
result = item.getType() == null ? OOrderByItem.ASC : item.getType();
} else {
String newType = item.getType() == null ? OOrderByItem.ASC : item.getType();
if (!newType.equals(result)) {
return null;
}
}
}
return result == null || result.equals(OOrderByItem.ASC);
} | class class_name[name] begin[{]
method[getOrderDirection, return_type[type[Boolean]], modifier[private], parameter[info]] begin[{]
if[binary_operation[member[info.orderBy], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], result]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), if_true=MemberReference(member=ASC, postfix_operators=[], prefix_operators=[], qualifier=OOrderByItem, selectors=[])), name=newType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=newType, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), if_true=MemberReference(member=ASC, postfix_operators=[], prefix_operators=[], qualifier=OOrderByItem, selectors=[]))), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getItems, postfix_operators=[], prefix_operators=[], qualifier=info.orderBy, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OOrderByItem, sub_type=None))), label=None)
return[binary_operation[binary_operation[member[.result], ==, literal[null]], ||, call[result.equals, parameter[member[OOrderByItem.ASC]]]]]
end[}]
END[}] | Keyword[private] identifier[Boolean] identifier[getOrderDirection] operator[SEP] identifier[QueryPlanningInfo] identifier[info] operator[SEP] {
Keyword[if] operator[SEP] identifier[info] operator[SEP] identifier[orderBy] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[result] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[OOrderByItem] identifier[item] operator[:] identifier[info] operator[SEP] identifier[orderBy] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[item] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] identifier[OOrderByItem] operator[SEP] identifier[ASC] operator[:] identifier[item] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[newType] operator[=] identifier[item] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] identifier[OOrderByItem] operator[SEP] identifier[ASC] operator[:] identifier[item] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[newType] operator[SEP] identifier[equals] operator[SEP] identifier[result] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[==] Other[null] operator[||] identifier[result] operator[SEP] identifier[equals] operator[SEP] identifier[OOrderByItem] operator[SEP] identifier[ASC] operator[SEP] operator[SEP]
}
|
@Override
public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException {
FacesContext result = null;
if (null != initContextServletContextMap && !initContextServletContextMap.isEmpty()) {
ServletContext servletContext = (ServletContext) FactoryFinder.FACTORIES_CACHE.getServletContextForCurrentClassLoader();
if (null != servletContext) {
for (Map.Entry<FacesContext, ServletContext> entry : initContextServletContextMap.entrySet()) {
if (servletContext.equals(entry.getValue())) {
result = entry.getKey();
break;
}
}
}
}
return result;
} | class class_name[name] begin[{]
method[getFacesContext, return_type[type[FacesContext]], modifier[public], parameter[context, request, response, lifecycle]] begin[{]
local_variable[type[FacesContext], result]
if[binary_operation[binary_operation[literal[null], !=, member[.initContextServletContextMap]], &&, call[initContextServletContextMap.isEmpty, parameter[]]]] begin[{]
local_variable[type[ServletContext], servletContext]
if[binary_operation[literal[null], !=, member[.servletContext]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=servletContext, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=initContextServletContextMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FacesContext, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ServletContext, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[FacesContext] identifier[getFacesContext] operator[SEP] identifier[Object] identifier[context] , identifier[Object] identifier[request] , identifier[Object] identifier[response] , identifier[Lifecycle] identifier[lifecycle] operator[SEP] Keyword[throws] identifier[FacesException] {
identifier[FacesContext] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[initContextServletContextMap] operator[&&] operator[!] identifier[initContextServletContextMap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[ServletContext] identifier[servletContext] operator[=] operator[SEP] identifier[ServletContext] operator[SEP] identifier[FactoryFinder] operator[SEP] identifier[FACTORIES_CACHE] operator[SEP] identifier[getServletContextForCurrentClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[servletContext] operator[SEP] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[FacesContext] , identifier[ServletContext] operator[>] identifier[entry] operator[:] identifier[initContextServletContextMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[servletContext] operator[SEP] identifier[equals] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
void resizeEntries(int newCapacity) {
this.elements = Arrays.copyOf(elements, newCapacity);
long[] entries = this.entries;
int oldCapacity = entries.length;
entries = Arrays.copyOf(entries, newCapacity);
if (newCapacity > oldCapacity) {
Arrays.fill(entries, oldCapacity, newCapacity, UNSET);
}
this.entries = entries;
} | class class_name[name] begin[{]
method[resizeEntries, return_type[void], modifier[default], parameter[newCapacity]] begin[{]
assign[THIS[member[None.elements]], call[Arrays.copyOf, parameter[member[.elements], member[.newCapacity]]]]
local_variable[type[long], entries]
local_variable[type[int], oldCapacity]
assign[member[.entries], call[Arrays.copyOf, parameter[member[.entries], member[.newCapacity]]]]
if[binary_operation[member[.newCapacity], >, member[.oldCapacity]]] begin[{]
call[Arrays.fill, parameter[member[.entries], member[.oldCapacity], member[.newCapacity], member[.UNSET]]]
else begin[{]
None
end[}]
assign[THIS[member[None.entries]], member[.entries]]
end[}]
END[}] | Keyword[void] identifier[resizeEntries] operator[SEP] Keyword[int] identifier[newCapacity] operator[SEP] {
Keyword[this] operator[SEP] identifier[elements] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[elements] , identifier[newCapacity] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[entries] operator[=] Keyword[this] operator[SEP] identifier[entries] operator[SEP] Keyword[int] identifier[oldCapacity] operator[=] identifier[entries] operator[SEP] identifier[length] operator[SEP] identifier[entries] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[entries] , identifier[newCapacity] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newCapacity] operator[>] identifier[oldCapacity] operator[SEP] {
identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[entries] , identifier[oldCapacity] , identifier[newCapacity] , identifier[UNSET] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[entries] operator[=] identifier[entries] operator[SEP]
}
|
@Override
public Map<String, Object> getParameters(
HttpServletRequest request, HttpServletResponse response) {
return null;
} | class class_name[name] begin[{]
method[getParameters, return_type[type[Map]], modifier[public], parameter[request, response]] begin[{]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getParameters] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public byte[] deliverSmResp(int commandStatus, int sequenceNumber, String messageId) {
PDUByteBuffer buf = new PDUByteBuffer(SMPPConstant.CID_DELIVER_SM_RESP,
commandStatus, sequenceNumber);
buf.append(messageId);
return buf.toBytes();
} | class class_name[name] begin[{]
method[deliverSmResp, return_type[type[byte]], modifier[public], parameter[commandStatus, sequenceNumber, messageId]] begin[{]
local_variable[type[PDUByteBuffer], buf]
call[buf.append, parameter[member[.messageId]]]
return[call[buf.toBytes, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[deliverSmResp] operator[SEP] Keyword[int] identifier[commandStatus] , Keyword[int] identifier[sequenceNumber] , identifier[String] identifier[messageId] operator[SEP] {
identifier[PDUByteBuffer] identifier[buf] operator[=] Keyword[new] identifier[PDUByteBuffer] operator[SEP] identifier[SMPPConstant] operator[SEP] identifier[CID_DELIVER_SM_RESP] , identifier[commandStatus] , identifier[sequenceNumber] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[messageId] operator[SEP] operator[SEP] Keyword[return] identifier[buf] operator[SEP] identifier[toBytes] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected Smb2ChangeNotifyResponse createResponse ( CIFSContext tc, ServerMessageBlock2Request<Smb2ChangeNotifyResponse> req ) {
return new Smb2ChangeNotifyResponse(tc.getConfig());
} | class class_name[name] begin[{]
method[createResponse, return_type[type[Smb2ChangeNotifyResponse]], modifier[protected], parameter[tc, req]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getConfig, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Smb2ChangeNotifyResponse, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[Smb2ChangeNotifyResponse] identifier[createResponse] operator[SEP] identifier[CIFSContext] identifier[tc] , identifier[ServerMessageBlock2Request] operator[<] identifier[Smb2ChangeNotifyResponse] operator[>] identifier[req] operator[SEP] {
Keyword[return] Keyword[new] identifier[Smb2ChangeNotifyResponse] operator[SEP] identifier[tc] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void addPaletteItem(String category,IPaletteItem item){
if(items.get(category)==null){
List<IPaletteItem> list = new ArrayList<IPaletteItem>();
items.put(category,list);
}
List<IPaletteItem> list = items.get(category);
list.add(item);
} | class class_name[name] begin[{]
method[addPaletteItem, return_type[void], modifier[private], parameter[category, item]] begin[{]
if[binary_operation[call[items.get, parameter[member[.category]]], ==, literal[null]]] begin[{]
local_variable[type[List], list]
call[items.put, parameter[member[.category], member[.list]]]
else begin[{]
None
end[}]
local_variable[type[List], list]
call[list.add, parameter[member[.item]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addPaletteItem] operator[SEP] identifier[String] identifier[category] , identifier[IPaletteItem] identifier[item] operator[SEP] {
Keyword[if] operator[SEP] identifier[items] operator[SEP] identifier[get] operator[SEP] identifier[category] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[IPaletteItem] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[IPaletteItem] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[items] operator[SEP] identifier[put] operator[SEP] identifier[category] , identifier[list] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[IPaletteItem] operator[>] identifier[list] operator[=] identifier[items] operator[SEP] identifier[get] operator[SEP] identifier[category] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[item] operator[SEP] operator[SEP]
}
|
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.GCPARC__XCENT:
setXCENT((Integer)newValue);
return;
case AfplibPackage.GCPARC__YCENT:
setYCENT((Integer)newValue);
return;
case AfplibPackage.GCPARC__MH:
setMH((Integer)newValue);
return;
case AfplibPackage.GCPARC__MFR:
setMFR((Integer)newValue);
return;
case AfplibPackage.GCPARC__START:
setSTART((Integer)newValue);
return;
case AfplibPackage.GCPARC__SWEEP:
setSWEEP((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
} | class class_name[name] begin[{]
method[eSet, return_type[void], modifier[public], parameter[featureID, newValue]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=GCPARC__XCENT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setXCENT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCPARC__YCENT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setYCENT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCPARC__MH, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setMH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCPARC__MFR, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setMFR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCPARC__START, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setSTART, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GCPARC__SWEEP, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setSWEEP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eSet] operator[SEP] Keyword[int] identifier[featureID] , identifier[Object] identifier[newValue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCPARC__XCENT] operator[:] identifier[setXCENT] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCPARC__YCENT] operator[:] identifier[setYCENT] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCPARC__MH] operator[:] identifier[setMH] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCPARC__MFR] operator[:] identifier[setMFR] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCPARC__START] operator[:] identifier[setSTART] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GCPARC__SWEEP] operator[:] identifier[setSWEEP] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eSet] operator[SEP] identifier[featureID] , identifier[newValue] operator[SEP] operator[SEP]
}
|
public static String normalizeURLPath(final String urlPath) {
String urlPathNormalized = urlPath;
if (!urlPathNormalized.startsWith("jrt:") && !urlPathNormalized.startsWith("http://")
&& !urlPathNormalized.startsWith("https://")) {
// Any URL with the "jar:" prefix must have "/" after any "!"
urlPathNormalized = urlPathNormalized.replace("/!", "!").replace("!/", "!").replace("!", "!/");
// Prepend "jar:file:"
if (!urlPathNormalized.startsWith("file:") && !urlPathNormalized.startsWith("jar:")) {
urlPathNormalized = "file:" + urlPathNormalized;
}
if (urlPathNormalized.contains("!") && !urlPathNormalized.startsWith("jar:")) {
urlPathNormalized = "jar:" + urlPathNormalized;
}
}
return encodePath(urlPathNormalized);
} | class class_name[name] begin[{]
method[normalizeURLPath, return_type[type[String]], modifier[public static], parameter[urlPath]] begin[{]
local_variable[type[String], urlPathNormalized]
if[binary_operation[binary_operation[call[urlPathNormalized.startsWith, parameter[literal["jrt:"]]], &&, call[urlPathNormalized.startsWith, parameter[literal["http://"]]]], &&, call[urlPathNormalized.startsWith, parameter[literal["https://"]]]]] begin[{]
assign[member[.urlPathNormalized], call[urlPathNormalized.replace, parameter[literal["/!"], literal["!"]]]]
if[binary_operation[call[urlPathNormalized.startsWith, parameter[literal["file:"]]], &&, call[urlPathNormalized.startsWith, parameter[literal["jar:"]]]]] begin[{]
assign[member[.urlPathNormalized], binary_operation[literal["file:"], +, member[.urlPathNormalized]]]
else begin[{]
None
end[}]
if[binary_operation[call[urlPathNormalized.contains, parameter[literal["!"]]], &&, call[urlPathNormalized.startsWith, parameter[literal["jar:"]]]]] begin[{]
assign[member[.urlPathNormalized], binary_operation[literal["jar:"], +, member[.urlPathNormalized]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[.encodePath, parameter[member[.urlPathNormalized]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[normalizeURLPath] operator[SEP] Keyword[final] identifier[String] identifier[urlPath] operator[SEP] {
identifier[String] identifier[urlPathNormalized] operator[=] identifier[urlPath] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[urlPathNormalized] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[urlPathNormalized] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[urlPathNormalized] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[urlPathNormalized] operator[=] identifier[urlPathNormalized] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[urlPathNormalized] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[urlPathNormalized] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[urlPathNormalized] operator[=] literal[String] operator[+] identifier[urlPathNormalized] operator[SEP]
}
Keyword[if] operator[SEP] identifier[urlPathNormalized] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[urlPathNormalized] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[urlPathNormalized] operator[=] literal[String] operator[+] identifier[urlPathNormalized] operator[SEP]
}
}
Keyword[return] identifier[encodePath] operator[SEP] identifier[urlPathNormalized] operator[SEP] operator[SEP]
}
|
public static nstrafficdomain_stats[] get(nitro_service service, options option) throws Exception{
nstrafficdomain_stats obj = new nstrafficdomain_stats();
nstrafficdomain_stats[] response = (nstrafficdomain_stats[])obj.stat_resources(service,option);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[nstrafficdomain_stats]], modifier[public static], parameter[service, option]] begin[{]
local_variable[type[nstrafficdomain_stats], obj]
local_variable[type[nstrafficdomain_stats], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[nstrafficdomain_stats] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[options] identifier[option] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[nstrafficdomain_stats] identifier[obj] operator[=] Keyword[new] identifier[nstrafficdomain_stats] operator[SEP] operator[SEP] operator[SEP] identifier[nstrafficdomain_stats] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[nstrafficdomain_stats] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[stat_resources] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
static void checkDirectMemCapacity(final int k, final long n, final long memCapBytes) {
final int reqBufBytes = getCompactStorageBytes(k, n);
if (memCapBytes < reqBufBytes) {
throw new SketchesArgumentException("Possible corruption: Memory capacity too small: "
+ memCapBytes + " < " + reqBufBytes);
}
} | class class_name[name] begin[{]
method[checkDirectMemCapacity, return_type[void], modifier[static], parameter[k, n, memCapBytes]] begin[{]
local_variable[type[int], reqBufBytes]
if[binary_operation[member[.memCapBytes], <, member[.reqBufBytes]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Possible corruption: Memory capacity too small: "), operandr=MemberReference(member=memCapBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" < "), operator=+), operandr=MemberReference(member=reqBufBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SketchesArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[checkDirectMemCapacity] operator[SEP] Keyword[final] Keyword[int] identifier[k] , Keyword[final] Keyword[long] identifier[n] , Keyword[final] Keyword[long] identifier[memCapBytes] operator[SEP] {
Keyword[final] Keyword[int] identifier[reqBufBytes] operator[=] identifier[getCompactStorageBytes] operator[SEP] identifier[k] , identifier[n] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[memCapBytes] operator[<] identifier[reqBufBytes] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SketchesArgumentException] operator[SEP] literal[String] operator[+] identifier[memCapBytes] operator[+] literal[String] operator[+] identifier[reqBufBytes] operator[SEP] operator[SEP]
}
}
|
LogMetadata asEnabled() {
return this.enabled ? this : new LogMetadata(this.epoch, true, this.ledgers, this.truncationAddress, this.updateVersion.get());
} | class class_name[name] begin[{]
method[asEnabled, return_type[type[LogMetadata]], modifier[default], parameter[]] begin[{]
return[TernaryExpression(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=enabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), if_false=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=epoch, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ledgers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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)), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]))]
end[}]
END[}] | identifier[LogMetadata] identifier[asEnabled] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[enabled] operator[?] Keyword[this] operator[:] Keyword[new] identifier[LogMetadata] operator[SEP] Keyword[this] operator[SEP] identifier[epoch] , literal[boolean] , Keyword[this] operator[SEP] identifier[ledgers] , 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 final void setDate(final Date date) {
this.date = date;
if (date instanceof DateTime) {
if (Value.DATE.equals(getParameter(Parameter.VALUE))) {
getParameters().replace(Value.DATE_TIME);
}
updateTimeZone(((DateTime) date).getTimeZone());
} else {
if (date != null) {
getParameters().replace(Value.DATE);
}
/*
else {
getParameters().removeAll(Parameter.VALUE);
}
*/
// ensure timezone is null for VALUE=DATE or null properties..
updateTimeZone(null);
}
} | class class_name[name] begin[{]
method[setDate, return_type[void], modifier[final public], parameter[date]] begin[{]
assign[THIS[member[None.date]], member[.date]]
if[binary_operation[member[.date], instanceof, type[DateTime]]] begin[{]
if[call[Value.DATE.equals, parameter[call[.getParameter, parameter[member[Parameter.VALUE]]]]]] begin[{]
call[.getParameters, parameter[]]
else begin[{]
None
end[}]
call[.updateTimeZone, parameter[Cast(expression=MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DateTime, sub_type=None))]]
else begin[{]
if[binary_operation[member[.date], !=, literal[null]]] begin[{]
call[.getParameters, parameter[]]
else begin[{]
None
end[}]
call[.updateTimeZone, parameter[literal[null]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[setDate] operator[SEP] Keyword[final] identifier[Date] identifier[date] operator[SEP] {
Keyword[this] operator[SEP] identifier[date] operator[=] identifier[date] operator[SEP] Keyword[if] operator[SEP] identifier[date] Keyword[instanceof] identifier[DateTime] operator[SEP] {
Keyword[if] operator[SEP] identifier[Value] operator[SEP] identifier[DATE] operator[SEP] identifier[equals] operator[SEP] identifier[getParameter] operator[SEP] identifier[Parameter] operator[SEP] identifier[VALUE] operator[SEP] operator[SEP] operator[SEP] {
identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[Value] operator[SEP] identifier[DATE_TIME] operator[SEP] operator[SEP]
}
identifier[updateTimeZone] operator[SEP] operator[SEP] operator[SEP] identifier[DateTime] operator[SEP] identifier[date] operator[SEP] operator[SEP] identifier[getTimeZone] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[date] operator[!=] Other[null] operator[SEP] {
identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[Value] operator[SEP] identifier[DATE] operator[SEP] operator[SEP]
}
identifier[updateTimeZone] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
}
|
public static void main(String[] args) throws InterruptedException, IOException, LineUnavailableException
{
final Options options = new Options();
options.addOption("h", "help", false, "displays help");
options.addOption("v", "version", false, "version of this library");
final CommandLineParser parser = new org.apache.commons.cli.BasicParser();
try {
final CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption("version")) {
// let's find what version of the library we're running
final String version = io.humble.video_native.Version.getVersionInfo();
System.out.println("Humble Version: " + version);
} else if (cmd.hasOption("help") || args.length == 0) {
final HelpFormatter formatter = new HelpFormatter();
formatter.printHelp(DecodeAndPlayAudio.class.getCanonicalName() + " <filename>", options);
} else {
final String[] parsedArgs = cmd.getArgs();
for(String arg: parsedArgs)
playSound(arg);
}
} catch (ParseException e) {
System.err.println("Exception parsing command line: " + e.getLocalizedMessage());
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[Options], options]
call[options.addOption, parameter[literal["h"], literal["help"], literal[false], literal["displays help"]]]
call[options.addOption, parameter[literal["v"], literal["version"], literal[false], literal["version of this library"]]]
local_variable[type[CommandLineParser], parser]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), name=cmd)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=CommandLine, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="version")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="help")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operator=||), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getArgs, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=parsedArgs)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=playSound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=parsedArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=arg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HelpFormatter, sub_type=None)), name=formatter)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=HelpFormatter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCanonicalName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DecodeAndPlayAudio, sub_type=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" <filename>"), operator=+), MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printHelp, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getVersionInfo, postfix_operators=[], prefix_operators=[], qualifier=io.humble.video_native.Version, selectors=[], type_arguments=None), name=version)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Humble Version: "), operandr=MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception parsing command line: "), operandr=MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ParseException']))], finally_block=None, label=None, resources=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[InterruptedException] , identifier[IOException] , identifier[LineUnavailableException] {
Keyword[final] identifier[Options] identifier[options] operator[=] Keyword[new] identifier[Options] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[addOption] operator[SEP] literal[String] , literal[String] , literal[boolean] , literal[String] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[addOption] operator[SEP] literal[String] , literal[String] , literal[boolean] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[CommandLineParser] identifier[parser] operator[=] Keyword[new] identifier[org] operator[SEP] identifier[apache] operator[SEP] identifier[commons] operator[SEP] identifier[cli] operator[SEP] identifier[BasicParser] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[CommandLine] identifier[cmd] operator[=] identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[options] , identifier[args] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[version] operator[=] identifier[io] operator[SEP] identifier[humble] operator[SEP] identifier[video_native] operator[SEP] identifier[Version] operator[SEP] identifier[getVersionInfo] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[version] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[||] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[final] identifier[HelpFormatter] identifier[formatter] operator[=] Keyword[new] identifier[HelpFormatter] operator[SEP] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[printHelp] operator[SEP] identifier[DecodeAndPlayAudio] operator[SEP] Keyword[class] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[options] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[parsedArgs] operator[=] identifier[cmd] operator[SEP] identifier[getArgs] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[arg] operator[:] identifier[parsedArgs] operator[SEP] identifier[playSound] operator[SEP] identifier[arg] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void addType(int pos, Class<? extends Value> type) throws ConflictingFieldTypeInfoException {
if (pos == schema.size()) {
// right at the end, most common case
schema.add(type);
} else if (pos < schema.size()) {
// in the middle, check for existing conflicts
Class<? extends Value> previous = schema.get(pos);
if (previous == null) {
schema.set(pos, type);
} else if (previous != type) {
throw new ConflictingFieldTypeInfoException(pos, previous, type);
}
} else {
// grow to the end
for (int i = schema.size(); i <= pos; i++) {
schema.add(null);
}
schema.set(pos, type);
}
} | class class_name[name] begin[{]
method[addType, return_type[void], modifier[public], parameter[pos, type]] begin[{]
if[binary_operation[member[.pos], ==, call[schema.size, parameter[]]]] begin[{]
call[schema.add, parameter[member[.type]]]
else begin[{]
if[binary_operation[member[.pos], <, call[schema.size, parameter[]]]] begin[{]
local_variable[type[Class], previous]
if[binary_operation[member[.previous], ==, literal[null]]] begin[{]
call[schema.set, parameter[member[.pos], member[.type]]]
else begin[{]
if[binary_operation[member[.previous], !=, member[.type]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=previous, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, 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=ConflictingFieldTypeInfoException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=add, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[schema.set, parameter[member[.pos], member[.type]]]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addType] operator[SEP] Keyword[int] identifier[pos] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Value] operator[>] identifier[type] operator[SEP] Keyword[throws] identifier[ConflictingFieldTypeInfoException] {
Keyword[if] operator[SEP] identifier[pos] operator[==] identifier[schema] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[schema] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[pos] operator[<] identifier[schema] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Value] operator[>] identifier[previous] operator[=] identifier[schema] operator[SEP] identifier[get] operator[SEP] identifier[pos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[previous] operator[==] Other[null] operator[SEP] {
identifier[schema] operator[SEP] identifier[set] operator[SEP] identifier[pos] , identifier[type] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[previous] operator[!=] identifier[type] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ConflictingFieldTypeInfoException] operator[SEP] identifier[pos] , identifier[previous] , identifier[type] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[schema] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<=] identifier[pos] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[schema] operator[SEP] identifier[add] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
identifier[schema] operator[SEP] identifier[set] operator[SEP] identifier[pos] , identifier[type] operator[SEP] operator[SEP]
}
}
|
@Override
public void perform(final Wave wave) {
final Cursor cursor = getKeyPart(Cursor.class);
// A cursor shall be used as key part
if (cursor == null) {
throw new CoreRuntimeException("You must use a Cursor instance as a key part.");
}
final Node node = getKeyPart(Node.class);
// Check if a node has been provided
if (node == null) {
// Define the cursor on the application's root node
localFacade().globalFacade().application().rootNode().setCursor(cursor);
} else {
// Define the cursor for the given node
node.setCursor(cursor);
}
} | class class_name[name] begin[{]
method[perform, return_type[void], modifier[public], parameter[wave]] begin[{]
local_variable[type[Cursor], cursor]
if[binary_operation[member[.cursor], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You must use a Cursor instance as a key part.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CoreRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Node], node]
if[binary_operation[member[.node], ==, literal[null]]] begin[{]
call[.localFacade, parameter[]]
else begin[{]
call[node.setCursor, parameter[member[.cursor]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[perform] operator[SEP] Keyword[final] identifier[Wave] identifier[wave] operator[SEP] {
Keyword[final] identifier[Cursor] identifier[cursor] operator[=] identifier[getKeyPart] operator[SEP] identifier[Cursor] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cursor] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CoreRuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Node] identifier[node] operator[=] identifier[getKeyPart] operator[SEP] identifier[Node] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[==] Other[null] operator[SEP] {
identifier[localFacade] operator[SEP] operator[SEP] operator[SEP] identifier[globalFacade] operator[SEP] operator[SEP] operator[SEP] identifier[application] operator[SEP] operator[SEP] operator[SEP] identifier[rootNode] operator[SEP] operator[SEP] operator[SEP] identifier[setCursor] operator[SEP] identifier[cursor] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[node] operator[SEP] identifier[setCursor] operator[SEP] identifier[cursor] operator[SEP] operator[SEP]
}
}
|
public void addMessage(final long messageId, final List<Token> messageTokens)
{
Verify.notNull(messageTokens, "messageTokens");
captureTypes(messageTokens, 0, messageTokens.size() - 1);
updateComponentTokenCounts(messageTokens);
messagesByIdMap.put(messageId, new ArrayList<>(messageTokens));
} | class class_name[name] begin[{]
method[addMessage, return_type[void], modifier[public], parameter[messageId, messageTokens]] begin[{]
call[Verify.notNull, parameter[member[.messageTokens], literal["messageTokens"]]]
call[.captureTypes, parameter[member[.messageTokens], literal[0], binary_operation[call[messageTokens.size, parameter[]], -, literal[1]]]]
call[.updateComponentTokenCounts, parameter[member[.messageTokens]]]
call[messagesByIdMap.put, parameter[member[.messageId], ClassCreator(arguments=[MemberReference(member=messageTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addMessage] operator[SEP] Keyword[final] Keyword[long] identifier[messageId] , Keyword[final] identifier[List] operator[<] identifier[Token] operator[>] identifier[messageTokens] operator[SEP] {
identifier[Verify] operator[SEP] identifier[notNull] operator[SEP] identifier[messageTokens] , literal[String] operator[SEP] operator[SEP] identifier[captureTypes] operator[SEP] identifier[messageTokens] , Other[0] , identifier[messageTokens] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[updateComponentTokenCounts] operator[SEP] identifier[messageTokens] operator[SEP] operator[SEP] identifier[messagesByIdMap] operator[SEP] identifier[put] operator[SEP] identifier[messageId] , Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[messageTokens] operator[SEP] operator[SEP] operator[SEP]
}
|
private AttributesImpl validateReference(final String attrName, final Attributes atts, final AttributesImpl modified) {
AttributesImpl res = modified;
final String href = atts.getValue(attrName);
if (href != null) {
try {
new URI(href);
} catch (final URISyntaxException e) {
switch (processingMode) {
case STRICT:
throw new RuntimeException(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ": " + e.getMessage(), e);
case SKIP:
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using invalid value.");
break;
case LAX:
try {
final URI uri = new URI(URLUtils.clean(href.trim()));
if (res == null) {
res = new AttributesImpl(atts);
}
res.setValue(res.getIndex(attrName), uri.toASCIIString());
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using '" + uri.toASCIIString() + "'.");
} catch (final URISyntaxException e1) {
logger.error(MessageUtils.getMessage("DOTJ054E", attrName, href).setLocation(locator) + ", using invalid value.");
}
break;
}
}
}
return res;
} | class class_name[name] begin[{]
method[validateReference, return_type[type[AttributesImpl]], modifier[private], parameter[attrName, atts, modified]] begin[{]
local_variable[type[AttributesImpl], res]
local_variable[type[String], href]
if[binary_operation[member[.href], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=ClassCreator(arguments=[MemberReference(member=href, 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=URI, sub_type=None)), label=None)], catches=[CatchClause(block=[SwitchStatement(cases=[SwitchStatementCase(case=['STRICT'], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DOTJ054E"), MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=MessageUtils, selectors=[MethodInvocation(arguments=[MemberReference(member=locator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLocation, 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=": "), operator=+), 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=RuntimeException, sub_type=None)), label=None)]), SwitchStatementCase(case=['SKIP'], statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DOTJ054E"), MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=MessageUtils, selectors=[MethodInvocation(arguments=[MemberReference(member=locator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLocation, 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=", using invalid value."), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['LAX'], statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=href, selectors=[], type_arguments=None)], member=clean, postfix_operators=[], prefix_operators=[], qualifier=URLUtils, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URI, sub_type=None)), name=uri)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=res, 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=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=atts, 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=AttributesImpl, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIndex, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toASCIIString, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None)], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DOTJ054E"), MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=MessageUtils, selectors=[MethodInvocation(arguments=[MemberReference(member=locator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLocation, 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=", using '"), operator=+), operandr=MethodInvocation(arguments=[], member=toASCIIString, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'."), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DOTJ054E"), MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=MessageUtils, selectors=[MethodInvocation(arguments=[MemberReference(member=locator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLocation, 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=", using invalid value."), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['URISyntaxException']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=processingMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.res]]
end[}]
END[}] | Keyword[private] identifier[AttributesImpl] identifier[validateReference] operator[SEP] Keyword[final] identifier[String] identifier[attrName] , Keyword[final] identifier[Attributes] identifier[atts] , Keyword[final] identifier[AttributesImpl] identifier[modified] operator[SEP] {
identifier[AttributesImpl] identifier[res] operator[=] identifier[modified] operator[SEP] Keyword[final] identifier[String] identifier[href] operator[=] identifier[atts] operator[SEP] identifier[getValue] operator[SEP] identifier[attrName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[href] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[new] identifier[URI] operator[SEP] identifier[href] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[switch] operator[SEP] identifier[processingMode] operator[SEP] {
Keyword[case] identifier[STRICT] operator[:] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[MessageUtils] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[attrName] , identifier[href] operator[SEP] operator[SEP] identifier[setLocation] operator[SEP] identifier[locator] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[case] identifier[SKIP] operator[:] identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[MessageUtils] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[attrName] , identifier[href] operator[SEP] operator[SEP] identifier[setLocation] operator[SEP] identifier[locator] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[LAX] operator[:] Keyword[try] {
Keyword[final] identifier[URI] identifier[uri] operator[=] Keyword[new] identifier[URI] operator[SEP] identifier[URLUtils] operator[SEP] identifier[clean] operator[SEP] identifier[href] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[res] operator[==] Other[null] operator[SEP] {
identifier[res] operator[=] Keyword[new] identifier[AttributesImpl] operator[SEP] identifier[atts] operator[SEP] operator[SEP]
}
identifier[res] operator[SEP] identifier[setValue] operator[SEP] identifier[res] operator[SEP] identifier[getIndex] operator[SEP] identifier[attrName] operator[SEP] , identifier[uri] operator[SEP] identifier[toASCIIString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[MessageUtils] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[attrName] , identifier[href] operator[SEP] operator[SEP] identifier[setLocation] operator[SEP] identifier[locator] operator[SEP] operator[+] literal[String] operator[+] identifier[uri] operator[SEP] identifier[toASCIIString] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[URISyntaxException] identifier[e1] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[MessageUtils] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[attrName] , identifier[href] operator[SEP] operator[SEP] identifier[setLocation] operator[SEP] identifier[locator] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP]
}
}
}
Keyword[return] identifier[res] operator[SEP]
}
|
void shutdown() {
m_isShutdown = true;
try {
int waitFor = 1 - Math.min(m_inFlight.availablePermits(), -4);
for (int i = 0; i < waitFor; ++i) {
try {
if (m_inFlight.tryAcquire(1, TimeUnit.SECONDS)) {
m_inFlight.release();
break;
}
} catch (InterruptedException e) {
break;
}
}
m_ecryptgw.die();
EncryptFrame frame = null;
while ((frame = m_encryptedFrames.poll()) != null) {
frame.frame.release();
}
for (EncryptFrame ef: m_partialMessages) {
ef.frame.release();
}
m_partialMessages.clear();
if (m_encryptedMessages.refCnt() > 0) m_encryptedMessages.release();
} finally {
m_inFlight.drainPermits();
m_inFlight.release();
}
} | class class_name[name] begin[{]
method[shutdown, return_type[void], modifier[default], parameter[]] begin[{]
assign[member[.m_isShutdown], literal[true]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=availablePermits, postfix_operators=[], prefix_operators=[], qualifier=m_inFlight, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=4)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operator=-), name=waitFor)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=SECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=tryAcquire, postfix_operators=[], prefix_operators=[], qualifier=m_inFlight, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=m_inFlight, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]))], catches=[CatchClause(block=[BreakStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=waitFor, 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=MethodInvocation(arguments=[], member=die, postfix_operators=[], prefix_operators=[], qualifier=m_ecryptgw, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=frame)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EncryptFrame, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=frame.frame, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=frame, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=m_encryptedFrames, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=ef.frame, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=m_partialMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EncryptFrame, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=m_partialMessages, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=refCnt, postfix_operators=[], prefix_operators=[], qualifier=m_encryptedMessages, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=m_encryptedMessages, selectors=[], type_arguments=None), label=None))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=drainPermits, postfix_operators=[], prefix_operators=[], qualifier=m_inFlight, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=m_inFlight, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[void] identifier[shutdown] operator[SEP] operator[SEP] {
identifier[m_isShutdown] operator[=] literal[boolean] operator[SEP] Keyword[try] {
Keyword[int] identifier[waitFor] operator[=] Other[1] operator[-] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[m_inFlight] operator[SEP] identifier[availablePermits] operator[SEP] operator[SEP] , operator[-] Other[4] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[waitFor] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[m_inFlight] operator[SEP] identifier[tryAcquire] operator[SEP] Other[1] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP] {
identifier[m_inFlight] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[break] operator[SEP]
}
}
identifier[m_ecryptgw] operator[SEP] identifier[die] operator[SEP] operator[SEP] operator[SEP] identifier[EncryptFrame] identifier[frame] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[frame] operator[=] identifier[m_encryptedFrames] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[frame] operator[SEP] identifier[frame] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[EncryptFrame] identifier[ef] operator[:] identifier[m_partialMessages] operator[SEP] {
identifier[ef] operator[SEP] identifier[frame] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
identifier[m_partialMessages] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_encryptedMessages] operator[SEP] identifier[refCnt] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[m_encryptedMessages] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[m_inFlight] operator[SEP] identifier[drainPermits] operator[SEP] operator[SEP] operator[SEP] identifier[m_inFlight] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static boolean compareNullableString(@Nullable String string, SoyValue other) {
// This is a parallel version of SharedRuntime.compareString except it can handle a null LHS.
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return Objects.equals(string, other.toString());
}
if (other instanceof NumberData) {
if (string == null) {
return false;
}
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | class class_name[name] begin[{]
method[compareNullableString, return_type[type[boolean]], modifier[public static], parameter[string, other]] begin[{]
if[binary_operation[binary_operation[member[.other], instanceof, type[StringData]], ||, binary_operation[member[.other], instanceof, type[SanitizedContent]]]] begin[{]
return[call[Objects.equals, parameter[member[.string], call[other.toString, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.other], instanceof, type[NumberData]]] begin[{]
if[binary_operation[member[.string], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=string, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseDouble, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=numberValue, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[], type_arguments=None), operator===), 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=nfe, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[compareNullableString] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[string] , identifier[SoyValue] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[other] Keyword[instanceof] identifier[StringData] operator[||] identifier[other] Keyword[instanceof] identifier[SanitizedContent] operator[SEP] {
Keyword[return] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[string] , identifier[other] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[other] Keyword[instanceof] identifier[NumberData] operator[SEP] {
Keyword[if] operator[SEP] identifier[string] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[string] operator[SEP] operator[==] identifier[other] operator[SEP] identifier[numberValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[nfe] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void unschedule() {
synchronized (mutex) {
if (pendingFuture != null && !pendingFuture.isDone() && !pendingFuture.isCancelled()) {
Log.v(Log.TAG_BATCHER, "%s: cancelling the pending future ...", this);
pendingFuture.cancel(false);
}
scheduled = false;
}
} | class class_name[name] begin[{]
method[unschedule, return_type[void], modifier[private], parameter[]] begin[{]
SYNCHRONIZED[member[.mutex]] BEGIN[{]
if[binary_operation[binary_operation[binary_operation[member[.pendingFuture], !=, literal[null]], &&, call[pendingFuture.isDone, parameter[]]], &&, call[pendingFuture.isCancelled, parameter[]]]] begin[{]
call[Log.v, parameter[member[Log.TAG_BATCHER], literal["%s: cancelling the pending future ..."], THIS[]]]
call[pendingFuture.cancel, parameter[literal[false]]]
else begin[{]
None
end[}]
assign[member[.scheduled], literal[false]]
END[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[unschedule] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[mutex] operator[SEP] {
Keyword[if] operator[SEP] identifier[pendingFuture] operator[!=] Other[null] operator[&&] operator[!] identifier[pendingFuture] operator[SEP] identifier[isDone] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[pendingFuture] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Log] operator[SEP] identifier[v] operator[SEP] identifier[Log] operator[SEP] identifier[TAG_BATCHER] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[pendingFuture] operator[SEP] identifier[cancel] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
identifier[scheduled] operator[=] literal[boolean] operator[SEP]
}
}
|
private int readPlaintextData(final ByteBuffer dst) {
final int sslRead;
final int pos = dst.position();
if (dst.isDirect()) {
sslRead = SSL.readFromSSL(ssl, bufferAddress(dst) + pos, dst.limit() - pos);
if (sslRead > 0) {
dst.position(pos + sslRead);
}
} else {
final int limit = dst.limit();
final int len = min(maxEncryptedPacketLength0(), limit - pos);
final ByteBuf buf = alloc.directBuffer(len);
try {
sslRead = SSL.readFromSSL(ssl, memoryAddress(buf), len);
if (sslRead > 0) {
dst.limit(pos + sslRead);
buf.getBytes(buf.readerIndex(), dst);
dst.limit(limit);
}
} finally {
buf.release();
}
}
return sslRead;
} | class class_name[name] begin[{]
method[readPlaintextData, return_type[type[int]], modifier[private], parameter[dst]] begin[{]
local_variable[type[int], sslRead]
local_variable[type[int], pos]
if[call[dst.isDirect, parameter[]]] begin[{]
assign[member[.sslRead], call[SSL.readFromSSL, parameter[member[.ssl], binary_operation[call[.bufferAddress, parameter[member[.dst]]], +, member[.pos]], binary_operation[call[dst.limit, parameter[]], -, member[.pos]]]]]
if[binary_operation[member[.sslRead], >, literal[0]]] begin[{]
call[dst.position, parameter[binary_operation[member[.pos], +, member[.sslRead]]]]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[int], limit]
local_variable[type[int], len]
local_variable[type[ByteBuf], buf]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sslRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ssl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=memoryAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFromSSL, postfix_operators=[], prefix_operators=[], qualifier=SSL, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=sslRead, 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=[BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sslRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=limit, postfix_operators=[], prefix_operators=[], qualifier=dst, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=readerIndex, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), MemberReference(member=dst, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=limit, postfix_operators=[], prefix_operators=[], qualifier=dst, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
return[member[.sslRead]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[readPlaintextData] operator[SEP] Keyword[final] identifier[ByteBuffer] identifier[dst] operator[SEP] {
Keyword[final] Keyword[int] identifier[sslRead] operator[SEP] Keyword[final] Keyword[int] identifier[pos] operator[=] identifier[dst] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dst] operator[SEP] identifier[isDirect] operator[SEP] operator[SEP] operator[SEP] {
identifier[sslRead] operator[=] identifier[SSL] operator[SEP] identifier[readFromSSL] operator[SEP] identifier[ssl] , identifier[bufferAddress] operator[SEP] identifier[dst] operator[SEP] operator[+] identifier[pos] , identifier[dst] operator[SEP] identifier[limit] operator[SEP] operator[SEP] operator[-] identifier[pos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sslRead] operator[>] Other[0] operator[SEP] {
identifier[dst] operator[SEP] identifier[position] operator[SEP] identifier[pos] operator[+] identifier[sslRead] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[final] Keyword[int] identifier[limit] operator[=] identifier[dst] operator[SEP] identifier[limit] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[len] operator[=] identifier[min] operator[SEP] identifier[maxEncryptedPacketLength0] operator[SEP] operator[SEP] , identifier[limit] operator[-] identifier[pos] operator[SEP] operator[SEP] Keyword[final] identifier[ByteBuf] identifier[buf] operator[=] identifier[alloc] operator[SEP] identifier[directBuffer] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[try] {
identifier[sslRead] operator[=] identifier[SSL] operator[SEP] identifier[readFromSSL] operator[SEP] identifier[ssl] , identifier[memoryAddress] operator[SEP] identifier[buf] operator[SEP] , identifier[len] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sslRead] operator[>] Other[0] operator[SEP] {
identifier[dst] operator[SEP] identifier[limit] operator[SEP] identifier[pos] operator[+] identifier[sslRead] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[getBytes] operator[SEP] identifier[buf] operator[SEP] identifier[readerIndex] operator[SEP] operator[SEP] , identifier[dst] operator[SEP] operator[SEP] identifier[dst] operator[SEP] identifier[limit] operator[SEP] identifier[limit] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[buf] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[sslRead] operator[SEP]
}
|
public static DatabaseType getDatabaseType(final String url) {
switch (getDriverClassName(url)) {
case "com.mysql.cj.jdbc.Driver":
case "com.mysql.jdbc.Driver":
return DatabaseType.MySQL;
case "org.postgresql.Driver":
return DatabaseType.PostgreSQL;
case "oracle.jdbc.driver.OracleDriver":
return DatabaseType.Oracle;
case "com.microsoft.sqlserver.jdbc.SQLServerDriver":
return DatabaseType.SQLServer;
case "org.h2.Driver":
return DatabaseType.H2;
default:
throw new ShardingException("Cannot resolve JDBC url `%s`", url);
}
} | class class_name[name] begin[{]
method[getDatabaseType, return_type[type[DatabaseType]], modifier[public static], parameter[url]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.mysql.cj.jdbc.Driver"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.mysql.jdbc.Driver")], statements=[ReturnStatement(expression=MemberReference(member=MySQL, postfix_operators=[], prefix_operators=[], qualifier=DatabaseType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.postgresql.Driver")], statements=[ReturnStatement(expression=MemberReference(member=PostgreSQL, postfix_operators=[], prefix_operators=[], qualifier=DatabaseType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="oracle.jdbc.driver.OracleDriver")], statements=[ReturnStatement(expression=MemberReference(member=Oracle, postfix_operators=[], prefix_operators=[], qualifier=DatabaseType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.microsoft.sqlserver.jdbc.SQLServerDriver")], statements=[ReturnStatement(expression=MemberReference(member=SQLServer, postfix_operators=[], prefix_operators=[], qualifier=DatabaseType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.h2.Driver")], statements=[ReturnStatement(expression=MemberReference(member=H2, postfix_operators=[], prefix_operators=[], qualifier=DatabaseType, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot resolve JDBC url `%s`"), MemberReference(member=url, 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=ShardingException, sub_type=None)), label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDriverClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DatabaseType] identifier[getDatabaseType] operator[SEP] Keyword[final] identifier[String] identifier[url] operator[SEP] {
Keyword[switch] operator[SEP] identifier[getDriverClassName] operator[SEP] identifier[url] operator[SEP] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[return] identifier[DatabaseType] operator[SEP] identifier[MySQL] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[DatabaseType] operator[SEP] identifier[PostgreSQL] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[DatabaseType] operator[SEP] identifier[Oracle] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[DatabaseType] operator[SEP] identifier[SQLServer] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[DatabaseType] operator[SEP] identifier[H2] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[ShardingException] operator[SEP] literal[String] , identifier[url] operator[SEP] operator[SEP]
}
}
|
public void setConsumerDispatcherStateFilter(ConsumerDispatcherState consumerDispatcherState)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "setConsumerDispatcherStateFilter", consumerDispatcherState);
this._consumerDispatcherState = consumerDispatcherState;
this._subscriptionId = null;
this._destination = null;
if (tc.isEntryEnabled())
SibTr.exit(tc, "setConsumerDispatcherStateFilter");
} | class class_name[name] begin[{]
method[setConsumerDispatcherStateFilter, return_type[void], modifier[public], parameter[consumerDispatcherState]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["setConsumerDispatcherStateFilter"], member[.consumerDispatcherState]]]
else begin[{]
None
end[}]
assign[THIS[member[None._consumerDispatcherState]], member[.consumerDispatcherState]]
assign[THIS[member[None._subscriptionId]], literal[null]]
assign[THIS[member[None._destination]], literal[null]]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["setConsumerDispatcherStateFilter"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setConsumerDispatcherStateFilter] operator[SEP] identifier[ConsumerDispatcherState] identifier[consumerDispatcherState] operator[SEP] {
Keyword[if] operator[SEP] 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[consumerDispatcherState] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[_consumerDispatcherState] operator[=] identifier[consumerDispatcherState] operator[SEP] Keyword[this] operator[SEP] identifier[_subscriptionId] operator[=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[_destination] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] 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 loadExtraFiles(final String filterPrefix, final boolean preserveExisting) {
Map<String, String> view = Maps.filterKeys(this, Predicates.startsWith(filterPrefix));
while (true) {
if (view.isEmpty()) {
break;
}
Queue<String> fileKeys = Queues.newArrayDeque(view.values());
// we need to keep them separately in order to be able to reload them (see put method)
extraFileProperties.addAll(fileKeys);
// Remove original keys in order to prevent a stack overflow
view.clear();
for (String fileNameKey = null; (fileNameKey = fileKeys.poll()) != null;) {
// Recursion
String fileName = processPropertyValue(fileNameKey);
if (PLACEHOLDER_PATTERN.matcher(fileName).find()) {
// not all placeholders were resolved, so we enqueue it again to process another file first
fileKeys.offer(fileName);
} else {
load(fileName, preserveExisting);
}
}
}
} | class class_name[name] begin[{]
method[loadExtraFiles, return_type[void], modifier[private], parameter[filterPrefix, preserveExisting]] begin[{]
local_variable[type[Map], view]
while[literal[true]] begin[{]
if[call[view.isEmpty, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[Queue], fileKeys]
call[extraFileProperties.addAll, parameter[member[.fileKeys]]]
call[view.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fileNameKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processPropertyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=fileName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=PLACEHOLDER_PATTERN, selectors=[MethodInvocation(arguments=[], member=find, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=preserveExisting, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=offer, postfix_operators=[], prefix_operators=[], qualifier=fileKeys, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=fileNameKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=fileKeys, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=fileNameKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), update=None), label=None)
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[loadExtraFiles] operator[SEP] Keyword[final] identifier[String] identifier[filterPrefix] , Keyword[final] Keyword[boolean] identifier[preserveExisting] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[view] operator[=] identifier[Maps] operator[SEP] identifier[filterKeys] operator[SEP] Keyword[this] , identifier[Predicates] operator[SEP] identifier[startsWith] operator[SEP] identifier[filterPrefix] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[view] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[Queue] operator[<] identifier[String] operator[>] identifier[fileKeys] operator[=] identifier[Queues] operator[SEP] identifier[newArrayDeque] operator[SEP] identifier[view] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[extraFileProperties] operator[SEP] identifier[addAll] operator[SEP] identifier[fileKeys] operator[SEP] operator[SEP] identifier[view] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[fileNameKey] operator[=] Other[null] operator[SEP] operator[SEP] identifier[fileNameKey] operator[=] identifier[fileKeys] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[String] identifier[fileName] operator[=] identifier[processPropertyValue] operator[SEP] identifier[fileNameKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[PLACEHOLDER_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[fileKeys] operator[SEP] identifier[offer] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[load] operator[SEP] identifier[fileName] , identifier[preserveExisting] operator[SEP] operator[SEP]
}
}
}
}
|
public FeatureManager build() {
Validate.notBlank(name, "No name specified");
Validate.notNull(featureProvider, "No feature provider specified");
Validate.notNull(stateRepository, "No state repository specified");
Validate.notNull(userProvider, "No user provider specified");
Validate.notNull(strategyProvider, "No activation strategy provider specified");
return new DefaultFeatureManager(name, featureProvider, stateRepository, userProvider, strategyProvider);
} | class class_name[name] begin[{]
method[build, return_type[type[FeatureManager]], modifier[public], parameter[]] begin[{]
call[Validate.notBlank, parameter[member[.name], literal["No name specified"]]]
call[Validate.notNull, parameter[member[.featureProvider], literal["No feature provider specified"]]]
call[Validate.notNull, parameter[member[.stateRepository], literal["No state repository specified"]]]
call[Validate.notNull, parameter[member[.userProvider], literal["No user provider specified"]]]
call[Validate.notNull, parameter[member[.strategyProvider], literal["No activation strategy provider specified"]]]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stateRepository, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=userProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strategyProvider, 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=DefaultFeatureManager, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[FeatureManager] identifier[build] operator[SEP] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notBlank] operator[SEP] identifier[name] , literal[String] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[featureProvider] , literal[String] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[stateRepository] , literal[String] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[userProvider] , literal[String] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[strategyProvider] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[DefaultFeatureManager] operator[SEP] identifier[name] , identifier[featureProvider] , identifier[stateRepository] , identifier[userProvider] , identifier[strategyProvider] operator[SEP] operator[SEP]
}
|
public void setAvatar(URL avatarURL) {
byte[] bytes = new byte[0];
try {
bytes = getBytes(avatarURL);
}
catch (IOException e) {
LOGGER.log(Level.SEVERE, "Error getting bytes from URL: " + avatarURL, e);
}
setAvatar(bytes);
} | class class_name[name] begin[{]
method[setAvatar, return_type[void], modifier[public], parameter[avatarURL]] begin[{]
local_variable[type[byte], bytes]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=avatarURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error getting bytes from URL: "), operandr=MemberReference(member=avatarURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
call[.setAvatar, parameter[member[.bytes]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAvatar] operator[SEP] identifier[URL] identifier[avatarURL] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[try] {
identifier[bytes] operator[=] identifier[getBytes] operator[SEP] identifier[avatarURL] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] operator[+] identifier[avatarURL] , identifier[e] operator[SEP] operator[SEP]
}
identifier[setAvatar] operator[SEP] identifier[bytes] operator[SEP] operator[SEP]
}
|
@Override
public String getSqlWithValues() {
if( namedParameterValues.size() == 0 ) {
return super.getSqlWithValues();
}
/*
If named parameters were used, it is no longer possible to simply replace the placeholders in the
original statement with the values of the bind variables. The only way it could be done is if the names
could be resolved by to the ordinal positions which is not possible on all databases.
New log format: <original statement> name:value, name:value
Example: {? = call test_proc(?,?)} param1:value1, param2:value2, param3:value3
In the event that ordinal and named parameters are both used, the original position will be used as the name.
Example: {? = call test_proc(?,?)} 1:value1, 3:value3, param2:value2
*/
final StringBuilder result = new StringBuilder();
final String statementQuery = getStatementQuery();
// first append the original statement
result.append(statementQuery);
result.append(" ");
StringBuilder parameters = new StringBuilder();
// add parameters set with ordinal positions
for( Map.Entry<Integer, Value> entry : getParameterValues().entrySet() ) {
appendParameter(parameters, entry.getKey().toString(), entry.getValue());
}
// add named parameters
for( Map.Entry<String, Value> entry : namedParameterValues.entrySet() ) {
appendParameter(parameters, entry.getKey(), entry.getValue());
}
result.append(parameters);
return result.toString();
} | class class_name[name] begin[{]
method[getSqlWithValues, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[namedParameterValues.size, parameter[]], ==, literal[0]]] begin[{]
return[SuperMethodInvocation(arguments=[], member=getSqlWithValues, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], result]
local_variable[type[String], statementQuery]
call[result.append, parameter[member[.statementQuery]]]
call[result.append, parameter[literal[" "]]]
local_variable[type[StringBuilder], parameters]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=appendParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParameterValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=entrySet, 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=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=appendParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=namedParameterValues, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[result.append, parameter[member[.parameters]]]
return[call[result.toString, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getSqlWithValues] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[namedParameterValues] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Keyword[super] operator[SEP] identifier[getSqlWithValues] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[statementQuery] operator[=] identifier[getStatementQuery] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[statementQuery] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[parameters] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[Value] operator[>] identifier[entry] operator[:] identifier[getParameterValues] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[appendParameter] operator[SEP] identifier[parameters] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Value] operator[>] identifier[entry] operator[:] identifier[namedParameterValues] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[appendParameter] operator[SEP] identifier[parameters] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[parameters] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void applyCamera(GL2 gl) {
// Setup projection.
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45f, // fov,
width / (float) height, // ratio
0.f, 10.f); // near, far clipping
eye[0] = (float) Math.sin(theta) * 2.f;
eye[1] = .5f;
eye[2] = (float) Math.cos(theta) * 2.f;
glu.gluLookAt(eye[0], eye[1], eye[2], // eye
.0f, .0f, 0.f, // center
0.f, 1.f, 0.f); // up
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glViewport(0, 0, width, height);
} | class class_name[name] begin[{]
method[applyCamera, return_type[void], modifier[public], parameter[gl]] begin[{]
call[gl.glMatrixMode, parameter[member[GL2.GL_PROJECTION]]]
call[gl.glLoadIdentity, parameter[]]
call[glu.gluPerspective, parameter[literal[45f], binary_operation[member[.width], /, Cast(expression=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=float))], literal[0.f], literal[10.f]]]
assign[member[.eye], binary_operation[Cast(expression=MethodInvocation(arguments=[MemberReference(member=theta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sin, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float)), *, literal[2.f]]]
assign[member[.eye], literal[.5f]]
assign[member[.eye], binary_operation[Cast(expression=MethodInvocation(arguments=[MemberReference(member=theta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cos, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float)), *, literal[2.f]]]
call[glu.gluLookAt, parameter[member[.eye], member[.eye], member[.eye], literal[.0f], literal[.0f], literal[0.f], literal[0.f], literal[1.f], literal[0.f]]]
call[gl.glMatrixMode, parameter[member[GL2.GL_MODELVIEW]]]
call[gl.glLoadIdentity, parameter[]]
call[gl.glViewport, parameter[literal[0], literal[0], member[.width], member[.height]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[applyCamera] operator[SEP] identifier[GL2] identifier[gl] operator[SEP] {
identifier[gl] operator[SEP] identifier[glMatrixMode] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_PROJECTION] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glLoadIdentity] operator[SEP] operator[SEP] operator[SEP] identifier[glu] operator[SEP] identifier[gluPerspective] operator[SEP] literal[Float] , identifier[width] operator[/] operator[SEP] Keyword[float] operator[SEP] identifier[height] , literal[Float] , literal[Float] operator[SEP] operator[SEP] identifier[eye] operator[SEP] Other[0] operator[SEP] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[theta] operator[SEP] operator[*] literal[Float] operator[SEP] identifier[eye] operator[SEP] Other[1] operator[SEP] operator[=] literal[Float] operator[SEP] identifier[eye] operator[SEP] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[theta] operator[SEP] operator[*] literal[Float] operator[SEP] identifier[glu] operator[SEP] identifier[gluLookAt] operator[SEP] identifier[eye] operator[SEP] Other[0] operator[SEP] , identifier[eye] operator[SEP] Other[1] operator[SEP] , identifier[eye] operator[SEP] Other[2] operator[SEP] , literal[Float] , literal[Float] , literal[Float] , literal[Float] , literal[Float] , literal[Float] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glMatrixMode] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_MODELVIEW] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glLoadIdentity] operator[SEP] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glViewport] operator[SEP] Other[0] , Other[0] , identifier[width] , identifier[height] operator[SEP] operator[SEP]
}
|
public static byte[] encodeInitialContextToken(InitialContextToken authToken, Codec codec) {
byte[] out;
Any any = ORB.init().create_any();
InitialContextTokenHelper.insert(any, authToken);
try {
out = codec.encode_value(any);
} catch (Exception e) {
return new byte[0];
}
int length = out.length + gssUpMechOidArray.length;
int n;
if (length < (1 << 7)) {
n = 0;
} else if (length < (1 << 8)) {
n = 1;
} else if (length < (1 << 16)) {
n = 2;
} else if (length < (1 << 24)) {
n = 3;
} else {// if (length < (1 << 32))
n = 4;
}
byte[] encodedToken = new byte[2 + n + length];
encodedToken[0] = 0x60;
if (n == 0) {
encodedToken[1] = (byte) length;
} else {
encodedToken[1] = (byte) (n | 0x80);
switch (n) {
case 1:
encodedToken[2] = (byte) length;
break;
case 2:
encodedToken[2] = (byte) (length >> 8);
encodedToken[3] = (byte) length;
break;
case 3:
encodedToken[2] = (byte) (length >> 16);
encodedToken[3] = (byte) (length >> 8);
encodedToken[4] = (byte) length;
break;
default: // case 4:
encodedToken[2] = (byte) (length >> 24);
encodedToken[3] = (byte) (length >> 16);
encodedToken[4] = (byte) (length >> 8);
encodedToken[5] = (byte) length;
}
}
System.arraycopy(gssUpMechOidArray, 0, encodedToken, 2 + n, gssUpMechOidArray.length);
System.arraycopy(out, 0, encodedToken, 2 + n + gssUpMechOidArray.length, out.length);
return encodedToken;
} | class class_name[name] begin[{]
method[encodeInitialContextToken, return_type[type[byte]], modifier[public static], parameter[authToken, codec]] begin[{]
local_variable[type[byte], out]
local_variable[type[Any], any]
call[InitialContextTokenHelper.insert, parameter[member[.any], member[.authToken]]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=any, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode_value, postfix_operators=[], prefix_operators=[], qualifier=codec, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[int], length]
local_variable[type[int], n]
if[binary_operation[member[.length], <, binary_operation[literal[1], <<, literal[7]]]] begin[{]
assign[member[.n], literal[0]]
else begin[{]
if[binary_operation[member[.length], <, binary_operation[literal[1], <<, literal[8]]]] begin[{]
assign[member[.n], literal[1]]
else begin[{]
if[binary_operation[member[.length], <, binary_operation[literal[1], <<, literal[16]]]] begin[{]
assign[member[.n], literal[2]]
else begin[{]
if[binary_operation[member[.length], <, binary_operation[literal[1], <<, literal[24]]]] begin[{]
assign[member[.n], literal[3]]
else begin[{]
assign[member[.n], literal[4]]
end[}]
end[}]
end[}]
end[}]
local_variable[type[byte], encodedToken]
assign[member[.encodedToken], literal[0x60]]
if[binary_operation[member[.n], ==, literal[0]]] begin[{]
assign[member[.encodedToken], Cast(expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]
else begin[{]
assign[member[.encodedToken], Cast(expression=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x80), operator=|), type=BasicType(dimensions=[], name=byte))]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), type==, value=Cast(expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))]), type==, value=Cast(expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4))]), type==, value=Cast(expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operator=>>), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4))]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=encodedToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5))]), type==, value=Cast(expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None)])], expression=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
call[System.arraycopy, parameter[member[.gssUpMechOidArray], literal[0], member[.encodedToken], binary_operation[literal[2], +, member[.n]], member[gssUpMechOidArray.length]]]
call[System.arraycopy, parameter[member[.out], literal[0], member[.encodedToken], binary_operation[binary_operation[literal[2], +, member[.n]], +, member[gssUpMechOidArray.length]], member[out.length]]]
return[member[.encodedToken]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[encodeInitialContextToken] operator[SEP] identifier[InitialContextToken] identifier[authToken] , identifier[Codec] identifier[codec] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[Any] identifier[any] operator[=] identifier[ORB] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP] identifier[create_any] operator[SEP] operator[SEP] operator[SEP] identifier[InitialContextTokenHelper] operator[SEP] identifier[insert] operator[SEP] identifier[any] , identifier[authToken] operator[SEP] operator[SEP] Keyword[try] {
identifier[out] operator[=] identifier[codec] operator[SEP] identifier[encode_value] operator[SEP] identifier[any] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] Keyword[new] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[int] identifier[length] operator[=] identifier[out] operator[SEP] identifier[length] operator[+] identifier[gssUpMechOidArray] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[n] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[<] operator[SEP] Other[1] operator[<<] Other[7] operator[SEP] operator[SEP] {
identifier[n] operator[=] Other[0] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[length] operator[<] operator[SEP] Other[1] operator[<<] Other[8] operator[SEP] operator[SEP] {
identifier[n] operator[=] Other[1] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[length] operator[<] operator[SEP] Other[1] operator[<<] Other[16] operator[SEP] operator[SEP] {
identifier[n] operator[=] Other[2] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[length] operator[<] operator[SEP] Other[1] operator[<<] Other[24] operator[SEP] operator[SEP] {
identifier[n] operator[=] Other[3] operator[SEP]
}
Keyword[else] {
identifier[n] operator[=] Other[4] operator[SEP]
}
Keyword[byte] operator[SEP] operator[SEP] identifier[encodedToken] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[2] operator[+] identifier[n] operator[+] identifier[length] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[0] operator[SEP] operator[=] literal[Integer] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[==] Other[0] operator[SEP] {
identifier[encodedToken] operator[SEP] Other[1] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[length] operator[SEP]
}
Keyword[else] {
identifier[encodedToken] operator[SEP] Other[1] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[|] literal[Integer] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[n] operator[SEP] {
Keyword[case] Other[1] operator[:] identifier[encodedToken] operator[SEP] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[length] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] identifier[encodedToken] operator[SEP] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[length] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[3] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[length] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[3] operator[:] identifier[encodedToken] operator[SEP] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[length] operator[>] operator[>] Other[16] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[3] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[length] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[4] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[length] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[encodedToken] operator[SEP] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[length] operator[>] operator[>] Other[24] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[3] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[length] operator[>] operator[>] Other[16] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[4] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[length] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[encodedToken] operator[SEP] Other[5] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[length] operator[SEP]
}
}
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[gssUpMechOidArray] , Other[0] , identifier[encodedToken] , Other[2] operator[+] identifier[n] , identifier[gssUpMechOidArray] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[out] , Other[0] , identifier[encodedToken] , Other[2] operator[+] identifier[n] operator[+] identifier[gssUpMechOidArray] operator[SEP] identifier[length] , identifier[out] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[encodedToken] operator[SEP]
}
|
private void addOp(String op, String path, String value) {
if (this.operations == null) {
this.operations = new JsonArray();
}
this.operations.add(new JsonObject()
.add("op", op)
.add("path", path)
.add("value", value));
} | class class_name[name] begin[{]
method[addOp, return_type[void], modifier[private], parameter[op, path, value]] begin[{]
if[binary_operation[THIS[member[None.operations]], ==, literal[null]]] begin[{]
assign[THIS[member[None.operations]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonArray, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.operations]call[None.add, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="op"), MemberReference(member=op, 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="path"), MemberReference(member=path, 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="value"), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JsonObject, sub_type=None))]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addOp] operator[SEP] identifier[String] identifier[op] , identifier[String] identifier[path] , identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[operations] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[operations] operator[=] Keyword[new] identifier[JsonArray] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[operations] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[op] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[path] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean isLuceneIndex(String indexName) {
I_CmsSearchIndex i = OpenCms.getSearchManager().getIndex(indexName);
return (i instanceof CmsSearchIndex) && (!(i instanceof CmsSolrIndex));
} | class class_name[name] begin[{]
method[isLuceneIndex, return_type[type[boolean]], modifier[public static], parameter[indexName]] begin[{]
local_variable[type[I_CmsSearchIndex], i]
return[binary_operation[binary_operation[member[.i], instanceof, type[CmsSearchIndex]], &&, binary_operation[member[.i], instanceof, type[CmsSolrIndex]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isLuceneIndex] operator[SEP] identifier[String] identifier[indexName] operator[SEP] {
identifier[I_CmsSearchIndex] identifier[i] operator[=] identifier[OpenCms] operator[SEP] identifier[getSearchManager] operator[SEP] operator[SEP] operator[SEP] identifier[getIndex] operator[SEP] identifier[indexName] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[i] Keyword[instanceof] identifier[CmsSearchIndex] operator[SEP] operator[&&] operator[SEP] operator[!] operator[SEP] identifier[i] Keyword[instanceof] identifier[CmsSolrIndex] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void validateColorCode(String code) {
Preconditions.checkNotEmpty(code, "color code is empty");
Integer numericColorCode = Integer.valueOf(code);
boolean isColorCodeValid = numericColorCode > 0 && numericColorCode < 257;
if (!isColorCodeValid) {
throw new IllegalArgumentException("color code should be a number between 1 and 256");
}
} | class class_name[name] begin[{]
method[validateColorCode, return_type[void], modifier[public], parameter[code]] begin[{]
call[Preconditions.checkNotEmpty, parameter[member[.code], literal["color code is empty"]]]
local_variable[type[Integer], numericColorCode]
local_variable[type[boolean], isColorCodeValid]
if[member[.isColorCodeValid]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="color code should be a number between 1 and 256")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[validateColorCode] operator[SEP] identifier[String] identifier[code] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotEmpty] operator[SEP] identifier[code] , literal[String] operator[SEP] operator[SEP] identifier[Integer] identifier[numericColorCode] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[code] operator[SEP] operator[SEP] Keyword[boolean] identifier[isColorCodeValid] operator[=] identifier[numericColorCode] operator[>] Other[0] operator[&&] identifier[numericColorCode] operator[<] Other[257] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isColorCodeValid] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
@Nullable
@SuppressWarnings("unchecked") // findPathToEnclosing guarantees that the type is from |classes|
@SafeVarargs
public final <T extends Tree> T findEnclosing(Class<? extends T>... classes) {
TreePath pathToEnclosing = findPathToEnclosing(classes);
return (pathToEnclosing == null) ? null : (T) pathToEnclosing.getLeaf();
} | class class_name[name] begin[{]
method[findEnclosing, return_type[type[T]], modifier[final public], parameter[classes]] begin[{]
local_variable[type[TreePath], pathToEnclosing]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=pathToEnclosing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=Cast(expression=MethodInvocation(arguments=[], member=getLeaf, postfix_operators=[], prefix_operators=[], qualifier=pathToEnclosing, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | annotation[@] identifier[Nullable] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[SafeVarargs] Keyword[public] Keyword[final] operator[<] identifier[T] Keyword[extends] identifier[Tree] operator[>] identifier[T] identifier[findEnclosing] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[...] identifier[classes] operator[SEP] {
identifier[TreePath] identifier[pathToEnclosing] operator[=] identifier[findPathToEnclosing] operator[SEP] identifier[classes] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[pathToEnclosing] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] operator[SEP] identifier[T] operator[SEP] identifier[pathToEnclosing] operator[SEP] identifier[getLeaf] operator[SEP] operator[SEP] operator[SEP]
}
|
public static MediaType create(String type, String subtype) {
MediaType mediaType = create(type, subtype, ImmutableListMultimap.<String, String>of());
mediaType.parsedCharset = Optional.absent();
return mediaType;
} | class class_name[name] begin[{]
method[create, return_type[type[MediaType]], modifier[public static], parameter[type, subtype]] begin[{]
local_variable[type[MediaType], mediaType]
assign[member[mediaType.parsedCharset], call[Optional.absent, parameter[]]]
return[member[.mediaType]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MediaType] identifier[create] operator[SEP] identifier[String] identifier[type] , identifier[String] identifier[subtype] operator[SEP] {
identifier[MediaType] identifier[mediaType] operator[=] identifier[create] operator[SEP] identifier[type] , identifier[subtype] , identifier[ImmutableListMultimap] operator[SEP] operator[<] identifier[String] , identifier[String] operator[>] identifier[of] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mediaType] operator[SEP] identifier[parsedCharset] operator[=] identifier[Optional] operator[SEP] identifier[absent] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[mediaType] operator[SEP]
}
|
@ManagedAttribute()
public List<String> getEffectiveProperties() {
final List<String> properties = new LinkedList<String>();
for (final String key : myProperties.stringPropertyNames()) {
properties.add(key + "=" + myProperties.get(key));
}
return properties;
} | class class_name[name] begin[{]
method[getEffectiveProperties, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], properties]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=myProperties, selectors=[], type_arguments=None), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=stringPropertyNames, postfix_operators=[], prefix_operators=[], qualifier=myProperties, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.properties]]
end[}]
END[}] | annotation[@] identifier[ManagedAttribute] operator[SEP] operator[SEP] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getEffectiveProperties] operator[SEP] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[properties] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[:] identifier[myProperties] operator[SEP] identifier[stringPropertyNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[properties] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[+] literal[String] operator[+] identifier[myProperties] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[properties] operator[SEP]
}
|
public static double digamma(double x)
{
if(x == 0)
return Double.NaN;//complex infinity
else if(x < 0)//digamma(1-x) == digamma(x)+pi/tan(pi*x), to make x positive
{
if(Math.rint(x) == x)
return Double.NaN;//the zeros are complex infinity
return digamma(1-x)-PI/tan(PI*x);
}
/*
* shift over 2 values to the left and use truncated approximation
* log(x+2)-1/(2 (x+2))-1/(12 (x+2)^2) -1/x-1/(x+1),
* the x+2 and x and x+1 are grouped sepratly
*/
double xp2 = x+2;
return log(xp2)-(6*x+13)/(12*xp2*xp2)-(2*x+1)/(x*x+x);
} | class class_name[name] begin[{]
method[digamma, return_type[type[double]], modifier[public static], parameter[x]] begin[{]
if[binary_operation[member[.x], ==, literal[0]]] begin[{]
return[member[Double.NaN]]
else begin[{]
if[binary_operation[member[.x], <, literal[0]]] begin[{]
if[binary_operation[call[Math.rint, parameter[member[.x]]], ==, member[.x]]] begin[{]
return[member[Double.NaN]]
else begin[{]
None
end[}]
return[binary_operation[call[.digamma, parameter[binary_operation[literal[1], -, member[.x]]]], -, binary_operation[member[.PI], /, call[.tan, parameter[binary_operation[member[.PI], *, member[.x]]]]]]]
else begin[{]
None
end[}]
end[}]
local_variable[type[double], xp2]
return[binary_operation[binary_operation[call[.log, parameter[member[.xp2]]], -, binary_operation[binary_operation[binary_operation[literal[6], *, member[.x]], +, literal[13]], /, binary_operation[binary_operation[literal[12], *, member[.xp2]], *, member[.xp2]]]], -, binary_operation[binary_operation[binary_operation[literal[2], *, member[.x]], +, literal[1]], /, binary_operation[binary_operation[member[.x], *, member[.x]], +, member[.x]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[digamma] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[if] operator[SEP] identifier[x] operator[==] Other[0] operator[SEP] Keyword[return] identifier[Double] operator[SEP] identifier[NaN] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[x] operator[<] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[rint] operator[SEP] identifier[x] operator[SEP] operator[==] identifier[x] operator[SEP] Keyword[return] identifier[Double] operator[SEP] identifier[NaN] operator[SEP] Keyword[return] identifier[digamma] operator[SEP] Other[1] operator[-] identifier[x] operator[SEP] operator[-] identifier[PI] operator[/] identifier[tan] operator[SEP] identifier[PI] operator[*] identifier[x] operator[SEP] operator[SEP]
}
Keyword[double] identifier[xp2] operator[=] identifier[x] operator[+] Other[2] operator[SEP] Keyword[return] identifier[log] operator[SEP] identifier[xp2] operator[SEP] operator[-] operator[SEP] Other[6] operator[*] identifier[x] operator[+] Other[13] operator[SEP] operator[/] operator[SEP] Other[12] operator[*] identifier[xp2] operator[*] identifier[xp2] operator[SEP] operator[-] operator[SEP] Other[2] operator[*] identifier[x] operator[+] Other[1] operator[SEP] operator[/] operator[SEP] identifier[x] operator[*] identifier[x] operator[+] identifier[x] operator[SEP] operator[SEP]
}
|
private void writeIlinkArgs(final PropertyWriter writer, final String linkID, final String[] args)
throws SAXException {
for (final String arg : args) {
if (arg.charAt(0) == '/' || arg.charAt(0) == '-') {
final int equalsPos = arg.indexOf('=');
if (equalsPos > 0) {
final String option = "option." + arg.substring(0, equalsPos - 1);
writer.write(linkID, option + ".enabled", "1");
writer.write(linkID, option + ".value", arg.substring(equalsPos + 1));
} else {
writer.write(linkID, "option." + arg.substring(1) + ".enabled", "1");
}
}
}
} | class class_name[name] begin[{]
method[writeIlinkArgs, return_type[void], modifier[private], parameter[writer, linkID, args]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='=')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), name=equalsPos)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=equalsPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=linkID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="option."), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".enabled"), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="option."), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MemberReference(member=equalsPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None), operator=+), name=option)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=linkID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=option, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".enabled"), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=linkID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=option, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".value"), operator=+), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=equalsPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=arg)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeIlinkArgs] operator[SEP] Keyword[final] identifier[PropertyWriter] identifier[writer] , Keyword[final] identifier[String] identifier[linkID] , Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[SAXException] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[arg] operator[:] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[arg] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[||] identifier[arg] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[SEP] {
Keyword[final] Keyword[int] identifier[equalsPos] operator[=] identifier[arg] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[equalsPos] operator[>] Other[0] operator[SEP] {
Keyword[final] identifier[String] identifier[option] operator[=] literal[String] operator[+] identifier[arg] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[equalsPos] operator[-] Other[1] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[linkID] , identifier[option] operator[+] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[linkID] , identifier[option] operator[+] literal[String] , identifier[arg] operator[SEP] identifier[substring] operator[SEP] identifier[equalsPos] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[linkID] , literal[String] operator[+] identifier[arg] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[+] literal[String] , literal[String] operator[SEP] operator[SEP]
}
}
}
}
|
private boolean netscapeDomainMatches(final String domain, final String host) {
if (domain == null || host == null) {
return false;
}
// if there's no embedded dot in domain and domain is not .local
boolean isLocalDomain = ".local".equalsIgnoreCase(domain);
int embeddedDotInDomain = domain.indexOf('.');
if (embeddedDotInDomain == 0) {
embeddedDotInDomain = domain.indexOf('.', 1);
}
if (!isLocalDomain && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1)) {
return false;
}
// if the host name contains no dot and the domain name is .local
int firstDotInHost = host.indexOf('.');
if (firstDotInHost == -1 && isLocalDomain) {
return true;
}
int domainLength = domain.length();
int lengthDiff = host.length() - domainLength;
if (lengthDiff == 0) {
// if the host name and the domain name are just string-compare euqal
return host.equalsIgnoreCase(domain);
}
else if (lengthDiff > 0) {
// need to check H & D component
String H = host.substring(0, lengthDiff);
String D = host.substring(lengthDiff);
return (D.equalsIgnoreCase(domain));
}
else if (lengthDiff == -1) {
// if domain is actually .host
return (domain.charAt(0) == '.' &&
host.equalsIgnoreCase(domain.substring(1)));
}
return false;
} | class class_name[name] begin[{]
method[netscapeDomainMatches, return_type[type[boolean]], modifier[private], parameter[domain, host]] begin[{]
if[binary_operation[binary_operation[member[.domain], ==, literal[null]], ||, binary_operation[member[.host], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[boolean], isLocalDomain]
local_variable[type[int], embeddedDotInDomain]
if[binary_operation[member[.embeddedDotInDomain], ==, literal[0]]] begin[{]
assign[member[.embeddedDotInDomain], call[domain.indexOf, parameter[literal['.'], literal[1]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.isLocalDomain], &&, binary_operation[binary_operation[member[.embeddedDotInDomain], ==, literal[1]], ||, binary_operation[member[.embeddedDotInDomain], ==, binary_operation[call[domain.length, parameter[]], -, literal[1]]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], firstDotInHost]
if[binary_operation[binary_operation[member[.firstDotInHost], ==, literal[1]], &&, member[.isLocalDomain]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[int], domainLength]
local_variable[type[int], lengthDiff]
if[binary_operation[member[.lengthDiff], ==, literal[0]]] begin[{]
return[call[host.equalsIgnoreCase, parameter[member[.domain]]]]
else begin[{]
if[binary_operation[member[.lengthDiff], >, literal[0]]] begin[{]
local_variable[type[String], H]
local_variable[type[String], D]
return[call[D.equalsIgnoreCase, parameter[member[.domain]]]]
else begin[{]
if[binary_operation[member[.lengthDiff], ==, literal[1]]] begin[{]
return[binary_operation[binary_operation[call[domain.charAt, parameter[literal[0]]], ==, literal['.']], &&, call[host.equalsIgnoreCase, parameter[call[domain.substring, parameter[literal[1]]]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[netscapeDomainMatches] operator[SEP] Keyword[final] identifier[String] identifier[domain] , Keyword[final] identifier[String] identifier[host] operator[SEP] {
Keyword[if] operator[SEP] identifier[domain] operator[==] Other[null] operator[||] identifier[host] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[isLocalDomain] operator[=] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[domain] operator[SEP] operator[SEP] Keyword[int] identifier[embeddedDotInDomain] operator[=] identifier[domain] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[embeddedDotInDomain] operator[==] Other[0] operator[SEP] {
identifier[embeddedDotInDomain] operator[=] identifier[domain] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , Other[1] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[isLocalDomain] operator[&&] operator[SEP] identifier[embeddedDotInDomain] operator[==] operator[-] Other[1] operator[||] identifier[embeddedDotInDomain] operator[==] identifier[domain] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[firstDotInHost] operator[=] identifier[host] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstDotInHost] operator[==] operator[-] Other[1] operator[&&] identifier[isLocalDomain] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[domainLength] operator[=] identifier[domain] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[lengthDiff] operator[=] identifier[host] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[domainLength] operator[SEP] Keyword[if] operator[SEP] identifier[lengthDiff] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[host] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[domain] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lengthDiff] operator[>] Other[0] operator[SEP] {
identifier[String] identifier[H] operator[=] identifier[host] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[lengthDiff] operator[SEP] operator[SEP] identifier[String] identifier[D] operator[=] identifier[host] operator[SEP] identifier[substring] operator[SEP] identifier[lengthDiff] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[D] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[domain] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lengthDiff] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] operator[SEP] identifier[domain] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[&&] identifier[host] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[domain] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Blob get(String blob, BlobGetOption... options) {
return storage.get(BlobId.of(getName(), blob), options);
} | class class_name[name] begin[{]
method[get, return_type[type[Blob]], modifier[public], parameter[blob, options]] begin[{]
return[call[storage.get, parameter[call[BlobId.of, parameter[call[.getName, parameter[]], member[.blob]]], member[.options]]]]
end[}]
END[}] | Keyword[public] identifier[Blob] identifier[get] operator[SEP] identifier[String] identifier[blob] , identifier[BlobGetOption] operator[...] identifier[options] operator[SEP] {
Keyword[return] identifier[storage] operator[SEP] identifier[get] operator[SEP] identifier[BlobId] operator[SEP] identifier[of] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[blob] operator[SEP] , identifier[options] operator[SEP] operator[SEP]
}
|
public static byte[] toBytes(char[] chars) {
final CharBuffer charBuffer = CharBuffer.wrap(chars);
final ByteBuffer byteBuffer = Charset.forName("UTF-8").encode(charBuffer);
final byte[] bytes = Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit());
Arrays.fill(charBuffer.array(), '\u0000'); // clear sensitive data
Arrays.fill(byteBuffer.array(), (byte) 0); // clear sensitive data
return bytes;
} | class class_name[name] begin[{]
method[toBytes, return_type[type[byte]], modifier[public static], parameter[chars]] begin[{]
local_variable[type[CharBuffer], charBuffer]
local_variable[type[ByteBuffer], byteBuffer]
local_variable[type[byte], bytes]
call[Arrays.fill, parameter[call[charBuffer.array, parameter[]], literal[' ']]]
call[Arrays.fill, parameter[call[byteBuffer.array, parameter[]], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), type=BasicType(dimensions=[], name=byte))]]
return[member[.bytes]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[toBytes] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[chars] operator[SEP] {
Keyword[final] identifier[CharBuffer] identifier[charBuffer] operator[=] identifier[CharBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[chars] operator[SEP] operator[SEP] Keyword[final] identifier[ByteBuffer] identifier[byteBuffer] operator[=] identifier[Charset] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[encode] operator[SEP] identifier[charBuffer] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[Arrays] operator[SEP] identifier[copyOfRange] operator[SEP] identifier[byteBuffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] , identifier[byteBuffer] operator[SEP] identifier[position] operator[SEP] operator[SEP] , identifier[byteBuffer] operator[SEP] identifier[limit] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[charBuffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[byteBuffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[bytes] operator[SEP]
}
|
public static String toCountSql(String sql) {
sql = sql.replaceAll("select .*? from", "select count(*) from");
sql = sql.replaceAll("SELECT .*? FROM", "SELECT count(*) FROM");
sql = sql.replaceAll(" LIMIT.*", "");
sql = sql.replaceAll(" limit.*", "");
return sql;
} | class class_name[name] begin[{]
method[toCountSql, return_type[type[String]], modifier[public static], parameter[sql]] begin[{]
assign[member[.sql], call[sql.replaceAll, parameter[literal["select .*? from"], literal["select count(*) from"]]]]
assign[member[.sql], call[sql.replaceAll, parameter[literal["SELECT .*? FROM"], literal["SELECT count(*) FROM"]]]]
assign[member[.sql], call[sql.replaceAll, parameter[literal[" LIMIT.*"], literal[""]]]]
assign[member[.sql], call[sql.replaceAll, parameter[literal[" limit.*"], literal[""]]]]
return[member[.sql]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toCountSql] operator[SEP] identifier[String] identifier[sql] operator[SEP] {
identifier[sql] operator[=] identifier[sql] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[sql] operator[=] identifier[sql] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[sql] operator[=] identifier[sql] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[sql] operator[=] identifier[sql] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[sql] operator[SEP]
}
|
public static synchronized void shutdown() {
logger.info(Messages.get("info.service.shutdown"));
if (container != null)
try {
container.shutdown();
} catch (Exception e) {
logger.error(Messages.get("info.service.error.shutdown"), e);
}
logger.info(Messages.get("info.service.shutdown.done"));
} | class class_name[name] begin[{]
method[shutdown, return_type[void], modifier[synchronized public static], parameter[]] begin[{]
call[logger.info, parameter[call[Messages.get, parameter[literal["info.service.shutdown"]]]]]
if[binary_operation[member[.container], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=shutdown, postfix_operators=[], prefix_operators=[], qualifier=container, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="info.service.error.shutdown")], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
call[logger.info, parameter[call[Messages.get, parameter[literal["info.service.shutdown.done"]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[synchronized] Keyword[void] identifier[shutdown] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[container] operator[!=] Other[null] operator[SEP] Keyword[try] {
identifier[container] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public static CalendarPicker<JulianCalendar> julianWithSystemDefaults() {
return CalendarPicker.julian(
Locale.getDefault(Locale.Category.FORMAT),
() -> SystemClock.inLocalView().now(JulianCalendar.axis())
);
} | class class_name[name] begin[{]
method[julianWithSystemDefaults, return_type[type[CalendarPicker]], modifier[public static], parameter[]] begin[{]
return[call[CalendarPicker.julian, parameter[call[Locale.getDefault, parameter[member[Locale.Category.FORMAT]]], LambdaExpression(body=MethodInvocation(arguments=[], member=inLocalView, postfix_operators=[], prefix_operators=[], qualifier=SystemClock, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=axis, postfix_operators=[], prefix_operators=[], qualifier=JulianCalendar, selectors=[], type_arguments=None)], member=now, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[])]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CalendarPicker] operator[<] identifier[JulianCalendar] operator[>] identifier[julianWithSystemDefaults] operator[SEP] operator[SEP] {
Keyword[return] identifier[CalendarPicker] operator[SEP] identifier[julian] operator[SEP] identifier[Locale] operator[SEP] identifier[getDefault] operator[SEP] identifier[Locale] operator[SEP] identifier[Category] operator[SEP] identifier[FORMAT] operator[SEP] , operator[SEP] operator[SEP] operator[->] identifier[SystemClock] operator[SEP] identifier[inLocalView] operator[SEP] operator[SEP] operator[SEP] identifier[now] operator[SEP] identifier[JulianCalendar] operator[SEP] identifier[axis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<UrlCss3Value> getUrlCss3Values() {
// for security improvements for urlCss3Values without
// compromising performance.
// TODO the drawback of this the returning of new object each time even
// if the urlCss3Values array has not been modified, as a minor
// performance
// improvement, return a new object only if the urlCss3Values is
// modified.
if (urlCss3Values == null) {
return null;
}
return Collections.unmodifiableList(Arrays.asList(urlCss3Values));
} | class class_name[name] begin[{]
method[getUrlCss3Values, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.urlCss3Values], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[Collections.unmodifiableList, parameter[call[Arrays.asList, parameter[member[.urlCss3Values]]]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[UrlCss3Value] operator[>] identifier[getUrlCss3Values] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[urlCss3Values] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[urlCss3Values] operator[SEP] operator[SEP] operator[SEP]
}
|
public String put(String key, String value, boolean percentEncode) {
SortedSet<String> values = wrappedMap.get(key);
if (values == null) {
values = new TreeSet<String>();
wrappedMap.put(percentEncode ? OAuth.percentEncode(key) : key, values);
}
if (value != null) {
value = percentEncode ? OAuth.percentEncode(value) : value;
values.add(value);
}
return value;
} | class class_name[name] begin[{]
method[put, return_type[type[String]], modifier[public], parameter[key, value, percentEncode]] begin[{]
local_variable[type[SortedSet], values]
if[binary_operation[member[.values], ==, literal[null]]] begin[{]
assign[member[.values], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=TreeSet, sub_type=None))]
call[wrappedMap.put, parameter[TernaryExpression(condition=MemberReference(member=percentEncode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=percentEncode, postfix_operators=[], prefix_operators=[], qualifier=OAuth, selectors=[], type_arguments=None)), member[.values]]]
else begin[{]
None
end[}]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
assign[member[.value], TernaryExpression(condition=MemberReference(member=percentEncode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=percentEncode, postfix_operators=[], prefix_operators=[], qualifier=OAuth, selectors=[], type_arguments=None))]
call[values.add, parameter[member[.value]]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[put] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] , Keyword[boolean] identifier[percentEncode] operator[SEP] {
identifier[SortedSet] operator[<] identifier[String] operator[>] identifier[values] operator[=] identifier[wrappedMap] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[==] Other[null] operator[SEP] {
identifier[values] operator[=] Keyword[new] identifier[TreeSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[wrappedMap] operator[SEP] identifier[put] operator[SEP] identifier[percentEncode] operator[?] identifier[OAuth] operator[SEP] identifier[percentEncode] operator[SEP] identifier[key] operator[SEP] operator[:] identifier[key] , identifier[values] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[percentEncode] operator[?] identifier[OAuth] operator[SEP] identifier[percentEncode] operator[SEP] identifier[value] operator[SEP] operator[:] identifier[value] operator[SEP] identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
|
private void sendAdminPacket(ProtocolHeader header, Protocol protocol) throws IOException{
clientSocket.sendPacket(header, protocol);
} | class class_name[name] begin[{]
method[sendAdminPacket, return_type[void], modifier[private], parameter[header, protocol]] begin[{]
call[clientSocket.sendPacket, parameter[member[.header], member[.protocol]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[sendAdminPacket] operator[SEP] identifier[ProtocolHeader] identifier[header] , identifier[Protocol] identifier[protocol] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[clientSocket] operator[SEP] identifier[sendPacket] operator[SEP] identifier[header] , identifier[protocol] operator[SEP] operator[SEP]
}
|
protected List<BoxAPIResponse> parseResponse(BoxJSONResponse batchResponse) {
JsonObject responseJSON = JsonObject.readFrom(batchResponse.getJSON());
List<BoxAPIResponse> responses = new ArrayList<BoxAPIResponse>();
Iterator<JsonValue> responseIterator = responseJSON.get("responses").asArray().iterator();
while (responseIterator.hasNext()) {
JsonObject jsonResponse = responseIterator.next().asObject();
BoxAPIResponse response = null;
//Gather headers
Map<String, String> responseHeaders = new HashMap<String, String>();
if (jsonResponse.get("headers") != null) {
JsonObject batchResponseHeadersObject = jsonResponse.get("headers").asObject();
for (JsonObject.Member member : batchResponseHeadersObject) {
String headerName = member.getName();
String headerValue = member.getValue().asString();
responseHeaders.put(headerName, headerValue);
}
}
// Construct a BoxAPIResponse when response is null, or a BoxJSONResponse when there's a response
// (not anticipating any other response as per current APIs.
// Ideally we should do it based on response header)
if (jsonResponse.get("response") == null || jsonResponse.get("response").isNull()) {
response =
new BoxAPIResponse(jsonResponse.get("status").asInt(), responseHeaders);
} else {
response =
new BoxJSONResponse(jsonResponse.get("status").asInt(), responseHeaders,
jsonResponse.get("response").asObject());
}
responses.add(response);
}
return responses;
} | class class_name[name] begin[{]
method[parseResponse, return_type[type[List]], modifier[protected], parameter[batchResponse]] begin[{]
local_variable[type[JsonObject], responseJSON]
local_variable[type[List], responses]
local_variable[type[Iterator], responseIterator]
while[call[responseIterator.hasNext, parameter[]]] begin[{]
local_variable[type[JsonObject], jsonResponse]
local_variable[type[BoxAPIResponse], response]
local_variable[type[Map], responseHeaders]
if[binary_operation[call[jsonResponse.get, parameter[literal["headers"]]], !=, literal[null]]] begin[{]
local_variable[type[JsonObject], batchResponseHeadersObject]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=member, selectors=[], type_arguments=None), name=headerName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=member, selectors=[MethodInvocation(arguments=[], member=asString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=headerValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=headerName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=headerValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=responseHeaders, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=batchResponseHeadersObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=member)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=ReferenceType(arguments=None, dimensions=None, name=Member, sub_type=None)))), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[jsonResponse.get, parameter[literal["response"]]], ==, literal[null]], ||, call[jsonResponse.get, parameter[literal["response"]]]]] begin[{]
assign[member[.response], ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status")], member=get, postfix_operators=[], prefix_operators=[], qualifier=jsonResponse, selectors=[MethodInvocation(arguments=[], member=asInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=responseHeaders, 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=BoxAPIResponse, sub_type=None))]
else begin[{]
assign[member[.response], ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status")], member=get, postfix_operators=[], prefix_operators=[], qualifier=jsonResponse, selectors=[MethodInvocation(arguments=[], member=asInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=responseHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="response")], member=get, postfix_operators=[], prefix_operators=[], qualifier=jsonResponse, selectors=[MethodInvocation(arguments=[], member=asObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BoxJSONResponse, sub_type=None))]
end[}]
call[responses.add, parameter[member[.response]]]
end[}]
return[member[.responses]]
end[}]
END[}] | Keyword[protected] identifier[List] operator[<] identifier[BoxAPIResponse] operator[>] identifier[parseResponse] operator[SEP] identifier[BoxJSONResponse] identifier[batchResponse] operator[SEP] {
identifier[JsonObject] identifier[responseJSON] operator[=] identifier[JsonObject] operator[SEP] identifier[readFrom] operator[SEP] identifier[batchResponse] operator[SEP] identifier[getJSON] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[BoxAPIResponse] operator[>] identifier[responses] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[BoxAPIResponse] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[JsonValue] operator[>] identifier[responseIterator] operator[=] identifier[responseJSON] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asArray] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[responseIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[JsonObject] identifier[jsonResponse] operator[=] identifier[responseIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[asObject] operator[SEP] operator[SEP] operator[SEP] identifier[BoxAPIResponse] identifier[response] operator[=] Other[null] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[responseHeaders] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[JsonObject] identifier[batchResponseHeadersObject] operator[=] identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asObject] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[JsonObject] operator[SEP] identifier[Member] identifier[member] operator[:] identifier[batchResponseHeadersObject] operator[SEP] {
identifier[String] identifier[headerName] operator[=] identifier[member] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[headerValue] operator[=] identifier[member] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[responseHeaders] operator[SEP] identifier[put] operator[SEP] identifier[headerName] , identifier[headerValue] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[==] Other[null] operator[||] identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] {
identifier[response] operator[=] Keyword[new] identifier[BoxAPIResponse] operator[SEP] identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asInt] operator[SEP] operator[SEP] , identifier[responseHeaders] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[response] operator[=] Keyword[new] identifier[BoxJSONResponse] operator[SEP] identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asInt] operator[SEP] operator[SEP] , identifier[responseHeaders] , identifier[jsonResponse] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[responses] operator[SEP] identifier[add] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
Keyword[return] identifier[responses] operator[SEP]
}
|
public static void useJanusMessageFormat() {
final String format = System.getProperty(FORMAT_PROPERTY_KEY, null);
if (format == null || format.isEmpty()) {
System.setProperty(FORMAT_PROPERTY_KEY, JANUS_FORMAT);
}
} | class class_name[name] begin[{]
method[useJanusMessageFormat, return_type[void], modifier[public static], parameter[]] begin[{]
local_variable[type[String], format]
if[binary_operation[binary_operation[member[.format], ==, literal[null]], ||, call[format.isEmpty, parameter[]]]] begin[{]
call[System.setProperty, parameter[member[.FORMAT_PROPERTY_KEY], member[.JANUS_FORMAT]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[useJanusMessageFormat] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[format] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[FORMAT_PROPERTY_KEY] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[format] operator[==] Other[null] operator[||] identifier[format] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[setProperty] operator[SEP] identifier[FORMAT_PROPERTY_KEY] , identifier[JANUS_FORMAT] operator[SEP] operator[SEP]
}
}
|
public void marshall(ListEndpointConfigsRequest listEndpointConfigsRequest, ProtocolMarshaller protocolMarshaller) {
if (listEndpointConfigsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listEndpointConfigsRequest.getSortBy(), SORTBY_BINDING);
protocolMarshaller.marshall(listEndpointConfigsRequest.getSortOrder(), SORTORDER_BINDING);
protocolMarshaller.marshall(listEndpointConfigsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listEndpointConfigsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listEndpointConfigsRequest.getNameContains(), NAMECONTAINS_BINDING);
protocolMarshaller.marshall(listEndpointConfigsRequest.getCreationTimeBefore(), CREATIONTIMEBEFORE_BINDING);
protocolMarshaller.marshall(listEndpointConfigsRequest.getCreationTimeAfter(), CREATIONTIMEAFTER_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[listEndpointConfigsRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.listEndpointConfigsRequest], ==, 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=getSortBy, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=SORTBY_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=getSortOrder, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=SORTORDER_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=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=NEXTTOKEN_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=getMaxResults, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=MAXRESULTS_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=getNameContains, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=NAMECONTAINS_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=getCreationTimeBefore, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=CREATIONTIMEBEFORE_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=getCreationTimeAfter, postfix_operators=[], prefix_operators=[], qualifier=listEndpointConfigsRequest, selectors=[], type_arguments=None), MemberReference(member=CREATIONTIMEAFTER_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[ListEndpointConfigsRequest] identifier[listEndpointConfigsRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[listEndpointConfigsRequest] 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[listEndpointConfigsRequest] operator[SEP] identifier[getSortBy] operator[SEP] operator[SEP] , identifier[SORTBY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listEndpointConfigsRequest] operator[SEP] identifier[getSortOrder] operator[SEP] operator[SEP] , identifier[SORTORDER_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listEndpointConfigsRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listEndpointConfigsRequest] operator[SEP] identifier[getMaxResults] operator[SEP] operator[SEP] , identifier[MAXRESULTS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listEndpointConfigsRequest] operator[SEP] identifier[getNameContains] operator[SEP] operator[SEP] , identifier[NAMECONTAINS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listEndpointConfigsRequest] operator[SEP] identifier[getCreationTimeBefore] operator[SEP] operator[SEP] , identifier[CREATIONTIMEBEFORE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listEndpointConfigsRequest] operator[SEP] identifier[getCreationTimeAfter] operator[SEP] operator[SEP] , identifier[CREATIONTIMEAFTER_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 double cublasDasum(int n, Pointer x, int incx)
{
double result = cublasDasumNative(n, x, incx);
checkResultBLAS();
return result;
} | class class_name[name] begin[{]
method[cublasDasum, return_type[type[double]], modifier[public static], parameter[n, x, incx]] begin[{]
local_variable[type[double], result]
call[.checkResultBLAS, parameter[]]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[cublasDasum] operator[SEP] Keyword[int] identifier[n] , identifier[Pointer] identifier[x] , Keyword[int] identifier[incx] operator[SEP] {
Keyword[double] identifier[result] operator[=] identifier[cublasDasumNative] operator[SEP] identifier[n] , identifier[x] , identifier[incx] operator[SEP] operator[SEP] identifier[checkResultBLAS] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public void handleRequest(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
handleRequest(request, response, new AnalysisListener[0]);
} | class class_name[name] begin[{]
method[handleRequest, return_type[void], modifier[public], parameter[request, response]] begin[{]
call[.handleRequest, parameter[member[.request], member[.response], 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=AnalysisListener, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[handleRequest] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[handleRequest] operator[SEP] identifier[request] , identifier[response] , Keyword[new] identifier[AnalysisListener] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
|
public Long setnx(String key, Object value, int expiration) throws Exception {
Long result = 0L;
Jedis jedis = null;
try {
jedis = this.jedisPool.getResource();
result = jedis.setnx(SafeEncoder.encode(key), serialize(value));
jedis.expire(SafeEncoder.encode(key), expiration);
return result;
} catch (Exception e) {
logger.error(e.getMessage(), e);
this.jedisPool.returnBrokenResource(jedis);
throw e;
} finally {
if (jedis != null) {
this.jedisPool.returnResource(jedis);
}
}
} | class class_name[name] begin[{]
method[setnx, return_type[type[Long]], modifier[public], parameter[key, value, expiration]] begin[{]
local_variable[type[Long], result]
local_variable[type[Jedis], jedis]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jedis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=jedisPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=SafeEncoder, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setnx, postfix_operators=[], prefix_operators=[], qualifier=jedis, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=SafeEncoder, selectors=[], type_arguments=None), MemberReference(member=expiration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=expire, postfix_operators=[], prefix_operators=[], qualifier=jedis, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[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=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=jedisPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=jedis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=returnBrokenResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jedis, 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=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=jedisPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=jedis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=returnResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Long] identifier[setnx] operator[SEP] identifier[String] identifier[key] , identifier[Object] identifier[value] , Keyword[int] identifier[expiration] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Long] identifier[result] operator[=] Other[0L] operator[SEP] identifier[Jedis] identifier[jedis] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[jedis] operator[=] Keyword[this] operator[SEP] identifier[jedisPool] operator[SEP] identifier[getResource] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[jedis] operator[SEP] identifier[setnx] operator[SEP] identifier[SafeEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[key] operator[SEP] , identifier[serialize] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[jedis] operator[SEP] identifier[expire] operator[SEP] identifier[SafeEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[key] operator[SEP] , identifier[expiration] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[jedisPool] operator[SEP] identifier[returnBrokenResource] operator[SEP] identifier[jedis] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[jedis] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[jedisPool] operator[SEP] identifier[returnResource] operator[SEP] identifier[jedis] operator[SEP] operator[SEP]
}
}
}
|
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == m_buttonGo)
{
Scanner scanner = new Scanner(m_properties); // Fit them on floppys
progressBar.setIndeterminate(true); // For now
scanner.run();
progressBar.setIndeterminate(false);
AppUtilities.writeProperties(m_strFileName, m_properties);
}
if (e.getSource() == m_buttonSave)
{
AppUtilities.writeProperties(m_strFileName, m_properties);
}
} | class class_name[name] begin[{]
method[actionPerformed, return_type[void], modifier[public], parameter[e]] begin[{]
if[binary_operation[call[e.getSource, parameter[]], ==, member[.m_buttonGo]]] begin[{]
local_variable[type[Scanner], scanner]
call[progressBar.setIndeterminate, parameter[literal[true]]]
call[scanner.run, parameter[]]
call[progressBar.setIndeterminate, parameter[literal[false]]]
call[AppUtilities.writeProperties, parameter[member[.m_strFileName], member[.m_properties]]]
else begin[{]
None
end[}]
if[binary_operation[call[e.getSource, parameter[]], ==, member[.m_buttonSave]]] begin[{]
call[AppUtilities.writeProperties, parameter[member[.m_strFileName], member[.m_properties]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[actionPerformed] operator[SEP] identifier[ActionEvent] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] operator[==] identifier[m_buttonGo] operator[SEP] {
identifier[Scanner] identifier[scanner] operator[=] Keyword[new] identifier[Scanner] operator[SEP] identifier[m_properties] operator[SEP] operator[SEP] identifier[progressBar] operator[SEP] identifier[setIndeterminate] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[scanner] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] identifier[progressBar] operator[SEP] identifier[setIndeterminate] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[AppUtilities] operator[SEP] identifier[writeProperties] operator[SEP] identifier[m_strFileName] , identifier[m_properties] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] operator[==] identifier[m_buttonSave] operator[SEP] {
identifier[AppUtilities] operator[SEP] identifier[writeProperties] operator[SEP] identifier[m_strFileName] , identifier[m_properties] operator[SEP] operator[SEP]
}
}
|
@Override
protected void createHistProjectsTable(CmsSetupDb dbCon) throws SQLException {
System.out.println(new Exception().getStackTrace()[0].toString());
if (!dbCon.hasTableOrColumn(HISTORY_PROJECTS_TABLE, null)) {
String createStatement = readQuery(QUERY_CREATE_HISTORY_PROJECTS_TABLE_MYSQL);
Map<String, String> replacer = Collections.singletonMap("${tableEngine}", m_poolData.get("engine"));
dbCon.updateSqlStatement(createStatement, replacer, null);
transferDataToHistoryTable(dbCon);
} else {
System.out.println("table " + HISTORY_PROJECTS_TABLE + " already exists");
}
} | class class_name[name] begin[{]
method[createHistProjectsTable, return_type[void], modifier[protected], parameter[dbCon]] begin[{]
call[System.out.println, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getStackTrace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None))]]
if[call[dbCon.hasTableOrColumn, parameter[member[.HISTORY_PROJECTS_TABLE], literal[null]]]] begin[{]
local_variable[type[String], createStatement]
local_variable[type[Map], replacer]
call[dbCon.updateSqlStatement, parameter[member[.createStatement], member[.replacer], literal[null]]]
call[.transferDataToHistoryTable, parameter[member[.dbCon]]]
else begin[{]
call[System.out.println, parameter[binary_operation[binary_operation[literal["table "], +, member[.HISTORY_PROJECTS_TABLE]], +, literal[" already exists"]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[createHistProjectsTable] operator[SEP] identifier[CmsSetupDb] identifier[dbCon] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] Keyword[new] identifier[Exception] operator[SEP] operator[SEP] operator[SEP] identifier[getStackTrace] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dbCon] operator[SEP] identifier[hasTableOrColumn] operator[SEP] identifier[HISTORY_PROJECTS_TABLE] , Other[null] operator[SEP] operator[SEP] {
identifier[String] identifier[createStatement] operator[=] identifier[readQuery] operator[SEP] identifier[QUERY_CREATE_HISTORY_PROJECTS_TABLE_MYSQL] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[replacer] operator[=] identifier[Collections] operator[SEP] identifier[singletonMap] operator[SEP] literal[String] , identifier[m_poolData] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[dbCon] operator[SEP] identifier[updateSqlStatement] operator[SEP] identifier[createStatement] , identifier[replacer] , Other[null] operator[SEP] operator[SEP] identifier[transferDataToHistoryTable] operator[SEP] identifier[dbCon] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[HISTORY_PROJECTS_TABLE] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public boolean assignParsedElement(Instance parsedInstance, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException
{
if (syntaxElementName.equalsIgnoreCase(XMLSyntax.URI()) && syntaxElement instanceof SemanticIdentifier)
{
parsedInstance.setSemanticIdentifier((SemanticIdentifier) syntaxElement);
return true;
}
if (syntaxElementName.equalsIgnoreCase(XMLSyntax.ONTOLOGY()))
{
if (syntaxElement instanceof SemanticIdentifier)
{
parsedInstance.setOntology(bsdlRegistry, (SemanticIdentifier) syntaxElement);
}
return true;
}
if (syntaxElementName.equalsIgnoreCase(XMLSyntax.CONCEPT_OF_INSTANCE_URI()) && syntaxElement instanceof SemanticIdentifier)
{
parsedInstance.setConcept(bsdlRegistry, (SemanticIdentifier) syntaxElement);
return true;
}
if (syntaxElementName.equalsIgnoreCase(XMLSyntax.PROPERTY_VALUE()) && syntaxElement instanceof PropertyValue)
{
((PropertyValue) syntaxElement).setOntology(parsedInstance.getOntology());
parsedInstance.addProperty(((PropertyValue) syntaxElement));
return true;
}
if (syntaxElementName.equalsIgnoreCase(XMLSyntax.IMPORT()) && syntaxElement instanceof Import)
{
parsedInstance.imports().add((Import) syntaxElement);
return true;
}
return false;
} | class class_name[name] begin[{]
method[assignParsedElement, return_type[type[boolean]], modifier[public], parameter[parsedInstance, syntaxElementName, syntaxElement]] begin[{]
if[binary_operation[call[syntaxElementName.equalsIgnoreCase, parameter[call[XMLSyntax.URI, parameter[]]]], &&, binary_operation[member[.syntaxElement], instanceof, type[SemanticIdentifier]]]] begin[{]
call[parsedInstance.setSemanticIdentifier, parameter[Cast(expression=MemberReference(member=syntaxElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SemanticIdentifier, sub_type=None))]]
return[literal[true]]
else begin[{]
None
end[}]
if[call[syntaxElementName.equalsIgnoreCase, parameter[call[XMLSyntax.ONTOLOGY, parameter[]]]]] begin[{]
if[binary_operation[member[.syntaxElement], instanceof, type[SemanticIdentifier]]] begin[{]
call[parsedInstance.setOntology, parameter[member[.bsdlRegistry], Cast(expression=MemberReference(member=syntaxElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SemanticIdentifier, sub_type=None))]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[syntaxElementName.equalsIgnoreCase, parameter[call[XMLSyntax.CONCEPT_OF_INSTANCE_URI, parameter[]]]], &&, binary_operation[member[.syntaxElement], instanceof, type[SemanticIdentifier]]]] begin[{]
call[parsedInstance.setConcept, parameter[member[.bsdlRegistry], Cast(expression=MemberReference(member=syntaxElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SemanticIdentifier, sub_type=None))]]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[syntaxElementName.equalsIgnoreCase, parameter[call[XMLSyntax.PROPERTY_VALUE, parameter[]]]], &&, binary_operation[member[.syntaxElement], instanceof, type[PropertyValue]]]] begin[{]
Cast(expression=MemberReference(member=syntaxElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PropertyValue, sub_type=None))
call[parsedInstance.addProperty, parameter[Cast(expression=MemberReference(member=syntaxElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PropertyValue, sub_type=None))]]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[syntaxElementName.equalsIgnoreCase, parameter[call[XMLSyntax.IMPORT, parameter[]]]], &&, binary_operation[member[.syntaxElement], instanceof, type[Import]]]] begin[{]
call[parsedInstance.imports, parameter[]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[assignParsedElement] operator[SEP] identifier[Instance] identifier[parsedInstance] , identifier[String] identifier[syntaxElementName] , identifier[ISyntaxElement] identifier[syntaxElement] operator[SEP] Keyword[throws] identifier[ModelException] {
Keyword[if] operator[SEP] identifier[syntaxElementName] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[XMLSyntax] operator[SEP] identifier[URI] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[syntaxElement] Keyword[instanceof] identifier[SemanticIdentifier] operator[SEP] {
identifier[parsedInstance] operator[SEP] identifier[setSemanticIdentifier] operator[SEP] operator[SEP] identifier[SemanticIdentifier] operator[SEP] identifier[syntaxElement] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[syntaxElementName] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[XMLSyntax] operator[SEP] identifier[ONTOLOGY] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[syntaxElement] Keyword[instanceof] identifier[SemanticIdentifier] operator[SEP] {
identifier[parsedInstance] operator[SEP] identifier[setOntology] operator[SEP] identifier[bsdlRegistry] , operator[SEP] identifier[SemanticIdentifier] operator[SEP] identifier[syntaxElement] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[syntaxElementName] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[XMLSyntax] operator[SEP] identifier[CONCEPT_OF_INSTANCE_URI] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[syntaxElement] Keyword[instanceof] identifier[SemanticIdentifier] operator[SEP] {
identifier[parsedInstance] operator[SEP] identifier[setConcept] operator[SEP] identifier[bsdlRegistry] , operator[SEP] identifier[SemanticIdentifier] operator[SEP] identifier[syntaxElement] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[syntaxElementName] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[XMLSyntax] operator[SEP] identifier[PROPERTY_VALUE] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[syntaxElement] Keyword[instanceof] identifier[PropertyValue] operator[SEP] {
operator[SEP] operator[SEP] identifier[PropertyValue] operator[SEP] identifier[syntaxElement] operator[SEP] operator[SEP] identifier[setOntology] operator[SEP] identifier[parsedInstance] operator[SEP] identifier[getOntology] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[parsedInstance] operator[SEP] identifier[addProperty] operator[SEP] operator[SEP] operator[SEP] identifier[PropertyValue] operator[SEP] identifier[syntaxElement] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[syntaxElementName] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[XMLSyntax] operator[SEP] identifier[IMPORT] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[syntaxElement] Keyword[instanceof] identifier[Import] operator[SEP] {
identifier[parsedInstance] operator[SEP] identifier[imports] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] operator[SEP] identifier[Import] operator[SEP] identifier[syntaxElement] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setBillingAttribute(com.google.api.ads.admanager.axis.v201805.RichMediaStudioCreativeBillingAttribute billingAttribute) {
this.billingAttribute = billingAttribute;
} | class class_name[name] begin[{]
method[setBillingAttribute, return_type[void], modifier[public], parameter[billingAttribute]] begin[{]
assign[THIS[member[None.billingAttribute]], member[.billingAttribute]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setBillingAttribute] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201805] operator[SEP] identifier[RichMediaStudioCreativeBillingAttribute] identifier[billingAttribute] operator[SEP] {
Keyword[this] operator[SEP] identifier[billingAttribute] operator[=] identifier[billingAttribute] operator[SEP]
}
|
public List < CobolDataItem > toModel(final Reader cobolReader)
throws RecognizerException {
return emitModel(parse(lex(clean(cobolReader))));
} | class class_name[name] begin[{]
method[toModel, return_type[type[List]], modifier[public], parameter[cobolReader]] begin[{]
return[call[.emitModel, parameter[call[.parse, parameter[call[.lex, parameter[call[.clean, parameter[member[.cobolReader]]]]]]]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[CobolDataItem] operator[>] identifier[toModel] operator[SEP] Keyword[final] identifier[Reader] identifier[cobolReader] operator[SEP] Keyword[throws] identifier[RecognizerException] {
Keyword[return] identifier[emitModel] operator[SEP] identifier[parse] operator[SEP] identifier[lex] operator[SEP] identifier[clean] operator[SEP] identifier[cobolReader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Integer max(String column, String where, String[] args) {
return db.max(getTableName(), column, where, args);
} | class class_name[name] begin[{]
method[max, return_type[type[Integer]], modifier[public], parameter[column, where, args]] begin[{]
return[call[db.max, parameter[call[.getTableName, parameter[]], member[.column], member[.where], member[.args]]]]
end[}]
END[}] | Keyword[public] identifier[Integer] identifier[max] operator[SEP] identifier[String] identifier[column] , identifier[String] identifier[where] , identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[return] identifier[db] operator[SEP] identifier[max] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[column] , identifier[where] , identifier[args] operator[SEP] operator[SEP]
}
|
public void build(Node rootNode, SimpleApplication app) {
house = (Node) app.getAssetManager().loadModel(urlResource);
house.setUserData("ID", houseId);
house.setUserData("ROLE", "House");
System.out.println("\n\nBuinding " + house.getName());
physicalEntities = (Node) house.getChild("PhysicalEntities");
Node physicalStructure = (Node) house.getChild("Structure");
visualStructure = (Node) physicalStructure.getChild("Visual");
physicsStructure = (Node) physicalStructure.getChild("Physics");
logicalEntities = (Node) house.getChild("LogicalEntities");
spatialCoordenates = (Node) logicalEntities
.getChild("SpatialCoordenates");
initSpatials();
initLights(app);
app.getStateManager().getState(BulletAppState.class).getPhysicsSpace().addAll(physicalEntities);
app.getStateManager().getState(BulletAppState.class).getPhysicsSpace().addAll(physicsStructure);
rootNode.attachChild(house);
PhysicsUtils.updateLocationAndRotation(house);
} | class class_name[name] begin[{]
method[build, return_type[void], modifier[public], parameter[rootNode, app]] begin[{]
assign[member[.house], Cast(expression=MethodInvocation(arguments=[], member=getAssetManager, postfix_operators=[], prefix_operators=[], qualifier=app, selectors=[MethodInvocation(arguments=[MemberReference(member=urlResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadModel, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))]
call[house.setUserData, parameter[literal["ID"], member[.houseId]]]
call[house.setUserData, parameter[literal["ROLE"], literal["House"]]]
call[System.out.println, parameter[binary_operation[literal["\n\nBuinding "], +, call[house.getName, parameter[]]]]]
assign[member[.physicalEntities], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PhysicalEntities")], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=house, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))]
local_variable[type[Node], physicalStructure]
assign[member[.visualStructure], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Visual")], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=physicalStructure, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))]
assign[member[.physicsStructure], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Physics")], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=physicalStructure, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))]
assign[member[.logicalEntities], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="LogicalEntities")], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=house, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))]
assign[member[.spatialCoordenates], Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SpatialCoordenates")], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=logicalEntities, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))]
call[.initSpatials, parameter[]]
call[.initLights, parameter[member[.app]]]
call[app.getStateManager, parameter[]]
call[app.getStateManager, parameter[]]
call[rootNode.attachChild, parameter[member[.house]]]
call[PhysicsUtils.updateLocationAndRotation, parameter[member[.house]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[build] operator[SEP] identifier[Node] identifier[rootNode] , identifier[SimpleApplication] identifier[app] operator[SEP] {
identifier[house] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[app] operator[SEP] identifier[getAssetManager] operator[SEP] operator[SEP] operator[SEP] identifier[loadModel] operator[SEP] identifier[urlResource] operator[SEP] operator[SEP] identifier[house] operator[SEP] identifier[setUserData] operator[SEP] literal[String] , identifier[houseId] operator[SEP] operator[SEP] identifier[house] operator[SEP] identifier[setUserData] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[house] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[physicalEntities] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[house] operator[SEP] identifier[getChild] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Node] identifier[physicalStructure] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[house] operator[SEP] identifier[getChild] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[visualStructure] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[physicalStructure] operator[SEP] identifier[getChild] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[physicsStructure] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[physicalStructure] operator[SEP] identifier[getChild] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[logicalEntities] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[house] operator[SEP] identifier[getChild] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[spatialCoordenates] operator[=] operator[SEP] identifier[Node] operator[SEP] identifier[logicalEntities] operator[SEP] identifier[getChild] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[initSpatials] operator[SEP] operator[SEP] operator[SEP] identifier[initLights] operator[SEP] identifier[app] operator[SEP] operator[SEP] identifier[app] operator[SEP] identifier[getStateManager] operator[SEP] operator[SEP] operator[SEP] identifier[getState] operator[SEP] identifier[BulletAppState] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getPhysicsSpace] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[physicalEntities] operator[SEP] operator[SEP] identifier[app] operator[SEP] identifier[getStateManager] operator[SEP] operator[SEP] operator[SEP] identifier[getState] operator[SEP] identifier[BulletAppState] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getPhysicsSpace] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[physicsStructure] operator[SEP] operator[SEP] identifier[rootNode] operator[SEP] identifier[attachChild] operator[SEP] identifier[house] operator[SEP] operator[SEP] identifier[PhysicsUtils] operator[SEP] identifier[updateLocationAndRotation] operator[SEP] identifier[house] operator[SEP] operator[SEP]
}
|
public Response changeHeaders(String bucket, String key, Map<String, String> headers)
throws QiniuException {
String resource = encodedEntry(bucket, key);
String path = String.format("/chgm/%s", resource);
for (String k : headers.keySet()) {
String encodedMetaValue = UrlSafeBase64.encodeToString(headers.get(k));
path = String.format("%s/x-qn-meta-!%s/%s", path, k, encodedMetaValue);
}
return rsPost(bucket, path, null);
} | class class_name[name] begin[{]
method[changeHeaders, return_type[type[Response]], modifier[public], parameter[bucket, key, headers]] begin[{]
local_variable[type[String], resource]
local_variable[type[String], path]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=headers, selectors=[], type_arguments=None)], member=encodeToString, postfix_operators=[], prefix_operators=[], qualifier=UrlSafeBase64, selectors=[], type_arguments=None), name=encodedMetaValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s/x-qn-meta-!%s/%s"), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=encodedMetaValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=headers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=k)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[.rsPost, parameter[member[.bucket], member[.path], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[Response] identifier[changeHeaders] operator[SEP] identifier[String] identifier[bucket] , identifier[String] identifier[key] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[headers] operator[SEP] Keyword[throws] identifier[QiniuException] {
identifier[String] identifier[resource] operator[=] identifier[encodedEntry] operator[SEP] identifier[bucket] , identifier[key] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[resource] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[k] operator[:] identifier[headers] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[encodedMetaValue] operator[=] identifier[UrlSafeBase64] operator[SEP] identifier[encodeToString] operator[SEP] identifier[headers] operator[SEP] identifier[get] operator[SEP] identifier[k] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[path] , identifier[k] , identifier[encodedMetaValue] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rsPost] operator[SEP] identifier[bucket] , identifier[path] , Other[null] operator[SEP] operator[SEP]
}
|
public @NotNull CharAssert isGreaterThan(char other) {
if (actual > other) {
return this;
}
failIfCustomMessageIsSet();
throw failure(unexpectedLessThanOrEqualTo(actual, other));
} | class class_name[name] begin[{]
method[isGreaterThan, return_type[type[CharAssert]], modifier[public], parameter[other]] begin[{]
if[binary_operation[member[.actual], >, member[.other]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
call[.failIfCustomMessageIsSet, parameter[]]
ThrowStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unexpectedLessThanOrEqualTo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] annotation[@] identifier[NotNull] identifier[CharAssert] identifier[isGreaterThan] operator[SEP] Keyword[char] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[actual] operator[>] identifier[other] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
identifier[failIfCustomMessageIsSet] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] identifier[failure] operator[SEP] identifier[unexpectedLessThanOrEqualTo] operator[SEP] identifier[actual] , identifier[other] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void handleLogoutEvent(LogoutEvent event)
{
clearUser();
Authentication auth = (Authentication) event.getSource();
propertyChangeSupport.firePropertyChange(USER, auth, null);
} | class class_name[name] begin[{]
method[handleLogoutEvent, return_type[void], modifier[protected], parameter[event]] begin[{]
call[.clearUser, parameter[]]
local_variable[type[Authentication], auth]
call[propertyChangeSupport.firePropertyChange, parameter[member[.USER], member[.auth], literal[null]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[handleLogoutEvent] operator[SEP] identifier[LogoutEvent] identifier[event] operator[SEP] {
identifier[clearUser] operator[SEP] operator[SEP] operator[SEP] identifier[Authentication] identifier[auth] operator[=] operator[SEP] identifier[Authentication] operator[SEP] identifier[event] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] operator[SEP] identifier[propertyChangeSupport] operator[SEP] identifier[firePropertyChange] operator[SEP] identifier[USER] , identifier[auth] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public long getRetryTimeoutMillis(int retryAttempt) {
long temp = Math.min(MAX_RETRY_CAP, (long) (retryTimeoutMillis * Math.pow(2.0, retryAttempt - 1)));
return (long) ((temp / 2) * (1.0 + RANDOM.nextDouble()));
} | class class_name[name] begin[{]
method[getRetryTimeoutMillis, return_type[type[long]], modifier[public], parameter[retryAttempt]] begin[{]
local_variable[type[long], temp]
return[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=temp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=MethodInvocation(arguments=[], member=nextDouble, postfix_operators=[], prefix_operators=[], qualifier=RANDOM, selectors=[], type_arguments=None), operator=+), operator=*), type=BasicType(dimensions=[], name=long))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[getRetryTimeoutMillis] operator[SEP] Keyword[int] identifier[retryAttempt] operator[SEP] {
Keyword[long] identifier[temp] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[MAX_RETRY_CAP] , operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[retryTimeoutMillis] operator[*] identifier[Math] operator[SEP] identifier[pow] operator[SEP] literal[Float] , identifier[retryAttempt] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[long] operator[SEP] operator[SEP] operator[SEP] identifier[temp] operator[/] Other[2] operator[SEP] operator[*] operator[SEP] literal[Float] operator[+] identifier[RANDOM] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(DeleteFolderContentsRequest deleteFolderContentsRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteFolderContentsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteFolderContentsRequest.getAuthenticationToken(), AUTHENTICATIONTOKEN_BINDING);
protocolMarshaller.marshall(deleteFolderContentsRequest.getFolderId(), FOLDERID_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[deleteFolderContentsRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteFolderContentsRequest], ==, 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=getAuthenticationToken, postfix_operators=[], prefix_operators=[], qualifier=deleteFolderContentsRequest, selectors=[], type_arguments=None), MemberReference(member=AUTHENTICATIONTOKEN_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=getFolderId, postfix_operators=[], prefix_operators=[], qualifier=deleteFolderContentsRequest, selectors=[], type_arguments=None), MemberReference(member=FOLDERID_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[DeleteFolderContentsRequest] identifier[deleteFolderContentsRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteFolderContentsRequest] 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[deleteFolderContentsRequest] operator[SEP] identifier[getAuthenticationToken] operator[SEP] operator[SEP] , identifier[AUTHENTICATIONTOKEN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[deleteFolderContentsRequest] operator[SEP] identifier[getFolderId] operator[SEP] operator[SEP] , identifier[FOLDERID_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 Postcard withFloatArray(@Nullable String key, @Nullable float[] value) {
mBundle.putFloatArray(key, value);
return this;
} | class class_name[name] begin[{]
method[withFloatArray, return_type[type[Postcard]], modifier[public], parameter[key, value]] begin[{]
call[mBundle.putFloatArray, parameter[member[.key], member[.value]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Postcard] identifier[withFloatArray] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[key] , annotation[@] identifier[Nullable] Keyword[float] operator[SEP] operator[SEP] identifier[value] operator[SEP] {
identifier[mBundle] operator[SEP] identifier[putFloatArray] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static String initTree(CmsObject cms, String encoding, String skinUri) {
StringBuffer retValue = new StringBuffer(512);
String servletUrl = OpenCms.getSystemInfo().getOpenCmsContext();
// get the localized workplace messages
// TODO: Why a new message object, can it not be obtained from session?
Locale locale = cms.getRequestContext().getLocale();
CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(locale);
retValue.append("function initTreeResources() {\n");
retValue.append("\tinitResources(\"");
retValue.append(encoding);
retValue.append("\", \"");
retValue.append(PATH_WORKPLACE);
retValue.append("\", \"");
retValue.append(skinUri);
retValue.append("\", \"");
retValue.append(servletUrl);
retValue.append("\");\n");
// get all available resource types
List<I_CmsResourceType> allResTypes = OpenCms.getResourceManager().getResourceTypes();
for (int i = 0; i < allResTypes.size(); i++) {
// loop through all types
I_CmsResourceType type = allResTypes.get(i);
int curTypeId = type.getTypeId();
String curTypeName = type.getTypeName();
// get the settings for the resource type
CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(curTypeName);
if (settings == null) {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_MISSING_SETTINGS_ENTRY_1, curTypeName));
}
settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
CmsResourceTypePlain.getStaticTypeName());
}
retValue.append("\taddResourceType(");
retValue.append(curTypeId);
retValue.append(", \"");
retValue.append(curTypeName);
retValue.append("\",\t\"");
retValue.append(messages.key(settings.getKey()));
retValue.append("\",\t\"" + CmsWorkplace.RES_PATH_FILETYPES);
retValue.append(settings.getIcon());
retValue.append("\");\n");
}
retValue.append("}\n\n");
retValue.append("initTreeResources();\n");
String sharedFolder = OpenCms.getSiteManager().getSharedFolder();
if (sharedFolder != null) {
retValue.append("sharedFolderName = '" + sharedFolder + "';");
}
return retValue.toString();
} | class class_name[name] begin[{]
method[initTree, return_type[type[String]], modifier[public static], parameter[cms, encoding, skinUri]] begin[{]
local_variable[type[StringBuffer], retValue]
local_variable[type[String], servletUrl]
local_variable[type[Locale], locale]
local_variable[type[CmsMessages], messages]
call[retValue.append, parameter[literal["function initTreeResources() {\n"]]]
call[retValue.append, parameter[literal["\tinitResources(\""]]]
call[retValue.append, parameter[member[.encoding]]]
call[retValue.append, parameter[literal["\", \""]]]
call[retValue.append, parameter[member[.PATH_WORKPLACE]]]
call[retValue.append, parameter[literal["\", \""]]]
call[retValue.append, parameter[member[.skinUri]]]
call[retValue.append, parameter[literal["\", \""]]]
call[retValue.append, parameter[member[.servletUrl]]]
call[retValue.append, parameter[literal["\");\n"]]]
local_variable[type[List], allResTypes]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=allResTypes, selectors=[], type_arguments=None), name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=I_CmsResourceType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTypeId, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), name=curTypeId)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTypeName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), name=curTypeName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getWorkplaceManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=curTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getExplorerTypeSetting, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=settings)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsExplorerTypeSettings, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=settings, 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=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[], member=getBundle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=LOG_MISSING_SETTINGS_ENTRY_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MemberReference(member=curTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=settings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getWorkplaceManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStaticTypeName, postfix_operators=[], prefix_operators=[], qualifier=CmsResourceTypePlain, selectors=[], type_arguments=None)], member=getExplorerTypeSetting, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\taddResourceType(")], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=curTypeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, 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=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=curTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\",\t\"")], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None)], member=key, postfix_operators=[], prefix_operators=[], qualifier=messages, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\",\t\""), operandr=MemberReference(member=RES_PATH_FILETYPES, postfix_operators=[], prefix_operators=[], qualifier=CmsWorkplace, selectors=[]), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIcon, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\");\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=retValue, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=allResTypes, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[retValue.append, parameter[literal["}\n\n"]]]
call[retValue.append, parameter[literal["initTreeResources();\n"]]]
local_variable[type[String], sharedFolder]
if[binary_operation[member[.sharedFolder], !=, literal[null]]] begin[{]
call[retValue.append, parameter[binary_operation[binary_operation[literal["sharedFolderName = '"], +, member[.sharedFolder]], +, literal["';"]]]]
else begin[{]
None
end[}]
return[call[retValue.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[initTree] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[String] identifier[encoding] , identifier[String] identifier[skinUri] operator[SEP] {
identifier[StringBuffer] identifier[retValue] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[512] operator[SEP] operator[SEP] identifier[String] identifier[servletUrl] operator[=] identifier[OpenCms] operator[SEP] identifier[getSystemInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getOpenCmsContext] operator[SEP] operator[SEP] operator[SEP] identifier[Locale] identifier[locale] operator[=] identifier[cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] identifier[CmsMessages] identifier[messages] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getMessages] operator[SEP] identifier[locale] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[PATH_WORKPLACE] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[skinUri] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[servletUrl] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[I_CmsResourceType] operator[>] identifier[allResTypes] operator[=] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[allResTypes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[I_CmsResourceType] identifier[type] operator[=] identifier[allResTypes] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[int] identifier[curTypeId] operator[=] identifier[type] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[curTypeName] operator[=] identifier[type] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[SEP] identifier[CmsExplorerTypeSettings] identifier[settings] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getExplorerTypeSetting] operator[SEP] identifier[curTypeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[settings] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_MISSING_SETTINGS_ENTRY_1] , identifier[curTypeName] operator[SEP] operator[SEP] operator[SEP]
}
identifier[settings] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getExplorerTypeSetting] operator[SEP] identifier[CmsResourceTypePlain] operator[SEP] identifier[getStaticTypeName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[curTypeId] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[curTypeName] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[messages] operator[SEP] identifier[key] operator[SEP] identifier[settings] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[CmsWorkplace] operator[SEP] identifier[RES_PATH_FILETYPES] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] identifier[settings] operator[SEP] identifier[getIcon] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[sharedFolder] operator[=] identifier[OpenCms] operator[SEP] identifier[getSiteManager] operator[SEP] operator[SEP] operator[SEP] identifier[getSharedFolder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sharedFolder] operator[!=] Other[null] operator[SEP] {
identifier[retValue] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[sharedFolder] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[retValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void add_logging_target(final DeviceProxy deviceProxy, final String target)
throws DevFailed {
// Get connection on administration device
if (deviceProxy.getAdm_dev() == null) {
import_admin_device(deviceProxy, "add_logging_target");
}
// Prepeare data
final String[] str = new String[2];
str[0] = get_name(deviceProxy);
str[1] = target;
final DeviceData argin = new DeviceData();
argin.insert(str);
// And send command
deviceProxy.getAdm_dev().command_inout("AddLoggingTarget", argin);
} | class class_name[name] begin[{]
method[add_logging_target, return_type[void], modifier[public], parameter[deviceProxy, target]] begin[{]
if[binary_operation[call[deviceProxy.getAdm_dev, parameter[]], ==, literal[null]]] begin[{]
call[.import_admin_device, parameter[member[.deviceProxy], literal["add_logging_target"]]]
else begin[{]
None
end[}]
local_variable[type[String], str]
assign[member[.str], call[.get_name, parameter[member[.deviceProxy]]]]
assign[member[.str], member[.target]]
local_variable[type[DeviceData], argin]
call[argin.insert, parameter[member[.str]]]
call[deviceProxy.getAdm_dev, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[add_logging_target] operator[SEP] Keyword[final] identifier[DeviceProxy] identifier[deviceProxy] , Keyword[final] identifier[String] identifier[target] operator[SEP] Keyword[throws] identifier[DevFailed] {
Keyword[if] operator[SEP] identifier[deviceProxy] operator[SEP] identifier[getAdm_dev] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[import_admin_device] operator[SEP] identifier[deviceProxy] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[str] operator[=] Keyword[new] identifier[String] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[str] operator[SEP] Other[0] operator[SEP] operator[=] identifier[get_name] operator[SEP] identifier[deviceProxy] operator[SEP] operator[SEP] identifier[str] operator[SEP] Other[1] operator[SEP] operator[=] identifier[target] operator[SEP] Keyword[final] identifier[DeviceData] identifier[argin] operator[=] Keyword[new] identifier[DeviceData] operator[SEP] operator[SEP] operator[SEP] identifier[argin] operator[SEP] identifier[insert] operator[SEP] identifier[str] operator[SEP] operator[SEP] identifier[deviceProxy] operator[SEP] identifier[getAdm_dev] operator[SEP] operator[SEP] operator[SEP] identifier[command_inout] operator[SEP] literal[String] , identifier[argin] operator[SEP] operator[SEP]
}
|
public static com.liferay.commerce.model.CommerceOrder deleteCommerceOrder(
com.liferay.commerce.model.CommerceOrder commerceOrder)
throws com.liferay.portal.kernel.exception.PortalException {
return getService().deleteCommerceOrder(commerceOrder);
} | class class_name[name] begin[{]
method[deleteCommerceOrder, return_type[type[com]], modifier[public static], parameter[commerceOrder]] begin[{]
return[call[.getService, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[model] operator[SEP] identifier[CommerceOrder] identifier[deleteCommerceOrder] operator[SEP] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[model] operator[SEP] identifier[CommerceOrder] identifier[commerceOrder] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[portal] operator[SEP] identifier[kernel] operator[SEP] identifier[exception] operator[SEP] identifier[PortalException] {
Keyword[return] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[deleteCommerceOrder] operator[SEP] identifier[commerceOrder] operator[SEP] operator[SEP]
}
|
public static Vector3f findClosestPointOnLineSegment(float aX, float aY, float aZ, float bX, float bY, float bZ, float pX, float pY, float pZ, Vector3f result) {
float abX = bX - aX, abY = bY - aY, abZ = bZ - aZ;
float t = ((pX - aX) * abX + (pY - aY) * abY + (pZ - aZ) * abZ) / (abX * abX + abY * abY + abZ * abZ);
if (t < 0.0f) t = 0.0f;
if (t > 1.0f) t = 1.0f;
result.x = aX + t * abX;
result.y = aY + t * abY;
result.z = aZ + t * abZ;
return result;
} | class class_name[name] begin[{]
method[findClosestPointOnLineSegment, return_type[type[Vector3f]], modifier[public static], parameter[aX, aY, aZ, bX, bY, bZ, pX, pY, pZ, result]] begin[{]
local_variable[type[float], abX]
local_variable[type[float], t]
if[binary_operation[member[.t], <, literal[0.0f]]] begin[{]
assign[member[.t], literal[0.0f]]
else begin[{]
None
end[}]
if[binary_operation[member[.t], >, literal[1.0f]]] begin[{]
assign[member[.t], literal[1.0f]]
else begin[{]
None
end[}]
assign[member[result.x], binary_operation[member[.aX], +, binary_operation[member[.t], *, member[.abX]]]]
assign[member[result.y], binary_operation[member[.aY], +, binary_operation[member[.t], *, member[.abY]]]]
assign[member[result.z], binary_operation[member[.aZ], +, binary_operation[member[.t], *, member[.abZ]]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Vector3f] identifier[findClosestPointOnLineSegment] operator[SEP] Keyword[float] identifier[aX] , Keyword[float] identifier[aY] , Keyword[float] identifier[aZ] , Keyword[float] identifier[bX] , Keyword[float] identifier[bY] , Keyword[float] identifier[bZ] , Keyword[float] identifier[pX] , Keyword[float] identifier[pY] , Keyword[float] identifier[pZ] , identifier[Vector3f] identifier[result] operator[SEP] {
Keyword[float] identifier[abX] operator[=] identifier[bX] operator[-] identifier[aX] , identifier[abY] operator[=] identifier[bY] operator[-] identifier[aY] , identifier[abZ] operator[=] identifier[bZ] operator[-] identifier[aZ] operator[SEP] Keyword[float] identifier[t] operator[=] operator[SEP] operator[SEP] identifier[pX] operator[-] identifier[aX] operator[SEP] operator[*] identifier[abX] operator[+] operator[SEP] identifier[pY] operator[-] identifier[aY] operator[SEP] operator[*] identifier[abY] operator[+] operator[SEP] identifier[pZ] operator[-] identifier[aZ] operator[SEP] operator[*] identifier[abZ] operator[SEP] operator[/] operator[SEP] identifier[abX] operator[*] identifier[abX] operator[+] identifier[abY] operator[*] identifier[abY] operator[+] identifier[abZ] operator[*] identifier[abZ] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[<] literal[Float] operator[SEP] identifier[t] operator[=] literal[Float] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[>] literal[Float] operator[SEP] identifier[t] operator[=] literal[Float] operator[SEP] identifier[result] operator[SEP] identifier[x] operator[=] identifier[aX] operator[+] identifier[t] operator[*] identifier[abX] operator[SEP] identifier[result] operator[SEP] identifier[y] operator[=] identifier[aY] operator[+] identifier[t] operator[*] identifier[abY] operator[SEP] identifier[result] operator[SEP] identifier[z] operator[=] identifier[aZ] operator[+] identifier[t] operator[*] identifier[abZ] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public void registerPropertyExclusions( Class target, String[] properties ) {
if( target != null && properties != null && properties.length > 0 ) {
Set set = (Set) exclusionMap.get( target );
if( set == null ) {
set = new HashSet();
exclusionMap.put( target, set );
}
for( int i = 0; i < properties.length; i++ ) {
if( !set.contains( properties[i] ) ) {
set.add( properties[i] );
}
}
}
} | class class_name[name] begin[{]
method[registerPropertyExclusions, return_type[void], modifier[public], parameter[target, properties]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.target], !=, literal[null]], &&, binary_operation[member[.properties], !=, literal[null]]], &&, binary_operation[member[properties.length], >, literal[0]]]] begin[{]
local_variable[type[Set], set]
if[binary_operation[member[.set], ==, literal[null]]] begin[{]
assign[member[.set], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HashSet, sub_type=None))]
call[exclusionMap.put, parameter[member[.target], member[.set]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=set, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=add, postfix_operators=[], prefix_operators=[], qualifier=set, 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=properties, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[registerPropertyExclusions] operator[SEP] identifier[Class] identifier[target] , identifier[String] operator[SEP] operator[SEP] identifier[properties] operator[SEP] {
Keyword[if] operator[SEP] identifier[target] operator[!=] Other[null] operator[&&] identifier[properties] operator[!=] Other[null] operator[&&] identifier[properties] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[Set] identifier[set] operator[=] operator[SEP] identifier[Set] operator[SEP] identifier[exclusionMap] operator[SEP] identifier[get] operator[SEP] identifier[target] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[set] operator[==] Other[null] operator[SEP] {
identifier[set] operator[=] Keyword[new] identifier[HashSet] operator[SEP] operator[SEP] operator[SEP] identifier[exclusionMap] operator[SEP] identifier[put] operator[SEP] identifier[target] , identifier[set] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[properties] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[set] operator[SEP] identifier[contains] operator[SEP] identifier[properties] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[set] operator[SEP] identifier[add] operator[SEP] identifier[properties] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public JSONArray jsonifyValues() {
JSONArray jValues = new JSONArray();
for (ValueEntry vEntry : values) {
JSONObject o = new JSONObject();
o.put("value",vEntry.getValue());
o.put("timestamp",vEntry.getTimestamp());
jValues.add(o);
}
return jValues;
} | class class_name[name] begin[{]
method[jsonifyValues, return_type[type[JSONArray]], modifier[public], parameter[]] begin[{]
local_variable[type[JSONArray], jValues]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONObject, sub_type=None)), name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value"), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=vEntry, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="timestamp"), MethodInvocation(arguments=[], member=getTimestamp, postfix_operators=[], prefix_operators=[], qualifier=vEntry, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=jValues, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vEntry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ValueEntry, sub_type=None))), label=None)
return[member[.jValues]]
end[}]
END[}] | Keyword[public] identifier[JSONArray] identifier[jsonifyValues] operator[SEP] operator[SEP] {
identifier[JSONArray] identifier[jValues] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ValueEntry] identifier[vEntry] operator[:] identifier[values] operator[SEP] {
identifier[JSONObject] identifier[o] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[o] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[vEntry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[o] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[vEntry] operator[SEP] identifier[getTimestamp] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[jValues] operator[SEP] identifier[add] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
Keyword[return] identifier[jValues] operator[SEP]
}
|
@Override
public ValueRange range(TemporalField field) {
if (field == WEEK_BASED_YEAR) {
return WEEK_BASED_YEAR.range();
}
if (field == WEEK_OF_WEEK_BASED_YEAR) {
return ValueRange.of(1, weekRange(year));
}
return TemporalAccessor.super.range(field);
} | class class_name[name] begin[{]
method[range, return_type[type[ValueRange]], modifier[public], parameter[field]] begin[{]
if[binary_operation[member[.field], ==, member[.WEEK_BASED_YEAR]]] begin[{]
return[call[WEEK_BASED_YEAR.range, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.field], ==, member[.WEEK_OF_WEEK_BASED_YEAR]]] begin[{]
return[call[ValueRange.of, parameter[literal[1], call[.weekRange, parameter[member[.year]]]]]]
else begin[{]
None
end[}]
return[member[.TemporalAccessor]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ValueRange] identifier[range] operator[SEP] identifier[TemporalField] identifier[field] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[==] identifier[WEEK_BASED_YEAR] operator[SEP] {
Keyword[return] identifier[WEEK_BASED_YEAR] operator[SEP] identifier[range] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[field] operator[==] identifier[WEEK_OF_WEEK_BASED_YEAR] operator[SEP] {
Keyword[return] identifier[ValueRange] operator[SEP] identifier[of] operator[SEP] Other[1] , identifier[weekRange] operator[SEP] identifier[year] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[TemporalAccessor] operator[SEP] Keyword[super] operator[SEP] identifier[range] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
|
private boolean hasAnnotation(JavaAnnotatedElement clazz, Class<? extends Annotation> annotationClazz) {
return clazz.getAnnotations().stream()
.filter(item -> item.getType().isA(annotationClazz.getName()))
.count() > 0;
} | class class_name[name] begin[{]
method[hasAnnotation, return_type[type[boolean]], modifier[private], parameter[clazz, annotationClazz]] begin[{]
return[binary_operation[call[clazz.getAnnotations, parameter[]], >, literal[0]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[hasAnnotation] operator[SEP] identifier[JavaAnnotatedElement] identifier[clazz] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Annotation] operator[>] identifier[annotationClazz] operator[SEP] {
Keyword[return] identifier[clazz] operator[SEP] identifier[getAnnotations] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[item] operator[->] identifier[item] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[isA] operator[SEP] identifier[annotationClazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP]
}
|
public void marshall(EntitiesDetectionJobFilter entitiesDetectionJobFilter, ProtocolMarshaller protocolMarshaller) {
if (entitiesDetectionJobFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(entitiesDetectionJobFilter.getJobName(), JOBNAME_BINDING);
protocolMarshaller.marshall(entitiesDetectionJobFilter.getJobStatus(), JOBSTATUS_BINDING);
protocolMarshaller.marshall(entitiesDetectionJobFilter.getSubmitTimeBefore(), SUBMITTIMEBEFORE_BINDING);
protocolMarshaller.marshall(entitiesDetectionJobFilter.getSubmitTimeAfter(), SUBMITTIMEAFTER_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[entitiesDetectionJobFilter, protocolMarshaller]] begin[{]
if[binary_operation[member[.entitiesDetectionJobFilter], ==, 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=getJobName, postfix_operators=[], prefix_operators=[], qualifier=entitiesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=JOBNAME_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=getJobStatus, postfix_operators=[], prefix_operators=[], qualifier=entitiesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=JOBSTATUS_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=getSubmitTimeBefore, postfix_operators=[], prefix_operators=[], qualifier=entitiesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=SUBMITTIMEBEFORE_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=getSubmitTimeAfter, postfix_operators=[], prefix_operators=[], qualifier=entitiesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=SUBMITTIMEAFTER_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[EntitiesDetectionJobFilter] identifier[entitiesDetectionJobFilter] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[entitiesDetectionJobFilter] 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[entitiesDetectionJobFilter] operator[SEP] identifier[getJobName] operator[SEP] operator[SEP] , identifier[JOBNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[entitiesDetectionJobFilter] operator[SEP] identifier[getJobStatus] operator[SEP] operator[SEP] , identifier[JOBSTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[entitiesDetectionJobFilter] operator[SEP] identifier[getSubmitTimeBefore] operator[SEP] operator[SEP] , identifier[SUBMITTIMEBEFORE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[entitiesDetectionJobFilter] operator[SEP] identifier[getSubmitTimeAfter] operator[SEP] operator[SEP] , identifier[SUBMITTIMEAFTER_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 void addTransientRange(String id, RowRange range) {
String start = DatatypeConverter.printHexBinary(range.getStart().toArray());
String end = DatatypeConverter.printHexBinary(range.getEnd().toArray());
appConfig.setProperty(PREFIX + id, start + ":" + end);
} | class class_name[name] begin[{]
method[addTransientRange, return_type[void], modifier[public], parameter[id, range]] begin[{]
local_variable[type[String], start]
local_variable[type[String], end]
call[appConfig.setProperty, parameter[binary_operation[member[.PREFIX], +, member[.id]], binary_operation[binary_operation[member[.start], +, literal[":"]], +, member[.end]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addTransientRange] operator[SEP] identifier[String] identifier[id] , identifier[RowRange] identifier[range] operator[SEP] {
identifier[String] identifier[start] operator[=] identifier[DatatypeConverter] operator[SEP] identifier[printHexBinary] operator[SEP] identifier[range] operator[SEP] identifier[getStart] operator[SEP] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[end] operator[=] identifier[DatatypeConverter] operator[SEP] identifier[printHexBinary] operator[SEP] identifier[range] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[appConfig] operator[SEP] identifier[setProperty] operator[SEP] identifier[PREFIX] operator[+] identifier[id] , identifier[start] operator[+] literal[String] operator[+] identifier[end] operator[SEP] operator[SEP]
}
|
private CloseableHttpClient createHttpClient(HttpClientConnectionManager connectionManager) {
HttpClientBuilder builder =
HttpClients.custom().setConnectionManager(connectionManager).disableAutomaticRetries();
int socketBufferSizeInBytes = this.config.getSocketBufferSizeInBytes();
if (socketBufferSizeInBytes > 0) {
builder.setDefaultConnectionConfig(
ConnectionConfig.custom().setBufferSize(socketBufferSizeInBytes).build());
}
return builder.build();
} | class class_name[name] begin[{]
method[createHttpClient, return_type[type[CloseableHttpClient]], modifier[private], parameter[connectionManager]] begin[{]
local_variable[type[HttpClientBuilder], builder]
local_variable[type[int], socketBufferSizeInBytes]
if[binary_operation[member[.socketBufferSizeInBytes], >, literal[0]]] begin[{]
call[builder.setDefaultConnectionConfig, parameter[call[ConnectionConfig.custom, parameter[]]]]
else begin[{]
None
end[}]
return[call[builder.build, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[CloseableHttpClient] identifier[createHttpClient] operator[SEP] identifier[HttpClientConnectionManager] identifier[connectionManager] operator[SEP] {
identifier[HttpClientBuilder] identifier[builder] operator[=] identifier[HttpClients] operator[SEP] identifier[custom] operator[SEP] operator[SEP] operator[SEP] identifier[setConnectionManager] operator[SEP] identifier[connectionManager] operator[SEP] operator[SEP] identifier[disableAutomaticRetries] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[socketBufferSizeInBytes] operator[=] Keyword[this] operator[SEP] identifier[config] operator[SEP] identifier[getSocketBufferSizeInBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[socketBufferSizeInBytes] operator[>] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[setDefaultConnectionConfig] operator[SEP] identifier[ConnectionConfig] operator[SEP] identifier[custom] operator[SEP] operator[SEP] operator[SEP] identifier[setBufferSize] operator[SEP] identifier[socketBufferSizeInBytes] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
@edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL")
protected Reader createReader(final File file) throws FileNotFoundException {
return createReader(new FileInputStream(file));
} | class class_name[name] begin[{]
method[createReader, return_type[type[Reader]], modifier[protected], parameter[file]] begin[{]
return[call[.createReader, parameter[ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[edu] operator[SEP] identifier[umd] operator[SEP] identifier[cs] operator[SEP] identifier[findbugs] operator[SEP] identifier[annotations] operator[SEP] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] identifier[Reader] identifier[createReader] operator[SEP] Keyword[final] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[FileNotFoundException] {
Keyword[return] identifier[createReader] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP]
}
|
public static CommerceOrderItem[] findByCommerceOrderId_PrevAndNext(
long commerceOrderItemId, long commerceOrderId,
OrderByComparator<CommerceOrderItem> orderByComparator)
throws com.liferay.commerce.exception.NoSuchOrderItemException {
return getPersistence()
.findByCommerceOrderId_PrevAndNext(commerceOrderItemId,
commerceOrderId, orderByComparator);
} | class class_name[name] begin[{]
method[findByCommerceOrderId_PrevAndNext, return_type[type[CommerceOrderItem]], modifier[public static], parameter[commerceOrderItemId, commerceOrderId, orderByComparator]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CommerceOrderItem] operator[SEP] operator[SEP] identifier[findByCommerceOrderId_PrevAndNext] operator[SEP] Keyword[long] identifier[commerceOrderItemId] , Keyword[long] identifier[commerceOrderId] , identifier[OrderByComparator] operator[<] identifier[CommerceOrderItem] operator[>] identifier[orderByComparator] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[exception] operator[SEP] identifier[NoSuchOrderItemException] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByCommerceOrderId_PrevAndNext] operator[SEP] identifier[commerceOrderItemId] , identifier[commerceOrderId] , identifier[orderByComparator] operator[SEP] operator[SEP]
}
|
void log(
final LogLevel level,
@Nullable final String event,
@Nullable final String message,
@Nullable final String[] dataKeys,
@Nullable final Object[] dataValues,
@Nullable final Throwable throwable) {
level.log(
getSlf4jLogger(),
event,
createKeysFromArray(dataKeys, MESSAGE_DATA_KEY),
createValuesFromArray(dataValues, message),
throwable);
} | class class_name[name] begin[{]
method[log, return_type[void], modifier[default], parameter[level, event, message, dataKeys, dataValues, throwable]] begin[{]
call[level.log, parameter[call[.getSlf4jLogger, parameter[]], member[.event], call[.createKeysFromArray, parameter[member[.dataKeys], member[.MESSAGE_DATA_KEY]]], call[.createValuesFromArray, parameter[member[.dataValues], member[.message]]], member[.throwable]]]
end[}]
END[}] | Keyword[void] identifier[log] operator[SEP] Keyword[final] identifier[LogLevel] identifier[level] , annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[event] , annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[message] , annotation[@] identifier[Nullable] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[dataKeys] , annotation[@] identifier[Nullable] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[dataValues] , annotation[@] identifier[Nullable] Keyword[final] identifier[Throwable] identifier[throwable] operator[SEP] {
identifier[level] operator[SEP] identifier[log] operator[SEP] identifier[getSlf4jLogger] operator[SEP] operator[SEP] , identifier[event] , identifier[createKeysFromArray] operator[SEP] identifier[dataKeys] , identifier[MESSAGE_DATA_KEY] operator[SEP] , identifier[createValuesFromArray] operator[SEP] identifier[dataValues] , identifier[message] operator[SEP] , identifier[throwable] operator[SEP] operator[SEP]
}
|
String getListPattern(
TextWidth width,
int size
) {
if (width == null) {
throw new NullPointerException("Missing width.");
}
if (
(size >= MIN_LIST_INDEX)
&& (size <= MAX_LIST_INDEX)
) {
return this.list.get(Integer.valueOf(size)).get(width);
}
return lookup(this.locale, width, size);
} | class class_name[name] begin[{]
method[getListPattern, return_type[type[String]], modifier[default], parameter[width, size]] begin[{]
if[binary_operation[member[.width], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing width.")], 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[}]
if[binary_operation[binary_operation[member[.size], >=, member[.MIN_LIST_INDEX]], &&, binary_operation[member[.size], <=, member[.MAX_LIST_INDEX]]]] begin[{]
return[THIS[member[None.list]call[None.get, parameter[call[Integer.valueOf, parameter[member[.size]]]]]call[None.get, parameter[member[.width]]]]]
else begin[{]
None
end[}]
return[call[.lookup, parameter[THIS[member[None.locale]], member[.width], member[.size]]]]
end[}]
END[}] | identifier[String] identifier[getListPattern] operator[SEP] identifier[TextWidth] identifier[width] , Keyword[int] identifier[size] operator[SEP] {
Keyword[if] operator[SEP] identifier[width] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[size] operator[>=] identifier[MIN_LIST_INDEX] operator[SEP] operator[&&] operator[SEP] identifier[size] operator[<=] identifier[MAX_LIST_INDEX] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[list] operator[SEP] identifier[get] operator[SEP] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[width] operator[SEP] operator[SEP]
}
Keyword[return] identifier[lookup] operator[SEP] Keyword[this] operator[SEP] identifier[locale] , identifier[width] , identifier[size] operator[SEP] operator[SEP]
}
|
public JPAEntry getEntry(String entryKey) {
for (JPAEntry entry : entries) {
if (entry.getKey().equals(entryKey)) {
return entry;
}
}
return null;
} | class class_name[name] begin[{]
method[getEntry, return_type[type[JPAEntry]], modifier[public], parameter[entryKey]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[MemberReference(member=entryKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=entries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JPAEntry, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[JPAEntry] identifier[getEntry] operator[SEP] identifier[String] identifier[entryKey] operator[SEP] {
Keyword[for] operator[SEP] identifier[JPAEntry] identifier[entry] operator[:] identifier[entries] operator[SEP] {
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[entryKey] operator[SEP] operator[SEP] {
Keyword[return] identifier[entry] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public ListGeoMatchSetsResult listGeoMatchSets(ListGeoMatchSetsRequest request) {
request = beforeClientExecution(request);
return executeListGeoMatchSets(request);
} | class class_name[name] begin[{]
method[listGeoMatchSets, return_type[type[ListGeoMatchSetsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeListGeoMatchSets, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ListGeoMatchSetsResult] identifier[listGeoMatchSets] operator[SEP] identifier[ListGeoMatchSetsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeListGeoMatchSets] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public FieldDescriptor getFieldDescriptorByName(String name)
{
if (name == null || m_FieldDescriptions == null)
{
return null;
}
if (m_fieldDescriptorNameMap == null)
{
HashMap nameMap = new HashMap();
FieldDescriptor[] descriptors = getFieldDescriptions();
for (int i = descriptors.length - 1; i >= 0; i--)
{
FieldDescriptor fld = descriptors[i];
nameMap.put(fld.getPersistentField().getName(), fld);
}
m_fieldDescriptorNameMap = nameMap;
}
return (FieldDescriptor) m_fieldDescriptorNameMap.get(name);
} | class class_name[name] begin[{]
method[getFieldDescriptorByName, return_type[type[FieldDescriptor]], modifier[public], parameter[name]] begin[{]
if[binary_operation[binary_operation[member[.name], ==, literal[null]], ||, binary_operation[member[.m_FieldDescriptions], ==, literal[null]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_fieldDescriptorNameMap], ==, literal[null]]] begin[{]
local_variable[type[HashMap], nameMap]
local_variable[type[FieldDescriptor], descriptors]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=descriptors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=fld)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldDescriptor, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPersistentField, postfix_operators=[], prefix_operators=[], qualifier=fld, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=fld, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=nameMap, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, 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=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=descriptors, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.m_fieldDescriptorNameMap], member[.nameMap]]
else begin[{]
None
end[}]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=m_fieldDescriptorNameMap, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FieldDescriptor, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[FieldDescriptor] identifier[getFieldDescriptorByName] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[||] identifier[m_FieldDescriptions] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_fieldDescriptorNameMap] operator[==] Other[null] operator[SEP] {
identifier[HashMap] identifier[nameMap] operator[=] Keyword[new] identifier[HashMap] operator[SEP] operator[SEP] operator[SEP] identifier[FieldDescriptor] operator[SEP] operator[SEP] identifier[descriptors] operator[=] identifier[getFieldDescriptions] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[descriptors] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] identifier[i] operator[--] operator[SEP] {
identifier[FieldDescriptor] identifier[fld] operator[=] identifier[descriptors] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[nameMap] operator[SEP] identifier[put] operator[SEP] identifier[fld] operator[SEP] identifier[getPersistentField] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[fld] operator[SEP] operator[SEP]
}
identifier[m_fieldDescriptorNameMap] operator[=] identifier[nameMap] operator[SEP]
}
Keyword[return] operator[SEP] identifier[FieldDescriptor] operator[SEP] identifier[m_fieldDescriptorNameMap] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
|
public void setOutput(long outputContentId, ContentData outputContentData) {
setOutputContentId(outputContentId);
setOutputAccessType(outputContentData.getAccessType());
setOutputType(outputContentData.getType());
} | class class_name[name] begin[{]
method[setOutput, return_type[void], modifier[public], parameter[outputContentId, outputContentData]] begin[{]
call[.setOutputContentId, parameter[member[.outputContentId]]]
call[.setOutputAccessType, parameter[call[outputContentData.getAccessType, parameter[]]]]
call[.setOutputType, parameter[call[outputContentData.getType, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setOutput] operator[SEP] Keyword[long] identifier[outputContentId] , identifier[ContentData] identifier[outputContentData] operator[SEP] {
identifier[setOutputContentId] operator[SEP] identifier[outputContentId] operator[SEP] operator[SEP] identifier[setOutputAccessType] operator[SEP] identifier[outputContentData] operator[SEP] identifier[getAccessType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setOutputType] operator[SEP] identifier[outputContentData] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void decode(final ChannelHandlerContext ctx, final DatagramPacket msg, final List<Object> out)
throws Exception {
final long arrivalTime = this.clock.getCurrentTimeMillis();
final ByteBuf content = msg.content();
// some clients are sending various types of pings even over
// UDP, such as linphone which is sending "jaK\n\r".
// According to RFC5626, the only valid ping over UDP
// is to use a STUN request and since such a request is
// at least 20 bytes we will simply ignore anything less
// than that. And yes, there is no way that an actual
// SIP message ever could be less than 20 bytes.
if (content.readableBytes() < 20) {
return;
}
final byte[] b = new byte[content.readableBytes()];
content.getBytes(0, b);
final Buffer buffer = Buffers.wrap(b);
SipParser.consumeSWS(buffer);
final SipMessage sipMessage = SipParser.frame(buffer);
// System.err.println("CSeq header: " + sipMessage.getCSeqHeader());
// final SipInitialLine initialLine = SipInitialLine.parse(buffer.readLine());
// final Buffer headers = buffer.readUntilDoubleCRLF();
// SipMessage sipMessage = null;
// if (initialLine.isRequestLine()) {
// sipMessage = new SipRequestImpl(initialLine.toRequestLine(), headers, buffer);
// } else {
// sipMessage = new SipResponseImpl(initialLine.toResponseLine(), headers, buffer);
// }
final Connection connection = new UdpConnection(ctx.channel(), msg.sender());
final SipMessageEvent event = new DefaultSipMessageEvent(connection, sipMessage, arrivalTime);
out.add(event);
} | class class_name[name] begin[{]
method[decode, return_type[void], modifier[protected], parameter[ctx, msg, out]] begin[{]
local_variable[type[long], arrivalTime]
local_variable[type[ByteBuf], content]
if[binary_operation[call[content.readableBytes, parameter[]], <, literal[20]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[byte], b]
call[content.getBytes, parameter[literal[0], member[.b]]]
local_variable[type[Buffer], buffer]
call[SipParser.consumeSWS, parameter[member[.buffer]]]
local_variable[type[SipMessage], sipMessage]
local_variable[type[Connection], connection]
local_variable[type[SipMessageEvent], event]
call[out.add, parameter[member[.event]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[decode] operator[SEP] Keyword[final] identifier[ChannelHandlerContext] identifier[ctx] , Keyword[final] identifier[DatagramPacket] identifier[msg] , Keyword[final] identifier[List] operator[<] identifier[Object] operator[>] identifier[out] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] Keyword[long] identifier[arrivalTime] operator[=] Keyword[this] operator[SEP] identifier[clock] operator[SEP] identifier[getCurrentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ByteBuf] identifier[content] operator[=] identifier[msg] operator[SEP] identifier[content] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[content] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[<] Other[20] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[b] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[content] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[getBytes] operator[SEP] Other[0] , identifier[b] operator[SEP] operator[SEP] Keyword[final] identifier[Buffer] identifier[buffer] operator[=] identifier[Buffers] operator[SEP] identifier[wrap] operator[SEP] identifier[b] operator[SEP] operator[SEP] identifier[SipParser] operator[SEP] identifier[consumeSWS] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] Keyword[final] identifier[SipMessage] identifier[sipMessage] operator[=] identifier[SipParser] operator[SEP] identifier[frame] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] Keyword[final] identifier[Connection] identifier[connection] operator[=] Keyword[new] identifier[UdpConnection] operator[SEP] identifier[ctx] operator[SEP] identifier[channel] operator[SEP] operator[SEP] , identifier[msg] operator[SEP] identifier[sender] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[SipMessageEvent] identifier[event] operator[=] Keyword[new] identifier[DefaultSipMessageEvent] operator[SEP] identifier[connection] , identifier[sipMessage] , identifier[arrivalTime] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[add] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
|
public void remove(Token token,
boolean requiresCurrentCheckpoint)
throws ObjectManagerException
{
final String methodName = "remove";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName,
new Object[] { token, new Boolean(requiresCurrentCheckpoint) });
// The token is no longer visible.
inMemoryTokens.remove(new Long(token.storedObjectIdentifier));
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName);
} | class class_name[name] begin[{]
method[remove, return_type[void], modifier[public], parameter[token, requiresCurrentCheckpoint]] begin[{]
local_variable[type[String], methodName]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.entry, parameter[THIS[], member[.cclass], member[.methodName], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=token, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=requiresCurrentCheckpoint, 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=Boolean, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
call[inMemoryTokens.remove, parameter[ClassCreator(arguments=[MemberReference(member=storedObjectIdentifier, postfix_operators=[], prefix_operators=[], qualifier=token, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None))]]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.exit, parameter[THIS[], member[.cclass], member[.methodName]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[remove] operator[SEP] identifier[Token] identifier[token] , Keyword[boolean] identifier[requiresCurrentCheckpoint] operator[SEP] Keyword[throws] identifier[ObjectManagerException] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[cclass] , identifier[methodName] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[token] , Keyword[new] identifier[Boolean] operator[SEP] identifier[requiresCurrentCheckpoint] operator[SEP]
} operator[SEP] operator[SEP] identifier[inMemoryTokens] operator[SEP] identifier[remove] operator[SEP] Keyword[new] identifier[Long] operator[SEP] identifier[token] operator[SEP] identifier[storedObjectIdentifier] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[cclass] , identifier[methodName] operator[SEP] operator[SEP]
}
|
@Override
public Double max11(Double arg1, Double arg2) {
if (arg1 == null || arg2 == null) {
return Double.NaN;
} else {
return Math.max(arg1, arg2);
}
} | class class_name[name] begin[{]
method[max11, return_type[type[Double]], modifier[public], parameter[arg1, arg2]] begin[{]
if[binary_operation[binary_operation[member[.arg1], ==, literal[null]], ||, binary_operation[member[.arg2], ==, literal[null]]]] begin[{]
return[member[Double.NaN]]
else begin[{]
return[call[Math.max, parameter[member[.arg1], member[.arg2]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Double] identifier[max11] operator[SEP] identifier[Double] identifier[arg1] , identifier[Double] identifier[arg2] operator[SEP] {
Keyword[if] operator[SEP] identifier[arg1] operator[==] Other[null] operator[||] identifier[arg2] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[NaN] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[arg1] , identifier[arg2] operator[SEP] operator[SEP]
}
}
|
protected <E extends Event> void linkWave(final Node node, final javafx.event.EventType<E> eventType, final WaveType waveType, final Callback<E, Boolean> callback,
final WaveData<?>... waveData) {
node.addEventHandler(eventType, new AbstractNamedEventHandler<E, EventAdapter>("LinkWave", null) {
/**
* Handle the triggered event.
*/
@Override
public void handle(final E event) {
if (callback == null || callback.call(event)) {
model().sendWave(waveType, waveData);
}
}
});
} | class class_name[name] begin[{]
method[linkWave, return_type[void], modifier[protected], parameter[node, eventType, waveType, callback, waveData]] begin[{]
call[node.addEventHandler, parameter[member[.eventType], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="LinkWave"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=callback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=call, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=waveType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=waveData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendWave, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], documentation=/**
* Handle the triggered event.
*/, modifiers={'public'}, name=handle, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=event, type=ReferenceType(arguments=None, dimensions=[], name=E, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=EventAdapter, sub_type=None))], dimensions=None, name=AbstractNamedEventHandler, sub_type=None))]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[E] Keyword[extends] identifier[Event] operator[>] Keyword[void] identifier[linkWave] operator[SEP] Keyword[final] identifier[Node] identifier[node] , Keyword[final] identifier[javafx] operator[SEP] identifier[event] operator[SEP] identifier[EventType] operator[<] identifier[E] operator[>] identifier[eventType] , Keyword[final] identifier[WaveType] identifier[waveType] , Keyword[final] identifier[Callback] operator[<] identifier[E] , identifier[Boolean] operator[>] identifier[callback] , Keyword[final] identifier[WaveData] operator[<] operator[?] operator[>] operator[...] identifier[waveData] operator[SEP] {
identifier[node] operator[SEP] identifier[addEventHandler] operator[SEP] identifier[eventType] , Keyword[new] identifier[AbstractNamedEventHandler] operator[<] identifier[E] , identifier[EventAdapter] operator[>] operator[SEP] literal[String] , Other[null] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] Keyword[final] identifier[E] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[callback] operator[==] Other[null] operator[||] identifier[callback] operator[SEP] identifier[call] operator[SEP] identifier[event] operator[SEP] operator[SEP] {
identifier[model] operator[SEP] operator[SEP] operator[SEP] identifier[sendWave] operator[SEP] identifier[waveType] , identifier[waveData] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public static DeploymentCreator creator(final String pathServiceSid,
final String pathEnvironmentSid,
final String buildSid) {
return new DeploymentCreator(pathServiceSid, pathEnvironmentSid, buildSid);
} | class class_name[name] begin[{]
method[creator, return_type[type[DeploymentCreator]], modifier[public static], parameter[pathServiceSid, pathEnvironmentSid, buildSid]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=pathServiceSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathEnvironmentSid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=buildSid, 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=DeploymentCreator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DeploymentCreator] identifier[creator] operator[SEP] Keyword[final] identifier[String] identifier[pathServiceSid] , Keyword[final] identifier[String] identifier[pathEnvironmentSid] , Keyword[final] identifier[String] identifier[buildSid] operator[SEP] {
Keyword[return] Keyword[new] identifier[DeploymentCreator] operator[SEP] identifier[pathServiceSid] , identifier[pathEnvironmentSid] , identifier[buildSid] operator[SEP] operator[SEP]
}
|
private void validateSQLFields()
{
boolean flag = controller.isEnableSQLDatabaseOutput();
enableSQLDatabaseConnection.setSelected(flag);
sqlHostLabel.setEnabled(flag);
sqlHostField.setEnabled(flag);
sqlDatabaseLabel.setEnabled(flag);
sqlDatabaseField.setEnabled(flag);
sqlUserLabel.setEnabled(flag);
sqlUserField.setEnabled(flag);
sqlPasswordLabel.setEnabled(flag);
sqlPasswordField.setEnabled(flag);
enableZipEncodingCheckBox.setEnabled(flag);
} | class class_name[name] begin[{]
method[validateSQLFields, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[boolean], flag]
call[enableSQLDatabaseConnection.setSelected, parameter[member[.flag]]]
call[sqlHostLabel.setEnabled, parameter[member[.flag]]]
call[sqlHostField.setEnabled, parameter[member[.flag]]]
call[sqlDatabaseLabel.setEnabled, parameter[member[.flag]]]
call[sqlDatabaseField.setEnabled, parameter[member[.flag]]]
call[sqlUserLabel.setEnabled, parameter[member[.flag]]]
call[sqlUserField.setEnabled, parameter[member[.flag]]]
call[sqlPasswordLabel.setEnabled, parameter[member[.flag]]]
call[sqlPasswordField.setEnabled, parameter[member[.flag]]]
call[enableZipEncodingCheckBox.setEnabled, parameter[member[.flag]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[validateSQLFields] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[flag] operator[=] identifier[controller] operator[SEP] identifier[isEnableSQLDatabaseOutput] operator[SEP] operator[SEP] operator[SEP] identifier[enableSQLDatabaseConnection] operator[SEP] identifier[setSelected] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlHostLabel] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlHostField] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlDatabaseLabel] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlDatabaseField] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlUserLabel] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlUserField] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlPasswordLabel] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[sqlPasswordField] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP] identifier[enableZipEncodingCheckBox] operator[SEP] identifier[setEnabled] operator[SEP] identifier[flag] operator[SEP] operator[SEP]
}
|
public BugSet query(BugAspects a) {
BugSet result = this;
for (SortableValue sp : a) {
result = result.query(sp);
}
return result;
} | class class_name[name] begin[{]
method[query, return_type[type[BugSet]], modifier[public], parameter[a]] begin[{]
local_variable[type[BugSet], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=sp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=query, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SortableValue, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[BugSet] identifier[query] operator[SEP] identifier[BugAspects] identifier[a] operator[SEP] {
identifier[BugSet] identifier[result] operator[=] Keyword[this] operator[SEP] Keyword[for] operator[SEP] identifier[SortableValue] identifier[sp] operator[:] identifier[a] operator[SEP] {
identifier[result] operator[=] identifier[result] operator[SEP] identifier[query] operator[SEP] identifier[sp] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static cspolicy_cspolicylabel_binding[] get(nitro_service service, String policyname) throws Exception{
cspolicy_cspolicylabel_binding obj = new cspolicy_cspolicylabel_binding();
obj.set_policyname(policyname);
cspolicy_cspolicylabel_binding response[] = (cspolicy_cspolicylabel_binding[]) obj.get_resources(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[cspolicy_cspolicylabel_binding]], modifier[public static], parameter[service, policyname]] begin[{]
local_variable[type[cspolicy_cspolicylabel_binding], obj]
call[obj.set_policyname, parameter[member[.policyname]]]
local_variable[type[cspolicy_cspolicylabel_binding], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[cspolicy_cspolicylabel_binding] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[policyname] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[cspolicy_cspolicylabel_binding] identifier[obj] operator[=] Keyword[new] identifier[cspolicy_cspolicylabel_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_policyname] operator[SEP] identifier[policyname] operator[SEP] operator[SEP] identifier[cspolicy_cspolicylabel_binding] identifier[response] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[cspolicy_cspolicylabel_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public UpdateDevEndpointRequest withDeletePublicKeys(String... deletePublicKeys) {
if (this.deletePublicKeys == null) {
setDeletePublicKeys(new java.util.ArrayList<String>(deletePublicKeys.length));
}
for (String ele : deletePublicKeys) {
this.deletePublicKeys.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withDeletePublicKeys, return_type[type[UpdateDevEndpointRequest]], modifier[public], parameter[deletePublicKeys]] begin[{]
if[binary_operation[THIS[member[None.deletePublicKeys]], ==, literal[null]]] begin[{]
call[.setDeletePublicKeys, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=deletePublicKeys, 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))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=deletePublicKeys, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=deletePublicKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[UpdateDevEndpointRequest] identifier[withDeletePublicKeys] operator[SEP] identifier[String] operator[...] identifier[deletePublicKeys] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[deletePublicKeys] operator[==] Other[null] operator[SEP] {
identifier[setDeletePublicKeys] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[deletePublicKeys] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[deletePublicKeys] operator[SEP] {
Keyword[this] operator[SEP] identifier[deletePublicKeys] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
private static <E> void validateCounter(Counter<E> counts) {
for (Map.Entry<E, Double> entry : counts.entrySet()) {
E item = entry.getKey();
Double dblCount = entry.getValue();
if (dblCount == null) {
throw new IllegalArgumentException("ERROR: null count for item " + item + "!");
}
if (dblCount < 0) {
throw new IllegalArgumentException("ERROR: negative count " + dblCount + " for item " + item + "!");
}
}
} | class class_name[name] begin[{]
method[validateCounter, return_type[void], modifier[private static], parameter[counts]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=dblCount)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dblCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR: null count for item "), operandr=MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="!"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dblCount, 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=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR: negative count "), operandr=MemberReference(member=dblCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for item "), operator=+), operandr=MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="!"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=counts, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[E] operator[>] Keyword[void] identifier[validateCounter] operator[SEP] identifier[Counter] operator[<] identifier[E] operator[>] identifier[counts] operator[SEP] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[E] , identifier[Double] operator[>] identifier[entry] operator[:] identifier[counts] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[E] identifier[item] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[Double] identifier[dblCount] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dblCount] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[item] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[dblCount] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[dblCount] operator[+] literal[String] operator[+] identifier[item] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
@Override
public void trace(final MessageItem messageItem) {
getLogger().log(messageItem.getMarker(), FQCN, LocationAwareLogger.TRACE_INT, messageItem.getText(), null, null);
} | class class_name[name] begin[{]
method[trace, return_type[void], modifier[public], parameter[messageItem]] begin[{]
call[.getLogger, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[trace] operator[SEP] Keyword[final] identifier[MessageItem] identifier[messageItem] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[messageItem] operator[SEP] identifier[getMarker] operator[SEP] operator[SEP] , identifier[FQCN] , identifier[LocationAwareLogger] operator[SEP] identifier[TRACE_INT] , identifier[messageItem] operator[SEP] identifier[getText] operator[SEP] operator[SEP] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public void setScriptsPermission(int event) {
if (event == InstallProgressEvent.POST_INSTALL ? setScriptsPermission : getUninstallDirector().needToSetScriptsPermission()) {
fireProgressEvent(event, 95, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_SET_SCRIPTS_PERMISSION"));
try {
SelfExtractUtils.fixScriptPermissions(new SelfExtractor.NullExtractProgress(), product.getInstallDir(), null);
} catch (Exception e) {
}
}
} | class class_name[name] begin[{]
method[setScriptsPermission, return_type[void], modifier[public], parameter[event]] begin[{]
if[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=POST_INSTALL, postfix_operators=[], prefix_operators=[], qualifier=InstallProgressEvent, selectors=[]), operator===), if_false=MethodInvocation(arguments=[], member=getUninstallDirector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=needToSetScriptsPermission, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=MemberReference(member=setScriptsPermission, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))] begin[{]
call[.fireProgressEvent, parameter[member[.event], literal[95], call[Messages.INSTALL_KERNEL_MESSAGES.getLogMessage, parameter[literal["STATE_SET_SCRIPTS_PERMISSION"]]]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SelfExtractor, sub_type=ReferenceType(arguments=None, dimensions=None, name=NullExtractProgress, sub_type=None))), MethodInvocation(arguments=[], member=getInstallDir, postfix_operators=[], prefix_operators=[], qualifier=product, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=fixScriptPermissions, postfix_operators=[], prefix_operators=[], qualifier=SelfExtractUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setScriptsPermission] operator[SEP] Keyword[int] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[event] operator[==] identifier[InstallProgressEvent] operator[SEP] identifier[POST_INSTALL] operator[?] identifier[setScriptsPermission] operator[:] identifier[getUninstallDirector] operator[SEP] operator[SEP] operator[SEP] identifier[needToSetScriptsPermission] operator[SEP] operator[SEP] operator[SEP] {
identifier[fireProgressEvent] operator[SEP] identifier[event] , Other[95] , identifier[Messages] operator[SEP] identifier[INSTALL_KERNEL_MESSAGES] operator[SEP] identifier[getLogMessage] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[SelfExtractUtils] operator[SEP] identifier[fixScriptPermissions] operator[SEP] Keyword[new] identifier[SelfExtractor] operator[SEP] identifier[NullExtractProgress] operator[SEP] operator[SEP] , identifier[product] operator[SEP] identifier[getInstallDir] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
}
|
@Override
public final void handleCurrencyChanged(final Map<String, Object> pRqVs,
final Cart pCart, final AccSettings pAs,
final TradingSettings pTs) throws Exception {
TaxDestination txRules = revealTaxRules(pRqVs, pCart, pAs);
CartLn clf = null;
for (CartLn cl : pCart.getItems()) {
if (!cl.getDisab()) {
if (cl.getForc()) {
clf = cl;
delLine(pRqVs, cl, txRules);
} else {
makeCartLine(pRqVs, cl, pAs, pTs, txRules, true, true);
makeCartTotals(pRqVs, pTs, cl, pAs, txRules);
}
}
}
if (clf != null) {
hndCartChan(pRqVs, pCart, txRules);
}
} | class class_name[name] begin[{]
method[handleCurrencyChanged, return_type[void], modifier[final public], parameter[pRqVs, pCart, pAs, pTs]] begin[{]
local_variable[type[TaxDestination], txRules]
local_variable[type[CartLn], clf]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getDisab, postfix_operators=[], prefix_operators=['!'], qualifier=cl, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getForc, postfix_operators=[], prefix_operators=[], qualifier=cl, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pRqVs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pAs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pTs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=txRules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=makeCartLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pRqVs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pTs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pAs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=txRules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeCartTotals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=cl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pRqVs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=txRules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=delLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getItems, postfix_operators=[], prefix_operators=[], qualifier=pCart, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CartLn, sub_type=None))), label=None)
if[binary_operation[member[.clf], !=, literal[null]]] begin[{]
call[.hndCartChan, parameter[member[.pRqVs], member[.pCart], member[.txRules]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[handleCurrencyChanged] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[pRqVs] , Keyword[final] identifier[Cart] identifier[pCart] , Keyword[final] identifier[AccSettings] identifier[pAs] , Keyword[final] identifier[TradingSettings] identifier[pTs] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[TaxDestination] identifier[txRules] operator[=] identifier[revealTaxRules] operator[SEP] identifier[pRqVs] , identifier[pCart] , identifier[pAs] operator[SEP] operator[SEP] identifier[CartLn] identifier[clf] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[CartLn] identifier[cl] operator[:] identifier[pCart] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[cl] operator[SEP] identifier[getDisab] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[cl] operator[SEP] identifier[getForc] operator[SEP] operator[SEP] operator[SEP] {
identifier[clf] operator[=] identifier[cl] operator[SEP] identifier[delLine] operator[SEP] identifier[pRqVs] , identifier[cl] , identifier[txRules] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[makeCartLine] operator[SEP] identifier[pRqVs] , identifier[cl] , identifier[pAs] , identifier[pTs] , identifier[txRules] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[makeCartTotals] operator[SEP] identifier[pRqVs] , identifier[pTs] , identifier[cl] , identifier[pAs] , identifier[txRules] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[clf] operator[!=] Other[null] operator[SEP] {
identifier[hndCartChan] operator[SEP] identifier[pRqVs] , identifier[pCart] , identifier[txRules] operator[SEP] operator[SEP]
}
}
|
void setScriptType(int type) {
// OOo related code
if (database.isStoredFileAccess()) {
return;
}
// OOo end
boolean needsCheckpoint = scriptFormat != type;
scriptFormat = type;
properties.setProperty(HsqlDatabaseProperties.hsqldb_script_format,
String.valueOf(scriptFormat));
if (needsCheckpoint) {
database.logger.needsCheckpoint = true;
}
} | class class_name[name] begin[{]
method[setScriptType, return_type[void], modifier[default], parameter[type]] begin[{]
if[call[database.isStoredFileAccess, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[boolean], needsCheckpoint]
assign[member[.scriptFormat], member[.type]]
call[properties.setProperty, parameter[member[HsqlDatabaseProperties.hsqldb_script_format], call[String.valueOf, parameter[member[.scriptFormat]]]]]
if[member[.needsCheckpoint]] begin[{]
assign[member[database.logger.needsCheckpoint], literal[true]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[setScriptType] operator[SEP] Keyword[int] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[database] operator[SEP] identifier[isStoredFileAccess] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[boolean] identifier[needsCheckpoint] operator[=] identifier[scriptFormat] operator[!=] identifier[type] operator[SEP] identifier[scriptFormat] operator[=] identifier[type] operator[SEP] identifier[properties] operator[SEP] identifier[setProperty] operator[SEP] identifier[HsqlDatabaseProperties] operator[SEP] identifier[hsqldb_script_format] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[scriptFormat] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[needsCheckpoint] operator[SEP] {
identifier[database] operator[SEP] identifier[logger] operator[SEP] identifier[needsCheckpoint] operator[=] literal[boolean] operator[SEP]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.