code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
protected <T extends CSSProperty> boolean genericTermIdent(Class<T> type,
Term<?> term, boolean avoidInherit, String propertyName,
Map<String, CSSProperty> properties) {
if (term instanceof TermIdent) {
return genericProperty(type, (TermIdent) term, avoidInherit,
properties, propertyName);
}
return false;
} | class class_name[name] begin[{]
method[genericTermIdent, return_type[type[boolean]], modifier[protected], parameter[type, term, avoidInherit, propertyName, properties]] begin[{]
if[binary_operation[member[.term], instanceof, type[TermIdent]]] begin[{]
return[call[.genericProperty, parameter[member[.type], Cast(expression=MemberReference(member=term, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TermIdent, sub_type=None)), member[.avoidInherit], member[.properties], member[.propertyName]]]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[T] Keyword[extends] identifier[CSSProperty] operator[>] Keyword[boolean] identifier[genericTermIdent] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , identifier[Term] operator[<] operator[?] operator[>] identifier[term] , Keyword[boolean] identifier[avoidInherit] , identifier[String] identifier[propertyName] , identifier[Map] operator[<] identifier[String] , identifier[CSSProperty] operator[>] identifier[properties] operator[SEP] {
Keyword[if] operator[SEP] identifier[term] Keyword[instanceof] identifier[TermIdent] operator[SEP] {
Keyword[return] identifier[genericProperty] operator[SEP] identifier[type] , operator[SEP] identifier[TermIdent] operator[SEP] identifier[term] , identifier[avoidInherit] , identifier[properties] , identifier[propertyName] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void getBackStoryAnswerInfo(String[] ids, Callback<List<BackStoryAnswer>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getBackStoryAnswerInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | class class_name[name] begin[{]
method[getBackStoryAnswerInfo, return_type[void], modifier[public], parameter[ids, callback]] begin[{]
call[.isParamValid, parameter[ClassCreator(arguments=[MemberReference(member=ids, 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=ParamChecker, sub_type=None))]]
call[gw2API.getBackStoryAnswerInfo, parameter[call[.processIds, parameter[member[.ids]]], call[GuildWars2.lang.getValue, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getBackStoryAnswerInfo] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[ids] , identifier[Callback] operator[<] identifier[List] operator[<] identifier[BackStoryAnswer] operator[>] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[GuildWars2Exception] , identifier[NullPointerException] {
identifier[isParamValid] operator[SEP] Keyword[new] identifier[ParamChecker] operator[SEP] identifier[ids] operator[SEP] operator[SEP] operator[SEP] identifier[gw2API] operator[SEP] identifier[getBackStoryAnswerInfo] operator[SEP] identifier[processIds] operator[SEP] identifier[ids] operator[SEP] , identifier[GuildWars2] operator[SEP] identifier[lang] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[enqueue] operator[SEP] identifier[callback] operator[SEP] operator[SEP]
}
|
public void sendMessage(String message, final Respoke.TaskCompletionListener completionListener) {
if (isActive()) {
JSONObject jsonMessage = new JSONObject();
try {
jsonMessage.put("message", message);
byte[] rawMessage = jsonMessage.toString().getBytes(Charset.forName("UTF-8"));
ByteBuffer directData = ByteBuffer.allocateDirect(rawMessage.length);
directData.put(rawMessage);
directData.flip();
DataChannel.Buffer data = new DataChannel.Buffer(directData, false);
if (dataChannel.send(data)) {
Respoke.postTaskSuccess(completionListener);
} else {
Respoke.postTaskError(completionListener, "Error sending message");
}
} catch (JSONException e) {
Respoke.postTaskError(completionListener, "Unable to encode message to JSON");
}
} else {
Respoke.postTaskError(completionListener, "DataChannel not in an open state");
}
} | class class_name[name] begin[{]
method[sendMessage, return_type[void], modifier[public], parameter[message, completionListener]] begin[{]
if[call[.isActive, parameter[]]] begin[{]
local_variable[type[JSONObject], jsonMessage]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message"), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=jsonMessage, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=jsonMessage, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Charset, selectors=[], type_arguments=None)], member=getBytes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=rawMessage)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=rawMessage, selectors=[])], member=allocateDirect, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[], type_arguments=None), name=directData)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rawMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=directData, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flip, postfix_operators=[], prefix_operators=[], qualifier=directData, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=directData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataChannel, sub_type=ReferenceType(arguments=None, dimensions=None, name=Buffer, sub_type=None))), name=data)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataChannel, sub_type=ReferenceType(arguments=None, dimensions=None, name=Buffer, sub_type=None))), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=send, postfix_operators=[], prefix_operators=[], qualifier=dataChannel, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error sending message")], member=postTaskError, postfix_operators=[], prefix_operators=[], qualifier=Respoke, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=postTaskSuccess, postfix_operators=[], prefix_operators=[], qualifier=Respoke, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to encode message to JSON")], member=postTaskError, postfix_operators=[], prefix_operators=[], qualifier=Respoke, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException']))], finally_block=None, label=None, resources=None)
else begin[{]
call[Respoke.postTaskError, parameter[member[.completionListener], literal["DataChannel not in an open state"]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[sendMessage] operator[SEP] identifier[String] identifier[message] , Keyword[final] identifier[Respoke] operator[SEP] identifier[TaskCompletionListener] identifier[completionListener] operator[SEP] {
Keyword[if] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[SEP] {
identifier[JSONObject] identifier[jsonMessage] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[jsonMessage] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[message] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[rawMessage] operator[=] identifier[jsonMessage] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[Charset] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[ByteBuffer] identifier[directData] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocateDirect] operator[SEP] identifier[rawMessage] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[directData] operator[SEP] identifier[put] operator[SEP] identifier[rawMessage] operator[SEP] operator[SEP] identifier[directData] operator[SEP] identifier[flip] operator[SEP] operator[SEP] operator[SEP] identifier[DataChannel] operator[SEP] identifier[Buffer] identifier[data] operator[=] Keyword[new] identifier[DataChannel] operator[SEP] identifier[Buffer] operator[SEP] identifier[directData] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataChannel] operator[SEP] identifier[send] operator[SEP] identifier[data] operator[SEP] operator[SEP] {
identifier[Respoke] operator[SEP] identifier[postTaskSuccess] operator[SEP] identifier[completionListener] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Respoke] operator[SEP] identifier[postTaskError] operator[SEP] identifier[completionListener] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
identifier[Respoke] operator[SEP] identifier[postTaskError] operator[SEP] identifier[completionListener] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[Respoke] operator[SEP] identifier[postTaskError] operator[SEP] identifier[completionListener] , literal[String] operator[SEP] operator[SEP]
}
}
|
public java.util.List<String> getTaskDefinitionArns() {
if (taskDefinitionArns == null) {
taskDefinitionArns = new com.amazonaws.internal.SdkInternalList<String>();
}
return taskDefinitionArns;
} | class class_name[name] begin[{]
method[getTaskDefinitionArns, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.taskDefinitionArns], ==, literal[null]]] begin[{]
assign[member[.taskDefinitionArns], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.taskDefinitionArns]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[getTaskDefinitionArns] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[taskDefinitionArns] operator[==] Other[null] operator[SEP] {
identifier[taskDefinitionArns] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[taskDefinitionArns] operator[SEP]
}
|
@Override
public IPortletEntity getOrCreatePortletEntity(
HttpServletRequest request,
IPortletDefinitionId portletDefinitionId,
String layoutNodeId,
int userId) {
final PortletEntityCache<IPortletEntity> portletEntityCache = getPortletEntityMap(request);
// Try just getting an existing entity first
IPortletEntity portletEntity =
this.getPortletEntity(request, portletEntityCache, null, layoutNodeId, userId);
// Found an existing entity!
if (portletEntity != null) {
// Verify the definition IDs match, this is a MUST in the case where the subscribed
// portlet changes
final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
if (portletDefinitionId.equals(portletDefinition.getPortletDefinitionId())) {
return portletEntity;
}
// Remove the entity if the definition IDs don't match
this.logger.warn(
"Found portlet entity '{}' is not the correct entity for portlet definition id: {}. The entity will be deleted and a new one created.",
portletEntity,
portletDefinitionId);
this.deletePortletEntity(request, portletEntity, false);
}
// Create the entity data object and store it in the session map (if not already there)
final PortletEntityCache<PortletEntityData> portletEntityDataMap =
this.getPortletEntityDataMap(request);
final IPortletEntityId portletEntityId =
this.createConsistentPortletEntityId(portletDefinitionId, layoutNodeId, userId);
PortletEntityData portletEntityData =
new PortletEntityData(portletEntityId, portletDefinitionId, layoutNodeId, userId);
portletEntityData = portletEntityDataMap.storeIfAbsentEntity(portletEntityData);
portletEntity = wrapPortletEntityData(portletEntityData);
// Stick the wrapper in the request map
portletEntity = portletEntityCache.storeIfAbsentEntity(portletEntity);
return portletEntity;
} | class class_name[name] begin[{]
method[getOrCreatePortletEntity, return_type[type[IPortletEntity]], modifier[public], parameter[request, portletDefinitionId, layoutNodeId, userId]] begin[{]
local_variable[type[PortletEntityCache], portletEntityCache]
local_variable[type[IPortletEntity], portletEntity]
if[binary_operation[member[.portletEntity], !=, literal[null]]] begin[{]
local_variable[type[IPortletDefinition], portletDefinition]
if[call[portletDefinitionId.equals, parameter[call[portletDefinition.getPortletDefinitionId, parameter[]]]]] begin[{]
return[member[.portletEntity]]
else begin[{]
None
end[}]
THIS[member[None.logger]call[None.warn, parameter[literal["Found portlet entity '{}' is not the correct entity for portlet definition id: {}. The entity will be deleted and a new one created."], member[.portletEntity], member[.portletDefinitionId]]]]
THIS[call[None.deletePortletEntity, parameter[member[.request], member[.portletEntity], literal[false]]]]
else begin[{]
None
end[}]
local_variable[type[PortletEntityCache], portletEntityDataMap]
local_variable[type[IPortletEntityId], portletEntityId]
local_variable[type[PortletEntityData], portletEntityData]
assign[member[.portletEntityData], call[portletEntityDataMap.storeIfAbsentEntity, parameter[member[.portletEntityData]]]]
assign[member[.portletEntity], call[.wrapPortletEntityData, parameter[member[.portletEntityData]]]]
assign[member[.portletEntity], call[portletEntityCache.storeIfAbsentEntity, parameter[member[.portletEntity]]]]
return[member[.portletEntity]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[IPortletEntity] identifier[getOrCreatePortletEntity] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[IPortletDefinitionId] identifier[portletDefinitionId] , identifier[String] identifier[layoutNodeId] , Keyword[int] identifier[userId] operator[SEP] {
Keyword[final] identifier[PortletEntityCache] operator[<] identifier[IPortletEntity] operator[>] identifier[portletEntityCache] operator[=] identifier[getPortletEntityMap] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[IPortletEntity] identifier[portletEntity] operator[=] Keyword[this] operator[SEP] identifier[getPortletEntity] operator[SEP] identifier[request] , identifier[portletEntityCache] , Other[null] , identifier[layoutNodeId] , identifier[userId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[portletEntity] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[IPortletDefinition] identifier[portletDefinition] operator[=] identifier[portletEntity] operator[SEP] identifier[getPortletDefinition] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[portletDefinitionId] operator[SEP] identifier[equals] operator[SEP] identifier[portletDefinition] operator[SEP] identifier[getPortletDefinitionId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[portletEntity] operator[SEP]
}
Keyword[this] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[portletEntity] , identifier[portletDefinitionId] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[deletePortletEntity] operator[SEP] identifier[request] , identifier[portletEntity] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[final] identifier[PortletEntityCache] operator[<] identifier[PortletEntityData] operator[>] identifier[portletEntityDataMap] operator[=] Keyword[this] operator[SEP] identifier[getPortletEntityDataMap] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[final] identifier[IPortletEntityId] identifier[portletEntityId] operator[=] Keyword[this] operator[SEP] identifier[createConsistentPortletEntityId] operator[SEP] identifier[portletDefinitionId] , identifier[layoutNodeId] , identifier[userId] operator[SEP] operator[SEP] identifier[PortletEntityData] identifier[portletEntityData] operator[=] Keyword[new] identifier[PortletEntityData] operator[SEP] identifier[portletEntityId] , identifier[portletDefinitionId] , identifier[layoutNodeId] , identifier[userId] operator[SEP] operator[SEP] identifier[portletEntityData] operator[=] identifier[portletEntityDataMap] operator[SEP] identifier[storeIfAbsentEntity] operator[SEP] identifier[portletEntityData] operator[SEP] operator[SEP] identifier[portletEntity] operator[=] identifier[wrapPortletEntityData] operator[SEP] identifier[portletEntityData] operator[SEP] operator[SEP] identifier[portletEntity] operator[=] identifier[portletEntityCache] operator[SEP] identifier[storeIfAbsentEntity] operator[SEP] identifier[portletEntity] operator[SEP] operator[SEP] Keyword[return] identifier[portletEntity] operator[SEP]
}
|
public static float spToPx(Context ctx, float spSize){
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spSize, ctx.getResources().getDisplayMetrics());
} | class class_name[name] begin[{]
method[spToPx, return_type[type[float]], modifier[public static], parameter[ctx, spSize]] begin[{]
return[call[TypedValue.applyDimension, parameter[member[TypedValue.COMPLEX_UNIT_SP], member[.spSize], call[ctx.getResources, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[float] identifier[spToPx] operator[SEP] identifier[Context] identifier[ctx] , Keyword[float] identifier[spSize] operator[SEP] {
Keyword[return] identifier[TypedValue] operator[SEP] identifier[applyDimension] operator[SEP] identifier[TypedValue] operator[SEP] identifier[COMPLEX_UNIT_SP] , identifier[spSize] , identifier[ctx] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDisplayMetrics] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void endElement( String uri, String localName, String qName )
throws SAXException
{
flushCharacters();
if ( stack.isEmpty() )
{
throw new IllegalStateException( "Stack must not be empty when closing the element " + qName
+ " around line " + locator.getLineNumber() + " and column " + locator.getColumnNumber() );
}
IndentCheckSaxHandler.ElementEntry startEntry = stack.pop();
int indentDiff = lastIndent.size - startEntry.expectedIndent.size;
int expectedIndent = startEntry.expectedIndent.size;
if ( lastIndent.lineNumber != startEntry.foundIndent.lineNumber && indentDiff != 0 )
{
/*
* diff should be zero unless we are on the same line as start element
*/
int opValue = expectedIndent - lastIndent.size;
String op = opValue > 0 ? "Insert" : "Delete";
String units = opValue == 1 ? "space" : "spaces";
String message = op + " " + Math.abs( opValue ) + " " + units + ". Expected " + expectedIndent + " found "
+ lastIndent.size + " spaces before end element </" + qName + ">";
XmlFormatViolation violation =
new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message );
violationHandler.handle( violation );
}
} | class class_name[name] begin[{]
method[endElement, return_type[void], modifier[public], parameter[uri, localName, qName]] begin[{]
call[.flushCharacters, parameter[]]
if[call[stack.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Stack must not be empty when closing the element "), operandr=MemberReference(member=qName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" around line "), operator=+), operandr=MethodInvocation(arguments=[], member=getLineNumber, postfix_operators=[], prefix_operators=[], qualifier=locator, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" and column "), operator=+), operandr=MethodInvocation(arguments=[], member=getColumnNumber, postfix_operators=[], prefix_operators=[], qualifier=locator, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[IndentCheckSaxHandler], startEntry]
local_variable[type[int], indentDiff]
local_variable[type[int], expectedIndent]
if[binary_operation[binary_operation[member[lastIndent.lineNumber], !=, member[startEntry.foundIndent.lineNumber]], &&, binary_operation[member[.indentDiff], !=, literal[0]]]] begin[{]
local_variable[type[int], opValue]
local_variable[type[String], op]
local_variable[type[String], units]
local_variable[type[String], message]
local_variable[type[XmlFormatViolation], violation]
call[violationHandler.handle, parameter[member[.violation]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[endElement] operator[SEP] identifier[String] identifier[uri] , identifier[String] identifier[localName] , identifier[String] identifier[qName] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[flushCharacters] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stack] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[qName] operator[+] literal[String] operator[+] identifier[locator] operator[SEP] identifier[getLineNumber] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[locator] operator[SEP] identifier[getColumnNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[IndentCheckSaxHandler] operator[SEP] identifier[ElementEntry] identifier[startEntry] operator[=] identifier[stack] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[indentDiff] operator[=] identifier[lastIndent] operator[SEP] identifier[size] operator[-] identifier[startEntry] operator[SEP] identifier[expectedIndent] operator[SEP] identifier[size] operator[SEP] Keyword[int] identifier[expectedIndent] operator[=] identifier[startEntry] operator[SEP] identifier[expectedIndent] operator[SEP] identifier[size] operator[SEP] Keyword[if] operator[SEP] identifier[lastIndent] operator[SEP] identifier[lineNumber] operator[!=] identifier[startEntry] operator[SEP] identifier[foundIndent] operator[SEP] identifier[lineNumber] operator[&&] identifier[indentDiff] operator[!=] Other[0] operator[SEP] {
Keyword[int] identifier[opValue] operator[=] identifier[expectedIndent] operator[-] identifier[lastIndent] operator[SEP] identifier[size] operator[SEP] identifier[String] identifier[op] operator[=] identifier[opValue] operator[>] Other[0] operator[?] literal[String] operator[:] literal[String] operator[SEP] identifier[String] identifier[units] operator[=] identifier[opValue] operator[==] Other[1] operator[?] literal[String] operator[:] literal[String] operator[SEP] identifier[String] identifier[message] operator[=] identifier[op] operator[+] literal[String] operator[+] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[opValue] operator[SEP] operator[+] literal[String] operator[+] identifier[units] operator[+] literal[String] operator[+] identifier[expectedIndent] operator[+] literal[String] operator[+] identifier[lastIndent] operator[SEP] identifier[size] operator[+] literal[String] operator[+] identifier[qName] operator[+] literal[String] operator[SEP] identifier[XmlFormatViolation] identifier[violation] operator[=] Keyword[new] identifier[XmlFormatViolation] operator[SEP] identifier[file] , identifier[locator] operator[SEP] identifier[getLineNumber] operator[SEP] operator[SEP] , identifier[locator] operator[SEP] identifier[getColumnNumber] operator[SEP] operator[SEP] , identifier[message] operator[SEP] operator[SEP] identifier[violationHandler] operator[SEP] identifier[handle] operator[SEP] identifier[violation] operator[SEP] operator[SEP]
}
}
|
private static int index(File indexDir, File dataDir)
throws IOException {
if (!dataDir.exists() || !dataDir.isDirectory()) {
throw new IOException(dataDir
+ " does not exist or is not a directory");
}
IndexWriter writer = new IndexWriter(indexDir,
new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
writer.setUseCompoundFile(false);
indexDirectory(writer, dataDir);
int numIndexed = writer.numDocs();
writer.optimize();
writer.close();
return numIndexed;
} | class class_name[name] begin[{]
method[index, return_type[type[int]], modifier[private static], parameter[indexDir, dataDir]] begin[{]
if[binary_operation[call[dataDir.exists, parameter[]], ||, call[dataDir.isDirectory, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=dataDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not exist or is not a directory"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[IndexWriter], writer]
call[writer.setUseCompoundFile, parameter[literal[false]]]
call[.indexDirectory, parameter[member[.writer], member[.dataDir]]]
local_variable[type[int], numIndexed]
call[writer.optimize, parameter[]]
call[writer.close, parameter[]]
return[member[.numIndexed]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[index] operator[SEP] identifier[File] identifier[indexDir] , identifier[File] identifier[dataDir] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[dataDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[||] operator[!] identifier[dataDir] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[dataDir] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[IndexWriter] identifier[writer] operator[=] Keyword[new] identifier[IndexWriter] operator[SEP] identifier[indexDir] , Keyword[new] identifier[StandardAnalyzer] operator[SEP] operator[SEP] , literal[boolean] , identifier[IndexWriter] operator[SEP] identifier[MaxFieldLength] operator[SEP] identifier[UNLIMITED] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[setUseCompoundFile] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[indexDirectory] operator[SEP] identifier[writer] , identifier[dataDir] operator[SEP] operator[SEP] Keyword[int] identifier[numIndexed] operator[=] identifier[writer] operator[SEP] identifier[numDocs] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[optimize] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[numIndexed] operator[SEP]
}
|
public ServiceFuture<ContentKeyPolicyInner> createOrUpdateAsync(String resourceGroupName, String accountName, String contentKeyPolicyName, ContentKeyPolicyInner parameters, final ServiceCallback<ContentKeyPolicyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName, parameters), serviceCallback);
} | class class_name[name] begin[{]
method[createOrUpdateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, accountName, contentKeyPolicyName, parameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName], member[.contentKeyPolicyName], member[.parameters]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[ContentKeyPolicyInner] operator[>] identifier[createOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[accountName] , identifier[String] identifier[contentKeyPolicyName] , identifier[ContentKeyPolicyInner] identifier[parameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[ContentKeyPolicyInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] , identifier[contentKeyPolicyName] , identifier[parameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public static int find_bands(int warp, int bands, int a0, int a1) {
float div = (float) Math.log(2.0);
if(warp!=0) div *= 1.3f;
return (int) (bands*Math.log((float) a1/(float) a0)/div+0.5);
} | class class_name[name] begin[{]
method[find_bands, return_type[type[int]], modifier[public static], parameter[warp, bands, a0, a1]] begin[{]
local_variable[type[float], div]
if[binary_operation[member[.warp], !=, literal[0]]] begin[{]
assign[member[.div], literal[1.3f]]
else begin[{]
None
end[}]
return[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[BinaryOperation(operandl=Cast(expression=MemberReference(member=a1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=float)), operandr=Cast(expression=MemberReference(member=a0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=float)), operator=/)], member=log, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operator=*), operandr=MemberReference(member=div, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.5), operator=+), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[find_bands] operator[SEP] Keyword[int] identifier[warp] , Keyword[int] identifier[bands] , Keyword[int] identifier[a0] , Keyword[int] identifier[a1] operator[SEP] {
Keyword[float] identifier[div] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[log] operator[SEP] literal[Float] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[warp] operator[!=] Other[0] operator[SEP] identifier[div] operator[*=] literal[Float] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[bands] operator[*] identifier[Math] operator[SEP] identifier[log] operator[SEP] operator[SEP] Keyword[float] operator[SEP] identifier[a1] operator[/] operator[SEP] Keyword[float] operator[SEP] identifier[a0] operator[SEP] operator[/] identifier[div] operator[+] literal[Float] operator[SEP] operator[SEP]
}
|
public void buildSerialUIDInfo(XMLNode node, Content classTree) {
Content serialUidTree = writer.getSerialUIDInfoHeader();
for (Element e : utils.getFieldsUnfiltered(currentTypeElement)) {
VariableElement field = (VariableElement)e;
if (field.getSimpleName().toString().compareTo(SERIAL_VERSION_UID) == 0 &&
field.getConstantValue() != null) {
writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
utils.constantValueExpresion(field), serialUidTree);
break;
}
}
classTree.addContent(serialUidTree);
} | class class_name[name] begin[{]
method[buildSerialUIDInfo, return_type[void], modifier[public], parameter[node, classTree]] begin[{]
local_variable[type[Content], serialUidTree]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=VariableElement, sub_type=None)), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VariableElement, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=SERIAL_VERSION_UID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, 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=0), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getConstantValue, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SERIAL_VERSION_UID_HEADER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=constantValueExpresion, postfix_operators=[], prefix_operators=[], qualifier=utils, selectors=[], type_arguments=None), MemberReference(member=serialUidTree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addSerialUIDInfo, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=currentTypeElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFieldsUnfiltered, postfix_operators=[], prefix_operators=[], qualifier=utils, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))), label=None)
call[classTree.addContent, parameter[member[.serialUidTree]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[buildSerialUIDInfo] operator[SEP] identifier[XMLNode] identifier[node] , identifier[Content] identifier[classTree] operator[SEP] {
identifier[Content] identifier[serialUidTree] operator[=] identifier[writer] operator[SEP] identifier[getSerialUIDInfoHeader] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Element] identifier[e] operator[:] identifier[utils] operator[SEP] identifier[getFieldsUnfiltered] operator[SEP] identifier[currentTypeElement] operator[SEP] operator[SEP] {
identifier[VariableElement] identifier[field] operator[=] operator[SEP] identifier[VariableElement] operator[SEP] identifier[e] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[SERIAL_VERSION_UID] operator[SEP] operator[==] Other[0] operator[&&] identifier[field] operator[SEP] identifier[getConstantValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[addSerialUIDInfo] operator[SEP] identifier[SERIAL_VERSION_UID_HEADER] , identifier[utils] operator[SEP] identifier[constantValueExpresion] operator[SEP] identifier[field] operator[SEP] , identifier[serialUidTree] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
identifier[classTree] operator[SEP] identifier[addContent] operator[SEP] identifier[serialUidTree] operator[SEP] operator[SEP]
}
|
private void inferCallerELKI() {
needToInferCaller = false;
StackTraceElement[] stack = (new Throwable()).getStackTrace();
int ix = 0;
// skip back to the logger.
while(ix < stack.length) {
StackTraceElement frame = stack[ix];
final String cls = frame.getClassName();
if(cls.equals(START_TRACE_AT)) {
break;
}
ix++;
}
// skip further back through helper functions
while(ix < stack.length) {
StackTraceElement frame = stack[ix];
final String cls = frame.getClassName();
boolean ignore = false;
for(int i = 0; i < IGNORE_CLASSES.length; i++) {
if(cls.equals(IGNORE_CLASSES[i])) {
ignore = true;
break;
}
}
if(!ignore) {
super.setSourceClassName(frame.getClassName());
super.setSourceMethodName(frame.getMethodName());
break;
}
ix++;
}
} | class class_name[name] begin[{]
method[inferCallerELKI, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[.needToInferCaller], literal[false]]
local_variable[type[StackTraceElement], stack]
local_variable[type[int], ix]
while[binary_operation[member[.ix], <, member[stack.length]]] begin[{]
local_variable[type[StackTraceElement], frame]
local_variable[type[String], cls]
if[call[cls.equals, parameter[member[.START_TRACE_AT]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
member[.ix]
end[}]
while[binary_operation[member[.ix], <, member[stack.length]]] begin[{]
local_variable[type[StackTraceElement], frame]
local_variable[type[String], cls]
local_variable[type[boolean], ignore]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=IGNORE_CLASSES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ignore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=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=IGNORE_CLASSES, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[member[.ignore]] begin[{]
SuperMethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=frame, selectors=[], type_arguments=None)], member=setSourceClassName, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMethodName, postfix_operators=[], prefix_operators=[], qualifier=frame, selectors=[], type_arguments=None)], member=setSourceMethodName, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
member[.ix]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[inferCallerELKI] operator[SEP] operator[SEP] {
identifier[needToInferCaller] operator[=] literal[boolean] operator[SEP] identifier[StackTraceElement] operator[SEP] operator[SEP] identifier[stack] operator[=] operator[SEP] Keyword[new] identifier[Throwable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ix] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[ix] operator[<] identifier[stack] operator[SEP] identifier[length] operator[SEP] {
identifier[StackTraceElement] identifier[frame] operator[=] identifier[stack] operator[SEP] identifier[ix] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[cls] operator[=] identifier[frame] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cls] operator[SEP] identifier[equals] operator[SEP] identifier[START_TRACE_AT] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[ix] operator[++] operator[SEP]
}
Keyword[while] operator[SEP] identifier[ix] operator[<] identifier[stack] operator[SEP] identifier[length] operator[SEP] {
identifier[StackTraceElement] identifier[frame] operator[=] identifier[stack] operator[SEP] identifier[ix] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[cls] operator[=] identifier[frame] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[ignore] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[IGNORE_CLASSES] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[cls] operator[SEP] identifier[equals] operator[SEP] identifier[IGNORE_CLASSES] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[ignore] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[ignore] operator[SEP] {
Keyword[super] operator[SEP] identifier[setSourceClassName] operator[SEP] identifier[frame] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[setSourceMethodName] operator[SEP] identifier[frame] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
identifier[ix] operator[++] operator[SEP]
}
}
|
public void writeRecord(StationObsDatatype sobs, StructureData sdata) throws IOException {
if (debug) System.out.println("sobs= " + sobs + "; station = " + sobs.getStation());
for (Variable v : recordVars) {
if (timeName.equals(v.getShortName())) {
Date d = sobs.getObservationTimeAsDate();
int secs = (int) (d.getTime() / 1000);
timeArray.set(0, secs);
} else if (parentName.equals(v.getShortName())) {
int stationIndex = stnList.indexOf(sobs.getStation());
parentArray.set(0, stationIndex);
} else {
v.setCachedData(sdata.getArray(v.getShortName()), false);
}
}
ncfile.writeRecordData(recordVars);
} | class class_name[name] begin[{]
method[writeRecord, return_type[void], modifier[public], parameter[sobs, sdata]] begin[{]
if[member[.debug]] begin[{]
call[System.out.println, parameter[binary_operation[binary_operation[binary_operation[literal["sobs= "], +, member[.sobs]], +, literal["; station = "]], +, call[sobs.getStation, parameter[]]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getShortName, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=timeName, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getShortName, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=parentName, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getShortName, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None)], member=getArray, postfix_operators=[], prefix_operators=[], qualifier=sdata, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setCachedData, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStation, postfix_operators=[], prefix_operators=[], qualifier=sobs, selectors=[], type_arguments=None)], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=stnList, selectors=[], type_arguments=None), name=stationIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=stationIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=parentArray, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getObservationTimeAsDate, postfix_operators=[], prefix_operators=[], qualifier=sobs, selectors=[], type_arguments=None), name=d)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getTime, postfix_operators=[], prefix_operators=[], qualifier=d, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=/), type=BasicType(dimensions=[], name=int)), name=secs)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=secs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=timeArray, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=recordVars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Variable, sub_type=None))), label=None)
call[ncfile.writeRecordData, parameter[member[.recordVars]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeRecord] operator[SEP] identifier[StationObsDatatype] identifier[sobs] , identifier[StructureData] identifier[sdata] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[debug] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[sobs] operator[+] literal[String] operator[+] identifier[sobs] operator[SEP] identifier[getStation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Variable] identifier[v] operator[:] identifier[recordVars] operator[SEP] {
Keyword[if] operator[SEP] identifier[timeName] operator[SEP] identifier[equals] operator[SEP] identifier[v] operator[SEP] identifier[getShortName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Date] identifier[d] operator[=] identifier[sobs] operator[SEP] identifier[getObservationTimeAsDate] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[secs] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[d] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[/] Other[1000] operator[SEP] operator[SEP] identifier[timeArray] operator[SEP] identifier[set] operator[SEP] Other[0] , identifier[secs] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[parentName] operator[SEP] identifier[equals] operator[SEP] identifier[v] operator[SEP] identifier[getShortName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[stationIndex] operator[=] identifier[stnList] operator[SEP] identifier[indexOf] operator[SEP] identifier[sobs] operator[SEP] identifier[getStation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[parentArray] operator[SEP] identifier[set] operator[SEP] Other[0] , identifier[stationIndex] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[v] operator[SEP] identifier[setCachedData] operator[SEP] identifier[sdata] operator[SEP] identifier[getArray] operator[SEP] identifier[v] operator[SEP] identifier[getShortName] operator[SEP] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
}
identifier[ncfile] operator[SEP] identifier[writeRecordData] operator[SEP] identifier[recordVars] operator[SEP] operator[SEP]
}
|
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data,
final Converter<String, String> converter, boolean failOnUnexpanded) {
return replaceDataReferencesInString(input, data, converter, failOnUnexpanded, false);
} | class class_name[name] begin[{]
method[replaceDataReferencesInString, return_type[type[String]], modifier[public static], parameter[input, data, converter, failOnUnexpanded]] begin[{]
return[call[.replaceDataReferencesInString, parameter[member[.input], member[.data], member[.converter], member[.failOnUnexpanded], literal[false]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[replaceDataReferencesInString] operator[SEP] Keyword[final] identifier[String] identifier[input] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[data] , Keyword[final] identifier[Converter] operator[<] identifier[String] , identifier[String] operator[>] identifier[converter] , Keyword[boolean] identifier[failOnUnexpanded] operator[SEP] {
Keyword[return] identifier[replaceDataReferencesInString] operator[SEP] identifier[input] , identifier[data] , identifier[converter] , identifier[failOnUnexpanded] , literal[boolean] operator[SEP] operator[SEP]
}
|
private void ensureBuilders() {
if (this.builders == null) {
this.builders = new ArrayList<SingleFieldBuilder<MType, BType, IType>>(messages.size());
for (int i = 0; i < messages.size(); i++) {
builders.add(null);
}
}
} | class class_name[name] begin[{]
method[ensureBuilders, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[THIS[member[None.builders]], ==, literal[null]]] begin[{]
assign[THIS[member[None.builders]], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=messages, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MType, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BType, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IType, sub_type=None))], dimensions=[], name=SingleFieldBuilder, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
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=builders, 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=messages, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[ensureBuilders] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[builders] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[builders] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[SingleFieldBuilder] operator[<] identifier[MType] , identifier[BType] , identifier[IType] operator[>] operator[>] operator[SEP] identifier[messages] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[messages] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[builders] operator[SEP] identifier[add] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
}
}
|
private boolean includes(String identifier) {
if (includes.isEmpty()) return !exclude(identifier);
String includeMatch = null;
String excludeMatch = null;
for (String rule = identifier; rule != null; rule = enclosing(rule)) {
if (excludes.contains(rule)) {
excludeMatch = rule;
}
if (includes.contains(rule)) {
includeMatch = rule;
}
}
if (excludeMatch != null) {
usedExcludes.add(excludeMatch);
return false;
}
if (includeMatch != null) {
usedIncludes.add(includeMatch);
return true;
}
return false;
} | class class_name[name] begin[{]
method[includes, return_type[type[boolean]], modifier[private], parameter[identifier]] begin[{]
if[call[includes.isEmpty, parameter[]]] begin[{]
return[call[.exclude, parameter[member[.identifier]]]]
else begin[{]
None
end[}]
local_variable[type[String], includeMatch]
local_variable[type[String], excludeMatch]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=excludes, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=excludeMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=includes, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=includeMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=identifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=rule)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=enclosing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]), label=None)
if[binary_operation[member[.excludeMatch], !=, literal[null]]] begin[{]
call[usedExcludes.add, parameter[member[.excludeMatch]]]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.includeMatch], !=, literal[null]]] begin[{]
call[usedIncludes.add, parameter[member[.includeMatch]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[includes] operator[SEP] identifier[String] identifier[identifier] operator[SEP] {
Keyword[if] operator[SEP] identifier[includes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[!] identifier[exclude] operator[SEP] identifier[identifier] operator[SEP] operator[SEP] identifier[String] identifier[includeMatch] operator[=] Other[null] operator[SEP] identifier[String] identifier[excludeMatch] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[rule] operator[=] identifier[identifier] operator[SEP] identifier[rule] operator[!=] Other[null] operator[SEP] identifier[rule] operator[=] identifier[enclosing] operator[SEP] identifier[rule] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[excludes] operator[SEP] identifier[contains] operator[SEP] identifier[rule] operator[SEP] operator[SEP] {
identifier[excludeMatch] operator[=] identifier[rule] operator[SEP]
}
Keyword[if] operator[SEP] identifier[includes] operator[SEP] identifier[contains] operator[SEP] identifier[rule] operator[SEP] operator[SEP] {
identifier[includeMatch] operator[=] identifier[rule] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[excludeMatch] operator[!=] Other[null] operator[SEP] {
identifier[usedExcludes] operator[SEP] identifier[add] operator[SEP] identifier[excludeMatch] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[includeMatch] operator[!=] Other[null] operator[SEP] {
identifier[usedIncludes] operator[SEP] identifier[add] operator[SEP] identifier[includeMatch] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static <T extends MethodDescription> ElementMatcher.Junction<T> canThrow(Class<? extends Throwable> exceptionType) {
return canThrow(TypeDescription.ForLoadedType.of(exceptionType));
} | class class_name[name] begin[{]
method[canThrow, return_type[type[ElementMatcher]], modifier[public static], parameter[exceptionType]] begin[{]
return[call[.canThrow, parameter[call[TypeDescription.ForLoadedType.of, parameter[member[.exceptionType]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[MethodDescription] operator[>] identifier[ElementMatcher] operator[SEP] identifier[Junction] operator[<] identifier[T] operator[>] identifier[canThrow] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Throwable] operator[>] identifier[exceptionType] operator[SEP] {
Keyword[return] identifier[canThrow] operator[SEP] identifier[TypeDescription] operator[SEP] identifier[ForLoadedType] operator[SEP] identifier[of] operator[SEP] identifier[exceptionType] operator[SEP] operator[SEP] operator[SEP]
}
|
public synchronized void add(T element) {
Assert.notNull(element, "Element cannot be null");
int filterSize = getFilterSize();
int hashFunctionCount = getHashFunctionCount(element);
this.random.setSeed(element.hashCode());
for (int count = 0; count < hashFunctionCount; count++) {
int bitIndex = this.random.nextInt(filterSize);
this.bitArray[bitIndex / 32] |= BIT_MASKS[bitIndex % 32];
}
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[synchronized public], parameter[element]] begin[{]
call[Assert.notNull, parameter[member[.element], literal["Element cannot be null"]]]
local_variable[type[int], filterSize]
local_variable[type[int], hashFunctionCount]
THIS[member[None.random]call[None.setSeed, parameter[call[element.hashCode, parameter[]]]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=random, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=filterSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=bitIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=bitArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=BinaryOperation(operandl=MemberReference(member=bitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), operator=/))]), type=|=, value=MemberReference(member=BIT_MASKS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=bitIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), operator=%))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=hashFunctionCount, 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=count)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=count, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[add] operator[SEP] identifier[T] identifier[element] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[element] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[filterSize] operator[=] identifier[getFilterSize] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[hashFunctionCount] operator[=] identifier[getHashFunctionCount] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[random] operator[SEP] identifier[setSeed] operator[SEP] identifier[element] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] identifier[count] operator[<] identifier[hashFunctionCount] operator[SEP] identifier[count] operator[++] operator[SEP] {
Keyword[int] identifier[bitIndex] operator[=] Keyword[this] operator[SEP] identifier[random] operator[SEP] identifier[nextInt] operator[SEP] identifier[filterSize] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[bitArray] operator[SEP] identifier[bitIndex] operator[/] Other[32] operator[SEP] operator[|=] identifier[BIT_MASKS] operator[SEP] identifier[bitIndex] operator[%] Other[32] operator[SEP] operator[SEP]
}
}
|
public void close() {
try {
flush();
pw.close();
rawWriter.close();
} catch (IOException e) {
Throwables.propagate(e);
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=pw, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=rawWriter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=propagate, postfix_operators=[], prefix_operators=[], qualifier=Throwables, 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)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[rawWriter] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[Throwables] operator[SEP] identifier[propagate] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public void onDeselectLayer(LayerDeselectedEvent event) {
ListGridRecord selected = treeGrid.getSelectedRecord();
if (selected != null) {
treeGrid.deselectRecord(selected);
}
selectedLayerTreeNode = null;
htmlSelectedLayer.setContents(I18nProvider.getLayerTree().activeLayer(I18nProvider.getLayerTree().none()));
} | class class_name[name] begin[{]
method[onDeselectLayer, return_type[void], modifier[public], parameter[event]] begin[{]
local_variable[type[ListGridRecord], selected]
if[binary_operation[member[.selected], !=, literal[null]]] begin[{]
call[treeGrid.deselectRecord, parameter[member[.selected]]]
else begin[{]
None
end[}]
assign[member[.selectedLayerTreeNode], literal[null]]
call[htmlSelectedLayer.setContents, parameter[call[I18nProvider.getLayerTree, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[onDeselectLayer] operator[SEP] identifier[LayerDeselectedEvent] identifier[event] operator[SEP] {
identifier[ListGridRecord] identifier[selected] operator[=] identifier[treeGrid] operator[SEP] identifier[getSelectedRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[selected] operator[!=] Other[null] operator[SEP] {
identifier[treeGrid] operator[SEP] identifier[deselectRecord] operator[SEP] identifier[selected] operator[SEP] operator[SEP]
}
identifier[selectedLayerTreeNode] operator[=] Other[null] operator[SEP] identifier[htmlSelectedLayer] operator[SEP] identifier[setContents] operator[SEP] identifier[I18nProvider] operator[SEP] identifier[getLayerTree] operator[SEP] operator[SEP] operator[SEP] identifier[activeLayer] operator[SEP] identifier[I18nProvider] operator[SEP] identifier[getLayerTree] operator[SEP] operator[SEP] operator[SEP] identifier[none] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void uninstallDefaults() {
SeaGlassContext context = getContext(splitPane, ENABLED);
style.uninstallDefaults(context);
context.dispose();
style = null;
context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER, ENABLED);
dividerStyle.uninstallDefaults(context);
context.dispose();
dividerStyle = null;
super.uninstallDefaults();
} | class class_name[name] begin[{]
method[uninstallDefaults, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[SeaGlassContext], context]
call[style.uninstallDefaults, parameter[member[.context]]]
call[context.dispose, parameter[]]
assign[member[.style], literal[null]]
assign[member[.context], call[.getContext, parameter[member[.splitPane], member[Region.SPLIT_PANE_DIVIDER], member[.ENABLED]]]]
call[dividerStyle.uninstallDefaults, parameter[member[.context]]]
call[context.dispose, parameter[]]
assign[member[.dividerStyle], literal[null]]
SuperMethodInvocation(arguments=[], member=uninstallDefaults, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[uninstallDefaults] operator[SEP] operator[SEP] {
identifier[SeaGlassContext] identifier[context] operator[=] identifier[getContext] operator[SEP] identifier[splitPane] , identifier[ENABLED] operator[SEP] operator[SEP] identifier[style] operator[SEP] identifier[uninstallDefaults] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP] identifier[style] operator[=] Other[null] operator[SEP] identifier[context] operator[=] identifier[getContext] operator[SEP] identifier[splitPane] , identifier[Region] operator[SEP] identifier[SPLIT_PANE_DIVIDER] , identifier[ENABLED] operator[SEP] operator[SEP] identifier[dividerStyle] operator[SEP] identifier[uninstallDefaults] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP] identifier[dividerStyle] operator[=] Other[null] operator[SEP] Keyword[super] operator[SEP] identifier[uninstallDefaults] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public EClass getObjectDefinition() {
if (objectDefinitionEClass == null) {
objectDefinitionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(68);
}
return objectDefinitionEClass;
} | class class_name[name] begin[{]
method[getObjectDefinition, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.objectDefinitionEClass], ==, literal[null]]] begin[{]
assign[member[.objectDefinitionEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=StorePackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=68)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.objectDefinitionEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getObjectDefinition] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[objectDefinitionEClass] operator[==] Other[null] operator[SEP] {
identifier[objectDefinitionEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[StorePackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[68] operator[SEP] operator[SEP]
}
Keyword[return] identifier[objectDefinitionEClass] operator[SEP]
}
|
private static double calAfpDis(int afp1, int afp2, FatCatParameters params, AFPChain afpChain)
{
List<AFP> afpSet = afpChain.getAfpSet();
Matrix disTable1 = afpChain.getDisTable1();
Matrix disTable2 = afpChain.getDisTable2();
int fragLen = params.getFragLen();
double afpDisCut = params.getAfpDisCut();
double disCut = params.getDisCut();
double fragLenSq = params.getFragLenSq();
int i, j, ai, bi, aj, bj;
double d;
double rms = 0;
for(i = 0; i < fragLen; i ++) {
ai = afpSet.get(afp1).getP1() + i;
bi = afpSet.get(afp1).getP2() + i;
for(j = 0; j < fragLen; j ++) {
aj = afpSet.get(afp2).getP1() + j;
bj = afpSet.get(afp2).getP2() + j;
d = disTable1.get(aj,ai) - disTable2.get(bj,bi);
rms += d * d;
if(rms > afpDisCut) { return (disCut); }
}
}
return (Math.sqrt(rms / fragLenSq));
} | class class_name[name] begin[{]
method[calAfpDis, return_type[type[double]], modifier[private static], parameter[afp1, afp2, params, afpChain]] begin[{]
local_variable[type[List], afpSet]
local_variable[type[Matrix], disTable1]
local_variable[type[Matrix], disTable2]
local_variable[type[int], fragLen]
local_variable[type[double], afpDisCut]
local_variable[type[double], disCut]
local_variable[type[double], fragLenSq]
local_variable[type[int], i]
local_variable[type[double], d]
local_variable[type[double], rms]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ai, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=afp1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afpSet, selectors=[MethodInvocation(arguments=[], member=getP1, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=afp1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afpSet, selectors=[MethodInvocation(arguments=[], member=getP2, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=aj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=afp2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afpSet, selectors=[MethodInvocation(arguments=[], member=getP1, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=afp2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afpSet, selectors=[MethodInvocation(arguments=[], member=getP2, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=aj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ai, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=disTable1, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=bj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=disTable2, selectors=[], type_arguments=None), operator=-)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=afpDisCut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=disCut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=fragLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=fragLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[Math.sqrt, parameter[binary_operation[member[.rms], /, member[.fragLenSq]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[double] identifier[calAfpDis] operator[SEP] Keyword[int] identifier[afp1] , Keyword[int] identifier[afp2] , identifier[FatCatParameters] identifier[params] , identifier[AFPChain] identifier[afpChain] operator[SEP] {
identifier[List] operator[<] identifier[AFP] operator[>] identifier[afpSet] operator[=] identifier[afpChain] operator[SEP] identifier[getAfpSet] operator[SEP] operator[SEP] operator[SEP] identifier[Matrix] identifier[disTable1] operator[=] identifier[afpChain] operator[SEP] identifier[getDisTable1] operator[SEP] operator[SEP] operator[SEP] identifier[Matrix] identifier[disTable2] operator[=] identifier[afpChain] operator[SEP] identifier[getDisTable2] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[fragLen] operator[=] identifier[params] operator[SEP] identifier[getFragLen] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[afpDisCut] operator[=] identifier[params] operator[SEP] identifier[getAfpDisCut] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[disCut] operator[=] identifier[params] operator[SEP] identifier[getDisCut] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[fragLenSq] operator[=] identifier[params] operator[SEP] identifier[getFragLenSq] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] , identifier[j] , identifier[ai] , identifier[bi] , identifier[aj] , identifier[bj] operator[SEP] Keyword[double] identifier[d] operator[SEP] Keyword[double] identifier[rms] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fragLen] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[ai] operator[=] identifier[afpSet] operator[SEP] identifier[get] operator[SEP] identifier[afp1] operator[SEP] operator[SEP] identifier[getP1] operator[SEP] operator[SEP] operator[+] identifier[i] operator[SEP] identifier[bi] operator[=] identifier[afpSet] operator[SEP] identifier[get] operator[SEP] identifier[afp1] operator[SEP] operator[SEP] identifier[getP2] operator[SEP] operator[SEP] operator[+] identifier[i] operator[SEP] Keyword[for] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[fragLen] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[aj] operator[=] identifier[afpSet] operator[SEP] identifier[get] operator[SEP] identifier[afp2] operator[SEP] operator[SEP] identifier[getP1] operator[SEP] operator[SEP] operator[+] identifier[j] operator[SEP] identifier[bj] operator[=] identifier[afpSet] operator[SEP] identifier[get] operator[SEP] identifier[afp2] operator[SEP] operator[SEP] identifier[getP2] operator[SEP] operator[SEP] operator[+] identifier[j] operator[SEP] identifier[d] operator[=] identifier[disTable1] operator[SEP] identifier[get] operator[SEP] identifier[aj] , identifier[ai] operator[SEP] operator[-] identifier[disTable2] operator[SEP] identifier[get] operator[SEP] identifier[bj] , identifier[bi] operator[SEP] operator[SEP] identifier[rms] operator[+=] identifier[d] operator[*] identifier[d] operator[SEP] Keyword[if] operator[SEP] identifier[rms] operator[>] identifier[afpDisCut] operator[SEP] {
Keyword[return] operator[SEP] identifier[disCut] operator[SEP] operator[SEP]
}
}
}
Keyword[return] operator[SEP] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[rms] operator[/] identifier[fragLenSq] operator[SEP] operator[SEP] operator[SEP]
}
|
public static DirectoryStream newDirectoryStream(Path dir, String glob) throws IOException {
FileSystem fs = dir.getFileSystem();
final PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
public boolean accept(Path entry) {
return matcher.matches(entry.getFileName());
}
};
return fs.provider().newDirectoryStream(dir, filter);
} | class class_name[name] begin[{]
method[newDirectoryStream, return_type[type[DirectoryStream]], modifier[public static], parameter[dir, glob]] begin[{]
local_variable[type[FileSystem], fs]
local_variable[type[PathMatcher], matcher]
local_variable[type[DirectoryStream], filter]
return[call[fs.provider, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DirectoryStream] identifier[newDirectoryStream] operator[SEP] identifier[Path] identifier[dir] , identifier[String] identifier[glob] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[FileSystem] identifier[fs] operator[=] identifier[dir] operator[SEP] identifier[getFileSystem] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[PathMatcher] identifier[matcher] operator[=] identifier[fs] operator[SEP] identifier[getPathMatcher] operator[SEP] literal[String] operator[+] identifier[glob] operator[SEP] operator[SEP] identifier[DirectoryStream] operator[SEP] identifier[Filter] operator[<] identifier[Path] operator[>] identifier[filter] operator[=] Keyword[new] identifier[DirectoryStream] operator[SEP] identifier[Filter] operator[<] identifier[Path] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[boolean] identifier[accept] operator[SEP] identifier[Path] identifier[entry] operator[SEP] {
Keyword[return] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] identifier[entry] operator[SEP] identifier[getFileName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] Keyword[return] identifier[fs] operator[SEP] identifier[provider] operator[SEP] operator[SEP] operator[SEP] identifier[newDirectoryStream] operator[SEP] identifier[dir] , identifier[filter] operator[SEP] operator[SEP]
}
|
public static <T, V> String interpose(Iterable<T> values, V separator) {
dbc.precondition(values != null, "cannot interpose from a null iterable");
return new InterposeStrings<T, V>().apply(values.iterator(), new ConstantIterator<>(separator));
} | class class_name[name] begin[{]
method[interpose, return_type[type[String]], modifier[public static], parameter[values, separator]] begin[{]
call[dbc.precondition, parameter[binary_operation[member[.values], !=, literal[null]], literal["cannot interpose from a null iterable"]]]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), ClassCreator(arguments=[MemberReference(member=separator, 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=ConstantIterator, sub_type=None))], member=apply, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=InterposeStrings, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[V] operator[>] identifier[String] identifier[interpose] operator[SEP] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[values] , identifier[V] identifier[separator] operator[SEP] {
identifier[dbc] operator[SEP] identifier[precondition] operator[SEP] identifier[values] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[InterposeStrings] operator[<] identifier[T] , identifier[V] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[apply] operator[SEP] identifier[values] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] , Keyword[new] identifier[ConstantIterator] operator[<] operator[>] operator[SEP] identifier[separator] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public BaseRedisCache init() {
super.init();
long expireAfterWrite = getExpireAfterWrite();
long expireAfterAccess = getExpireAfterAccess();
if (expireAfterAccess > 0 || expireAfterWrite > 0) {
timeToLiveSeconds = expireAfterAccess > 0 ? expireAfterAccess : expireAfterWrite;
} else {
timeToLiveSeconds = -1;
}
/*
* Parse custom property: key-mode
*/
KeyMode oldKeyMode = this.keyMode;
try {
this.keyMode = KeyMode.valueOf(getCacheProperty(CACHE_PROP_KEY_MODE).toUpperCase());
} catch (Exception e) {
this.keyMode = oldKeyMode;
if (getCacheProperty(CACHE_PROP_KEY_MODE) != null) {
LOGGER.warn(e.getMessage(), e);
}
}
/*
* Parse custom property: ttl-seconds
*/
long oldTTL = this.timeToLiveSeconds;
try {
this.timeToLiveSeconds = Long.parseLong(getCacheProperty(CACHE_PROP_TTL_SECONDS));
} catch (Exception e) {
this.timeToLiveSeconds = oldTTL;
if (getCacheProperty(CACHE_PROP_TTL_SECONDS) != null) {
LOGGER.warn(e.getMessage(), e);
}
}
/*
* Parse custom property: redis-password
*/
String password = getCacheProperty(CACHE_PROP_REDIS_PASSWORD);
if (!StringUtils.isBlank(password)) {
this.redisPassword = password;
}
return this;
} | class class_name[name] begin[{]
method[init, return_type[type[BaseRedisCache]], modifier[public], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=init, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[long], expireAfterWrite]
local_variable[type[long], expireAfterAccess]
if[binary_operation[binary_operation[member[.expireAfterAccess], >, literal[0]], ||, binary_operation[member[.expireAfterWrite], >, literal[0]]]] begin[{]
assign[member[.timeToLiveSeconds], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=expireAfterAccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=MemberReference(member=expireAfterWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=expireAfterAccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
assign[member[.timeToLiveSeconds], literal[1]]
end[}]
local_variable[type[KeyMode], oldKeyMode]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=keyMode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=CACHE_PROP_KEY_MODE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCacheProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toUpperCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=KeyMode, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=keyMode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=oldKeyMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=CACHE_PROP_KEY_MODE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCacheProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[long], oldTTL]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=timeToLiveSeconds, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=CACHE_PROP_TTL_SECONDS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCacheProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=parseLong, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=timeToLiveSeconds, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=oldTTL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=CACHE_PROP_TTL_SECONDS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCacheProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[String], password]
if[call[StringUtils.isBlank, parameter[member[.password]]]] begin[{]
assign[THIS[member[None.redisPassword]], member[.password]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[BaseRedisCache] identifier[init] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[expireAfterWrite] operator[=] identifier[getExpireAfterWrite] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[expireAfterAccess] operator[=] identifier[getExpireAfterAccess] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expireAfterAccess] operator[>] Other[0] operator[||] identifier[expireAfterWrite] operator[>] Other[0] operator[SEP] {
identifier[timeToLiveSeconds] operator[=] identifier[expireAfterAccess] operator[>] Other[0] operator[?] identifier[expireAfterAccess] operator[:] identifier[expireAfterWrite] operator[SEP]
}
Keyword[else] {
identifier[timeToLiveSeconds] operator[=] operator[-] Other[1] operator[SEP]
}
identifier[KeyMode] identifier[oldKeyMode] operator[=] Keyword[this] operator[SEP] identifier[keyMode] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[keyMode] operator[=] identifier[KeyMode] operator[SEP] identifier[valueOf] operator[SEP] identifier[getCacheProperty] operator[SEP] identifier[CACHE_PROP_KEY_MODE] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[this] operator[SEP] identifier[keyMode] operator[=] identifier[oldKeyMode] operator[SEP] Keyword[if] operator[SEP] identifier[getCacheProperty] operator[SEP] identifier[CACHE_PROP_KEY_MODE] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[long] identifier[oldTTL] operator[=] Keyword[this] operator[SEP] identifier[timeToLiveSeconds] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[timeToLiveSeconds] operator[=] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[getCacheProperty] operator[SEP] identifier[CACHE_PROP_TTL_SECONDS] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[this] operator[SEP] identifier[timeToLiveSeconds] operator[=] identifier[oldTTL] operator[SEP] Keyword[if] operator[SEP] identifier[getCacheProperty] operator[SEP] identifier[CACHE_PROP_TTL_SECONDS] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[String] identifier[password] operator[=] identifier[getCacheProperty] operator[SEP] identifier[CACHE_PROP_REDIS_PASSWORD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[password] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[redisPassword] operator[=] identifier[password] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
protected List<Metric> serializeMetered(String name, Metered meter) {
return Lists.newArrayList(
serializeValue(name, meter.getCount(), Measurements.COUNT.name()),
serializeValue(name, meter.getMeanRate(), Measurements.MEAN_RATE.name()),
serializeValue(name, meter.getOneMinuteRate(), Measurements.RATE_1MIN.name()),
serializeValue(name, meter.getFiveMinuteRate(), Measurements.RATE_5MIN.name()),
serializeValue(name, meter.getFifteenMinuteRate(), Measurements.RATE_15MIN.name())
);
} | class class_name[name] begin[{]
method[serializeMetered, return_type[type[List]], modifier[protected], parameter[name, meter]] begin[{]
return[call[Lists.newArrayList, parameter[call[.serializeValue, parameter[member[.name], call[meter.getCount, parameter[]], call[Measurements.COUNT.name, parameter[]]]], call[.serializeValue, parameter[member[.name], call[meter.getMeanRate, parameter[]], call[Measurements.MEAN_RATE.name, parameter[]]]], call[.serializeValue, parameter[member[.name], call[meter.getOneMinuteRate, parameter[]], call[Measurements.RATE_1MIN.name, parameter[]]]], call[.serializeValue, parameter[member[.name], call[meter.getFiveMinuteRate, parameter[]], call[Measurements.RATE_5MIN.name, parameter[]]]], call[.serializeValue, parameter[member[.name], call[meter.getFifteenMinuteRate, parameter[]], call[Measurements.RATE_15MIN.name, parameter[]]]]]]]
end[}]
END[}] | Keyword[protected] identifier[List] operator[<] identifier[Metric] operator[>] identifier[serializeMetered] operator[SEP] identifier[String] identifier[name] , identifier[Metered] identifier[meter] operator[SEP] {
Keyword[return] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] identifier[serializeValue] operator[SEP] identifier[name] , identifier[meter] operator[SEP] identifier[getCount] operator[SEP] operator[SEP] , identifier[Measurements] operator[SEP] identifier[COUNT] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] , identifier[serializeValue] operator[SEP] identifier[name] , identifier[meter] operator[SEP] identifier[getMeanRate] operator[SEP] operator[SEP] , identifier[Measurements] operator[SEP] identifier[MEAN_RATE] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] , identifier[serializeValue] operator[SEP] identifier[name] , identifier[meter] operator[SEP] identifier[getOneMinuteRate] operator[SEP] operator[SEP] , identifier[Measurements] operator[SEP] identifier[RATE_1MIN] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] , identifier[serializeValue] operator[SEP] identifier[name] , identifier[meter] operator[SEP] identifier[getFiveMinuteRate] operator[SEP] operator[SEP] , identifier[Measurements] operator[SEP] identifier[RATE_5MIN] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] , identifier[serializeValue] operator[SEP] identifier[name] , identifier[meter] operator[SEP] identifier[getFifteenMinuteRate] operator[SEP] operator[SEP] , identifier[Measurements] operator[SEP] identifier[RATE_15MIN] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object put(Object key, Object value) {
// Make sure the value is not null
if (value == null) {
throw new NullPointerException();
}
// Makes sure the key is not already in the hashtable.
FastHashtableEntry tab[] = table;
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (FastHashtableEntry e = tab[index] ; e != null ; e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
Object old = e.value;
e.value = value;
return old;
}
}
if (count >= threshold) {
// Rehash the table if the threshold is exceeded
rehash();
return put(key, value);
}
// Creates the new entry.
FastHashtableEntry e = new FastHashtableEntry();
e.hash = hash;
e.key = key;
e.value = value;
e.next = tab[index];
tab[index] = e;
count++;
return null;
} | class class_name[name] begin[{]
method[put, return_type[type[Object]], modifier[public], parameter[key, value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[FastHashtableEntry], tab]
local_variable[type[int], hash]
local_variable[type[int], index]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=e.key, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), name=old)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), type==, value=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ReturnStatement(expression=MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=tab, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FastHashtableEntry, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]))]), label=None)
if[binary_operation[member[.count], >=, member[.threshold]]] begin[{]
call[.rehash, parameter[]]
return[call[.put, parameter[member[.key], member[.value]]]]
else begin[{]
None
end[}]
local_variable[type[FastHashtableEntry], e]
assign[member[e.hash], member[.hash]]
assign[member[e.key], member[.key]]
assign[member[e.value], member[.value]]
assign[member[e.next], member[.tab]]
assign[member[.tab], member[.e]]
member[.count]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[put] operator[SEP] identifier[Object] identifier[key] , identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[FastHashtableEntry] identifier[tab] operator[SEP] operator[SEP] operator[=] identifier[table] operator[SEP] Keyword[int] identifier[hash] operator[=] identifier[key] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] operator[SEP] identifier[hash] operator[&] literal[Integer] operator[SEP] operator[%] identifier[tab] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] identifier[FastHashtableEntry] identifier[e] operator[=] identifier[tab] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] identifier[e] operator[=] identifier[e] operator[SEP] identifier[next] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[hash] operator[==] identifier[hash] operator[SEP] operator[&&] identifier[e] operator[SEP] identifier[key] operator[SEP] identifier[equals] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[Object] identifier[old] operator[=] identifier[e] operator[SEP] identifier[value] operator[SEP] identifier[e] operator[SEP] identifier[value] operator[=] identifier[value] operator[SEP] Keyword[return] identifier[old] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[count] operator[>=] identifier[threshold] operator[SEP] {
identifier[rehash] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
identifier[FastHashtableEntry] identifier[e] operator[=] Keyword[new] identifier[FastHashtableEntry] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[hash] operator[=] identifier[hash] operator[SEP] identifier[e] operator[SEP] identifier[key] operator[=] identifier[key] operator[SEP] identifier[e] operator[SEP] identifier[value] operator[=] identifier[value] operator[SEP] identifier[e] operator[SEP] identifier[next] operator[=] identifier[tab] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[tab] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[e] operator[SEP] identifier[count] operator[++] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
protected void connectZooKeeper() throws IOException {
LOG.info("Connecting ZooKeeper " + zkQuorum);
for (int i = 0; i <= connectRetryTimes; i++) {
try {
zooKeeper = new ZooKeeper(zkQuorum, sessionTimeout, this);
break;
} catch (IOException e) {
if (i == connectRetryTimes) {
throw new IOException("Can't connect ZooKeeper after retrying", e);
}
LOG.error("Exception to connect ZooKeeper, retry " + (i + 1) + " times");
}
}
} | class class_name[name] begin[{]
method[connectZooKeeper, return_type[void], modifier[protected], parameter[]] begin[{]
call[LOG.info, parameter[binary_operation[literal["Connecting ZooKeeper "], +, member[.zkQuorum]]]]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=zooKeeper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=zkQuorum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sessionTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ZooKeeper, sub_type=None))), label=None), BreakStatement(goto=None, label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=connectRetryTimes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't connect ZooKeeper after retrying"), 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=IOException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception to connect ZooKeeper, retry "), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" times"), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=connectRetryTimes, 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)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[connectZooKeeper] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[zkQuorum] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<=] identifier[connectRetryTimes] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
identifier[zooKeeper] operator[=] Keyword[new] identifier[ZooKeeper] operator[SEP] identifier[zkQuorum] , identifier[sessionTimeout] , Keyword[this] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] identifier[connectRetryTimes] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public Project dependsOnArtifact(Artifact artifact)
{
Project project = new Project();
project.setArtifact(artifact);
project.setInputVariablesName(inputVarName);
return project;
} | class class_name[name] begin[{]
method[dependsOnArtifact, return_type[type[Project]], modifier[public], parameter[artifact]] begin[{]
local_variable[type[Project], project]
call[project.setArtifact, parameter[member[.artifact]]]
call[project.setInputVariablesName, parameter[member[.inputVarName]]]
return[member[.project]]
end[}]
END[}] | Keyword[public] identifier[Project] identifier[dependsOnArtifact] operator[SEP] identifier[Artifact] identifier[artifact] operator[SEP] {
identifier[Project] identifier[project] operator[=] Keyword[new] identifier[Project] operator[SEP] operator[SEP] operator[SEP] identifier[project] operator[SEP] identifier[setArtifact] operator[SEP] identifier[artifact] operator[SEP] operator[SEP] identifier[project] operator[SEP] identifier[setInputVariablesName] operator[SEP] identifier[inputVarName] operator[SEP] operator[SEP] Keyword[return] identifier[project] operator[SEP]
}
|
@Override
@Pure
public final double getDistance(Point2D<?, ?> point) {
if (isWidePolyline()) {
return distance(point, getWidth());
}
return distance(point, 0);
} | class class_name[name] begin[{]
method[getDistance, return_type[type[double]], modifier[final public], parameter[point]] begin[{]
if[call[.isWidePolyline, parameter[]]] begin[{]
return[call[.distance, parameter[member[.point], call[.getWidth, parameter[]]]]]
else begin[{]
None
end[}]
return[call[.distance, parameter[member[.point], literal[0]]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[Pure] Keyword[public] Keyword[final] Keyword[double] identifier[getDistance] operator[SEP] identifier[Point2D] operator[<] operator[?] , operator[?] operator[>] identifier[point] operator[SEP] {
Keyword[if] operator[SEP] identifier[isWidePolyline] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[distance] operator[SEP] identifier[point] , identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[distance] operator[SEP] identifier[point] , Other[0] operator[SEP] operator[SEP]
}
|
protected <C> List<List<C>> deserializeIntoList( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializer<C> deserializer,
JsonDeserializerParameters params ) {
List<List<C>> list;
reader.beginArray();
JsonToken token = reader.peek();
if ( JsonToken.END_ARRAY == token ) {
// empty array, no need to create a list
list = Collections.emptyList();
} else {
list = doDeserializeIntoList( reader, ctx, deserializer, params, token );
}
reader.endArray();
return list;
} | class class_name[name] begin[{]
method[deserializeIntoList, return_type[type[List]], modifier[protected], parameter[reader, ctx, deserializer, params]] begin[{]
local_variable[type[List], list]
call[reader.beginArray, parameter[]]
local_variable[type[JsonToken], token]
if[binary_operation[member[JsonToken.END_ARRAY], ==, member[.token]]] begin[{]
assign[member[.list], call[Collections.emptyList, parameter[]]]
else begin[{]
assign[member[.list], call[.doDeserializeIntoList, parameter[member[.reader], member[.ctx], member[.deserializer], member[.params], member[.token]]]]
end[}]
call[reader.endArray, parameter[]]
return[member[.list]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[C] operator[>] identifier[List] operator[<] identifier[List] operator[<] identifier[C] operator[>] operator[>] identifier[deserializeIntoList] operator[SEP] identifier[JsonReader] identifier[reader] , identifier[JsonDeserializationContext] identifier[ctx] , identifier[JsonDeserializer] operator[<] identifier[C] operator[>] identifier[deserializer] , identifier[JsonDeserializerParameters] identifier[params] operator[SEP] {
identifier[List] operator[<] identifier[List] operator[<] identifier[C] operator[>] operator[>] identifier[list] operator[SEP] identifier[reader] operator[SEP] identifier[beginArray] operator[SEP] operator[SEP] operator[SEP] identifier[JsonToken] identifier[token] operator[=] identifier[reader] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[JsonToken] operator[SEP] identifier[END_ARRAY] operator[==] identifier[token] operator[SEP] {
identifier[list] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[list] operator[=] identifier[doDeserializeIntoList] operator[SEP] identifier[reader] , identifier[ctx] , identifier[deserializer] , identifier[params] , identifier[token] operator[SEP] operator[SEP]
}
identifier[reader] operator[SEP] identifier[endArray] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[list] operator[SEP]
}
|
private TTTState<I, D> createState(@Nonnull TTTTransition<I, D> transition) {
return hypothesis.createState(transition);
} | class class_name[name] begin[{]
method[createState, return_type[type[TTTState]], modifier[private], parameter[transition]] begin[{]
return[call[hypothesis.createState, parameter[member[.transition]]]]
end[}]
END[}] | Keyword[private] identifier[TTTState] operator[<] identifier[I] , identifier[D] operator[>] identifier[createState] operator[SEP] annotation[@] identifier[Nonnull] identifier[TTTTransition] operator[<] identifier[I] , identifier[D] operator[>] identifier[transition] operator[SEP] {
Keyword[return] identifier[hypothesis] operator[SEP] identifier[createState] operator[SEP] identifier[transition] operator[SEP] operator[SEP]
}
|
@org.eclipse.xtext.service.SingletonBinding(eager=true) public Class<? extends org.eclipse.xtext.generator.parser.antlr.debug.validation.SimpleAntlrJavaValidator> bindSimpleAntlrJavaValidator() {
return org.eclipse.xtext.generator.parser.antlr.debug.validation.SimpleAntlrJavaValidator.class;
} | class class_name[name] begin[{]
method[bindSimpleAntlrJavaValidator, return_type[type[Class]], modifier[public], parameter[]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=org.eclipse.xtext.generator.parser.antlr.debug.validation, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimpleAntlrJavaValidator, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[org] operator[SEP] identifier[eclipse] operator[SEP] identifier[xtext] operator[SEP] identifier[service] operator[SEP] identifier[SingletonBinding] operator[SEP] identifier[eager] operator[=] literal[boolean] operator[SEP] Keyword[public] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[org] operator[SEP] identifier[eclipse] operator[SEP] identifier[xtext] operator[SEP] identifier[generator] operator[SEP] identifier[parser] operator[SEP] identifier[antlr] operator[SEP] identifier[debug] operator[SEP] identifier[validation] operator[SEP] identifier[SimpleAntlrJavaValidator] operator[>] identifier[bindSimpleAntlrJavaValidator] operator[SEP] operator[SEP] {
Keyword[return] identifier[org] operator[SEP] identifier[eclipse] operator[SEP] identifier[xtext] operator[SEP] identifier[generator] operator[SEP] identifier[parser] operator[SEP] identifier[antlr] operator[SEP] identifier[debug] operator[SEP] identifier[validation] operator[SEP] identifier[SimpleAntlrJavaValidator] operator[SEP] Keyword[class] operator[SEP]
}
|
public static OptionHandler parseElement(final Element element,
final Properties props,
final Class expectedClass) throws Exception {
String clazz = subst(element.getAttribute("class"), props);
Object instance = OptionConverter.instantiateByClassName(clazz,
expectedClass, null);
if (instance instanceof OptionHandler) {
OptionHandler optionHandler = (OptionHandler) instance;
PropertySetter propSetter = new PropertySetter(optionHandler);
NodeList children = element.getChildNodes();
final int length = children.getLength();
for (int loop = 0; loop < length; loop++) {
Node currentNode = children.item(loop);
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
Element currentElement = (Element) currentNode;
String tagName = currentElement.getTagName();
if (tagName.equals("param")) {
setParameter(currentElement, propSetter, props);
} else {
parseUnrecognizedElement(instance, currentElement, props);
}
}
}
return optionHandler;
}
return null;
} | class class_name[name] begin[{]
method[parseElement, return_type[type[OptionHandler]], modifier[public static], parameter[element, props, expectedClass]] begin[{]
local_variable[type[String], clazz]
local_variable[type[Object], instance]
if[binary_operation[member[.instance], instanceof, type[OptionHandler]]] begin[{]
local_variable[type[OptionHandler], optionHandler]
local_variable[type[PropertySetter], propSetter]
local_variable[type[NodeList], children]
local_variable[type[int], length]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=item, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[], type_arguments=None), name=currentNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getNodeType, postfix_operators=[], prefix_operators=[], qualifier=currentNode, selectors=[], type_arguments=None), operandr=MemberReference(member=ELEMENT_NODE, postfix_operators=[], prefix_operators=[], qualifier=Node, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=currentNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None)), name=currentElement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTagName, postfix_operators=[], prefix_operators=[], qualifier=currentElement, selectors=[], type_arguments=None), name=tagName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="param")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=tagName, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseUnrecognizedElement, 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=currentElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=propSetter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=loop)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=loop, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.optionHandler]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[OptionHandler] identifier[parseElement] operator[SEP] Keyword[final] identifier[Element] identifier[element] , Keyword[final] identifier[Properties] identifier[props] , Keyword[final] identifier[Class] identifier[expectedClass] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[clazz] operator[=] identifier[subst] operator[SEP] identifier[element] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] , identifier[props] operator[SEP] operator[SEP] identifier[Object] identifier[instance] operator[=] identifier[OptionConverter] operator[SEP] identifier[instantiateByClassName] operator[SEP] identifier[clazz] , identifier[expectedClass] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[instance] Keyword[instanceof] identifier[OptionHandler] operator[SEP] {
identifier[OptionHandler] identifier[optionHandler] operator[=] operator[SEP] identifier[OptionHandler] operator[SEP] identifier[instance] operator[SEP] identifier[PropertySetter] identifier[propSetter] operator[=] Keyword[new] identifier[PropertySetter] operator[SEP] identifier[optionHandler] operator[SEP] operator[SEP] identifier[NodeList] identifier[children] operator[=] identifier[element] operator[SEP] identifier[getChildNodes] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[length] operator[=] identifier[children] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[loop] operator[=] Other[0] operator[SEP] identifier[loop] operator[<] identifier[length] operator[SEP] identifier[loop] operator[++] operator[SEP] {
identifier[Node] identifier[currentNode] operator[=] identifier[children] operator[SEP] identifier[item] operator[SEP] identifier[loop] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentNode] operator[SEP] identifier[getNodeType] operator[SEP] operator[SEP] operator[==] identifier[Node] operator[SEP] identifier[ELEMENT_NODE] operator[SEP] {
identifier[Element] identifier[currentElement] operator[=] operator[SEP] identifier[Element] operator[SEP] identifier[currentNode] operator[SEP] identifier[String] identifier[tagName] operator[=] identifier[currentElement] operator[SEP] identifier[getTagName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tagName] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[setParameter] operator[SEP] identifier[currentElement] , identifier[propSetter] , identifier[props] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[parseUnrecognizedElement] operator[SEP] identifier[instance] , identifier[currentElement] , identifier[props] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[optionHandler] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public CMAUiExtension fetchOne(String spaceId, String environmentId, String extensionId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "spaceId");
assertNotNull(extensionId, "extensionId");
return service.fetchOne(spaceId, environmentId, extensionId).blockingFirst();
} | class class_name[name] begin[{]
method[fetchOne, return_type[type[CMAUiExtension]], modifier[public], parameter[spaceId, environmentId, extensionId]] begin[{]
call[.assertNotNull, parameter[member[.spaceId], literal["spaceId"]]]
call[.assertNotNull, parameter[member[.environmentId], literal["spaceId"]]]
call[.assertNotNull, parameter[member[.extensionId], literal["extensionId"]]]
return[call[service.fetchOne, parameter[member[.spaceId], member[.environmentId], member[.extensionId]]]]
end[}]
END[}] | Keyword[public] identifier[CMAUiExtension] identifier[fetchOne] operator[SEP] identifier[String] identifier[spaceId] , identifier[String] identifier[environmentId] , identifier[String] identifier[extensionId] operator[SEP] {
identifier[assertNotNull] operator[SEP] identifier[spaceId] , literal[String] operator[SEP] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[environmentId] , literal[String] operator[SEP] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[extensionId] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[fetchOne] operator[SEP] identifier[spaceId] , identifier[environmentId] , identifier[extensionId] operator[SEP] operator[SEP] identifier[blockingFirst] operator[SEP] operator[SEP] operator[SEP]
}
|
@Check(CheckType.FAST)
public void checkSuperType(SarlAgent agent) {
checkSuperTypes(
agent,
SARL_AGENT__EXTENDS,
Utils.singletonList(agent.getExtends()),
Agent.class,
false);
} | class class_name[name] begin[{]
method[checkSuperType, return_type[void], modifier[public], parameter[agent]] begin[{]
call[.checkSuperTypes, parameter[member[.agent], member[.SARL_AGENT__EXTENDS], call[Utils.singletonList, parameter[call[agent.getExtends, parameter[]]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Agent, sub_type=None)), literal[false]]]
end[}]
END[}] | annotation[@] identifier[Check] operator[SEP] identifier[CheckType] operator[SEP] identifier[FAST] operator[SEP] Keyword[public] Keyword[void] identifier[checkSuperType] operator[SEP] identifier[SarlAgent] identifier[agent] operator[SEP] {
identifier[checkSuperTypes] operator[SEP] identifier[agent] , identifier[SARL_AGENT__EXTENDS] , identifier[Utils] operator[SEP] identifier[singletonList] operator[SEP] identifier[agent] operator[SEP] identifier[getExtends] operator[SEP] operator[SEP] operator[SEP] , identifier[Agent] operator[SEP] Keyword[class] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static Object getListener(Object bag, int index)
{
if (index == 0) {
if (bag == null)
return null;
if (!(bag instanceof Object[]))
return bag;
Object[] array = (Object[])bag;
// bag has at least 2 elements if it is array
if (array.length < 2) throw new IllegalArgumentException();
return array[0];
} else if (index == 1) {
if (!(bag instanceof Object[])) {
if (bag == null) throw new IllegalArgumentException();
return null;
}
Object[] array = (Object[])bag;
// the array access will check for index on its own
return array[1];
} else {
// bag has to array
Object[] array = (Object[])bag;
int L = array.length;
if (L < 2) throw new IllegalArgumentException();
if (index == L)
return null;
return array[index];
}
} | class class_name[name] begin[{]
method[getListener, return_type[type[Object]], modifier[public static], parameter[bag, index]] begin[{]
if[binary_operation[member[.index], ==, literal[0]]] begin[{]
if[binary_operation[member[.bag], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.bag], instanceof, type[Object]]] begin[{]
return[member[.bag]]
else begin[{]
None
end[}]
local_variable[type[Object], array]
if[binary_operation[member[array.length], <, literal[2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.array]]
else begin[{]
if[binary_operation[member[.index], ==, literal[1]]] begin[{]
if[binary_operation[member[.bag], instanceof, type[Object]]] begin[{]
if[binary_operation[member[.bag], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Object], array]
return[member[.array]]
else begin[{]
local_variable[type[Object], array]
local_variable[type[int], L]
if[binary_operation[member[.L], <, literal[2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.index], ==, member[.L]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[member[.array]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[getListener] operator[SEP] identifier[Object] identifier[bag] , Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[==] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[bag] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[bag] Keyword[instanceof] identifier[Object] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[bag] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[bag] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[length] operator[<] Other[2] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[array] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[index] operator[==] Other[1] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[bag] Keyword[instanceof] identifier[Object] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[bag] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[bag] operator[SEP] Keyword[return] identifier[array] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[bag] operator[SEP] Keyword[int] identifier[L] operator[=] identifier[array] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[L] operator[<] Other[2] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] identifier[L] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[array] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
}
|
public static SurfaceConfig imports(Xml root)
{
Check.notNull(root);
final Xml node = root.getChild(NODE_SURFACE);
final String surface = node.readString(ATT_IMAGE);
final String icon = node.readString(null, ATT_ICON);
return new SurfaceConfig(surface, icon);
} | class class_name[name] begin[{]
method[imports, return_type[type[SurfaceConfig]], modifier[public static], parameter[root]] begin[{]
call[Check.notNull, parameter[member[.root]]]
local_variable[type[Xml], node]
local_variable[type[String], surface]
local_variable[type[String], icon]
return[ClassCreator(arguments=[MemberReference(member=surface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=icon, 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=SurfaceConfig, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SurfaceConfig] identifier[imports] operator[SEP] identifier[Xml] identifier[root] operator[SEP] {
identifier[Check] operator[SEP] identifier[notNull] operator[SEP] identifier[root] operator[SEP] operator[SEP] Keyword[final] identifier[Xml] identifier[node] operator[=] identifier[root] operator[SEP] identifier[getChild] operator[SEP] identifier[NODE_SURFACE] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[surface] operator[=] identifier[node] operator[SEP] identifier[readString] operator[SEP] identifier[ATT_IMAGE] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[icon] operator[=] identifier[node] operator[SEP] identifier[readString] operator[SEP] Other[null] , identifier[ATT_ICON] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[SurfaceConfig] operator[SEP] identifier[surface] , identifier[icon] operator[SEP] operator[SEP]
}
|
public static <T extends Comparable<? super T>> List<T> minList (Iterable<T> iterable)
{
return maxList(iterable, java.util.Collections.reverseOrder());
} | class class_name[name] begin[{]
method[minList, return_type[type[List]], modifier[public static], parameter[iterable]] begin[{]
return[call[.maxList, parameter[member[.iterable], call[java.util.Collections.reverseOrder, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[T] operator[>] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[minList] operator[SEP] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[iterable] operator[SEP] {
Keyword[return] identifier[maxList] operator[SEP] identifier[iterable] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collections] operator[SEP] identifier[reverseOrder] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private List<Element> extractElements(String content, String selector, int amount) {
Element body = parseContent(content);
List<Element> elements = body.select(selector);
if (elements.size() > 0) {
elements = filterParents(elements);
if (amount >= 0) {
// limit to the indicated amount
elements = elements.subList(0, Math.min(amount, elements.size()));
}
// remove all from their parents
for (Element element : elements) {
element.remove();
}
}
List<Element> results = new ArrayList<Element>();
// first element is the body
results.add(body);
results.addAll(elements);
return results;
} | class class_name[name] begin[{]
method[extractElements, return_type[type[List]], modifier[private], parameter[content, selector, amount]] begin[{]
local_variable[type[Element], body]
local_variable[type[List], elements]
if[binary_operation[call[elements.size, parameter[]], >, literal[0]]] begin[{]
assign[member[.elements], call[.filterParents, parameter[member[.elements]]]]
if[binary_operation[member[.amount], >=, literal[0]]] begin[{]
assign[member[.elements], call[elements.subList, parameter[literal[0], call[Math.min, parameter[member[.amount], call[elements.size, parameter[]]]]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=remove, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=elements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[List], results]
call[results.add, parameter[member[.body]]]
call[results.addAll, parameter[member[.elements]]]
return[member[.results]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[Element] operator[>] identifier[extractElements] operator[SEP] identifier[String] identifier[content] , identifier[String] identifier[selector] , Keyword[int] identifier[amount] operator[SEP] {
identifier[Element] identifier[body] operator[=] identifier[parseContent] operator[SEP] identifier[content] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Element] operator[>] identifier[elements] operator[=] identifier[body] operator[SEP] identifier[select] operator[SEP] identifier[selector] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elements] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[elements] operator[=] identifier[filterParents] operator[SEP] identifier[elements] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[amount] operator[>=] Other[0] operator[SEP] {
identifier[elements] operator[=] identifier[elements] operator[SEP] identifier[subList] operator[SEP] Other[0] , identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[amount] , identifier[elements] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Element] identifier[element] operator[:] identifier[elements] operator[SEP] {
identifier[element] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[Element] operator[>] identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Element] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[add] operator[SEP] identifier[body] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[addAll] operator[SEP] identifier[elements] operator[SEP] operator[SEP] Keyword[return] identifier[results] operator[SEP]
}
|
public Functor transform(Functor functor)
{
FunctorName functorName = interner.getFunctorFunctorName(functor);
if (builtInExpressions.containsKey(functorName))
{
Class<? extends Functor> builtInExpressionClass = builtInExpressions.get(functorName);
return ReflectionUtils.newInstance(ReflectionUtils.getConstructor(builtInExpressionClass,
new Class[] { Integer.TYPE, Term[].class }),
new Object[] { functor.getName(), functor.getArguments() });
}
else
{
return functor;
}
} | class class_name[name] begin[{]
method[transform, return_type[type[Functor]], modifier[public], parameter[functor]] begin[{]
local_variable[type[FunctorName], functorName]
if[call[builtInExpressions.containsKey, parameter[member[.functorName]]]] begin[{]
local_variable[type[Class], builtInExpressionClass]
return[call[ReflectionUtils.newInstance, parameter[call[ReflectionUtils.getConstructor, parameter[member[.builtInExpressionClass], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Term, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None))]], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=functor, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getArguments, postfix_operators=[], prefix_operators=[], qualifier=functor, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]
else begin[{]
return[member[.functor]]
end[}]
end[}]
END[}] | Keyword[public] identifier[Functor] identifier[transform] operator[SEP] identifier[Functor] identifier[functor] operator[SEP] {
identifier[FunctorName] identifier[functorName] operator[=] identifier[interner] operator[SEP] identifier[getFunctorFunctorName] operator[SEP] identifier[functor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[builtInExpressions] operator[SEP] identifier[containsKey] operator[SEP] identifier[functorName] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Functor] operator[>] identifier[builtInExpressionClass] operator[=] identifier[builtInExpressions] operator[SEP] identifier[get] operator[SEP] identifier[functorName] operator[SEP] operator[SEP] Keyword[return] identifier[ReflectionUtils] operator[SEP] identifier[newInstance] operator[SEP] identifier[ReflectionUtils] operator[SEP] identifier[getConstructor] operator[SEP] identifier[builtInExpressionClass] , Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
identifier[Integer] operator[SEP] identifier[TYPE] , identifier[Term] operator[SEP] operator[SEP] operator[SEP] Keyword[class]
} operator[SEP] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[functor] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[functor] operator[SEP] identifier[getArguments] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[functor] operator[SEP]
}
}
|
void enableStatistics(boolean enabled) {
requireNotClosed();
synchronized (configuration) {
if (enabled) {
JmxRegistration.registerMXBean(this, statistics, MBeanType.Statistics);
} else {
JmxRegistration.unregisterMXBean(this, MBeanType.Statistics);
}
statistics.enable(enabled);
configuration.setStatisticsEnabled(enabled);
}
} | class class_name[name] begin[{]
method[enableStatistics, return_type[void], modifier[default], parameter[enabled]] begin[{]
call[.requireNotClosed, parameter[]]
SYNCHRONIZED[member[.configuration]] BEGIN[{]
if[member[.enabled]] begin[{]
call[JmxRegistration.registerMXBean, parameter[THIS[], member[.statistics], member[MBeanType.Statistics]]]
else begin[{]
call[JmxRegistration.unregisterMXBean, parameter[THIS[], member[MBeanType.Statistics]]]
end[}]
call[statistics.enable, parameter[member[.enabled]]]
call[configuration.setStatisticsEnabled, parameter[member[.enabled]]]
END[}]
end[}]
END[}] | Keyword[void] identifier[enableStatistics] operator[SEP] Keyword[boolean] identifier[enabled] operator[SEP] {
identifier[requireNotClosed] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[configuration] operator[SEP] {
Keyword[if] operator[SEP] identifier[enabled] operator[SEP] {
identifier[JmxRegistration] operator[SEP] identifier[registerMXBean] operator[SEP] Keyword[this] , identifier[statistics] , identifier[MBeanType] operator[SEP] identifier[Statistics] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[JmxRegistration] operator[SEP] identifier[unregisterMXBean] operator[SEP] Keyword[this] , identifier[MBeanType] operator[SEP] identifier[Statistics] operator[SEP] operator[SEP]
}
identifier[statistics] operator[SEP] identifier[enable] operator[SEP] identifier[enabled] operator[SEP] operator[SEP] identifier[configuration] operator[SEP] identifier[setStatisticsEnabled] operator[SEP] identifier[enabled] operator[SEP] operator[SEP]
}
}
|
public double getCount(F first, S second) {
Counter<S> counter = maps.get(first);
if (counter == null)
return 0.0;
return counter.getCount(second);
} | class class_name[name] begin[{]
method[getCount, return_type[type[double]], modifier[public], parameter[first, second]] begin[{]
local_variable[type[Counter], counter]
if[binary_operation[member[.counter], ==, literal[null]]] begin[{]
return[literal[0.0]]
else begin[{]
None
end[}]
return[call[counter.getCount, parameter[member[.second]]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[getCount] operator[SEP] identifier[F] identifier[first] , identifier[S] identifier[second] operator[SEP] {
identifier[Counter] operator[<] identifier[S] operator[>] identifier[counter] operator[=] identifier[maps] operator[SEP] identifier[get] operator[SEP] identifier[first] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[counter] operator[==] Other[null] operator[SEP] Keyword[return] literal[Float] operator[SEP] Keyword[return] identifier[counter] operator[SEP] identifier[getCount] operator[SEP] identifier[second] operator[SEP] operator[SEP]
}
|
public ReadModifyWriteRow adapt(Increment increment) {
ReadModifyWriteRow readModifyWriteRow = ReadModifyWriteRow
.create(bigtableTableName.getTableId(), ByteString.copyFrom(increment.getRow()));
Adapters.INCREMENT_ADAPTER.adapt(increment, readModifyWriteRow);
return readModifyWriteRow;
} | class class_name[name] begin[{]
method[adapt, return_type[type[ReadModifyWriteRow]], modifier[public], parameter[increment]] begin[{]
local_variable[type[ReadModifyWriteRow], readModifyWriteRow]
call[Adapters.INCREMENT_ADAPTER.adapt, parameter[member[.increment], member[.readModifyWriteRow]]]
return[member[.readModifyWriteRow]]
end[}]
END[}] | Keyword[public] identifier[ReadModifyWriteRow] identifier[adapt] operator[SEP] identifier[Increment] identifier[increment] operator[SEP] {
identifier[ReadModifyWriteRow] identifier[readModifyWriteRow] operator[=] identifier[ReadModifyWriteRow] operator[SEP] identifier[create] operator[SEP] identifier[bigtableTableName] operator[SEP] identifier[getTableId] operator[SEP] operator[SEP] , identifier[ByteString] operator[SEP] identifier[copyFrom] operator[SEP] identifier[increment] operator[SEP] identifier[getRow] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Adapters] operator[SEP] identifier[INCREMENT_ADAPTER] operator[SEP] identifier[adapt] operator[SEP] identifier[increment] , identifier[readModifyWriteRow] operator[SEP] operator[SEP] Keyword[return] identifier[readModifyWriteRow] operator[SEP]
}
|
@Override
public byte[] transformIn(Blob blob) throws CpoException {
byte[] buffBytes = new byte[1024];
byte[] retBytes = null;
int length;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
if (blob != null) {
logger.debug("BLOB IS NOT NULL");
try {
InputStream is = blob.getBinaryStream();
while ((length = is.read(buffBytes)) != -1) {
bos.write(buffBytes, 0, length);
}
is.close();
retBytes = bos.toByteArray();
logger.debug("Got " + retBytes.length + " bytes");
} catch (Exception e) {
logger.debug("Error in transform blob", e);
throw new CpoException(e);
}
}
return retBytes;
} | class class_name[name] begin[{]
method[transformIn, return_type[type[byte]], modifier[public], parameter[blob]] begin[{]
local_variable[type[byte], buffBytes]
local_variable[type[byte], retBytes]
local_variable[type[int], length]
local_variable[type[ByteArrayOutputStream], bos]
if[binary_operation[member[.blob], !=, literal[null]]] begin[{]
call[logger.debug, parameter[literal["BLOB IS NOT NULL"]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBinaryStream, postfix_operators=[], prefix_operators=[], qualifier=blob, selectors=[], type_arguments=None), name=is)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=bos, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=buffBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=retBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toByteArray, postfix_operators=[], prefix_operators=[], qualifier=bos, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Got "), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=retBytes, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" bytes"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error in transform blob"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CpoException, sub_type=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[}]
return[member[.retBytes]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[transformIn] operator[SEP] identifier[Blob] identifier[blob] operator[SEP] Keyword[throws] identifier[CpoException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[buffBytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[1024] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[retBytes] operator[=] Other[null] operator[SEP] Keyword[int] identifier[length] operator[SEP] identifier[ByteArrayOutputStream] identifier[bos] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[blob] operator[!=] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[InputStream] identifier[is] operator[=] identifier[blob] operator[SEP] identifier[getBinaryStream] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[length] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[buffBytes] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[bos] operator[SEP] identifier[write] operator[SEP] identifier[buffBytes] , Other[0] , identifier[length] operator[SEP] operator[SEP]
}
identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[retBytes] operator[=] identifier[bos] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[retBytes] operator[SEP] identifier[length] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CpoException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[retBytes] operator[SEP]
}
|
protected boolean extractBoolean(Object val) {
try {
return (Boolean) val;
} catch (ClassCastException cce) {
logException(cce);
return false;
}
} | class class_name[name] begin[{]
method[extractBoolean, return_type[type[boolean]], modifier[protected], parameter[val]] begin[{]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=cce, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[extractBoolean] operator[SEP] identifier[Object] identifier[val] operator[SEP] {
Keyword[try] {
Keyword[return] operator[SEP] identifier[Boolean] operator[SEP] identifier[val] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[cce] operator[SEP] {
identifier[logException] operator[SEP] identifier[cce] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
|
protected void register(final Class<? extends Component<?>> interfaceClass, final Class<? extends Component<?>> implClass) {
register(interfaceClass, implClass, PriorityLevel.Normal, 0);
} | class class_name[name] begin[{]
method[register, return_type[void], modifier[protected], parameter[interfaceClass, implClass]] begin[{]
call[.register, parameter[member[.interfaceClass], member[.implClass], member[PriorityLevel.Normal], literal[0]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[register] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Component] operator[<] operator[?] operator[>] operator[>] identifier[interfaceClass] , Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Component] operator[<] operator[?] operator[>] operator[>] identifier[implClass] operator[SEP] {
identifier[register] operator[SEP] identifier[interfaceClass] , identifier[implClass] , identifier[PriorityLevel] operator[SEP] identifier[Normal] , Other[0] operator[SEP] operator[SEP]
}
|
private void symLinkAndConfigureFiles(JobConf job) throws IOException {
if (!(job.getBoolean("mapred.used.genericoptionsparser", false))) {
LOG.warn("Use GenericOptionsParser for parsing the arguments. " +
"Applications should implement Tool for the same.");
}
// get all the command line arguments into the
// jobconf passed in by the user conf
String files = job.get("tmpfiles");
String archives = job.get("tmparchives");
// "tmpjars" are not needed because its in the classpath
List<String> filesToSymLink = new ArrayList<String>();
splitAndAdd(files, filesToSymLink);
splitAndAdd(archives, filesToSymLink);
for (String file : filesToSymLink) {
String target = new Path(file).toUri().getPath();
String basename = new File(target).getName();
String linkName = new File(".").getAbsolutePath() + File.separator + basename;
File toLink = new File(linkName);
if (toLink.exists()) {
LOG.info("Symlink " + linkName + " already exists. Delete it.");
toLink.delete();
}
int ret = FileUtil.symLink(target, linkName);
LOG.info("Creating symlink " + linkName + " -> " + target +
" returns " + ret + ".");
}
// Configure job name
String originalJar = job.getJar();
if (originalJar != null) {
// use jar name if job is not named.
if ("".equals(job.getJobName())) {
job.setJobName(new Path(originalJar).getName());
}
}
// Configure username
configureUserName(job);
} | class class_name[name] begin[{]
method[symLinkAndConfigureFiles, return_type[void], modifier[private], parameter[job]] begin[{]
if[call[job.getBoolean, parameter[literal["mapred.used.genericoptionsparser"], literal[false]]]] begin[{]
call[LOG.warn, parameter[binary_operation[literal["Use GenericOptionsParser for parsing the arguments. "], +, literal["Applications should implement Tool for the same."]]]]
else begin[{]
None
end[}]
local_variable[type[String], files]
local_variable[type[String], archives]
local_variable[type[List], filesToSymLink]
call[.splitAndAdd, parameter[member[.files], member[.filesToSymLink]]]
call[.splitAndAdd, parameter[member[.archives], member[.filesToSymLink]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=toUri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getPath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Path, sub_type=None)), name=target)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=basename)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), operandr=MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=File, selectors=[]), operator=+), operandr=MemberReference(member=basename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=linkName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=linkName, 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=File, sub_type=None)), name=toLink)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=[], qualifier=toLink, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Symlink "), operandr=MemberReference(member=linkName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" already exists. Delete it."), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=delete, postfix_operators=[], prefix_operators=[], qualifier=toLink, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=linkName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=symLink, postfix_operators=[], prefix_operators=[], qualifier=FileUtil, selectors=[], type_arguments=None), name=ret)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Creating symlink "), operandr=MemberReference(member=linkName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" -> "), operator=+), operandr=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" returns "), operator=+), operandr=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=filesToSymLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
local_variable[type[String], originalJar]
if[binary_operation[member[.originalJar], !=, literal[null]]] begin[{]
if[literal[""]] begin[{]
call[job.setJobName, parameter[ClassCreator(arguments=[MemberReference(member=originalJar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Path, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[.configureUserName, parameter[member[.job]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[symLinkAndConfigureFiles] operator[SEP] identifier[JobConf] identifier[job] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[job] operator[SEP] identifier[getBoolean] operator[SEP] literal[String] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[files] operator[=] identifier[job] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[archives] operator[=] identifier[job] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[filesToSymLink] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[splitAndAdd] operator[SEP] identifier[files] , identifier[filesToSymLink] operator[SEP] operator[SEP] identifier[splitAndAdd] operator[SEP] identifier[archives] , identifier[filesToSymLink] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[file] operator[:] identifier[filesToSymLink] operator[SEP] {
identifier[String] identifier[target] operator[=] Keyword[new] identifier[Path] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[toUri] operator[SEP] operator[SEP] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[basename] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[linkName] operator[=] Keyword[new] identifier[File] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] identifier[File] operator[SEP] identifier[separator] operator[+] identifier[basename] operator[SEP] identifier[File] identifier[toLink] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[linkName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[toLink] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[linkName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[toLink] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[ret] operator[=] identifier[FileUtil] operator[SEP] identifier[symLink] operator[SEP] identifier[target] , identifier[linkName] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[linkName] operator[+] literal[String] operator[+] identifier[target] operator[+] literal[String] operator[+] identifier[ret] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[originalJar] operator[=] identifier[job] operator[SEP] identifier[getJar] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[originalJar] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[job] operator[SEP] identifier[getJobName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[job] operator[SEP] identifier[setJobName] operator[SEP] Keyword[new] identifier[Path] operator[SEP] identifier[originalJar] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[configureUserName] operator[SEP] identifier[job] operator[SEP] operator[SEP]
}
|
private void update(ESSyncConfig config, Dml dml) {
List<Map<String, Object>> dataList = dml.getData();
List<Map<String, Object>> oldList = dml.getOld();
if (dataList == null || dataList.isEmpty() || oldList == null || oldList.isEmpty()) {
return;
}
SchemaItem schemaItem = config.getEsMapping().getSchemaItem();
int i = 0;
for (Map<String, Object> data : dataList) {
Map<String, Object> old = oldList.get(i);
if (data == null || data.isEmpty() || old == null || old.isEmpty()) {
continue;
}
if (schemaItem.getAliasTableItems().size() == 1 && schemaItem.isAllFieldsSimple()) {
// ------单表 & 所有字段都为简单字段------
singleTableSimpleFiledUpdate(config, dml, data, old);
} else {
// ------主表 查询sql来更新------
if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) {
ESMapping mapping = config.getEsMapping();
String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id();
FieldItem idFieldItem = schemaItem.getSelectFields().get(idFieldName);
boolean idFieldSimple = true;
if (idFieldItem.isMethod() || idFieldItem.isBinaryOp()) {
idFieldSimple = false;
}
boolean allUpdateFieldSimple = true;
out: for (FieldItem fieldItem : schemaItem.getSelectFields().values()) {
for (ColumnItem columnItem : fieldItem.getColumnItems()) {
if (old.containsKey(columnItem.getColumnName())) {
if (fieldItem.isMethod() || fieldItem.isBinaryOp()) {
allUpdateFieldSimple = false;
break out;
}
}
}
}
// 不支持主键更新!!
// 判断是否有外键更新
boolean fkChanged = false;
for (TableItem tableItem : schemaItem.getAliasTableItems().values()) {
if (tableItem.isMain()) {
continue;
}
boolean changed = false;
for (List<FieldItem> fieldItems : tableItem.getRelationTableFields().values()) {
for (FieldItem fieldItem : fieldItems) {
if (old.containsKey(fieldItem.getColumn().getColumnName())) {
fkChanged = true;
changed = true;
break;
}
}
}
// 如果外键有修改,则更新所对应该表的所有查询条件数据
if (changed) {
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
fieldItem.getColumnItems()
.forEach(columnItem -> old.put(columnItem.getColumnName(), null));
}
}
}
// 判断主键和所更新的字段是否全为简单字段
if (idFieldSimple && allUpdateFieldSimple && !fkChanged) {
singleTableSimpleFiledUpdate(config, dml, data, old);
} else {
mainTableUpdate(config, dml, data, old);
}
}
// 从表的操作
for (TableItem tableItem : schemaItem.getAliasTableItems().values()) {
if (tableItem.isMain()) {
continue;
}
if (!tableItem.getTableName().equals(dml.getTable())) {
continue;
}
// 关联条件出现在主表查询条件是否为简单字段
boolean allFieldsSimple = true;
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
if (fieldItem.isMethod() || fieldItem.isBinaryOp()) {
allFieldsSimple = false;
break;
}
}
// 所有查询字段均为简单字段
if (allFieldsSimple) {
// 不是子查询
if (!tableItem.isSubQuery()) {
// ------关联表简单字段更新------
Map<String, Object> esFieldData = new LinkedHashMap<>();
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
if (old.containsKey(fieldItem.getColumn().getColumnName())) {
Object value = esTemplate.getValFromData(config.getEsMapping(),
data,
fieldItem.getFieldName(),
fieldItem.getColumn().getColumnName());
esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value);
}
}
joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData);
} else {
// ------关联子表简单字段更新------
subTableSimpleFieldOperation(config, dml, data, old, tableItem);
}
} else {
// ------关联子表复杂字段更新 执行全sql更新es------
wholeSqlOperation(config, dml, data, old, tableItem);
}
}
}
i++;
}
} | class class_name[name] begin[{]
method[update, return_type[void], modifier[private], parameter[config, dml]] begin[{]
local_variable[type[List], dataList]
local_variable[type[List], oldList]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.dataList], ==, literal[null]], ||, call[dataList.isEmpty, parameter[]]], ||, binary_operation[member[.oldList], ==, literal[null]]], ||, call[oldList.isEmpty, parameter[]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[SchemaItem], schemaItem]
local_variable[type[int], i]
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=oldList, selectors=[], type_arguments=None), name=old)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=||), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=old, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getAliasTableItems, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), operandr=MethodInvocation(arguments=[], member=isAllFieldsSimple, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getMainTable, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[MethodInvocation(arguments=[], member=getTableName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTable, postfix_operators=[], prefix_operators=[], qualifier=dml, selectors=[], type_arguments=None)], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getEsMapping, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), name=mapping)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ESMapping, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=get_id, postfix_operators=[], prefix_operators=[], qualifier=mapping, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=get_id, postfix_operators=[], prefix_operators=[], qualifier=mapping, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=getPk, postfix_operators=[], prefix_operators=[], qualifier=mapping, selectors=[], type_arguments=None)), name=idFieldName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSelectFields, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[MethodInvocation(arguments=[MemberReference(member=idFieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=idFieldItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=idFieldSimple)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isMethod, postfix_operators=[], prefix_operators=[], qualifier=idFieldItem, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isBinaryOp, postfix_operators=[], prefix_operators=[], qualifier=idFieldItem, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=idFieldSimple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=allUpdateFieldSimple)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=columnItem, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=old, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isMethod, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isBinaryOp, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=allUpdateFieldSimple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=out, label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getColumnItems, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=columnItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnItem, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getSelectFields, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None))), label=out), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=fkChanged)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isMain, postfix_operators=[], prefix_operators=[], qualifier=tableItem, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=changed)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=old, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fkChanged, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=changed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=fieldItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRelationTableFields, postfix_operators=[], prefix_operators=[], qualifier=tableItem, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldItems)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None))], dimensions=[], name=List, sub_type=None))), label=None), IfStatement(condition=MemberReference(member=changed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getColumnItems, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=columnItem, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=put, postfix_operators=[], prefix_operators=[], qualifier=old, selectors=[], type_arguments=None), parameters=[MemberReference(member=columnItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=forEach, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRelationSelectFieldItems, postfix_operators=[], prefix_operators=[], qualifier=tableItem, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAliasTableItems, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tableItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TableItem, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=idFieldSimple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=allUpdateFieldSimple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&&), operandr=MemberReference(member=fkChanged, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mainTableUpdate, 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=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=singleTableSimpleFiledUpdate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isMain, postfix_operators=[], prefix_operators=[], qualifier=tableItem, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=['!'], qualifier=tableItem, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTable, postfix_operators=[], prefix_operators=[], qualifier=dml, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=allFieldsSimple)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isMethod, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isBinaryOp, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=allFieldsSimple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRelationSelectFieldItems, postfix_operators=[], prefix_operators=[], qualifier=tableItem, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None))), label=None), IfStatement(condition=MemberReference(member=allFieldsSimple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tableItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wholeSqlOperation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isSubQuery, postfix_operators=[], prefix_operators=['!'], qualifier=tableItem, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tableItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=subTableSimpleFieldOperation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=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=[], dimensions=None, name=LinkedHashMap, sub_type=None)), name=esFieldData)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=old, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEsMapping, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFieldName, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[MethodInvocation(arguments=[], member=getColumnName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getValFromData, postfix_operators=[], prefix_operators=[], qualifier=esTemplate, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFieldName, postfix_operators=[], prefix_operators=[], qualifier=fieldItem, selectors=[], type_arguments=None)], member=cleanColumn, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=esFieldData, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRelationSelectFieldItems, postfix_operators=[], prefix_operators=[], qualifier=tableItem, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldItem, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tableItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=esFieldData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=joinTableSimpleFieldOperation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAliasTableItems, postfix_operators=[], prefix_operators=[], qualifier=schemaItem, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tableItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TableItem, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=old, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=singleTableSimpleFiledUpdate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dataList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=data)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[update] operator[SEP] identifier[ESSyncConfig] identifier[config] , identifier[Dml] identifier[dml] operator[SEP] {
identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[dataList] operator[=] identifier[dml] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[oldList] operator[=] identifier[dml] operator[SEP] identifier[getOld] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataList] operator[==] Other[null] operator[||] identifier[dataList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[oldList] operator[==] Other[null] operator[||] identifier[oldList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[SchemaItem] identifier[schemaItem] operator[=] identifier[config] operator[SEP] identifier[getEsMapping] operator[SEP] operator[SEP] operator[SEP] identifier[getSchemaItem] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[data] operator[:] identifier[dataList] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[old] operator[=] identifier[oldList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[==] Other[null] operator[||] identifier[data] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[old] operator[==] Other[null] operator[||] identifier[old] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[schemaItem] operator[SEP] identifier[getAliasTableItems] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] identifier[schemaItem] operator[SEP] identifier[isAllFieldsSimple] operator[SEP] operator[SEP] operator[SEP] {
identifier[singleTableSimpleFiledUpdate] operator[SEP] identifier[config] , identifier[dml] , identifier[data] , identifier[old] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[schemaItem] operator[SEP] identifier[getMainTable] operator[SEP] operator[SEP] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[dml] operator[SEP] identifier[getTable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[ESMapping] identifier[mapping] operator[=] identifier[config] operator[SEP] identifier[getEsMapping] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[idFieldName] operator[=] identifier[mapping] operator[SEP] identifier[get_id] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] identifier[mapping] operator[SEP] identifier[getPk] operator[SEP] operator[SEP] operator[:] identifier[mapping] operator[SEP] identifier[get_id] operator[SEP] operator[SEP] operator[SEP] identifier[FieldItem] identifier[idFieldItem] operator[=] identifier[schemaItem] operator[SEP] identifier[getSelectFields] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[idFieldName] operator[SEP] operator[SEP] Keyword[boolean] identifier[idFieldSimple] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[idFieldItem] operator[SEP] identifier[isMethod] operator[SEP] operator[SEP] operator[||] identifier[idFieldItem] operator[SEP] identifier[isBinaryOp] operator[SEP] operator[SEP] operator[SEP] {
identifier[idFieldSimple] operator[=] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[allUpdateFieldSimple] operator[=] literal[boolean] operator[SEP] identifier[out] operator[:] Keyword[for] operator[SEP] identifier[FieldItem] identifier[fieldItem] operator[:] identifier[schemaItem] operator[SEP] identifier[getSelectFields] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[ColumnItem] identifier[columnItem] operator[:] identifier[fieldItem] operator[SEP] identifier[getColumnItems] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[old] operator[SEP] identifier[containsKey] operator[SEP] identifier[columnItem] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fieldItem] operator[SEP] identifier[isMethod] operator[SEP] operator[SEP] operator[||] identifier[fieldItem] operator[SEP] identifier[isBinaryOp] operator[SEP] operator[SEP] operator[SEP] {
identifier[allUpdateFieldSimple] operator[=] literal[boolean] operator[SEP] Keyword[break] identifier[out] operator[SEP]
}
}
}
}
Keyword[boolean] identifier[fkChanged] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[TableItem] identifier[tableItem] operator[:] identifier[schemaItem] operator[SEP] identifier[getAliasTableItems] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tableItem] operator[SEP] identifier[isMain] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[boolean] identifier[changed] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[List] operator[<] identifier[FieldItem] operator[>] identifier[fieldItems] operator[:] identifier[tableItem] operator[SEP] identifier[getRelationTableFields] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[FieldItem] identifier[fieldItem] operator[:] identifier[fieldItems] operator[SEP] {
Keyword[if] operator[SEP] identifier[old] operator[SEP] identifier[containsKey] operator[SEP] identifier[fieldItem] operator[SEP] identifier[getColumn] operator[SEP] operator[SEP] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[fkChanged] operator[=] literal[boolean] operator[SEP] identifier[changed] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[changed] operator[SEP] {
Keyword[for] operator[SEP] identifier[FieldItem] identifier[fieldItem] operator[:] identifier[tableItem] operator[SEP] identifier[getRelationSelectFieldItems] operator[SEP] operator[SEP] operator[SEP] {
identifier[fieldItem] operator[SEP] identifier[getColumnItems] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[columnItem] operator[->] identifier[old] operator[SEP] identifier[put] operator[SEP] identifier[columnItem] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[idFieldSimple] operator[&&] identifier[allUpdateFieldSimple] operator[&&] operator[!] identifier[fkChanged] operator[SEP] {
identifier[singleTableSimpleFiledUpdate] operator[SEP] identifier[config] , identifier[dml] , identifier[data] , identifier[old] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[mainTableUpdate] operator[SEP] identifier[config] , identifier[dml] , identifier[data] , identifier[old] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[TableItem] identifier[tableItem] operator[:] identifier[schemaItem] operator[SEP] identifier[getAliasTableItems] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tableItem] operator[SEP] identifier[isMain] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[tableItem] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[dml] operator[SEP] identifier[getTable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[boolean] identifier[allFieldsSimple] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[FieldItem] identifier[fieldItem] operator[:] identifier[tableItem] operator[SEP] identifier[getRelationSelectFieldItems] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fieldItem] operator[SEP] identifier[isMethod] operator[SEP] operator[SEP] operator[||] identifier[fieldItem] operator[SEP] identifier[isBinaryOp] operator[SEP] operator[SEP] operator[SEP] {
identifier[allFieldsSimple] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[allFieldsSimple] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[tableItem] operator[SEP] identifier[isSubQuery] operator[SEP] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[esFieldData] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FieldItem] identifier[fieldItem] operator[:] identifier[tableItem] operator[SEP] identifier[getRelationSelectFieldItems] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[old] operator[SEP] identifier[containsKey] operator[SEP] identifier[fieldItem] operator[SEP] identifier[getColumn] operator[SEP] operator[SEP] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[esTemplate] operator[SEP] identifier[getValFromData] operator[SEP] identifier[config] operator[SEP] identifier[getEsMapping] operator[SEP] operator[SEP] , identifier[data] , identifier[fieldItem] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] , identifier[fieldItem] operator[SEP] identifier[getColumn] operator[SEP] operator[SEP] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[esFieldData] operator[SEP] identifier[put] operator[SEP] identifier[Util] operator[SEP] identifier[cleanColumn] operator[SEP] identifier[fieldItem] operator[SEP] identifier[getFieldName] operator[SEP] operator[SEP] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
}
identifier[joinTableSimpleFieldOperation] operator[SEP] identifier[config] , identifier[dml] , identifier[data] , identifier[tableItem] , identifier[esFieldData] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[subTableSimpleFieldOperation] operator[SEP] identifier[config] , identifier[dml] , identifier[data] , identifier[old] , identifier[tableItem] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[wholeSqlOperation] operator[SEP] identifier[config] , identifier[dml] , identifier[data] , identifier[old] , identifier[tableItem] operator[SEP] operator[SEP]
}
}
}
identifier[i] operator[++] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
private <T> T execOperator(Element element, Object scope, Meta meta, Format... format) throws IOException {
Operator operator = factory.geInstance(meta.opcode);
return (T) operator.exec(element, scope, meta.operand, format.length == 1 ? format[0] : null);
} | class class_name[name] begin[{]
method[execOperator, return_type[type[T]], modifier[private], parameter[element, scope, meta, format]] begin[{]
local_variable[type[Operator], operator]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operand, postfix_operators=[], prefix_operators=[], qualifier=meta, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=format, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MemberReference(member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]))], member=exec, postfix_operators=[], prefix_operators=[], qualifier=operator, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] operator[<] identifier[T] operator[>] identifier[T] identifier[execOperator] operator[SEP] identifier[Element] identifier[element] , identifier[Object] identifier[scope] , identifier[Meta] identifier[meta] , identifier[Format] operator[...] identifier[format] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Operator] identifier[operator] operator[=] identifier[factory] operator[SEP] identifier[geInstance] operator[SEP] identifier[meta] operator[SEP] identifier[opcode] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[operator] operator[SEP] identifier[exec] operator[SEP] identifier[element] , identifier[scope] , identifier[meta] operator[SEP] identifier[operand] , identifier[format] operator[SEP] identifier[length] operator[==] Other[1] operator[?] identifier[format] operator[SEP] Other[0] operator[SEP] operator[:] Other[null] operator[SEP] operator[SEP]
}
|
@Override
public String generateClause() {
StringBuilder wherePart = new StringBuilder();
wherePart.append(referenceIndices.generateColumnReference(columnSpec));
if (not) {
wherePart.append(" NOT");
}
wherePart.append(" IN (");
for (int k = 0; k < elements.length; k++) {
Object val = elements[k];
wherePart.append(SqlGeneratorUtil.prepareValue(val));
if (k + 1 < elements.length) {
if ((k + 1) % 1000 == 0) {
wherePart.append(") OR ");
wherePart.append(referenceIndices.generateColumnReference(columnSpec));
wherePart.append(" IN (");
} else {
wherePart.append(',');
}
}
}
wherePart.append(')');
return wherePart.toString();
} | class class_name[name] begin[{]
method[generateClause, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[StringBuilder], wherePart]
call[wherePart.append, parameter[call[referenceIndices.generateColumnReference, parameter[member[.columnSpec]]]]]
if[member[.not]] begin[{]
call[wherePart.append, parameter[literal[" NOT"]]]
else begin[{]
None
end[}]
call[wherePart.append, parameter[literal[" IN ("]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=elements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=val)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareValue, postfix_operators=[], prefix_operators=[], qualifier=SqlGeneratorUtil, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=wherePart, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=elements, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=wherePart, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") OR ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=wherePart, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=columnSpec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateColumnReference, postfix_operators=[], prefix_operators=[], qualifier=referenceIndices, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=wherePart, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" IN (")], member=append, postfix_operators=[], prefix_operators=[], qualifier=wherePart, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=elements, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[wherePart.append, parameter[literal[')']]]
return[call[wherePart.toString, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[generateClause] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[wherePart] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[wherePart] operator[SEP] identifier[append] operator[SEP] identifier[referenceIndices] operator[SEP] identifier[generateColumnReference] operator[SEP] identifier[columnSpec] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[not] operator[SEP] {
identifier[wherePart] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[wherePart] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] Other[0] operator[SEP] identifier[k] operator[<] identifier[elements] operator[SEP] identifier[length] operator[SEP] identifier[k] operator[++] operator[SEP] {
identifier[Object] identifier[val] operator[=] identifier[elements] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[wherePart] operator[SEP] identifier[append] operator[SEP] identifier[SqlGeneratorUtil] operator[SEP] identifier[prepareValue] operator[SEP] identifier[val] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[k] operator[+] Other[1] operator[<] identifier[elements] operator[SEP] identifier[length] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[%] Other[1000] operator[==] Other[0] operator[SEP] {
identifier[wherePart] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[wherePart] operator[SEP] identifier[append] operator[SEP] identifier[referenceIndices] operator[SEP] identifier[generateColumnReference] operator[SEP] identifier[columnSpec] operator[SEP] operator[SEP] operator[SEP] identifier[wherePart] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[wherePart] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
identifier[wherePart] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[wherePart] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Map<String, String> getAdditionalFlashPlayerParameters(Media media, Dimension dimension) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("allowFullScreen", "true");
parameters.put("wmode", "opaque");
return parameters;
} | class class_name[name] begin[{]
method[getAdditionalFlashPlayerParameters, return_type[type[Map]], modifier[protected], parameter[media, dimension]] begin[{]
local_variable[type[Map], parameters]
call[parameters.put, parameter[literal["allowFullScreen"], literal["true"]]]
call[parameters.put, parameter[literal["wmode"], literal["opaque"]]]
return[member[.parameters]]
end[}]
END[}] | Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[getAdditionalFlashPlayerParameters] operator[SEP] identifier[Media] identifier[media] , identifier[Dimension] identifier[dimension] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameters] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[parameters] operator[SEP]
}
|
public static void disableAction(BaseComponent component, String eventName, boolean disable) {
ActionListener listener = getListener(component, eventName);
if (listener != null) {
listener.setDisabled(disable);
}
} | class class_name[name] begin[{]
method[disableAction, return_type[void], modifier[public static], parameter[component, eventName, disable]] begin[{]
local_variable[type[ActionListener], listener]
if[binary_operation[member[.listener], !=, literal[null]]] begin[{]
call[listener.setDisabled, parameter[member[.disable]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[disableAction] operator[SEP] identifier[BaseComponent] identifier[component] , identifier[String] identifier[eventName] , Keyword[boolean] identifier[disable] operator[SEP] {
identifier[ActionListener] identifier[listener] operator[=] identifier[getListener] operator[SEP] identifier[component] , identifier[eventName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listener] operator[!=] Other[null] operator[SEP] {
identifier[listener] operator[SEP] identifier[setDisabled] operator[SEP] identifier[disable] operator[SEP] operator[SEP]
}
}
|
public PoolStatistics getAllPoolsLifetimeStatistics(Iterable<BatchClientBehavior> additionalBehaviors)
throws BatchErrorException, IOException {
PoolGetAllLifetimeStatisticsOptions options = new PoolGetAllLifetimeStatisticsOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().pools().getAllLifetimeStatistics(options);
} | class class_name[name] begin[{]
method[getAllPoolsLifetimeStatistics, return_type[type[PoolStatistics]], modifier[public], parameter[additionalBehaviors]] begin[{]
local_variable[type[PoolGetAllLifetimeStatisticsOptions], options]
local_variable[type[BehaviorManager], bhMgr]
call[bhMgr.applyRequestBehaviors, parameter[member[.options]]]
return[THIS[member[None.parentBatchClient]call[None.protocolLayer, parameter[]]call[None.pools, parameter[]]call[None.getAllLifetimeStatistics, parameter[member[.options]]]]]
end[}]
END[}] | Keyword[public] identifier[PoolStatistics] identifier[getAllPoolsLifetimeStatistics] operator[SEP] identifier[Iterable] operator[<] identifier[BatchClientBehavior] operator[>] identifier[additionalBehaviors] operator[SEP] Keyword[throws] identifier[BatchErrorException] , identifier[IOException] {
identifier[PoolGetAllLifetimeStatisticsOptions] identifier[options] operator[=] Keyword[new] identifier[PoolGetAllLifetimeStatisticsOptions] operator[SEP] operator[SEP] operator[SEP] identifier[BehaviorManager] identifier[bhMgr] operator[=] Keyword[new] identifier[BehaviorManager] operator[SEP] Keyword[this] operator[SEP] identifier[customBehaviors] operator[SEP] operator[SEP] , identifier[additionalBehaviors] operator[SEP] operator[SEP] identifier[bhMgr] operator[SEP] identifier[applyRequestBehaviors] operator[SEP] identifier[options] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[parentBatchClient] operator[SEP] identifier[protocolLayer] operator[SEP] operator[SEP] operator[SEP] identifier[pools] operator[SEP] operator[SEP] operator[SEP] identifier[getAllLifetimeStatistics] operator[SEP] identifier[options] operator[SEP] operator[SEP]
}
|
public @Nonnull final <T extends Annotation> List<AnnotationValue<T>> getAnnotations(String member, Class<T> type) {
AnnotationValue[] values = get(member, AnnotationValue[].class).orElse(null);
if (ArrayUtils.isNotEmpty(values)) {
List<AnnotationValue<T>> list = new ArrayList<>(values.length);
String typeName = type.getName();
for (AnnotationValue value : values) {
if (value == null) {
continue;
}
if (value.getAnnotationName().equals(typeName)) {
//noinspection unchecked
list.add(value);
}
}
return list;
}
return Collections.emptyList();
} | class class_name[name] begin[{]
method[getAnnotations, return_type[type[List]], modifier[final public], parameter[member, type]] begin[{]
local_variable[type[AnnotationValue], values]
if[call[ArrayUtils.isNotEmpty, parameter[member[.values]]]] begin[{]
local_variable[type[List], list]
local_variable[type[String], typeName]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=getAnnotationName, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[MethodInvocation(arguments=[MemberReference(member=typeName, 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=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AnnotationValue, sub_type=None))), label=None)
return[member[.list]]
else begin[{]
None
end[}]
return[call[Collections.emptyList, parameter[]]]
end[}]
END[}] | Keyword[public] annotation[@] identifier[Nonnull] Keyword[final] operator[<] identifier[T] Keyword[extends] identifier[Annotation] operator[>] identifier[List] operator[<] identifier[AnnotationValue] operator[<] identifier[T] operator[>] operator[>] identifier[getAnnotations] operator[SEP] identifier[String] identifier[member] , identifier[Class] operator[<] identifier[T] operator[>] identifier[type] operator[SEP] {
identifier[AnnotationValue] operator[SEP] operator[SEP] identifier[values] operator[=] identifier[get] operator[SEP] identifier[member] , identifier[AnnotationValue] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ArrayUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[values] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[AnnotationValue] operator[<] identifier[T] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[String] identifier[typeName] operator[=] identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AnnotationValue] identifier[value] operator[:] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[getAnnotationName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[typeName] operator[SEP] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[list] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
|
public void observeUpdateModelValues(@Observes @Before @UpdateModelValues PhaseEvent event) {
log.debug("After Update Model Values event");
performObservation(event, PhaseIdType.UPDATE_MODEL_VALUES);
} | class class_name[name] begin[{]
method[observeUpdateModelValues, return_type[void], modifier[public], parameter[event]] begin[{]
call[log.debug, parameter[literal["After Update Model Values event"]]]
call[.performObservation, parameter[member[.event], member[PhaseIdType.UPDATE_MODEL_VALUES]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[observeUpdateModelValues] operator[SEP] annotation[@] identifier[Observes] annotation[@] identifier[Before] annotation[@] identifier[UpdateModelValues] identifier[PhaseEvent] identifier[event] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[performObservation] operator[SEP] identifier[event] , identifier[PhaseIdType] operator[SEP] identifier[UPDATE_MODEL_VALUES] operator[SEP] operator[SEP]
}
|
public static <T, R> Map<R, List<T>> groupBy(Stream<T> stream,
Function<T, R> classifier) {
return stream.collect(groupingBy(classifier));
} | class class_name[name] begin[{]
method[groupBy, return_type[type[Map]], modifier[public static], parameter[stream, classifier]] begin[{]
return[call[stream.collect, parameter[call[.groupingBy, parameter[member[.classifier]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[R] operator[>] identifier[Map] operator[<] identifier[R] , identifier[List] operator[<] identifier[T] operator[>] operator[>] identifier[groupBy] operator[SEP] identifier[Stream] operator[<] identifier[T] operator[>] identifier[stream] , identifier[Function] operator[<] identifier[T] , identifier[R] operator[>] identifier[classifier] operator[SEP] {
Keyword[return] identifier[stream] operator[SEP] identifier[collect] operator[SEP] identifier[groupingBy] operator[SEP] identifier[classifier] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean remove(Object o) {
boolean b = queue.remove(o);
if (b){
signalSizeReduced();
}
return b;
} | class class_name[name] begin[{]
method[remove, return_type[type[boolean]], modifier[public], parameter[o]] begin[{]
local_variable[type[boolean], b]
if[member[.b]] begin[{]
call[.signalSizeReduced, parameter[]]
else begin[{]
None
end[}]
return[member[.b]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[remove] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
Keyword[boolean] identifier[b] operator[=] identifier[queue] operator[SEP] identifier[remove] operator[SEP] identifier[o] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[SEP] {
identifier[signalSizeReduced] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[b] operator[SEP]
}
|
@SuppressWarnings("unused")
public void setOkColor(@ColorInt int color) {
mOkColor = Color.argb(255, Color.red(color), Color.green(color), Color.blue(color));
} | class class_name[name] begin[{]
method[setOkColor, return_type[void], modifier[public], parameter[color]] begin[{]
assign[member[.mOkColor], call[Color.argb, parameter[literal[255], call[Color.red, parameter[member[.color]]], call[Color.green, parameter[member[.color]]], call[Color.blue, parameter[member[.color]]]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[setOkColor] operator[SEP] annotation[@] identifier[ColorInt] Keyword[int] identifier[color] operator[SEP] {
identifier[mOkColor] operator[=] identifier[Color] operator[SEP] identifier[argb] operator[SEP] Other[255] , identifier[Color] operator[SEP] identifier[red] operator[SEP] identifier[color] operator[SEP] , identifier[Color] operator[SEP] identifier[green] operator[SEP] identifier[color] operator[SEP] , identifier[Color] operator[SEP] identifier[blue] operator[SEP] identifier[color] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setPreferredLocale(Locale preferredLocale) {
if (!Objects.equals(this.preferredLocale, preferredLocale)) {
this.preferredLocale = preferredLocale;
this.manifestXml = null;
this.apkMeta = null;
this.manifestParsed = false;
}
} | class class_name[name] begin[{]
method[setPreferredLocale, return_type[void], modifier[public], parameter[preferredLocale]] begin[{]
if[call[Objects.equals, parameter[THIS[member[None.preferredLocale]], member[.preferredLocale]]]] begin[{]
assign[THIS[member[None.preferredLocale]], member[.preferredLocale]]
assign[THIS[member[None.manifestXml]], literal[null]]
assign[THIS[member[None.apkMeta]], literal[null]]
assign[THIS[member[None.manifestParsed]], literal[false]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPreferredLocale] operator[SEP] identifier[Locale] identifier[preferredLocale] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] Keyword[this] operator[SEP] identifier[preferredLocale] , identifier[preferredLocale] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[preferredLocale] operator[=] identifier[preferredLocale] operator[SEP] Keyword[this] operator[SEP] identifier[manifestXml] operator[=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[apkMeta] operator[=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[manifestParsed] operator[=] literal[boolean] operator[SEP]
}
}
|
public static void main(String[] args) {
/*
* Developers Notes:
*
* -No corresponding Junit test class currently
* provided. Test by eyeball of the output.
*
* -Add a menu with Help(About)
* --> TBD.
*
* -Figure out some sane way to set initial default
* column sizes.
*
* -Lots of inner classes here, done in order to keep
* all the .class files easily identifiable. Some of
* this code is pretty ugly, very procedural in nature.
* Lots of very tight coupling between all the classes,
* thinly disguised switch statements, etc ..... This
* code written on the fly, with almost no thought given
* to OO design.
*
* -Also, I'm not really a GUI guy, so forgive any
* transgressions.
*
*/
if ( args.length < 1 ) {
System.err.println("File name is required!");
usage();
System.exit(1);
}
/*
* Instantiate a DateTimeBrowser and invoke it's go method,
* passing the input argument list.
*/
new DateTimeBrowser().go( args );
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[binary_operation[member[args.length], <, literal[1]]] begin[{]
call[System.err.println, parameter[literal["File name is required!"]]]
call[.usage, parameter[]]
call[System.exit, parameter[literal[1]]]
else begin[{]
None
end[}]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=go, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DateTimeBrowser, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[<] Other[1] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[usage] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[new] identifier[DateTimeBrowser] operator[SEP] operator[SEP] operator[SEP] identifier[go] operator[SEP] identifier[args] operator[SEP] operator[SEP]
}
|
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the CampaignService.
CampaignServiceInterface campaignService =
adWordsServices.get(session, CampaignServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(CampaignField.Id, CampaignField.Name)
.orderAscBy(CampaignField.Name)
.offset(offset)
.limit(PAGE_SIZE)
.build();
CampaignPage page;
do {
// Get all campaigns.
page = campaignService.get(selector);
// Display campaigns.
if (page.getEntries() != null) {
for (Campaign campaign : page.getEntries()) {
System.out.printf("Campaign with name '%s' and ID %d was found.%n", campaign.getName(),
campaign.getId());
}
} else {
System.out.println("No campaigns were found.");
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adWordsServices, session]] begin[{]
local_variable[type[CampaignServiceInterface], campaignService]
local_variable[type[int], offset]
local_variable[type[SelectorBuilder], builder]
local_variable[type[Selector], selector]
local_variable[type[CampaignPage], page]
do[binary_operation[member[.offset], <, call[page.getTotalNumEntries, parameter[]]]] begin[{]
assign[member[.page], call[campaignService.get, parameter[member[.selector]]]]
if[binary_operation[call[page.getEntries, parameter[]], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Campaign with name '%s' and ID %d was found.%n"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=campaign, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=campaign, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getEntries, postfix_operators=[], prefix_operators=[], qualifier=page, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=campaign)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Campaign, sub_type=None))), label=None)
else begin[{]
call[System.out.println, parameter[literal["No campaigns were found."]]]
end[}]
assign[member[.offset], member[.PAGE_SIZE]]
assign[member[.selector], call[builder.increaseOffsetBy, parameter[member[.PAGE_SIZE]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdWordsServicesInterface] identifier[adWordsServices] , identifier[AdWordsSession] identifier[session] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[CampaignServiceInterface] identifier[campaignService] operator[=] identifier[adWordsServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[CampaignServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[int] identifier[offset] operator[=] Other[0] operator[SEP] identifier[SelectorBuilder] identifier[builder] operator[=] Keyword[new] identifier[SelectorBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Selector] identifier[selector] operator[=] identifier[builder] operator[SEP] identifier[fields] operator[SEP] identifier[CampaignField] operator[SEP] identifier[Id] , identifier[CampaignField] operator[SEP] identifier[Name] operator[SEP] operator[SEP] identifier[orderAscBy] operator[SEP] identifier[CampaignField] operator[SEP] identifier[Name] operator[SEP] operator[SEP] identifier[offset] operator[SEP] identifier[offset] operator[SEP] operator[SEP] identifier[limit] operator[SEP] identifier[PAGE_SIZE] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[CampaignPage] identifier[page] operator[SEP] Keyword[do] {
identifier[page] operator[=] identifier[campaignService] operator[SEP] identifier[get] operator[SEP] identifier[selector] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[page] operator[SEP] identifier[getEntries] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Campaign] identifier[campaign] operator[:] identifier[page] operator[SEP] identifier[getEntries] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[campaign] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[campaign] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[offset] operator[+=] identifier[PAGE_SIZE] operator[SEP] identifier[selector] operator[=] identifier[builder] operator[SEP] identifier[increaseOffsetBy] operator[SEP] identifier[PAGE_SIZE] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[offset] operator[<] identifier[page] operator[SEP] identifier[getTotalNumEntries] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public ObjectifyImpl open() {
final ObjectifyImpl objectify = new ObjectifyImpl(this);
stacks.get().add(objectify);
return objectify;
} | class class_name[name] begin[{]
method[open, return_type[type[ObjectifyImpl]], modifier[public], parameter[]] begin[{]
local_variable[type[ObjectifyImpl], objectify]
call[stacks.get, parameter[]]
return[member[.objectify]]
end[}]
END[}] | Keyword[public] identifier[ObjectifyImpl] identifier[open] operator[SEP] operator[SEP] {
Keyword[final] identifier[ObjectifyImpl] identifier[objectify] operator[=] Keyword[new] identifier[ObjectifyImpl] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[stacks] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[objectify] operator[SEP] operator[SEP] Keyword[return] identifier[objectify] operator[SEP]
}
|
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BpsimPackage.PARAMETER_VALUE__INSTANCE:
return getInstance();
case BpsimPackage.PARAMETER_VALUE__RESULT:
return getResult();
case BpsimPackage.PARAMETER_VALUE__VALID_FOR:
return getValidFor();
}
return super.eGet(featureID, resolve, coreType);
} | class class_name[name] begin[{]
method[eGet, return_type[type[Object]], modifier[public], parameter[featureID, resolve, coreType]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=PARAMETER_VALUE__INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=BpsimPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=PARAMETER_VALUE__RESULT, postfix_operators=[], prefix_operators=[], qualifier=BpsimPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=PARAMETER_VALUE__VALID_FOR, postfix_operators=[], prefix_operators=[], qualifier=BpsimPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getValidFor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resolve, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=coreType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[eGet] operator[SEP] Keyword[int] identifier[featureID] , Keyword[boolean] identifier[resolve] , Keyword[boolean] identifier[coreType] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[BpsimPackage] operator[SEP] identifier[PARAMETER_VALUE__INSTANCE] operator[:] Keyword[return] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[BpsimPackage] operator[SEP] identifier[PARAMETER_VALUE__RESULT] operator[:] Keyword[return] identifier[getResult] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[BpsimPackage] operator[SEP] identifier[PARAMETER_VALUE__VALID_FOR] operator[:] Keyword[return] identifier[getValidFor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eGet] operator[SEP] identifier[featureID] , identifier[resolve] , identifier[coreType] operator[SEP] operator[SEP]
}
|
public static void registerSerializers(final Kryo kryo) {
// ImmutableList is used by ArrayTable. However,
// we already have a separate serializer class for ImmutableList,
// ImmutableListSerializer. If it is not already being used, register it.
Serializer immutableListSerializer = getSerializer(kryo, ImmutableList.class);
if (!(immutableListSerializer instanceof ImmutableListSerializer)) {
ImmutableListSerializer.registerSerializers(kryo);
}
final ArrayTableSerializer serializer = new ArrayTableSerializer();
kryo.register(ArrayTable.class, serializer);
} | class class_name[name] begin[{]
method[registerSerializers, return_type[void], modifier[public static], parameter[kryo]] begin[{]
local_variable[type[Serializer], immutableListSerializer]
if[binary_operation[member[.immutableListSerializer], instanceof, type[ImmutableListSerializer]]] begin[{]
call[ImmutableListSerializer.registerSerializers, parameter[member[.kryo]]]
else begin[{]
None
end[}]
local_variable[type[ArrayTableSerializer], serializer]
call[kryo.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayTable, sub_type=None)), member[.serializer]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[registerSerializers] operator[SEP] Keyword[final] identifier[Kryo] identifier[kryo] operator[SEP] {
identifier[Serializer] identifier[immutableListSerializer] operator[=] identifier[getSerializer] operator[SEP] identifier[kryo] , identifier[ImmutableList] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[immutableListSerializer] Keyword[instanceof] identifier[ImmutableListSerializer] operator[SEP] operator[SEP] {
identifier[ImmutableListSerializer] operator[SEP] identifier[registerSerializers] operator[SEP] identifier[kryo] operator[SEP] operator[SEP]
}
Keyword[final] identifier[ArrayTableSerializer] identifier[serializer] operator[=] Keyword[new] identifier[ArrayTableSerializer] operator[SEP] operator[SEP] operator[SEP] identifier[kryo] operator[SEP] identifier[register] operator[SEP] identifier[ArrayTable] operator[SEP] Keyword[class] , identifier[serializer] operator[SEP] operator[SEP]
}
|
Map<String, String> parseQueryString(final String queryString, final Map<String, String> into) {
final Map<String, String> result = (into == null) ? new HashMap<>() : into;
if (StringUtils.isNotEmpty(queryString)) {
for (final String keyValuePair : queryString.split("&")) {
final String[] keyValue = keyValuePair.split("=", 2);
if (keyValue.length > 1) {
result.put(keyValue[0], urlUtils.decodeQueryString(keyValue[1]));
} else {
result.put(keyValue[0], StringUtils.EMPTY);
}
}
}
return result;
} | class class_name[name] begin[{]
method[parseQueryString, return_type[type[Map]], modifier[default], parameter[queryString, into]] begin[{]
local_variable[type[Map], result]
if[call[StringUtils.isNotEmpty, parameter[member[.queryString]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=split, postfix_operators=[], prefix_operators=[], qualifier=keyValuePair, selectors=[], type_arguments=None), name=keyValue)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=keyValue, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=EMPTY, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MethodInvocation(arguments=[MemberReference(member=keyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=decodeQueryString, postfix_operators=[], prefix_operators=[], qualifier=urlUtils, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&")], member=split, postfix_operators=[], prefix_operators=[], qualifier=queryString, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=keyValuePair)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parseQueryString] operator[SEP] Keyword[final] identifier[String] identifier[queryString] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[into] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[result] operator[=] operator[SEP] identifier[into] operator[==] Other[null] operator[SEP] operator[?] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[:] identifier[into] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[queryString] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[keyValuePair] operator[:] identifier[queryString] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[keyValue] operator[=] identifier[keyValuePair] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keyValue] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
identifier[result] operator[SEP] identifier[put] operator[SEP] identifier[keyValue] operator[SEP] Other[0] operator[SEP] , identifier[urlUtils] operator[SEP] identifier[decodeQueryString] operator[SEP] identifier[keyValue] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[SEP] identifier[put] operator[SEP] identifier[keyValue] operator[SEP] Other[0] operator[SEP] , identifier[StringUtils] operator[SEP] identifier[EMPTY] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public GitBranchResponse deleteBranch(File repositoryPath, boolean forceDelete, boolean remote,
List<Ref> branchList) throws IOException, JavaGitException {
CheckUtilities.checkNullArgument(repositoryPath, "repository path");
CheckUtilities.checkNullListArgument(branchList, "branch list");
CheckUtilities.validateListRefType(branchList, Ref.RefType.BRANCH, "branch list");
IClient client = ClientManager.getInstance().getPreferredClient();
IGitBranch gitBranch = client.getGitBranchInstance();
return gitBranch.deleteBranches(repositoryPath, forceDelete, remote, branchList);
} | class class_name[name] begin[{]
method[deleteBranch, return_type[type[GitBranchResponse]], modifier[public], parameter[repositoryPath, forceDelete, remote, branchList]] begin[{]
call[CheckUtilities.checkNullArgument, parameter[member[.repositoryPath], literal["repository path"]]]
call[CheckUtilities.checkNullListArgument, parameter[member[.branchList], literal["branch list"]]]
call[CheckUtilities.validateListRefType, parameter[member[.branchList], member[Ref.RefType.BRANCH], literal["branch list"]]]
local_variable[type[IClient], client]
local_variable[type[IGitBranch], gitBranch]
return[call[gitBranch.deleteBranches, parameter[member[.repositoryPath], member[.forceDelete], member[.remote], member[.branchList]]]]
end[}]
END[}] | Keyword[public] identifier[GitBranchResponse] identifier[deleteBranch] operator[SEP] identifier[File] identifier[repositoryPath] , Keyword[boolean] identifier[forceDelete] , Keyword[boolean] identifier[remote] , identifier[List] operator[<] identifier[Ref] operator[>] identifier[branchList] operator[SEP] Keyword[throws] identifier[IOException] , identifier[JavaGitException] {
identifier[CheckUtilities] operator[SEP] identifier[checkNullArgument] operator[SEP] identifier[repositoryPath] , literal[String] operator[SEP] operator[SEP] identifier[CheckUtilities] operator[SEP] identifier[checkNullListArgument] operator[SEP] identifier[branchList] , literal[String] operator[SEP] operator[SEP] identifier[CheckUtilities] operator[SEP] identifier[validateListRefType] operator[SEP] identifier[branchList] , identifier[Ref] operator[SEP] identifier[RefType] operator[SEP] identifier[BRANCH] , literal[String] operator[SEP] operator[SEP] identifier[IClient] identifier[client] operator[=] identifier[ClientManager] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getPreferredClient] operator[SEP] operator[SEP] operator[SEP] identifier[IGitBranch] identifier[gitBranch] operator[=] identifier[client] operator[SEP] identifier[getGitBranchInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[gitBranch] operator[SEP] identifier[deleteBranches] operator[SEP] identifier[repositoryPath] , identifier[forceDelete] , identifier[remote] , identifier[branchList] operator[SEP] operator[SEP]
}
|
protected LightweightTypeReference getMergedType(List<LightweightTypeReference> types) {
if (types.isEmpty()) {
return null;
}
if (types.size() == 1) {
LightweightTypeReference result = types.get(0);
return result;
}
LightweightTypeReference result = getServices().getTypeConformanceComputer().getCommonSuperType(types, getReferenceOwner());
if (result != null || types.isEmpty()) {
return result;
}
// common type of JvmAnyType and JvmVoid may be null ... use JvmAnyType in that case
for (LightweightTypeReference type: types) {
if (!type.isType(Void.TYPE)) {
return type;
}
}
return types.get(0);
} | class class_name[name] begin[{]
method[getMergedType, return_type[type[LightweightTypeReference]], modifier[protected], parameter[types]] begin[{]
if[call[types.isEmpty, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[call[types.size, parameter[]], ==, literal[1]]] begin[{]
local_variable[type[LightweightTypeReference], result]
return[member[.result]]
else begin[{]
None
end[}]
local_variable[type[LightweightTypeReference], result]
if[binary_operation[binary_operation[member[.result], !=, literal[null]], ||, call[types.isEmpty, parameter[]]]] begin[{]
return[member[.result]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=Void, selectors=[])], member=isType, postfix_operators=[], prefix_operators=['!'], qualifier=type, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LightweightTypeReference, sub_type=None))), label=None)
return[call[types.get, parameter[literal[0]]]]
end[}]
END[}] | Keyword[protected] identifier[LightweightTypeReference] identifier[getMergedType] operator[SEP] identifier[List] operator[<] identifier[LightweightTypeReference] operator[>] identifier[types] operator[SEP] {
Keyword[if] operator[SEP] identifier[types] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[types] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[LightweightTypeReference] identifier[result] operator[=] identifier[types] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
identifier[LightweightTypeReference] identifier[result] operator[=] identifier[getServices] operator[SEP] operator[SEP] operator[SEP] identifier[getTypeConformanceComputer] operator[SEP] operator[SEP] operator[SEP] identifier[getCommonSuperType] operator[SEP] identifier[types] , identifier[getReferenceOwner] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[||] identifier[types] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
Keyword[for] operator[SEP] identifier[LightweightTypeReference] identifier[type] operator[:] identifier[types] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[type] operator[SEP] identifier[isType] operator[SEP] identifier[Void] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] {
Keyword[return] identifier[type] operator[SEP]
}
}
Keyword[return] identifier[types] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
protected String createDialogErrorMessage() {
if (getException() != null) {
StringBuffer result = new StringBuffer(8);
result.append(dialogBlockStart(""));
result.append("<table border=\"0\">\n");
result.append("<tr><td><img src=\"");
result.append(getSkinUri()).append("commons/");
result.append("error.png");
result.append("\" border=\"0\" alt=\"\"></td><td class=\"xmlTdError maxwidth\">");
Throwable t = getException();
while (t != null) {
result.append(t.getLocalizedMessage());
t = t.getCause();
if (t != null) {
result.append("<br>");
}
}
result.append("</table>\n");
result.append(dialogBlockEnd());
return result.toString();
}
return "";
} | class class_name[name] begin[{]
method[createDialogErrorMessage, return_type[type[String]], modifier[protected], parameter[]] begin[{]
if[binary_operation[call[.getException, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[StringBuffer], result]
call[result.append, parameter[call[.dialogBlockStart, parameter[literal[""]]]]]
call[result.append, parameter[literal["<table border=\"0\">\n"]]]
call[result.append, parameter[literal["<tr><td><img src=\""]]]
call[result.append, parameter[call[.getSkinUri, parameter[]]]]
call[result.append, parameter[literal["error.png"]]]
call[result.append, parameter[literal["\" border=\"0\" alt=\"\"></td><td class=\"xmlTdError maxwidth\">"]]]
local_variable[type[Throwable], t]
while[binary_operation[member[.t], !=, literal[null]]] begin[{]
call[result.append, parameter[call[t.getLocalizedMessage, parameter[]]]]
assign[member[.t], call[t.getCause, parameter[]]]
if[binary_operation[member[.t], !=, literal[null]]] begin[{]
call[result.append, parameter[literal["<br>"]]]
else begin[{]
None
end[}]
end[}]
call[result.append, parameter[literal["</table>\n"]]]
call[result.append, parameter[call[.dialogBlockEnd, parameter[]]]]
return[call[result.toString, parameter[]]]
else begin[{]
None
end[}]
return[literal[""]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[createDialogErrorMessage] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[StringBuffer] identifier[result] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[8] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[dialogBlockStart] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[getSkinUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Throwable] identifier[t] operator[=] identifier[getException] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[t] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[t] operator[=] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[dialogBlockEnd] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
|
public static String addImpliedHttpIfNecessary(String u) {
int colon = u.indexOf(':');
int period = u.indexOf('.');
if (colon == -1 || (period >= 0) && (period < colon)) {
// No scheme present; prepend "http://"
u = "http://" + u;
}
return u;
} | class class_name[name] begin[{]
method[addImpliedHttpIfNecessary, return_type[type[String]], modifier[public static], parameter[u]] begin[{]
local_variable[type[int], colon]
local_variable[type[int], period]
if[binary_operation[binary_operation[member[.colon], ==, literal[1]], ||, binary_operation[binary_operation[member[.period], >=, literal[0]], &&, binary_operation[member[.period], <, member[.colon]]]]] begin[{]
assign[member[.u], binary_operation[literal["http://"], +, member[.u]]]
else begin[{]
None
end[}]
return[member[.u]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[addImpliedHttpIfNecessary] operator[SEP] identifier[String] identifier[u] operator[SEP] {
Keyword[int] identifier[colon] operator[=] identifier[u] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[period] operator[=] identifier[u] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[colon] operator[==] operator[-] Other[1] operator[||] operator[SEP] identifier[period] operator[>=] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[period] operator[<] identifier[colon] operator[SEP] operator[SEP] {
identifier[u] operator[=] literal[String] operator[+] identifier[u] operator[SEP]
}
Keyword[return] identifier[u] operator[SEP]
}
|
public PagedList<SyncFullSchemaPropertiesInner> listMemberSchemas(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) {
ServiceResponse<Page<SyncFullSchemaPropertiesInner>> response = listMemberSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).toBlocking().single();
return new PagedList<SyncFullSchemaPropertiesInner>(response.body()) {
@Override
public Page<SyncFullSchemaPropertiesInner> nextPage(String nextPageLink) {
return listMemberSchemasNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
} | class class_name[name] begin[{]
method[listMemberSchemas, return_type[type[PagedList]], modifier[public], parameter[resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName]] begin[{]
local_variable[type[ServiceResponse], response]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listMemberSchemasNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toBlocking, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=single, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=body, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=nextPage, parameters=[FormalParameter(annotations=[], modifiers=set(), name=nextPageLink, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SyncFullSchemaPropertiesInner, sub_type=None))], dimensions=[], name=Page, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SyncFullSchemaPropertiesInner, sub_type=None))], dimensions=None, name=PagedList, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[PagedList] operator[<] identifier[SyncFullSchemaPropertiesInner] operator[>] identifier[listMemberSchemas] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[serverName] , Keyword[final] identifier[String] identifier[databaseName] , Keyword[final] identifier[String] identifier[syncGroupName] , Keyword[final] identifier[String] identifier[syncMemberName] operator[SEP] {
identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SyncFullSchemaPropertiesInner] operator[>] operator[>] identifier[response] operator[=] identifier[listMemberSchemasSinglePageAsync] operator[SEP] identifier[resourceGroupName] , identifier[serverName] , identifier[databaseName] , identifier[syncGroupName] , identifier[syncMemberName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PagedList] operator[<] identifier[SyncFullSchemaPropertiesInner] operator[>] operator[SEP] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[SyncFullSchemaPropertiesInner] operator[>] identifier[nextPage] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listMemberSchemasNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static String getStackTrace( Throwable throwable ) {
if (throwable == null) return null;
final ByteArrayOutputStream bas = new ByteArrayOutputStream();
final PrintWriter pw = new PrintWriter(bas);
throwable.printStackTrace(pw);
pw.close();
return bas.toString();
} | class class_name[name] begin[{]
method[getStackTrace, return_type[type[String]], modifier[public static], parameter[throwable]] begin[{]
if[binary_operation[member[.throwable], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ByteArrayOutputStream], bas]
local_variable[type[PrintWriter], pw]
call[throwable.printStackTrace, parameter[member[.pw]]]
call[pw.close, parameter[]]
return[call[bas.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getStackTrace] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
Keyword[if] operator[SEP] identifier[throwable] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[final] identifier[ByteArrayOutputStream] identifier[bas] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[PrintWriter] identifier[pw] operator[=] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[bas] operator[SEP] operator[SEP] identifier[throwable] operator[SEP] identifier[printStackTrace] operator[SEP] identifier[pw] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[bas] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <T> T newInstance(String className, Object... arguments)
{
return (T)newInstance(Classes.forName(className), arguments);
} | class class_name[name] begin[{]
method[newInstance, return_type[type[T]], modifier[public static], parameter[className, arguments]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Classes, selectors=[], type_arguments=None), MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[newInstance] operator[SEP] identifier[String] identifier[className] , identifier[Object] operator[...] identifier[arguments] operator[SEP] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[newInstance] operator[SEP] identifier[Classes] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] , identifier[arguments] operator[SEP] operator[SEP]
}
|
void deliverTaskMessage(final byte[] message) {
synchronized (this.contextLifeCycle) {
if (!this.task.isPresent()) {
LOG.log(Level.WARNING, "Received a task message while there was no task running. Ignoring.");
} else {
this.task.get().deliver(message);
}
}
} | class class_name[name] begin[{]
method[deliverTaskMessage, return_type[void], modifier[default], parameter[message]] begin[{]
SYNCHRONIZED[THIS[member[None.contextLifeCycle]]] BEGIN[{]
if[THIS[member[None.task]call[None.isPresent, parameter[]]]] begin[{]
call[LOG.log, parameter[member[Level.WARNING], literal["Received a task message while there was no task running. Ignoring."]]]
else begin[{]
THIS[member[None.task]call[None.get, parameter[]]call[None.deliver, parameter[member[.message]]]]
end[}]
END[}]
end[}]
END[}] | Keyword[void] identifier[deliverTaskMessage] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[message] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[contextLifeCycle] operator[SEP] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[task] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[task] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[deliver] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
}
|
private void configureCredential(List<ConfigProperty> properties) {
// if a credential-reference has been defined, get the password property from it
if (credentialSourceSupplier != null) {
try {
CredentialSource credentialSource = credentialSourceSupplier.get();
if (credentialSource != null) {
char[] password = credentialSource.getCredential(PasswordCredential.class).getPassword(ClearPassword.class).getPassword();
if (password != null) {
// add the password property
properties.add(simpleProperty15("password", String.class.getName(), new String(password)));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | class class_name[name] begin[{]
method[configureCredential, return_type[void], modifier[private], parameter[properties]] begin[{]
if[binary_operation[member[.credentialSourceSupplier], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=credentialSourceSupplier, selectors=[], type_arguments=None), name=credentialSource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CredentialSource, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=credentialSource, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PasswordCredential, sub_type=None))], member=getCredential, postfix_operators=[], prefix_operators=[], qualifier=credentialSource, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClearPassword, sub_type=None))], member=getPassword, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getPassword, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=password)], modifiers=set(), type=BasicType(dimensions=[None], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="password"), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassCreator(arguments=[MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=simpleProperty15, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[configureCredential] operator[SEP] identifier[List] operator[<] identifier[ConfigProperty] operator[>] identifier[properties] operator[SEP] {
Keyword[if] operator[SEP] identifier[credentialSourceSupplier] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[CredentialSource] identifier[credentialSource] operator[=] identifier[credentialSourceSupplier] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[credentialSource] operator[!=] Other[null] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[password] operator[=] identifier[credentialSource] operator[SEP] identifier[getCredential] operator[SEP] identifier[PasswordCredential] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getPassword] operator[SEP] identifier[ClearPassword] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[password] operator[!=] Other[null] operator[SEP] {
identifier[properties] operator[SEP] identifier[add] operator[SEP] identifier[simpleProperty15] operator[SEP] literal[String] , identifier[String] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Keyword[new] identifier[String] operator[SEP] identifier[password] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
|
private List<ParsedPolicy> getJavaPolicies() {
List<ParsedPolicy> list = new ArrayList<ParsedPolicy>();
int counter = 1;
String policyUrl = null;
while ((policyUrl = SecurityActions.getSecurityProperty("policy.url." + counter)) != null) {
try {
policyUrl = expandStringWithProperty(policyUrl);
} catch (Exception ex) {
System.err.println("Expanding filepath in policy policy.url." + counter + "=" + policyUrl
+ " failed. Exception message: " + ex.getMessage());
counter++;
continue;
}
ParsedPolicy p = null;
InputStreamReader reader = null;
try {
reader = new InputStreamReader(new URL(policyUrl).openStream(), "UTF-8");
p = new Parser(debug).parse(reader);
if (p != null) {
list.add(p);
} else {
System.err.println("Parsed policy policy.url." + counter + "=" + policyUrl + " is null");
}
} catch (Exception ex) {
System.err.println("Policy policy.url." + counter + "=" + policyUrl
+ " wasn't successfully parsed. Exception message: " + ex.getMessage());
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
counter++;
}
return list;
} | class class_name[name] begin[{]
method[getJavaPolicies, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[List], list]
local_variable[type[int], counter]
local_variable[type[String], policyUrl]
while[binary_operation[assign[member[.policyUrl], call[SecurityActions.getSecurityProperty, parameter[binary_operation[literal["policy.url."], +, member[.counter]]]]], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=policyUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=policyUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=expandStringWithProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expanding filepath in policy policy.url."), operandr=MemberReference(member=counter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MemberReference(member=policyUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" failed. Exception message: "), operator=+), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=counter, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[ParsedPolicy], p]
local_variable[type[InputStreamReader], reader]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=policyUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=openStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Parser, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parsed policy policy.url."), operandr=MemberReference(member=counter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MemberReference(member=policyUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is null"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Policy policy.url."), operandr=MemberReference(member=counter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="="), operator=+), operandr=MemberReference(member=policyUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" wasn't successfully parsed. Exception message: "), operator=+), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, 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=ex, types=['Exception']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=reader, 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=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]))], label=None, resources=None)
member[.counter]
end[}]
return[member[.list]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[ParsedPolicy] operator[>] identifier[getJavaPolicies] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[ParsedPolicy] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ParsedPolicy] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[counter] operator[=] Other[1] operator[SEP] identifier[String] identifier[policyUrl] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[policyUrl] operator[=] identifier[SecurityActions] operator[SEP] identifier[getSecurityProperty] operator[SEP] literal[String] operator[+] identifier[counter] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[policyUrl] operator[=] identifier[expandStringWithProperty] operator[SEP] identifier[policyUrl] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[counter] operator[+] literal[String] operator[+] identifier[policyUrl] operator[+] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[counter] operator[++] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[ParsedPolicy] identifier[p] operator[=] Other[null] operator[SEP] identifier[InputStreamReader] identifier[reader] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[reader] operator[=] Keyword[new] identifier[InputStreamReader] operator[SEP] Keyword[new] identifier[URL] operator[SEP] identifier[policyUrl] operator[SEP] operator[SEP] identifier[openStream] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[p] operator[=] Keyword[new] identifier[Parser] operator[SEP] identifier[debug] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[reader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[p] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[counter] operator[+] literal[String] operator[+] identifier[policyUrl] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[counter] operator[+] literal[String] operator[+] identifier[policyUrl] operator[+] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[reader] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[reader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[counter] operator[++] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
public static void enableAutoExpansion(final JTree tree) {
tree.getModel().addTreeModelListener(new TreeModelListener() {
public void treeNodesChanged(TreeModelEvent e) {
// nothing to do
}
public void treeNodesInserted(TreeModelEvent e) {
tree.expandPath(e.getTreePath());
}
public void treeNodesRemoved(TreeModelEvent e) {
// nothing to do
}
public void treeStructureChanged(TreeModelEvent e) {
// nothing to do
}
});
} | class class_name[name] begin[{]
method[enableAutoExpansion, return_type[void], modifier[public static], parameter[tree]] begin[{]
call[tree.getModel, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[enableAutoExpansion] operator[SEP] Keyword[final] identifier[JTree] identifier[tree] operator[SEP] {
identifier[tree] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[addTreeModelListener] operator[SEP] Keyword[new] identifier[TreeModelListener] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[treeNodesChanged] operator[SEP] identifier[TreeModelEvent] identifier[e] operator[SEP] {
}
Keyword[public] Keyword[void] identifier[treeNodesInserted] operator[SEP] identifier[TreeModelEvent] identifier[e] operator[SEP] {
identifier[tree] operator[SEP] identifier[expandPath] operator[SEP] identifier[e] operator[SEP] identifier[getTreePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[public] Keyword[void] identifier[treeNodesRemoved] operator[SEP] identifier[TreeModelEvent] identifier[e] operator[SEP] {
}
Keyword[public] Keyword[void] identifier[treeStructureChanged] operator[SEP] identifier[TreeModelEvent] identifier[e] operator[SEP] {
}
} operator[SEP] operator[SEP]
}
|
public static long TimesBetween(String long1, String long2) {
long l1 = null == long1 ? 0 : (Pattern.matches(numerical, long1) ? Long.parseLong(long1) : 0);
long l2 = null == long2 ? 0 : (Pattern.matches(numerical, long2) ? Long.parseLong(long2) : 0);
return TimesBetween(l1, l2);
} | class class_name[name] begin[{]
method[TimesBetween, return_type[type[long]], modifier[public static], parameter[long1, long2]] begin[{]
local_variable[type[long], l1]
local_variable[type[long], l2]
return[call[.TimesBetween, parameter[member[.l1], member[.l2]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[TimesBetween] operator[SEP] identifier[String] identifier[long1] , identifier[String] identifier[long2] operator[SEP] {
Keyword[long] identifier[l1] operator[=] Other[null] operator[==] identifier[long1] operator[?] Other[0] operator[:] operator[SEP] identifier[Pattern] operator[SEP] identifier[matches] operator[SEP] identifier[numerical] , identifier[long1] operator[SEP] operator[?] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[long1] operator[SEP] operator[:] Other[0] operator[SEP] operator[SEP] Keyword[long] identifier[l2] operator[=] Other[null] operator[==] identifier[long2] operator[?] Other[0] operator[:] operator[SEP] identifier[Pattern] operator[SEP] identifier[matches] operator[SEP] identifier[numerical] , identifier[long2] operator[SEP] operator[?] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[long2] operator[SEP] operator[:] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[TimesBetween] operator[SEP] identifier[l1] , identifier[l2] operator[SEP] operator[SEP]
}
|
public static int parseInt (@Nullable final String sStr, @Nonnegative final int nRadix, final int nDefault)
{
if (sStr != null && sStr.length () > 0)
try
{
return Integer.parseInt (sStr, nRadix);
}
catch (final NumberFormatException ex)
{
// Fall through
}
return nDefault;
} | class class_name[name] begin[{]
method[parseInt, return_type[type[int]], modifier[public static], parameter[sStr, nRadix, nDefault]] begin[{]
if[binary_operation[binary_operation[member[.sStr], !=, literal[null]], &&, binary_operation[call[sStr.length, parameter[]], >, literal[0]]]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=sStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nRadix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.nDefault]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[parseInt] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sStr] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nRadix] , Keyword[final] Keyword[int] identifier[nDefault] operator[SEP] {
Keyword[if] operator[SEP] identifier[sStr] operator[!=] Other[null] operator[&&] identifier[sStr] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[try] {
Keyword[return] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[sStr] , identifier[nRadix] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NumberFormatException] identifier[ex] operator[SEP] {
}
Keyword[return] identifier[nDefault] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static Closure ensureClosure(Object o) {
if (o == null) throw new UnsupportedOperationException();
if (o instanceof Closure) return (Closure) o;
return new ReturnValueWrappingClosure(o);
} | class class_name[name] begin[{]
method[ensureClosure, return_type[type[Closure]], modifier[public static], parameter[o]] begin[{]
if[binary_operation[member[.o], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.o], instanceof, type[Closure]]] begin[{]
return[Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Closure, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=o, 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=ReturnValueWrappingClosure, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[Closure] identifier[ensureClosure] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
Keyword[if] operator[SEP] identifier[o] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[Closure] operator[SEP] Keyword[return] operator[SEP] identifier[Closure] operator[SEP] identifier[o] operator[SEP] Keyword[return] Keyword[new] identifier[ReturnValueWrappingClosure] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
|
public <K, V> Optional<KafkaProducer<K, V>> getProducer(
@NotNull final Serializer<K> keySerializer,
@NotNull final Serializer<V> valueSerializer) {
try {
return partialConfigs.map(
input -> new KafkaProducer<>(input, keySerializer, valueSerializer));
} catch (final Exception e) {
log.warn("error while generating KafkaProducer - {}", e);
return Optional.empty();
}
} | class class_name[name] begin[{]
method[getProducer, return_type[type[Optional]], modifier[public], parameter[keySerializer, valueSerializer]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[LambdaExpression(body=ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keySerializer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=valueSerializer, 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=KafkaProducer, sub_type=None)), parameters=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=map, postfix_operators=[], prefix_operators=[], qualifier=partialConfigs, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error while generating KafkaProducer - {}"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] operator[<] identifier[K] , identifier[V] operator[>] identifier[Optional] operator[<] identifier[KafkaProducer] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[getProducer] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[Serializer] operator[<] identifier[K] operator[>] identifier[keySerializer] , annotation[@] identifier[NotNull] Keyword[final] identifier[Serializer] operator[<] identifier[V] operator[>] identifier[valueSerializer] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[partialConfigs] operator[SEP] identifier[map] operator[SEP] identifier[input] operator[->] Keyword[new] identifier[KafkaProducer] operator[<] operator[>] operator[SEP] identifier[input] , identifier[keySerializer] , identifier[valueSerializer] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public <T> void destroy() {
final Set<Entry<Bean<?>, Object>> beanSet = beanReferences.entrySet();
final Iterator<Entry<Bean<?>, Object>> i = beanSet.iterator();
Bean<?> bean;
while (i.hasNext()) {
bean = i.next().getKey();
final T instance = (T) beanReferences.get(bean);
destroyReference((Bean<T>) bean, instance);
}
beanReferences.clear();
} | class class_name[name] begin[{]
method[destroy, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Set], beanSet]
local_variable[type[Iterator], i]
local_variable[type[Bean], bean]
while[call[i.hasNext, parameter[]]] begin[{]
assign[member[.bean], call[i.next, parameter[]]]
local_variable[type[T], instance]
call[.destroyReference, parameter[Cast(expression=MemberReference(member=bean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Bean, sub_type=None)), member[.instance]]]
end[}]
call[beanReferences.clear, parameter[]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] Keyword[void] identifier[destroy] operator[SEP] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[Entry] operator[<] identifier[Bean] operator[<] operator[?] operator[>] , identifier[Object] operator[>] operator[>] identifier[beanSet] operator[=] identifier[beanReferences] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[Entry] operator[<] identifier[Bean] operator[<] operator[?] operator[>] , identifier[Object] operator[>] operator[>] identifier[i] operator[=] identifier[beanSet] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[Bean] operator[<] operator[?] operator[>] identifier[bean] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[bean] operator[=] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[T] identifier[instance] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[beanReferences] operator[SEP] identifier[get] operator[SEP] identifier[bean] operator[SEP] operator[SEP] identifier[destroyReference] operator[SEP] operator[SEP] identifier[Bean] operator[<] identifier[T] operator[>] operator[SEP] identifier[bean] , identifier[instance] operator[SEP] operator[SEP]
}
identifier[beanReferences] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponse<Page<VaultInner>>> listBySubscriptionSinglePageAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final Integer top = null;
return service.listBySubscription(this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<VaultInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VaultInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<VaultInner>> result = listBySubscriptionDelegate(response);
return Observable.just(new ServiceResponse<Page<VaultInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} | class class_name[name] begin[{]
method[listBySubscriptionSinglePageAsync, return_type[type[Observable]], modifier[public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.subscriptionId, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.subscriptionId() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.client]call[None.apiVersion, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.apiVersion() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Integer], top]
return[call[service.listBySubscription, parameter[THIS[member[None.client]call[None.subscriptionId, parameter[]]], member[.top], THIS[member[None.client]call[None.apiVersion, parameter[]]], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VaultInner] operator[>] operator[>] operator[>] identifier[listBySubscriptionSinglePageAsync] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Integer] identifier[top] operator[=] Other[null] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[listBySubscription] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] , identifier[top] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VaultInner] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VaultInner] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[PageImpl] operator[<] identifier[VaultInner] operator[>] operator[>] identifier[result] operator[=] identifier[listBySubscriptionDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] Keyword[new] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VaultInner] operator[>] operator[>] operator[SEP] identifier[result] operator[SEP] identifier[body] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[response] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
static public void registerFactory( FeatureType datatype, String className) throws ClassNotFoundException {
Class c = Class.forName( className);
registerFactory( datatype, c);
} | class class_name[name] begin[{]
method[registerFactory, return_type[void], modifier[public static], parameter[datatype, className]] begin[{]
local_variable[type[Class], c]
call[.registerFactory, parameter[member[.datatype], member[.c]]]
end[}]
END[}] | Keyword[static] Keyword[public] Keyword[void] identifier[registerFactory] operator[SEP] identifier[FeatureType] identifier[datatype] , identifier[String] identifier[className] operator[SEP] Keyword[throws] identifier[ClassNotFoundException] {
identifier[Class] identifier[c] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP] identifier[registerFactory] operator[SEP] identifier[datatype] , identifier[c] operator[SEP] operator[SEP]
}
|
public void registerConsumer( LocalMessageConsumer consumer )
{
consumersLock.writeLock().lock();
try
{
localConsumers.add(consumer);
}
finally
{
consumersLock.writeLock().unlock();
}
} | class class_name[name] begin[{]
method[registerConsumer, return_type[void], modifier[public], parameter[consumer]] begin[{]
call[consumersLock.writeLock, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=localConsumers, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=consumersLock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[registerConsumer] operator[SEP] identifier[LocalMessageConsumer] identifier[consumer] operator[SEP] {
identifier[consumersLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[localConsumers] operator[SEP] identifier[add] operator[SEP] identifier[consumer] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[consumersLock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static AWSCredentialsProvider getCredentialsProvider(
AmazonWebServiceRequest req,
AWSCredentialsProvider base) {
if (req != null && req.getRequestCredentialsProvider() != null) {
return req.getRequestCredentialsProvider();
}
return base;
} | class class_name[name] begin[{]
method[getCredentialsProvider, return_type[type[AWSCredentialsProvider]], modifier[public static], parameter[req, base]] begin[{]
if[binary_operation[binary_operation[member[.req], !=, literal[null]], &&, binary_operation[call[req.getRequestCredentialsProvider, parameter[]], !=, literal[null]]]] begin[{]
return[call[req.getRequestCredentialsProvider, parameter[]]]
else begin[{]
None
end[}]
return[member[.base]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AWSCredentialsProvider] identifier[getCredentialsProvider] operator[SEP] identifier[AmazonWebServiceRequest] identifier[req] , identifier[AWSCredentialsProvider] identifier[base] operator[SEP] {
Keyword[if] operator[SEP] identifier[req] operator[!=] Other[null] operator[&&] identifier[req] operator[SEP] identifier[getRequestCredentialsProvider] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[req] operator[SEP] identifier[getRequestCredentialsProvider] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[base] operator[SEP]
}
|
private void quietSetAutoCommit(Connection conn, Boolean autoCommit) {
if (null != autoCommit) {
try {
conn.setAutoCommit(autoCommit);
} catch (Exception e) {
StaticLog.error(e);
}
}
} | class class_name[name] begin[{]
method[quietSetAutoCommit, return_type[void], modifier[private], parameter[conn, autoCommit]] begin[{]
if[binary_operation[literal[null], !=, member[.autoCommit]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=autoCommit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setAutoCommit, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=StaticLog, 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[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[quietSetAutoCommit] operator[SEP] identifier[Connection] identifier[conn] , identifier[Boolean] identifier[autoCommit] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[autoCommit] operator[SEP] {
Keyword[try] {
identifier[conn] operator[SEP] identifier[setAutoCommit] operator[SEP] identifier[autoCommit] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[StaticLog] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public static <S,T> List<T> collect(Iterator<S> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure<T> transform) {
return (List<T>) collect(self, new ArrayList<T>(), transform);
} | class class_name[name] begin[{]
method[collect, return_type[type[List]], modifier[public static], parameter[self, transform]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=self, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), MemberReference(member=transform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=collect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=List, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[S] , identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[collect] operator[SEP] identifier[Iterator] operator[<] identifier[S] operator[>] identifier[self] , annotation[@] identifier[ClosureParams] operator[SEP] identifier[FirstParam] operator[SEP] identifier[FirstGenericType] operator[SEP] Keyword[class] operator[SEP] identifier[Closure] operator[<] identifier[T] operator[>] identifier[transform] operator[SEP] {
Keyword[return] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] operator[SEP] identifier[collect] operator[SEP] identifier[self] , Keyword[new] identifier[ArrayList] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] , identifier[transform] operator[SEP] operator[SEP]
}
|
public Iterable<MetricsInfo> filter(Iterable<MetricsInfo> metricsInfos) {
List<MetricsInfo> metricsFiltered = new ArrayList<MetricsInfo>();
for (MetricsInfo metricsInfo : metricsInfos) {
if (contains(metricsInfo.getName())) {
metricsFiltered.add(metricsInfo);
}
}
return metricsFiltered;
} | class class_name[name] begin[{]
method[filter, return_type[type[Iterable]], modifier[public], parameter[metricsInfos]] begin[{]
local_variable[type[List], metricsFiltered]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=metricsInfo, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=metricsInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=metricsFiltered, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=metricsInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=metricsInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetricsInfo, sub_type=None))), label=None)
return[member[.metricsFiltered]]
end[}]
END[}] | Keyword[public] identifier[Iterable] operator[<] identifier[MetricsInfo] operator[>] identifier[filter] operator[SEP] identifier[Iterable] operator[<] identifier[MetricsInfo] operator[>] identifier[metricsInfos] operator[SEP] {
identifier[List] operator[<] identifier[MetricsInfo] operator[>] identifier[metricsFiltered] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MetricsInfo] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MetricsInfo] identifier[metricsInfo] operator[:] identifier[metricsInfos] operator[SEP] {
Keyword[if] operator[SEP] identifier[contains] operator[SEP] identifier[metricsInfo] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[metricsFiltered] operator[SEP] identifier[add] operator[SEP] identifier[metricsInfo] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[metricsFiltered] operator[SEP]
}
|
@Nonnull
public static SchematronResourcePure fromFile (@Nonnull @Nonempty final String sSCHPath)
{
return new SchematronResourcePure (new FileSystemResource (sSCHPath));
} | class class_name[name] begin[{]
method[fromFile, return_type[type[SchematronResourcePure]], modifier[public static], parameter[sSCHPath]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=sSCHPath, 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=FileSystemResource, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SchematronResourcePure, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[SchematronResourcePure] identifier[fromFile] operator[SEP] annotation[@] identifier[Nonnull] annotation[@] identifier[Nonempty] Keyword[final] identifier[String] identifier[sSCHPath] operator[SEP] {
Keyword[return] Keyword[new] identifier[SchematronResourcePure] operator[SEP] Keyword[new] identifier[FileSystemResource] operator[SEP] identifier[sSCHPath] operator[SEP] operator[SEP] operator[SEP]
}
|
private static String getTemplateMarker(String str) throws IllegalStateException{
Pattern p = Pattern.compile("\\{\\{(.*?)\\}\\}", Pattern.DOTALL);
Matcher matcher = p.matcher(str);
String tpl = null;
while(matcher.find())
{
if(tpl!=null){
throw new IllegalStateException("More than one template in the sentence.");
}
tpl=matcher.group(1);
}
return tpl;
} | class class_name[name] begin[{]
method[getTemplateMarker, return_type[type[String]], modifier[private static], parameter[str]] begin[{]
local_variable[type[Pattern], p]
local_variable[type[Matcher], matcher]
local_variable[type[String], tpl]
while[call[matcher.find, parameter[]]] begin[{]
if[binary_operation[member[.tpl], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="More than one template in the sentence.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.tpl], call[matcher.group, parameter[literal[1]]]]
end[}]
return[member[.tpl]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[getTemplateMarker] operator[SEP] identifier[String] identifier[str] operator[SEP] Keyword[throws] identifier[IllegalStateException] {
identifier[Pattern] identifier[p] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] , identifier[Pattern] operator[SEP] identifier[DOTALL] operator[SEP] operator[SEP] identifier[Matcher] identifier[matcher] operator[=] identifier[p] operator[SEP] identifier[matcher] operator[SEP] identifier[str] operator[SEP] operator[SEP] identifier[String] identifier[tpl] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tpl] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[tpl] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tpl] operator[SEP]
}
|
static <S, I, O> Optional<ADSNode<S, I, O>> compute(final MealyMachine<S, I, ?, O> automaton,
final Alphabet<I> input,
final SplitTree<S, I, O> node) {
final Iterator<S> targetStateIterator = node.getPartition().iterator();
final S s1 = targetStateIterator.next();
final S s2 = targetStateIterator.next();
final Word<I> separatingWord = Automata.findSeparatingWord(automaton, s1, s2, input);
// sep word may be non existent, if current hypothesis is not consistent
if (separatingWord == null) {
return Optional.empty();
}
final Word<O> s1Output = automaton.computeStateOutput(s1, separatingWord);
final Word<O> s2Output = automaton.computeStateOutput(s2, separatingWord);
final Word<O> sharedOutput = s1Output.longestCommonPrefix(s2Output);
final Word<I> trace = separatingWord.prefix(sharedOutput.length() + 1);
final Pair<ADSNode<S, I, O>, ADSNode<S, I, O>> ads = ADSUtil.buildFromTrace(automaton, trace, s1);
final ADSNode<S, I, O> head = ads.getFirst();
final ADSNode<S, I, O> tail = ads.getSecond();
final ADSNode<S, I, O> s1FinalNode = new ADSLeafNode<>(tail, node.getMapping().get(s1));
final ADSNode<S, I, O> s2FinalNode = new ADSLeafNode<>(tail, node.getMapping().get(s2));
tail.getChildren().put(s1Output.getSymbol(sharedOutput.length()), s1FinalNode);
tail.getChildren().put(s2Output.getSymbol(sharedOutput.length()), s2FinalNode);
return Optional.of(head);
} | class class_name[name] begin[{]
method[compute, return_type[type[Optional]], modifier[static], parameter[automaton, input, node]] begin[{]
local_variable[type[Iterator], targetStateIterator]
local_variable[type[S], s1]
local_variable[type[S], s2]
local_variable[type[Word], separatingWord]
if[binary_operation[member[.separatingWord], ==, literal[null]]] begin[{]
return[call[Optional.empty, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Word], s1Output]
local_variable[type[Word], s2Output]
local_variable[type[Word], sharedOutput]
local_variable[type[Word], trace]
local_variable[type[Pair], ads]
local_variable[type[ADSNode], head]
local_variable[type[ADSNode], tail]
local_variable[type[ADSNode], s1FinalNode]
local_variable[type[ADSNode], s2FinalNode]
call[tail.getChildren, parameter[]]
call[tail.getChildren, parameter[]]
return[call[Optional.of, parameter[member[.head]]]]
end[}]
END[}] | Keyword[static] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[Optional] operator[<] identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] operator[>] identifier[compute] operator[SEP] Keyword[final] identifier[MealyMachine] operator[<] identifier[S] , identifier[I] , operator[?] , identifier[O] operator[>] identifier[automaton] , Keyword[final] identifier[Alphabet] operator[<] identifier[I] operator[>] identifier[input] , Keyword[final] identifier[SplitTree] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[node] operator[SEP] {
Keyword[final] identifier[Iterator] operator[<] identifier[S] operator[>] identifier[targetStateIterator] operator[=] identifier[node] operator[SEP] identifier[getPartition] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[S] identifier[s1] operator[=] identifier[targetStateIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[S] identifier[s2] operator[=] identifier[targetStateIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Word] operator[<] identifier[I] operator[>] identifier[separatingWord] operator[=] identifier[Automata] operator[SEP] identifier[findSeparatingWord] operator[SEP] identifier[automaton] , identifier[s1] , identifier[s2] , identifier[input] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[separatingWord] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Word] operator[<] identifier[O] operator[>] identifier[s1Output] operator[=] identifier[automaton] operator[SEP] identifier[computeStateOutput] operator[SEP] identifier[s1] , identifier[separatingWord] operator[SEP] operator[SEP] Keyword[final] identifier[Word] operator[<] identifier[O] operator[>] identifier[s2Output] operator[=] identifier[automaton] operator[SEP] identifier[computeStateOutput] operator[SEP] identifier[s2] , identifier[separatingWord] operator[SEP] operator[SEP] Keyword[final] identifier[Word] operator[<] identifier[O] operator[>] identifier[sharedOutput] operator[=] identifier[s1Output] operator[SEP] identifier[longestCommonPrefix] operator[SEP] identifier[s2Output] operator[SEP] operator[SEP] Keyword[final] identifier[Word] operator[<] identifier[I] operator[>] identifier[trace] operator[=] identifier[separatingWord] operator[SEP] identifier[prefix] operator[SEP] identifier[sharedOutput] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[final] identifier[Pair] operator[<] identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] , identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] operator[>] identifier[ads] operator[=] identifier[ADSUtil] operator[SEP] identifier[buildFromTrace] operator[SEP] identifier[automaton] , identifier[trace] , identifier[s1] operator[SEP] operator[SEP] Keyword[final] identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[head] operator[=] identifier[ads] operator[SEP] identifier[getFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[tail] operator[=] identifier[ads] operator[SEP] identifier[getSecond] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[s1FinalNode] operator[=] Keyword[new] identifier[ADSLeafNode] operator[<] operator[>] operator[SEP] identifier[tail] , identifier[node] operator[SEP] identifier[getMapping] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[s1] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ADSNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[s2FinalNode] operator[=] Keyword[new] identifier[ADSLeafNode] operator[<] operator[>] operator[SEP] identifier[tail] , identifier[node] operator[SEP] identifier[getMapping] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[s2] operator[SEP] operator[SEP] operator[SEP] identifier[tail] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[s1Output] operator[SEP] identifier[getSymbol] operator[SEP] identifier[sharedOutput] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] , identifier[s1FinalNode] operator[SEP] operator[SEP] identifier[tail] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[s2Output] operator[SEP] identifier[getSymbol] operator[SEP] identifier[sharedOutput] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] , identifier[s2FinalNode] operator[SEP] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[head] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
public RoleAction setPermissions(Long permissions)
{
if (permissions != null)
{
Checks.notNegative(permissions, "Raw Permissions");
Checks.check(permissions <= Permission.ALL_PERMISSIONS, "Provided permissions may not be greater than a full permission set!");
for (Permission p : Permission.toEnumSet(permissions))
checkPermission(p);
}
this.permissions = permissions;
return this;
} | class class_name[name] begin[{]
method[setPermissions, return_type[type[RoleAction]], modifier[public], parameter[permissions]] begin[{]
if[binary_operation[member[.permissions], !=, literal[null]]] begin[{]
call[Checks.notNegative, parameter[member[.permissions], literal["Raw Permissions"]]]
call[Checks.check, parameter[binary_operation[member[.permissions], <=, member[Permission.ALL_PERMISSIONS]], literal["Provided permissions may not be greater than a full permission set!"]]]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkPermission, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=permissions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toEnumSet, postfix_operators=[], prefix_operators=[], qualifier=Permission, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Permission, sub_type=None))), label=None)
else begin[{]
None
end[}]
assign[THIS[member[None.permissions]], member[.permissions]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] Keyword[public] identifier[RoleAction] identifier[setPermissions] operator[SEP] identifier[Long] identifier[permissions] operator[SEP] {
Keyword[if] operator[SEP] identifier[permissions] operator[!=] Other[null] operator[SEP] {
identifier[Checks] operator[SEP] identifier[notNegative] operator[SEP] identifier[permissions] , literal[String] operator[SEP] operator[SEP] identifier[Checks] operator[SEP] identifier[check] operator[SEP] identifier[permissions] operator[<=] identifier[Permission] operator[SEP] identifier[ALL_PERMISSIONS] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Permission] identifier[p] operator[:] identifier[Permission] operator[SEP] identifier[toEnumSet] operator[SEP] identifier[permissions] operator[SEP] operator[SEP] identifier[checkPermission] operator[SEP] identifier[p] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[permissions] operator[=] identifier[permissions] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static Image getInstance(PdfWriter writer, java.awt.Image awtImage, float quality) throws BadElementException, IOException {
return getInstance(new PdfContentByte(writer), awtImage, quality);
} | class class_name[name] begin[{]
method[getInstance, return_type[type[Image]], modifier[public static], parameter[writer, awtImage, quality]] begin[{]
return[call[.getInstance, parameter[ClassCreator(arguments=[MemberReference(member=writer, 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=PdfContentByte, sub_type=None)), member[.awtImage], member[.quality]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Image] identifier[getInstance] operator[SEP] identifier[PdfWriter] identifier[writer] , identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Image] identifier[awtImage] , Keyword[float] identifier[quality] operator[SEP] Keyword[throws] identifier[BadElementException] , identifier[IOException] {
Keyword[return] identifier[getInstance] operator[SEP] Keyword[new] identifier[PdfContentByte] operator[SEP] identifier[writer] operator[SEP] , identifier[awtImage] , identifier[quality] operator[SEP] operator[SEP]
}
|
public void setFrom(Address address) {
assertArgumentNotNull("address", address);
from = address;
try {
message.setFrom(address);
} catch (MessagingException e) {
String msg = buildAddressSettingFailureMessage("from", address);
throw new SMailMessageSettingFailureException(msg, e);
}
} | class class_name[name] begin[{]
method[setFrom, return_type[void], modifier[public], parameter[address]] begin[{]
call[.assertArgumentNotNull, parameter[literal["address"], member[.address]]]
assign[member[.from], member[.address]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setFrom, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="from"), MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildAddressSettingFailureMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SMailMessageSettingFailureException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MessagingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setFrom] operator[SEP] identifier[Address] identifier[address] operator[SEP] {
identifier[assertArgumentNotNull] operator[SEP] literal[String] , identifier[address] operator[SEP] operator[SEP] identifier[from] operator[=] identifier[address] operator[SEP] Keyword[try] {
identifier[message] operator[SEP] identifier[setFrom] operator[SEP] identifier[address] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MessagingException] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] identifier[buildAddressSettingFailureMessage] operator[SEP] literal[String] , identifier[address] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SMailMessageSettingFailureException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void error(VirtualConnection vc, TCPReadRequestContext req, IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "error: " + vc);
}
// This can legitemately happen if the client closes
// the connection before sending data - we will always get
// an exception in that case
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Error occurred during initial read of request from client: " + req.getInterface().getRemoteAddress() + " " + req.getInterface().getRemotePort() + " : "
+ ioe);
}
// release any WsByteBuffers that were allocated for this request
WsByteBuffer buffArray[] = req.getBuffers();
if (buffArray != null) {
for (int i = 0; i < buffArray.length; i++) {
if (buffArray[i] != null) {
buffArray[i].release();
}
}
}
req.setBuffers(null);
// if read timed out, send to discriminators so that they
// can send error response if necessary
if (ioe != null && ioe instanceof SocketTimeoutException) {
sendToDiscriminators(vc, req, true);
} else {
// Destroy the connection link
((TCPReadRequestContextImpl) req).getTCPConnLink().close(vc, ioe);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "error");
}
} | class class_name[name] begin[{]
method[error, return_type[void], modifier[public], parameter[vc, req, ioe]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], binary_operation[literal["error: "], +, member[.vc]]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["Error occurred during initial read of request from client: "], +, call[req.getInterface, parameter[]]], +, literal[" "]], +, call[req.getInterface, parameter[]]], +, literal[" : "]], +, member[.ioe]]]]
else begin[{]
None
end[}]
local_variable[type[WsByteBuffer], buffArray]
if[binary_operation[member[.buffArray], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=buffArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=buffArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=release, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffArray, 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[}]
call[req.setBuffers, parameter[literal[null]]]
if[binary_operation[binary_operation[member[.ioe], !=, literal[null]], &&, binary_operation[member[.ioe], instanceof, type[SocketTimeoutException]]]] begin[{]
call[.sendToDiscriminators, parameter[member[.vc], member[.req], literal[true]]]
else begin[{]
Cast(expression=MemberReference(member=req, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TCPReadRequestContextImpl, sub_type=None))
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["error"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[error] operator[SEP] identifier[VirtualConnection] identifier[vc] , identifier[TCPReadRequestContext] identifier[req] , identifier[IOException] identifier[ioe] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[vc] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[req] operator[SEP] identifier[getInterface] operator[SEP] operator[SEP] operator[SEP] identifier[getRemoteAddress] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[req] operator[SEP] identifier[getInterface] operator[SEP] operator[SEP] operator[SEP] identifier[getRemotePort] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[ioe] operator[SEP] operator[SEP]
}
identifier[WsByteBuffer] identifier[buffArray] operator[SEP] operator[SEP] operator[=] identifier[req] operator[SEP] identifier[getBuffers] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[buffArray] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[buffArray] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[buffArray] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[buffArray] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[req] operator[SEP] identifier[setBuffers] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ioe] operator[!=] Other[null] operator[&&] identifier[ioe] Keyword[instanceof] identifier[SocketTimeoutException] operator[SEP] {
identifier[sendToDiscriminators] operator[SEP] identifier[vc] , identifier[req] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
operator[SEP] operator[SEP] identifier[TCPReadRequestContextImpl] operator[SEP] identifier[req] operator[SEP] operator[SEP] identifier[getTCPConnLink] operator[SEP] operator[SEP] operator[SEP] identifier[close] operator[SEP] identifier[vc] , identifier[ioe] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
}
|
private CompletableFuture<WriterFlushResult> flushOnce(TimeoutTimer timer) {
boolean hasDelete = this.hasDeletePending.get();
boolean hasMerge = this.mergeTransactionCount.get() > 0;
boolean hasSeal = this.hasSealPending.get();
boolean hasTruncate = this.truncateCount.get() > 0;
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "flushOnce", this.operations.size(),
this.mergeTransactionCount, hasSeal, hasTruncate, hasDelete);
CompletableFuture<WriterFlushResult> result;
if (hasDelete) {
// If we have a Deletes, simply delete the Segment and move on. No other operation matters now.
result = deleteSegment(timer);
} else if (hasSeal || hasMerge || hasTruncate) {
// If we have a Seal, Merge or Truncate Pending, flush everything until we reach that operation.
result = flushFully(timer);
if (hasMerge) {
// If we have a merge, do it after we flush fully.
result = result.thenComposeAsync(flushResult -> mergeIfNecessary(flushResult, timer), this.executor);
}
if (hasSeal) {
// If we have a seal, do it after every other operation.
result = result.thenComposeAsync(flushResult -> sealIfNecessary(flushResult, timer), this.executor);
}
} else {
// Otherwise, just flush the excess as long as we have something to flush.
result = flushExcess(timer);
}
if (log.isTraceEnabled()) {
result = result.thenApply(r -> {
LoggerHelpers.traceLeave(log, this.traceObjectId, "flushOnce", traceId, r);
return r;
});
}
return result;
} | class class_name[name] begin[{]
method[flushOnce, return_type[type[CompletableFuture]], modifier[private], parameter[timer]] begin[{]
local_variable[type[boolean], hasDelete]
local_variable[type[boolean], hasMerge]
local_variable[type[boolean], hasSeal]
local_variable[type[boolean], hasTruncate]
local_variable[type[long], traceId]
local_variable[type[CompletableFuture], result]
if[member[.hasDelete]] begin[{]
assign[member[.result], call[.deleteSegment, parameter[member[.timer]]]]
else begin[{]
if[binary_operation[binary_operation[member[.hasSeal], ||, member[.hasMerge]], ||, member[.hasTruncate]]] begin[{]
assign[member[.result], call[.flushFully, parameter[member[.timer]]]]
if[member[.hasMerge]] begin[{]
assign[member[.result], call[result.thenComposeAsync, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=flushResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mergeIfNecessary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[MemberReference(member=flushResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), THIS[member[None.executor]]]]]
else begin[{]
None
end[}]
if[member[.hasSeal]] begin[{]
assign[member[.result], call[result.thenComposeAsync, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=flushResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sealIfNecessary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[MemberReference(member=flushResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), THIS[member[None.executor]]]]]
else begin[{]
None
end[}]
else begin[{]
assign[member[.result], call[.flushExcess, parameter[member[.timer]]]]
end[}]
end[}]
if[call[log.isTraceEnabled, parameter[]]] begin[{]
assign[member[.result], call[result.thenApply, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=traceObjectId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="flushOnce"), MemberReference(member=traceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=traceLeave, postfix_operators=[], prefix_operators=[], qualifier=LoggerHelpers, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], parameters=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[CompletableFuture] operator[<] identifier[WriterFlushResult] operator[>] identifier[flushOnce] operator[SEP] identifier[TimeoutTimer] identifier[timer] operator[SEP] {
Keyword[boolean] identifier[hasDelete] operator[=] Keyword[this] operator[SEP] identifier[hasDeletePending] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[hasMerge] operator[=] Keyword[this] operator[SEP] identifier[mergeTransactionCount] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[boolean] identifier[hasSeal] operator[=] Keyword[this] operator[SEP] identifier[hasSealPending] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[hasTruncate] operator[=] Keyword[this] operator[SEP] identifier[truncateCount] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[long] identifier[traceId] operator[=] identifier[LoggerHelpers] operator[SEP] identifier[traceEnterWithContext] operator[SEP] identifier[log] , Keyword[this] operator[SEP] identifier[traceObjectId] , literal[String] , Keyword[this] operator[SEP] identifier[operations] operator[SEP] identifier[size] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[mergeTransactionCount] , identifier[hasSeal] , identifier[hasTruncate] , identifier[hasDelete] operator[SEP] operator[SEP] identifier[CompletableFuture] operator[<] identifier[WriterFlushResult] operator[>] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[hasDelete] operator[SEP] {
identifier[result] operator[=] identifier[deleteSegment] operator[SEP] identifier[timer] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[hasSeal] operator[||] identifier[hasMerge] operator[||] identifier[hasTruncate] operator[SEP] {
identifier[result] operator[=] identifier[flushFully] operator[SEP] identifier[timer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasMerge] operator[SEP] {
identifier[result] operator[=] identifier[result] operator[SEP] identifier[thenComposeAsync] operator[SEP] identifier[flushResult] operator[->] identifier[mergeIfNecessary] operator[SEP] identifier[flushResult] , identifier[timer] operator[SEP] , Keyword[this] operator[SEP] identifier[executor] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[hasSeal] operator[SEP] {
identifier[result] operator[=] identifier[result] operator[SEP] identifier[thenComposeAsync] operator[SEP] identifier[flushResult] operator[->] identifier[sealIfNecessary] operator[SEP] identifier[flushResult] , identifier[timer] operator[SEP] , Keyword[this] operator[SEP] identifier[executor] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[result] operator[=] identifier[flushExcess] operator[SEP] identifier[timer] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[result] operator[SEP] identifier[thenApply] operator[SEP] identifier[r] operator[->] {
identifier[LoggerHelpers] operator[SEP] identifier[traceLeave] operator[SEP] identifier[log] , Keyword[this] operator[SEP] identifier[traceObjectId] , literal[String] , identifier[traceId] , identifier[r] operator[SEP] operator[SEP] Keyword[return] identifier[r] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public Map<String, Object> apply(final Map<String, Object> row) {
Map<String, Object> cleanRow, filteredRow;
// Make sure the row isn't null.
if (row == null) {
cleanRow = new LinkedHashMap<>();
} else {
cleanRow = new LinkedHashMap<>(row);
}
// Copy the row so we avoid concurrent modifications.
filteredRow = new LinkedHashMap<>();
// Iterate through the requested columns and add/override the ones
// the user wants to see.
for (String column : columns) {
if (cleanRow.containsKey(column)) {
filteredRow.put(column, cleanRow.get(column));
} else {
filteredRow.put(column, null);
}
}
return filteredRow;
} | class class_name[name] begin[{]
method[apply, return_type[type[Map]], modifier[public], parameter[row]] begin[{]
local_variable[type[Map], cleanRow]
if[binary_operation[member[.row], ==, literal[null]]] begin[{]
assign[member[.cleanRow], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None))]
else begin[{]
assign[member[.cleanRow], ClassCreator(arguments=[MemberReference(member=row, 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=LinkedHashMap, sub_type=None))]
end[}]
assign[member[.filteredRow], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=cleanRow, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=put, postfix_operators=[], prefix_operators=[], qualifier=filteredRow, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=cleanRow, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=filteredRow, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=column)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.filteredRow]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[apply] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[row] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[cleanRow] , identifier[filteredRow] operator[SEP] Keyword[if] operator[SEP] identifier[row] operator[==] Other[null] operator[SEP] {
identifier[cleanRow] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[cleanRow] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] identifier[row] operator[SEP] operator[SEP]
}
identifier[filteredRow] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[column] operator[:] identifier[columns] operator[SEP] {
Keyword[if] operator[SEP] identifier[cleanRow] operator[SEP] identifier[containsKey] operator[SEP] identifier[column] operator[SEP] operator[SEP] {
identifier[filteredRow] operator[SEP] identifier[put] operator[SEP] identifier[column] , identifier[cleanRow] operator[SEP] identifier[get] operator[SEP] identifier[column] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[filteredRow] operator[SEP] identifier[put] operator[SEP] identifier[column] , Other[null] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[filteredRow] operator[SEP]
}
|
public void update(long throughput) {
if (LOG.isDebugEnabled()) {
LOG.debug("Received throughput of " + throughput + " on channel - " + this.channel.getComponentName());
}
this.throughput = throughput;
} | class class_name[name] begin[{]
method[update, return_type[void], modifier[public], parameter[throughput]] begin[{]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[binary_operation[binary_operation[binary_operation[literal["Received throughput of "], +, member[.throughput]], +, literal[" on channel - "]], +, THIS[member[None.channel]call[None.getComponentName, parameter[]]]]]]
else begin[{]
None
end[}]
assign[THIS[member[None.throughput]], member[.throughput]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[update] operator[SEP] Keyword[long] identifier[throughput] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[throughput] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[channel] operator[SEP] identifier[getComponentName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[throughput] operator[=] identifier[throughput] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.