code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static void assertNoWorkspacesOpen(String msg, boolean allowScopedOut) throws ND4JWorkspaceException {
if (Nd4j.getWorkspaceManager().anyWorkspaceActiveForCurrentThread()) {
MemoryWorkspace currWs = Nd4j.getMemoryManager().getCurrentWorkspace();
if(allowScopedOut && (currWs == null || currWs instanceof DummyWorkspace))
return; //Open WS but we've scoped out
List<MemoryWorkspace> l = Nd4j.getWorkspaceManager().getAllWorkspacesForCurrentThread();
List<String> workspaces = new ArrayList<>(l.size());
for (MemoryWorkspace ws : l) {
if(ws.isScopeActive()) {
workspaces.add(ws.getId());
}
}
throw new ND4JWorkspaceException(msg + " - Open/active workspaces: " + workspaces);
}
}
|
class class_name[name] begin[{]
method[assertNoWorkspacesOpen, return_type[void], modifier[public static], parameter[msg, allowScopedOut]] begin[{]
if[call[Nd4j.getWorkspaceManager, parameter[]]] begin[{]
local_variable[type[MemoryWorkspace], currWs]
if[binary_operation[member[.allowScopedOut], &&, binary_operation[binary_operation[member[.currWs], ==, literal[null]], ||, binary_operation[member[.currWs], instanceof, type[DummyWorkspace]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[List], l]
local_variable[type[List], workspaces]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isScopeActive, postfix_operators=[], prefix_operators=[], qualifier=ws, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=ws, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=workspaces, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ws)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MemoryWorkspace, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" - Open/active workspaces: "), operator=+), operandr=MemberReference(member=workspaces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ND4JWorkspaceException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[assertNoWorkspacesOpen] operator[SEP] identifier[String] identifier[msg] , Keyword[boolean] identifier[allowScopedOut] operator[SEP] Keyword[throws] identifier[ND4JWorkspaceException] {
Keyword[if] operator[SEP] identifier[Nd4j] operator[SEP] identifier[getWorkspaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[anyWorkspaceActiveForCurrentThread] operator[SEP] operator[SEP] operator[SEP] {
identifier[MemoryWorkspace] identifier[currWs] operator[=] identifier[Nd4j] operator[SEP] identifier[getMemoryManager] operator[SEP] operator[SEP] operator[SEP] identifier[getCurrentWorkspace] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[allowScopedOut] operator[&&] operator[SEP] identifier[currWs] operator[==] Other[null] operator[||] identifier[currWs] Keyword[instanceof] identifier[DummyWorkspace] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[List] operator[<] identifier[MemoryWorkspace] operator[>] identifier[l] operator[=] identifier[Nd4j] operator[SEP] identifier[getWorkspaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getAllWorkspacesForCurrentThread] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[workspaces] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[l] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MemoryWorkspace] identifier[ws] operator[:] identifier[l] operator[SEP] {
Keyword[if] operator[SEP] identifier[ws] operator[SEP] identifier[isScopeActive] operator[SEP] operator[SEP] operator[SEP] {
identifier[workspaces] operator[SEP] identifier[add] operator[SEP] identifier[ws] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[ND4JWorkspaceException] operator[SEP] identifier[msg] operator[+] literal[String] operator[+] identifier[workspaces] operator[SEP] operator[SEP]
}
}
|
public void remove(final Long canalId) {
Assert.assertNotNull(canalId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
Canal canal = findById(canalId);
canalDao.delete(canalId);
arbitrateViewService.removeCanal(canal.getName()); // 删除canal节点信息
} catch (Exception e) {
logger.error("ERROR ## remove canal(" + canalId + ") has an exception!");
throw new ManagerException(e);
}
}
});
}
|
class class_name[name] begin[{]
method[remove, return_type[void], modifier[public], parameter[canalId]] begin[{]
call[Assert.assertNotNull, parameter[member[.canalId]]]
call[transactionTemplate.execute, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=canalId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findById, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=canal)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Canal, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=canalId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=delete, postfix_operators=[], prefix_operators=[], qualifier=canalDao, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=canal, selectors=[], type_arguments=None)], member=removeCanal, postfix_operators=[], prefix_operators=[], qualifier=arbitrateViewService, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR ## remove canal("), operandr=MemberReference(member=canalId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") has an exception!"), operator=+)], member=error, 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=ManagerException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'protected'}, name=doInTransactionWithoutResult, parameters=[FormalParameter(annotations=[], modifiers=set(), name=status, type=ReferenceType(arguments=None, dimensions=[], name=TransactionStatus, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TransactionCallbackWithoutResult, sub_type=None))]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[remove] operator[SEP] Keyword[final] identifier[Long] identifier[canalId] operator[SEP] {
identifier[Assert] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[canalId] operator[SEP] operator[SEP] identifier[transactionTemplate] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[TransactionCallbackWithoutResult] operator[SEP] operator[SEP] {
Keyword[protected] Keyword[void] identifier[doInTransactionWithoutResult] operator[SEP] identifier[TransactionStatus] identifier[status] operator[SEP] {
Keyword[try] {
identifier[Canal] identifier[canal] operator[=] identifier[findById] operator[SEP] identifier[canalId] operator[SEP] operator[SEP] identifier[canalDao] operator[SEP] identifier[delete] operator[SEP] identifier[canalId] operator[SEP] operator[SEP] identifier[arbitrateViewService] operator[SEP] identifier[removeCanal] operator[SEP] identifier[canal] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[canalId] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ManagerException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
private void processToUnicode(){
PdfObject toUni = fontDic.get(PdfName.TOUNICODE);
if (toUni != null){
try {
byte[] touni = PdfReader.getStreamBytes((PRStream)PdfReader.getPdfObjectRelease(toUni));
CMapParser cmapParser = new CMapParser();
toUnicodeCmap = cmapParser.parse(new ByteArrayInputStream(touni));
} catch (IOException e) {
throw new Error("Unable to process ToUnicode map - " + e.getMessage(), e);
}
}
}
|
class class_name[name] begin[{]
method[processToUnicode, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[PdfObject], toUni]
if[binary_operation[member[.toUni], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MemberReference(member=toUni, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPdfObjectRelease, postfix_operators=[], prefix_operators=[], qualifier=PdfReader, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=PRStream, sub_type=None))], member=getStreamBytes, postfix_operators=[], prefix_operators=[], qualifier=PdfReader, selectors=[], type_arguments=None), name=touni)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CMapParser, sub_type=None)), name=cmapParser)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CMapParser, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=toUnicodeCmap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=touni, 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=ByteArrayInputStream, sub_type=None))], member=parse, postfix_operators=[], prefix_operators=[], qualifier=cmapParser, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to process ToUnicode map - "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Error, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[processToUnicode] operator[SEP] operator[SEP] {
identifier[PdfObject] identifier[toUni] operator[=] identifier[fontDic] operator[SEP] identifier[get] operator[SEP] identifier[PdfName] operator[SEP] identifier[TOUNICODE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[toUni] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[touni] operator[=] identifier[PdfReader] operator[SEP] identifier[getStreamBytes] operator[SEP] operator[SEP] identifier[PRStream] operator[SEP] identifier[PdfReader] operator[SEP] identifier[getPdfObjectRelease] operator[SEP] identifier[toUni] operator[SEP] operator[SEP] operator[SEP] identifier[CMapParser] identifier[cmapParser] operator[=] Keyword[new] identifier[CMapParser] operator[SEP] operator[SEP] operator[SEP] identifier[toUnicodeCmap] operator[=] identifier[cmapParser] operator[SEP] identifier[parse] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[touni] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Error] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public Collection<XAttribute> getDefinedAttributes() {
if (allAttributes == null) {
// create collection on demand
allAttributes = new HashSet<XAttribute>();
allAttributes.addAll(getLogAttributes());
allAttributes.addAll(getTraceAttributes());
allAttributes.addAll(getEventAttributes());
allAttributes.addAll(getEventAttributes());
}
return allAttributes;
}
|
class class_name[name] begin[{]
method[getDefinedAttributes, return_type[type[Collection]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.allAttributes], ==, literal[null]]] begin[{]
assign[member[.allAttributes], 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=XAttribute, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]
call[allAttributes.addAll, parameter[call[.getLogAttributes, parameter[]]]]
call[allAttributes.addAll, parameter[call[.getTraceAttributes, parameter[]]]]
call[allAttributes.addAll, parameter[call[.getEventAttributes, parameter[]]]]
call[allAttributes.addAll, parameter[call[.getEventAttributes, parameter[]]]]
else begin[{]
None
end[}]
return[member[.allAttributes]]
end[}]
END[}]
|
Keyword[public] identifier[Collection] operator[<] identifier[XAttribute] operator[>] identifier[getDefinedAttributes] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[allAttributes] operator[==] Other[null] operator[SEP] {
identifier[allAttributes] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[XAttribute] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[allAttributes] operator[SEP] identifier[addAll] operator[SEP] identifier[getLogAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[allAttributes] operator[SEP] identifier[addAll] operator[SEP] identifier[getTraceAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[allAttributes] operator[SEP] identifier[addAll] operator[SEP] identifier[getEventAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[allAttributes] operator[SEP] identifier[addAll] operator[SEP] identifier[getEventAttributes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[allAttributes] operator[SEP]
}
|
public ApiResponse<ApiSuccessResponse> submitFeedbackWithHttpInfo(SubmitFeedbackData submitFeedbackData) throws ApiException {
com.squareup.okhttp.Call call = submitFeedbackValidateBeforeCall(submitFeedbackData, null, null);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
|
class class_name[name] begin[{]
method[submitFeedbackWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[submitFeedbackData]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}]
|
Keyword[public] identifier[ApiResponse] operator[<] identifier[ApiSuccessResponse] operator[>] identifier[submitFeedbackWithHttpInfo] operator[SEP] identifier[SubmitFeedbackData] identifier[submitFeedbackData] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[submitFeedbackValidateBeforeCall] operator[SEP] identifier[submitFeedbackData] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[ApiSuccessResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
@Override
public UpdateResourceServerResult updateResourceServer(UpdateResourceServerRequest request) {
request = beforeClientExecution(request);
return executeUpdateResourceServer(request);
}
|
class class_name[name] begin[{]
method[updateResourceServer, return_type[type[UpdateResourceServerResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeUpdateResourceServer, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[UpdateResourceServerResult] identifier[updateResourceServer] operator[SEP] identifier[UpdateResourceServerRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeUpdateResourceServer] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static ClientOptions of(ClientOptions baseOptions, Iterable<ClientOptionValue<?>> options) {
// TODO(trustin): Reduce the cost of creating a derived ClientOptions.
requireNonNull(baseOptions, "baseOptions");
requireNonNull(options, "options");
return new ClientOptions(baseOptions, options);
}
|
class class_name[name] begin[{]
method[of, return_type[type[ClientOptions]], modifier[public static], parameter[baseOptions, options]] begin[{]
call[.requireNonNull, parameter[member[.baseOptions], literal["baseOptions"]]]
call[.requireNonNull, parameter[member[.options], literal["options"]]]
return[ClassCreator(arguments=[MemberReference(member=baseOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=options, 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=ClientOptions, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ClientOptions] identifier[of] operator[SEP] identifier[ClientOptions] identifier[baseOptions] , identifier[Iterable] operator[<] identifier[ClientOptionValue] operator[<] operator[?] operator[>] operator[>] identifier[options] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[baseOptions] , literal[String] operator[SEP] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[options] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ClientOptions] operator[SEP] identifier[baseOptions] , identifier[options] operator[SEP] operator[SEP]
}
|
public void disable(String plugin) throws RabbitMqCommandException {
String[] args = {"disable", plugin};
String executionErrorMessage = "Error while disabling plugin '" + plugin + "'";
String unexpectedExitCodeMessage = "Disabling of plugin '" + plugin + "' failed with exit code: ";
getProcessResult(args, executionErrorMessage, unexpectedExitCodeMessage);
}
|
class class_name[name] begin[{]
method[disable, return_type[void], modifier[public], parameter[plugin]] begin[{]
local_variable[type[String], args]
local_variable[type[String], executionErrorMessage]
local_variable[type[String], unexpectedExitCodeMessage]
call[.getProcessResult, parameter[member[.args], member[.executionErrorMessage], member[.unexpectedExitCodeMessage]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[disable] operator[SEP] identifier[String] identifier[plugin] operator[SEP] Keyword[throws] identifier[RabbitMqCommandException] {
identifier[String] operator[SEP] operator[SEP] identifier[args] operator[=] {
literal[String] , identifier[plugin]
} operator[SEP] identifier[String] identifier[executionErrorMessage] operator[=] literal[String] operator[+] identifier[plugin] operator[+] literal[String] operator[SEP] identifier[String] identifier[unexpectedExitCodeMessage] operator[=] literal[String] operator[+] identifier[plugin] operator[+] literal[String] operator[SEP] identifier[getProcessResult] operator[SEP] identifier[args] , identifier[executionErrorMessage] , identifier[unexpectedExitCodeMessage] operator[SEP] operator[SEP]
}
|
private TreeEntry<E> getEntry(Entry<?> entry) {
TreeEntry<E> t = root;
while (t != null) {
int cmp = compareLongs(getLow(entry), t.low);
if (cmp == 0)
cmp = compareLongs(getHigh(entry), t.high);
if (cmp == 0)
cmp = entry.hashCode() - t.value.hashCode();
if (cmp < 0) {
t = t.left;
} else if (cmp > 0) {
t = t.right;
} else {
return t;
}
}
return null;
}
|
class class_name[name] begin[{]
method[getEntry, return_type[type[TreeEntry]], modifier[private], parameter[entry]] begin[{]
local_variable[type[TreeEntry], t]
while[binary_operation[member[.t], !=, literal[null]]] begin[{]
local_variable[type[int], cmp]
if[binary_operation[member[.cmp], ==, literal[0]]] begin[{]
assign[member[.cmp], call[.compareLongs, parameter[call[.getHigh, parameter[member[.entry]]], member[t.high]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.cmp], ==, literal[0]]] begin[{]
assign[member[.cmp], binary_operation[call[entry.hashCode, parameter[]], -, call[t.value.hashCode, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.cmp], <, literal[0]]] begin[{]
assign[member[.t], member[t.left]]
else begin[{]
if[binary_operation[member[.cmp], >, literal[0]]] begin[{]
assign[member[.t], member[t.right]]
else begin[{]
return[member[.t]]
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[private] identifier[TreeEntry] operator[<] identifier[E] operator[>] identifier[getEntry] operator[SEP] identifier[Entry] operator[<] operator[?] operator[>] identifier[entry] operator[SEP] {
identifier[TreeEntry] operator[<] identifier[E] operator[>] identifier[t] operator[=] identifier[root] operator[SEP] Keyword[while] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[cmp] operator[=] identifier[compareLongs] operator[SEP] identifier[getLow] operator[SEP] identifier[entry] operator[SEP] , identifier[t] operator[SEP] identifier[low] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmp] operator[==] Other[0] operator[SEP] identifier[cmp] operator[=] identifier[compareLongs] operator[SEP] identifier[getHigh] operator[SEP] identifier[entry] operator[SEP] , identifier[t] operator[SEP] identifier[high] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmp] operator[==] Other[0] operator[SEP] identifier[cmp] operator[=] identifier[entry] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[-] identifier[t] operator[SEP] identifier[value] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmp] operator[<] Other[0] operator[SEP] {
identifier[t] operator[=] identifier[t] operator[SEP] identifier[left] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[cmp] operator[>] Other[0] operator[SEP] {
identifier[t] operator[=] identifier[t] operator[SEP] identifier[right] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[t] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
private static String getClassSignature(TypeElement element) throws IOException
{
Result sb = new Result();
formalTypeParameters(sb, element.getTypeParameters());
TypeMirror superclass = element.getSuperclass();
// SuperclassSignature:
// ClassTypeSignature
if (superclass != null)
{
classTypeSignature(sb, superclass);
}
// SuperinterfaceSignature:
// ClassTypeSignature
for (TypeMirror intf : element.getInterfaces())
{
classTypeSignature(sb, intf);
}
return sb.toString();
}
|
class class_name[name] begin[{]
method[getClassSignature, return_type[type[String]], modifier[private static], parameter[element]] begin[{]
local_variable[type[Result], sb]
call[.formalTypeParameters, parameter[member[.sb], call[element.getTypeParameters, parameter[]]]]
local_variable[type[TypeMirror], superclass]
if[binary_operation[member[.superclass], !=, literal[null]]] begin[{]
call[.classTypeSignature, parameter[member[.sb], member[.superclass]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=intf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=classTypeSignature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=intf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeMirror, sub_type=None))), label=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[String] identifier[getClassSignature] operator[SEP] identifier[TypeElement] identifier[element] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Result] identifier[sb] operator[=] Keyword[new] identifier[Result] operator[SEP] operator[SEP] operator[SEP] identifier[formalTypeParameters] operator[SEP] identifier[sb] , identifier[element] operator[SEP] identifier[getTypeParameters] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[TypeMirror] identifier[superclass] operator[=] identifier[element] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[superclass] operator[!=] Other[null] operator[SEP] {
identifier[classTypeSignature] operator[SEP] identifier[sb] , identifier[superclass] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[TypeMirror] identifier[intf] operator[:] identifier[element] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] {
identifier[classTypeSignature] operator[SEP] identifier[sb] , identifier[intf] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void openKeyStore(Path path, String keyStoreType, String keyStorePassword) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException {
this.keystore = KeyStore.getInstance(keyStoreType);
if (path!=null) {
InputStream keyStoreInputStream = ffr.openFile(path);
this.keystore.load(keyStoreInputStream, keyStorePassword.toCharArray());
} else {
this.keystore.load(null, keyStorePassword.toCharArray());
}
}
|
class class_name[name] begin[{]
method[openKeyStore, return_type[void], modifier[public], parameter[path, keyStoreType, keyStorePassword]] begin[{]
assign[THIS[member[None.keystore]], call[KeyStore.getInstance, parameter[member[.keyStoreType]]]]
if[binary_operation[member[.path], !=, literal[null]]] begin[{]
local_variable[type[InputStream], keyStoreInputStream]
THIS[member[None.keystore]call[None.load, parameter[member[.keyStoreInputStream], call[keyStorePassword.toCharArray, parameter[]]]]]
else begin[{]
THIS[member[None.keystore]call[None.load, parameter[literal[null], call[keyStorePassword.toCharArray, parameter[]]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[openKeyStore] operator[SEP] identifier[Path] identifier[path] , identifier[String] identifier[keyStoreType] , identifier[String] identifier[keyStorePassword] operator[SEP] Keyword[throws] identifier[IOException] , identifier[NoSuchAlgorithmException] , identifier[CertificateException] , identifier[KeyStoreException] {
Keyword[this] operator[SEP] identifier[keystore] operator[=] identifier[KeyStore] operator[SEP] identifier[getInstance] operator[SEP] identifier[keyStoreType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[!=] Other[null] operator[SEP] {
identifier[InputStream] identifier[keyStoreInputStream] operator[=] identifier[ffr] operator[SEP] identifier[openFile] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[keystore] operator[SEP] identifier[load] operator[SEP] identifier[keyStoreInputStream] , identifier[keyStorePassword] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[keystore] operator[SEP] identifier[load] operator[SEP] Other[null] , identifier[keyStorePassword] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
protected com.ibm.ws.webcontainer.srt.SRTConnectionContext getConnectionContext() {
// SRTConnectionContext srt = _threadLocal.get();
// if (srt == null) {
// srt = new SRTConnectionContext();
// _threadLocal.set(srt);
// }
// return srt;
/*
* TODO: Investigate performance impact of removing thread locals and
* instead creating a new connection context each time. The threadlocal
* approach causes problems for requests that go async as a subsequent
* request may use the same thread and therefore get the same
* SRTServletRequest instance from the SRTConnectionContext.
*/
// return new SRTConnectionContext();
return connContextPool.get();
}
|
class class_name[name] begin[{]
method[getConnectionContext, return_type[type[com]], modifier[protected], parameter[]] begin[{]
return[call[connContextPool.get, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ws] operator[SEP] identifier[webcontainer] operator[SEP] identifier[srt] operator[SEP] identifier[SRTConnectionContext] identifier[getConnectionContext] operator[SEP] operator[SEP] {
Keyword[return] identifier[connContextPool] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void writeRequestHeaders(HttpState state, HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.writeRequestHeaders(HttpState,"
+ "HttpConnection)");
addRequestHeaders(state, conn);
String charset = getParams().getHttpElementCharset();
Header[] headers = getRequestHeaders();
for (int i = 0; i < headers.length; i++) {
String s = headers[i].toExternalForm();
if (Wire.HEADER_WIRE.enabled()) {
Wire.HEADER_WIRE.output(s);
}
conn.print(s, charset);
}
}
|
class class_name[name] begin[{]
method[writeRequestHeaders, return_type[void], modifier[protected], parameter[state, conn]] begin[{]
call[LOG.trace, parameter[binary_operation[literal["enter HttpMethodBase.writeRequestHeaders(HttpState,"], +, literal["HttpConnection)"]]]]
call[.addRequestHeaders, parameter[member[.state], member[.conn]]]
local_variable[type[String], charset]
local_variable[type[Header], headers]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=headers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=toExternalForm, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=enabled, postfix_operators=[], prefix_operators=[], qualifier=Wire.HEADER_WIRE, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=output, postfix_operators=[], prefix_operators=[], qualifier=Wire.HEADER_WIRE, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=print, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=headers, 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[writeRequestHeaders] operator[SEP] identifier[HttpState] identifier[state] , identifier[HttpConnection] identifier[conn] operator[SEP] Keyword[throws] identifier[IOException] , identifier[HttpException] {
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[addRequestHeaders] operator[SEP] identifier[state] , identifier[conn] operator[SEP] operator[SEP] identifier[String] identifier[charset] operator[=] identifier[getParams] operator[SEP] operator[SEP] operator[SEP] identifier[getHttpElementCharset] operator[SEP] operator[SEP] operator[SEP] identifier[Header] operator[SEP] operator[SEP] identifier[headers] operator[=] identifier[getRequestHeaders] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[headers] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[headers] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[toExternalForm] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Wire] operator[SEP] identifier[HEADER_WIRE] operator[SEP] identifier[enabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Wire] operator[SEP] identifier[HEADER_WIRE] operator[SEP] identifier[output] operator[SEP] identifier[s] operator[SEP] operator[SEP]
}
identifier[conn] operator[SEP] identifier[print] operator[SEP] identifier[s] , identifier[charset] operator[SEP] operator[SEP]
}
}
|
public static List<SecStrucState> parseFile(String dsspPath,
Structure structure, boolean assign)
throws IOException, StructureException {
File file = new File(dsspPath);
Reader read = new FileReader(file);
BufferedReader reader = new BufferedReader(read);
return generalParse(reader, structure, assign);
}
|
class class_name[name] begin[{]
method[parseFile, return_type[type[List]], modifier[public static], parameter[dsspPath, structure, assign]] begin[{]
local_variable[type[File], file]
local_variable[type[Reader], read]
local_variable[type[BufferedReader], reader]
return[call[.generalParse, parameter[member[.reader], member[.structure], member[.assign]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[SecStrucState] operator[>] identifier[parseFile] operator[SEP] identifier[String] identifier[dsspPath] , identifier[Structure] identifier[structure] , Keyword[boolean] identifier[assign] operator[SEP] Keyword[throws] identifier[IOException] , identifier[StructureException] {
identifier[File] identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[dsspPath] operator[SEP] operator[SEP] identifier[Reader] identifier[read] operator[=] Keyword[new] identifier[FileReader] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] identifier[read] operator[SEP] operator[SEP] Keyword[return] identifier[generalParse] operator[SEP] identifier[reader] , identifier[structure] , identifier[assign] operator[SEP] operator[SEP]
}
|
Object decodeProperty(MsgDestEncodingUtilsImpl.PropertyInputStream stream) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "decodeProperty", stream);
// Get the String value then strip the first character, which is always a '*'
String value = (String)super.decodeProperty(stream);
value = value.substring(1);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "decodeProperty", value);
return value;
}
|
class class_name[name] begin[{]
method[decodeProperty, return_type[type[Object]], modifier[default], parameter[stream]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["decodeProperty"], member[.stream]]]
else begin[{]
None
end[}]
local_variable[type[String], value]
assign[member[.value], call[value.substring, parameter[literal[1]]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["decodeProperty"], member[.value]]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}]
|
identifier[Object] identifier[decodeProperty] operator[SEP] identifier[MsgDestEncodingUtilsImpl] operator[SEP] identifier[PropertyInputStream] identifier[stream] operator[SEP] Keyword[throws] identifier[JMSException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[stream] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] operator[SEP] identifier[String] operator[SEP] Keyword[super] operator[SEP] identifier[decodeProperty] operator[SEP] identifier[stream] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[value] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
private static List getUrlClassLoaderClasspathComponents(URLClassLoader ucl)
{
List components = new ArrayList();
URL[] urls = new URL[0];
// Workaround for running on JBoss with UnifiedClassLoader3 usage
// We need to invoke getClasspath() method instead of getURLs()
if (ucl.getClass().getName().equals("org.jboss.mx.loading.UnifiedClassLoader3"))
{
try
{
Method classPathMethod = ucl.getClass().getMethod("getClasspath", new Class[] {});
urls = (URL[]) classPathMethod.invoke(ucl, new Object[0]);
}
catch(Exception e)
{
LogFactory.getLog(ClasspathUtils.class).debug("Error invoking getClasspath on UnifiedClassLoader3: ", e);
}
}
else
{
// Use regular ClassLoader method to get classpath
urls = ucl.getURLs();
}
for (int i = 0; i < urls.length; i++)
{
URL url = urls[i];
components.add(getCanonicalPath(url.getPath()));
}
return components;
}
|
class class_name[name] begin[{]
method[getUrlClassLoaderClasspathComponents, return_type[type[List]], modifier[private static], parameter[ucl]] begin[{]
local_variable[type[List], components]
local_variable[type[URL], urls]
if[call[ucl.getClass, parameter[]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=ucl, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getClasspath"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None))], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=classPathMethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=urls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=ucl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=classPathMethod, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=URL, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClasspathUtils, sub_type=None))], member=getLog, postfix_operators=[], prefix_operators=[], qualifier=LogFactory, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error invoking getClasspath on UnifiedClassLoader3: "), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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[{]
assign[member[.urls], call[ucl.getURLs, parameter[]]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=urls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=url)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)], member=getCanonicalPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=components, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=urls, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.components]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[List] identifier[getUrlClassLoaderClasspathComponents] operator[SEP] identifier[URLClassLoader] identifier[ucl] operator[SEP] {
identifier[List] identifier[components] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[URL] operator[SEP] operator[SEP] identifier[urls] operator[=] Keyword[new] identifier[URL] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ucl] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[Method] identifier[classPathMethod] operator[=] identifier[ucl] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] literal[String] , Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP] identifier[urls] operator[=] operator[SEP] identifier[URL] operator[SEP] operator[SEP] operator[SEP] identifier[classPathMethod] operator[SEP] identifier[invoke] operator[SEP] identifier[ucl] , Keyword[new] identifier[Object] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LogFactory] operator[SEP] identifier[getLog] operator[SEP] identifier[ClasspathUtils] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[urls] operator[=] identifier[ucl] operator[SEP] identifier[getURLs] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[urls] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[URL] identifier[url] operator[=] identifier[urls] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[components] operator[SEP] identifier[add] operator[SEP] identifier[getCanonicalPath] operator[SEP] identifier[url] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[components] operator[SEP]
}
|
private void menuRedoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRedoActionPerformed
final TabTitle title = this.getFocusedTab();
if (title != null) {
this.menuRedo.setEnabled(title.getProvider().redo());
this.menuUndo.setEnabled(title.getProvider().isUndo());
}
}
|
class class_name[name] begin[{]
method[menuRedoActionPerformed, return_type[void], modifier[private], parameter[evt]] begin[{]
local_variable[type[TabTitle], title]
if[binary_operation[member[.title], !=, literal[null]]] begin[{]
THIS[member[None.menuRedo]call[None.setEnabled, parameter[call[title.getProvider, parameter[]]]]]
THIS[member[None.menuUndo]call[None.setEnabled, parameter[call[title.getProvider, parameter[]]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[menuRedoActionPerformed] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[ActionEvent] identifier[evt] operator[SEP] {
Keyword[final] identifier[TabTitle] identifier[title] operator[=] Keyword[this] operator[SEP] identifier[getFocusedTab] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[title] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[menuRedo] operator[SEP] identifier[setEnabled] operator[SEP] identifier[title] operator[SEP] identifier[getProvider] operator[SEP] operator[SEP] operator[SEP] identifier[redo] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[menuUndo] operator[SEP] identifier[setEnabled] operator[SEP] identifier[title] operator[SEP] identifier[getProvider] operator[SEP] operator[SEP] operator[SEP] identifier[isUndo] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) {
if (classNameRewriter != IdentityClassNameRewriter.instance()) {
annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()),
annotation.getMethodName(), rewriteMethodSignature(classNameRewriter, annotation.getMethodSignature()),
annotation.isStatic());
}
return annotation;
}
|
class class_name[name] begin[{]
method[convertMethodAnnotation, return_type[type[MethodAnnotation]], modifier[public static], parameter[classNameRewriter, annotation]] begin[{]
if[binary_operation[member[.classNameRewriter], !=, call[IdentityClassNameRewriter.instance, parameter[]]]] begin[{]
assign[member[.annotation], ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], member=rewriteClassName, postfix_operators=[], prefix_operators=[], qualifier=classNameRewriter, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMethodName, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=classNameRewriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMethodSignature, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], member=rewriteMethodSignature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isStatic, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MethodAnnotation, sub_type=None))]
else begin[{]
None
end[}]
return[member[.annotation]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MethodAnnotation] identifier[convertMethodAnnotation] operator[SEP] identifier[ClassNameRewriter] identifier[classNameRewriter] , identifier[MethodAnnotation] identifier[annotation] operator[SEP] {
Keyword[if] operator[SEP] identifier[classNameRewriter] operator[!=] identifier[IdentityClassNameRewriter] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] {
identifier[annotation] operator[=] Keyword[new] identifier[MethodAnnotation] operator[SEP] identifier[classNameRewriter] operator[SEP] identifier[rewriteClassName] operator[SEP] identifier[annotation] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] , identifier[annotation] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] , identifier[rewriteMethodSignature] operator[SEP] identifier[classNameRewriter] , identifier[annotation] operator[SEP] identifier[getMethodSignature] operator[SEP] operator[SEP] operator[SEP] , identifier[annotation] operator[SEP] identifier[isStatic] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[annotation] operator[SEP]
}
|
@Override
public EClass getListOfIfcNormalisedRatioMeasure() {
if (listOfIfcNormalisedRatioMeasureEClass == null) {
listOfIfcNormalisedRatioMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1177);
}
return listOfIfcNormalisedRatioMeasureEClass;
}
|
class class_name[name] begin[{]
method[getListOfIfcNormalisedRatioMeasure, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.listOfIfcNormalisedRatioMeasureEClass], ==, literal[null]]] begin[{]
assign[member[.listOfIfcNormalisedRatioMeasureEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1177)], 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[.listOfIfcNormalisedRatioMeasureEClass]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getListOfIfcNormalisedRatioMeasure] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[listOfIfcNormalisedRatioMeasureEClass] operator[==] Other[null] operator[SEP] {
identifier[listOfIfcNormalisedRatioMeasureEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[1177] operator[SEP] operator[SEP]
}
Keyword[return] identifier[listOfIfcNormalisedRatioMeasureEClass] operator[SEP]
}
|
Manifest createBootJarManifest() {
Manifest manifest = new Manifest();
Attributes manifestAttributes = manifest.getMainAttributes();
manifestAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
manifestAttributes.putValue("Created-By", "Liberty Monitoring Extender");
manifestAttributes.putValue("Created-Time", DateFormat.getInstance().format(new Date()));
manifestAttributes.putValue(MONITORING_VERSION_MANIFEST_HEADER, getCurrentVersion());
return manifest;
}
|
class class_name[name] begin[{]
method[createBootJarManifest, return_type[type[Manifest]], modifier[default], parameter[]] begin[{]
local_variable[type[Manifest], manifest]
local_variable[type[Attributes], manifestAttributes]
call[manifestAttributes.putValue, parameter[call[Attributes.Name.MANIFEST_VERSION.toString, parameter[]], literal["1.0"]]]
call[manifestAttributes.putValue, parameter[literal["Created-By"], literal["Liberty Monitoring Extender"]]]
call[manifestAttributes.putValue, parameter[literal["Created-Time"], call[DateFormat.getInstance, parameter[]]]]
call[manifestAttributes.putValue, parameter[member[.MONITORING_VERSION_MANIFEST_HEADER], call[.getCurrentVersion, parameter[]]]]
return[member[.manifest]]
end[}]
END[}]
|
identifier[Manifest] identifier[createBootJarManifest] operator[SEP] operator[SEP] {
identifier[Manifest] identifier[manifest] operator[=] Keyword[new] identifier[Manifest] operator[SEP] operator[SEP] operator[SEP] identifier[Attributes] identifier[manifestAttributes] operator[=] identifier[manifest] operator[SEP] identifier[getMainAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[manifestAttributes] operator[SEP] identifier[putValue] operator[SEP] identifier[Attributes] operator[SEP] identifier[Name] operator[SEP] identifier[MANIFEST_VERSION] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[manifestAttributes] operator[SEP] identifier[putValue] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[manifestAttributes] operator[SEP] identifier[putValue] operator[SEP] literal[String] , identifier[DateFormat] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[format] operator[SEP] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[manifestAttributes] operator[SEP] identifier[putValue] operator[SEP] identifier[MONITORING_VERSION_MANIFEST_HEADER] , identifier[getCurrentVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[manifest] operator[SEP]
}
|
public Rule ImageAlt(){
return Sequence(
'[',
checkForParsingTimeout(),
push(new SuperNode()),
ZeroOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()),
']'
);
}
|
class class_name[name] begin[{]
method[ImageAlt, return_type[type[Rule]], modifier[public], parameter[]] begin[{]
return[call[.Sequence, parameter[literal['['], call[.checkForParsingTimeout, parameter[]], call[.push, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SuperNode, sub_type=None))]], call[.ZeroOrMore, parameter[call[.TestNot, parameter[literal[']']]], call[.NonAutoLinkInline, parameter[]], call[.addAsChild, parameter[]]]], literal[']']]]]
end[}]
END[}]
|
Keyword[public] identifier[Rule] identifier[ImageAlt] operator[SEP] operator[SEP] {
Keyword[return] identifier[Sequence] operator[SEP] literal[String] , identifier[checkForParsingTimeout] operator[SEP] operator[SEP] , identifier[push] operator[SEP] Keyword[new] identifier[SuperNode] operator[SEP] operator[SEP] operator[SEP] , identifier[ZeroOrMore] operator[SEP] identifier[TestNot] operator[SEP] literal[String] operator[SEP] , identifier[NonAutoLinkInline] operator[SEP] operator[SEP] , identifier[addAsChild] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
|
protected void valueChanged()
{
String newValue = fViewer.getDocument().get();
if (!newValue.equals(fOldValue))
{
fOldValue = newValue;
}
refreshValidState();
}
|
class class_name[name] begin[{]
method[valueChanged, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[String], newValue]
if[call[newValue.equals, parameter[member[.fOldValue]]]] begin[{]
assign[member[.fOldValue], member[.newValue]]
else begin[{]
None
end[}]
call[.refreshValidState, parameter[]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[valueChanged] operator[SEP] operator[SEP] {
identifier[String] identifier[newValue] operator[=] identifier[fViewer] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[newValue] operator[SEP] identifier[equals] operator[SEP] identifier[fOldValue] operator[SEP] operator[SEP] {
identifier[fOldValue] operator[=] identifier[newValue] operator[SEP]
}
identifier[refreshValidState] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object getValue(Object tree, Map context, Object root)
throws OgnlException
{
return getValue(tree, context, root, null);
}
|
class class_name[name] begin[{]
method[getValue, return_type[type[Object]], modifier[public static], parameter[tree, context, root]] begin[{]
return[call[.getValue, parameter[member[.tree], member[.context], member[.root], literal[null]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Object] identifier[getValue] operator[SEP] identifier[Object] identifier[tree] , identifier[Map] identifier[context] , identifier[Object] identifier[root] operator[SEP] Keyword[throws] identifier[OgnlException] {
Keyword[return] identifier[getValue] operator[SEP] identifier[tree] , identifier[context] , identifier[root] , Other[null] operator[SEP] operator[SEP]
}
|
private void invokeChainedMethod(Event event) {
Queue<MethodWrapper> queue = conversationQueueMap.get(event.getSender().getId());
if (queue != null && !queue.isEmpty()) {
MethodWrapper methodWrapper = queue.peek();
try {
EventType[] eventTypes = methodWrapper.getMethod().getAnnotation(Controller.class).events();
for (EventType eventType : eventTypes) {
if (eventType.name().equalsIgnoreCase(event.getType().name())) {
methodWrapper.getMethod().invoke(this, event);
return;
}
}
} catch (Exception e) {
logger.error("Error invoking chained method: ", e);
}
}
}
|
class class_name[name] begin[{]
method[invokeChainedMethod, return_type[void], modifier[private], parameter[event]] begin[{]
local_variable[type[Queue], queue]
if[binary_operation[binary_operation[member[.queue], !=, literal[null]], &&, call[queue.isEmpty, parameter[]]]] begin[{]
local_variable[type[MethodWrapper], methodWrapper]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=methodWrapper, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Controller, sub_type=None))], member=getAnnotation, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=events, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=eventTypes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=EventType, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=eventType, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[MethodInvocation(arguments=[], member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=[StatementExpression(expression=MethodInvocation(arguments=[], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=methodWrapper, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=eventTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=eventType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EventType, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error invoking chained method: "), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[invokeChainedMethod] operator[SEP] identifier[Event] identifier[event] operator[SEP] {
identifier[Queue] operator[<] identifier[MethodWrapper] operator[>] identifier[queue] operator[=] identifier[conversationQueueMap] operator[SEP] identifier[get] operator[SEP] identifier[event] operator[SEP] identifier[getSender] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[queue] operator[!=] Other[null] operator[&&] operator[!] identifier[queue] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[MethodWrapper] identifier[methodWrapper] operator[=] identifier[queue] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[EventType] operator[SEP] operator[SEP] identifier[eventTypes] operator[=] identifier[methodWrapper] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Controller] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[events] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[EventType] identifier[eventType] operator[:] identifier[eventTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[eventType] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[event] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[methodWrapper] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[invoke] operator[SEP] Keyword[this] , identifier[event] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public boolean removeAll(Collection<?> c) {
// Override AbstractSet version to avoid unnecessary call to size()
boolean modified = false;
for (Object e : c)
if (remove(e))
modified = true;
return modified;
}
|
class class_name[name] begin[{]
method[removeAll, return_type[type[boolean]], modifier[public], parameter[c]] begin[{]
local_variable[type[boolean], modified]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=modified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), control=EnhancedForControl(iterable=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.modified]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[removeAll] operator[SEP] identifier[Collection] operator[<] operator[?] operator[>] identifier[c] operator[SEP] {
Keyword[boolean] identifier[modified] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[e] operator[:] identifier[c] operator[SEP] Keyword[if] operator[SEP] identifier[remove] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[modified] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[modified] operator[SEP]
}
|
public Datapoint withExtendedStatistics(java.util.Map<String, Double> extendedStatistics) {
setExtendedStatistics(extendedStatistics);
return this;
}
|
class class_name[name] begin[{]
method[withExtendedStatistics, return_type[type[Datapoint]], modifier[public], parameter[extendedStatistics]] begin[{]
call[.setExtendedStatistics, parameter[member[.extendedStatistics]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[Datapoint] identifier[withExtendedStatistics] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Double] operator[>] identifier[extendedStatistics] operator[SEP] {
identifier[setExtendedStatistics] operator[SEP] identifier[extendedStatistics] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@InService(TableWriterService.class)
public void writePage(Page page,
SegmentStream sOut,
long oldSequence,
int saveLength,
int saveTail,
int sequenceWrite,
Result<Integer> result)
{
try {
sOut.writePage(this, page, saveLength, saveTail, sequenceWrite,
result);
} catch (Exception e) {
e.printStackTrace();
}
}
|
class class_name[name] begin[{]
method[writePage, return_type[void], modifier[public], parameter[page, sOut, oldSequence, saveLength, saveTail, sequenceWrite, result]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=page, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=saveLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=saveTail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sequenceWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writePage, postfix_operators=[], prefix_operators=[], qualifier=sOut, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[InService] operator[SEP] identifier[TableWriterService] operator[SEP] Keyword[class] operator[SEP] Keyword[public] Keyword[void] identifier[writePage] operator[SEP] identifier[Page] identifier[page] , identifier[SegmentStream] identifier[sOut] , Keyword[long] identifier[oldSequence] , Keyword[int] identifier[saveLength] , Keyword[int] identifier[saveTail] , Keyword[int] identifier[sequenceWrite] , identifier[Result] operator[<] identifier[Integer] operator[>] identifier[result] operator[SEP] {
Keyword[try] {
identifier[sOut] operator[SEP] identifier[writePage] operator[SEP] Keyword[this] , identifier[page] , identifier[saveLength] , identifier[saveTail] , identifier[sequenceWrite] , identifier[result] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static HttpResponse execute(HttpRequestBase request) throws IOException {
Assert.notNull(request, "Missing request!");
HttpClient client = HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()).build();
return client.execute(request);
}
|
class class_name[name] begin[{]
method[execute, return_type[type[HttpResponse]], modifier[public static], parameter[request]] begin[{]
call[Assert.notNull, parameter[member[.request], literal["Missing request!"]]]
local_variable[type[HttpClient], client]
return[call[client.execute, parameter[member[.request]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[HttpResponse] identifier[execute] operator[SEP] identifier[HttpRequestBase] identifier[request] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[request] , literal[String] operator[SEP] operator[SEP] identifier[HttpClient] identifier[client] operator[=] identifier[HttpClientBuilder] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[setRedirectStrategy] operator[SEP] Keyword[new] identifier[DefaultRedirectStrategy] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[client] operator[SEP] identifier[execute] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public Observable<CertificateBundle> updateCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
return updateCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, certificateAttributes, tags).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() {
@Override
public CertificateBundle call(ServiceResponse<CertificateBundle> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[updateCertificateAsync, return_type[type[Observable]], modifier[public], parameter[vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, certificateAttributes, tags]] begin[{]
return[call[.updateCertificateWithServiceResponseAsync, parameter[member[.vaultBaseUrl], member[.certificateName], member[.certificateVersion], member[.certificatePolicy], member[.certificateAttributes], member[.tags]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[CertificateBundle] operator[>] identifier[updateCertificateAsync] operator[SEP] identifier[String] identifier[vaultBaseUrl] , identifier[String] identifier[certificateName] , identifier[String] identifier[certificateVersion] , identifier[CertificatePolicy] identifier[certificatePolicy] , identifier[CertificateAttributes] identifier[certificateAttributes] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[tags] operator[SEP] {
Keyword[return] identifier[updateCertificateWithServiceResponseAsync] operator[SEP] identifier[vaultBaseUrl] , identifier[certificateName] , identifier[certificateVersion] , identifier[certificatePolicy] , identifier[certificateAttributes] , identifier[tags] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[CertificateBundle] operator[>] , identifier[CertificateBundle] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[CertificateBundle] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[CertificateBundle] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
protected void handleComputeFields(int julianDay) {
long d = julianDay - 347997;
long m = (d * DAY_PARTS) / MONTH_PARTS; // Months (approx)
int year = (int)((19 * m + 234) / 235) + 1; // Years (approx)
long ys = startOfYear(year); // 1st day of year
int dayOfYear = (int)(d - ys);
// Because of the postponement rules, it's possible to guess wrong. Fix it.
while (dayOfYear < 1) {
year--;
ys = startOfYear(year);
dayOfYear = (int)(d - ys);
}
// Now figure out which month we're in, and the date within that month
int yearType = yearType(year);
int monthStart[][] = isLeapYear(year) ? LEAP_MONTH_START : MONTH_START;
int month = 0;
while (dayOfYear > monthStart[month][yearType]) {
month++;
}
month--;
int dayOfMonth = dayOfYear - monthStart[month][yearType];
internalSet(ERA, 0);
internalSet(YEAR, year);
internalSet(EXTENDED_YEAR, year);
internalSet(MONTH, month);
internalSet(DAY_OF_MONTH, dayOfMonth);
internalSet(DAY_OF_YEAR, dayOfYear);
}
|
class class_name[name] begin[{]
method[handleComputeFields, return_type[void], modifier[protected], parameter[julianDay]] begin[{]
local_variable[type[long], d]
local_variable[type[long], m]
local_variable[type[int], year]
local_variable[type[long], ys]
local_variable[type[int], dayOfYear]
while[binary_operation[member[.dayOfYear], <, literal[1]]] begin[{]
member[.year]
assign[member[.ys], call[.startOfYear, parameter[member[.year]]]]
assign[member[.dayOfYear], Cast(expression=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), type=BasicType(dimensions=[], name=int))]
end[}]
local_variable[type[int], yearType]
local_variable[type[int], monthStart]
local_variable[type[int], month]
while[binary_operation[member[.dayOfYear], >, member[.monthStart]]] begin[{]
member[.month]
end[}]
member[.month]
local_variable[type[int], dayOfMonth]
call[.internalSet, parameter[member[.ERA], literal[0]]]
call[.internalSet, parameter[member[.YEAR], member[.year]]]
call[.internalSet, parameter[member[.EXTENDED_YEAR], member[.year]]]
call[.internalSet, parameter[member[.MONTH], member[.month]]]
call[.internalSet, parameter[member[.DAY_OF_MONTH], member[.dayOfMonth]]]
call[.internalSet, parameter[member[.DAY_OF_YEAR], member[.dayOfYear]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[handleComputeFields] operator[SEP] Keyword[int] identifier[julianDay] operator[SEP] {
Keyword[long] identifier[d] operator[=] identifier[julianDay] operator[-] Other[347997] operator[SEP] Keyword[long] identifier[m] operator[=] operator[SEP] identifier[d] operator[*] identifier[DAY_PARTS] operator[SEP] operator[/] identifier[MONTH_PARTS] operator[SEP] Keyword[int] identifier[year] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] Other[19] operator[*] identifier[m] operator[+] Other[234] operator[SEP] operator[/] Other[235] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[long] identifier[ys] operator[=] identifier[startOfYear] operator[SEP] identifier[year] operator[SEP] operator[SEP] Keyword[int] identifier[dayOfYear] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[d] operator[-] identifier[ys] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[dayOfYear] operator[<] Other[1] operator[SEP] {
identifier[year] operator[--] operator[SEP] identifier[ys] operator[=] identifier[startOfYear] operator[SEP] identifier[year] operator[SEP] operator[SEP] identifier[dayOfYear] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[d] operator[-] identifier[ys] operator[SEP] operator[SEP]
}
Keyword[int] identifier[yearType] operator[=] identifier[yearType] operator[SEP] identifier[year] operator[SEP] operator[SEP] Keyword[int] identifier[monthStart] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[=] identifier[isLeapYear] operator[SEP] identifier[year] operator[SEP] operator[?] identifier[LEAP_MONTH_START] operator[:] identifier[MONTH_START] operator[SEP] Keyword[int] identifier[month] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[dayOfYear] operator[>] identifier[monthStart] operator[SEP] identifier[month] operator[SEP] operator[SEP] identifier[yearType] operator[SEP] operator[SEP] {
identifier[month] operator[++] operator[SEP]
}
identifier[month] operator[--] operator[SEP] Keyword[int] identifier[dayOfMonth] operator[=] identifier[dayOfYear] operator[-] identifier[monthStart] operator[SEP] identifier[month] operator[SEP] operator[SEP] identifier[yearType] operator[SEP] operator[SEP] identifier[internalSet] operator[SEP] identifier[ERA] , Other[0] operator[SEP] operator[SEP] identifier[internalSet] operator[SEP] identifier[YEAR] , identifier[year] operator[SEP] operator[SEP] identifier[internalSet] operator[SEP] identifier[EXTENDED_YEAR] , identifier[year] operator[SEP] operator[SEP] identifier[internalSet] operator[SEP] identifier[MONTH] , identifier[month] operator[SEP] operator[SEP] identifier[internalSet] operator[SEP] identifier[DAY_OF_MONTH] , identifier[dayOfMonth] operator[SEP] operator[SEP] identifier[internalSet] operator[SEP] identifier[DAY_OF_YEAR] , identifier[dayOfYear] operator[SEP] operator[SEP]
}
|
public void setLongdesc(String longdesc) {
_imageState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.LONGDESC, longdesc);
}
|
class class_name[name] begin[{]
method[setLongdesc, return_type[void], modifier[public], parameter[longdesc]] begin[{]
call[_imageState.registerAttribute, parameter[member[AbstractHtmlState.ATTR_GENERAL], member[HtmlConstants.LONGDESC], member[.longdesc]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setLongdesc] operator[SEP] identifier[String] identifier[longdesc] operator[SEP] {
identifier[_imageState] operator[SEP] identifier[registerAttribute] operator[SEP] identifier[AbstractHtmlState] operator[SEP] identifier[ATTR_GENERAL] , identifier[HtmlConstants] operator[SEP] identifier[LONGDESC] , identifier[longdesc] operator[SEP] operator[SEP]
}
|
public boolean authenticate(String username, String password) throws Exception
{
Session session = service.getStorageSession();
try
{
return authenticate(session, username, password, null);
}
finally
{
session.logout();
}
}
|
class class_name[name] begin[{]
method[authenticate, return_type[type[boolean]], modifier[public], parameter[username, password]] begin[{]
local_variable[type[Session], session]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=authenticate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=logout, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[authenticate] operator[SEP] identifier[String] identifier[username] , identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Session] identifier[session] operator[=] identifier[service] operator[SEP] identifier[getStorageSession] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[authenticate] operator[SEP] identifier[session] , identifier[username] , identifier[password] , Other[null] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[session] operator[SEP] identifier[logout] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private String uploadSliceControl(UploadSliceFileRequest request) throws AbstractCosException {
String url = buildUrl(request);
long signExpired = System.currentTimeMillis() / 1000 + this.config.getSignExpired();
String sign = Sign.getPeriodEffectiveSign(request.getBucketName(), request.getCosPath(), this.cred, signExpired);
long fileSize = 0;
String shaDigest = "";
try {
String localPath = request.getLocalPath();
fileSize = CommonFileUtils.getFileLength(localPath);
shaDigest = CommonCodecUtils.getEntireFileSha1(localPath);
} catch (Exception e) {
throw new UnknownException(e.toString());
}
HttpRequest httpRequest = new HttpRequest();
httpRequest.setUrl(url);
httpRequest.addHeader(RequestHeaderKey.Authorization, sign);
httpRequest.addHeader(RequestHeaderKey.USER_AGENT, this.config.getUserAgent());
httpRequest.addParam(RequestBodyKey.OP, RequestBodyValue.OP.UPLOAD_SLICE);
httpRequest.addParam(RequestBodyKey.SHA, shaDigest);
httpRequest.addParam(RequestBodyKey.FILE_SIZE, String.valueOf(fileSize));
httpRequest.addParam(RequestBodyKey.SLICE_SIZE, String.valueOf(request.getSliceSize()));
httpRequest.addParam(RequestBodyKey.BIZ_ATTR, request.getBizAttr());
httpRequest.addParam(RequestBodyKey.INSERT_ONLY, String.valueOf(request.getInsertOnly().ordinal()));
return httpClient.sendHttpRequest(httpRequest);
}
|
class class_name[name] begin[{]
method[uploadSliceControl, return_type[type[String]], modifier[private], parameter[request]] begin[{]
local_variable[type[String], url]
local_variable[type[long], signExpired]
local_variable[type[String], sign]
local_variable[type[long], fileSize]
local_variable[type[String], shaDigest]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getLocalPath, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), name=localPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=fileSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=localPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFileLength, postfix_operators=[], prefix_operators=[], qualifier=CommonFileUtils, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=shaDigest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=localPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEntireFileSha1, postfix_operators=[], prefix_operators=[], qualifier=CommonCodecUtils, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnknownException, sub_type=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[HttpRequest], httpRequest]
call[httpRequest.setUrl, parameter[member[.url]]]
call[httpRequest.addHeader, parameter[member[RequestHeaderKey.Authorization], member[.sign]]]
call[httpRequest.addHeader, parameter[member[RequestHeaderKey.USER_AGENT], THIS[member[None.config]call[None.getUserAgent, parameter[]]]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.OP], member[RequestBodyValue.OP.UPLOAD_SLICE]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.SHA], member[.shaDigest]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.FILE_SIZE], call[String.valueOf, parameter[member[.fileSize]]]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.SLICE_SIZE], call[String.valueOf, parameter[call[request.getSliceSize, parameter[]]]]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.BIZ_ATTR], call[request.getBizAttr, parameter[]]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.INSERT_ONLY], call[String.valueOf, parameter[call[request.getInsertOnly, parameter[]]]]]]
return[call[httpClient.sendHttpRequest, parameter[member[.httpRequest]]]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[uploadSliceControl] operator[SEP] identifier[UploadSliceFileRequest] identifier[request] operator[SEP] Keyword[throws] identifier[AbstractCosException] {
identifier[String] identifier[url] operator[=] identifier[buildUrl] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[long] identifier[signExpired] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[/] Other[1000] operator[+] Keyword[this] operator[SEP] identifier[config] operator[SEP] identifier[getSignExpired] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[sign] operator[=] identifier[Sign] operator[SEP] identifier[getPeriodEffectiveSign] operator[SEP] identifier[request] operator[SEP] identifier[getBucketName] operator[SEP] operator[SEP] , identifier[request] operator[SEP] identifier[getCosPath] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[cred] , identifier[signExpired] operator[SEP] operator[SEP] Keyword[long] identifier[fileSize] operator[=] Other[0] operator[SEP] identifier[String] identifier[shaDigest] operator[=] literal[String] operator[SEP] Keyword[try] {
identifier[String] identifier[localPath] operator[=] identifier[request] operator[SEP] identifier[getLocalPath] operator[SEP] operator[SEP] operator[SEP] identifier[fileSize] operator[=] identifier[CommonFileUtils] operator[SEP] identifier[getFileLength] operator[SEP] identifier[localPath] operator[SEP] operator[SEP] identifier[shaDigest] operator[=] identifier[CommonCodecUtils] operator[SEP] identifier[getEntireFileSha1] operator[SEP] identifier[localPath] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnknownException] operator[SEP] identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[HttpRequest] identifier[httpRequest] operator[=] Keyword[new] identifier[HttpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[setUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[RequestHeaderKey] operator[SEP] identifier[Authorization] , identifier[sign] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[RequestHeaderKey] operator[SEP] identifier[USER_AGENT] , Keyword[this] operator[SEP] identifier[config] operator[SEP] identifier[getUserAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[OP] , identifier[RequestBodyValue] operator[SEP] identifier[OP] operator[SEP] identifier[UPLOAD_SLICE] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[SHA] , identifier[shaDigest] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[FILE_SIZE] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[fileSize] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[SLICE_SIZE] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[request] operator[SEP] identifier[getSliceSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[BIZ_ATTR] , identifier[request] operator[SEP] identifier[getBizAttr] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[INSERT_ONLY] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[request] operator[SEP] identifier[getInsertOnly] operator[SEP] operator[SEP] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[httpClient] operator[SEP] identifier[sendHttpRequest] operator[SEP] identifier[httpRequest] operator[SEP] operator[SEP]
}
|
String addDefaultExtension(String filename) {
StringBuffer newFileName = new StringBuffer(filename);
String ext = "card";
newFileName.append("."); //$NON-NLS-1$
newFileName.append(ext);
return newFileName.toString();
}
|
class class_name[name] begin[{]
method[addDefaultExtension, return_type[type[String]], modifier[default], parameter[filename]] begin[{]
local_variable[type[StringBuffer], newFileName]
local_variable[type[String], ext]
call[newFileName.append, parameter[literal["."]]]
call[newFileName.append, parameter[member[.ext]]]
return[call[newFileName.toString, parameter[]]]
end[}]
END[}]
|
identifier[String] identifier[addDefaultExtension] operator[SEP] identifier[String] identifier[filename] operator[SEP] {
identifier[StringBuffer] identifier[newFileName] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[filename] operator[SEP] operator[SEP] identifier[String] identifier[ext] operator[=] literal[String] operator[SEP] identifier[newFileName] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[newFileName] operator[SEP] identifier[append] operator[SEP] identifier[ext] operator[SEP] operator[SEP] Keyword[return] identifier[newFileName] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) {
config.addDefaultKryoSerializer(type, serializerClass);
}
|
class class_name[name] begin[{]
method[addDefaultKryoSerializer, return_type[void], modifier[public], parameter[type, serializerClass]] begin[{]
call[config.addDefaultKryoSerializer, parameter[member[.type], member[.serializerClass]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addDefaultKryoSerializer] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Serializer] operator[<] operator[?] operator[>] operator[>] identifier[serializerClass] operator[SEP] {
identifier[config] operator[SEP] identifier[addDefaultKryoSerializer] operator[SEP] identifier[type] , identifier[serializerClass] operator[SEP] operator[SEP]
}
|
public static String replaceMap(String input, Map map, boolean ignoreCase) throws PageException {
return replaceMap(input, map, ignoreCase, true);
}
|
class class_name[name] begin[{]
method[replaceMap, return_type[type[String]], modifier[public static], parameter[input, map, ignoreCase]] begin[{]
return[call[.replaceMap, parameter[member[.input], member[.map], member[.ignoreCase], literal[true]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[replaceMap] operator[SEP] identifier[String] identifier[input] , identifier[Map] identifier[map] , Keyword[boolean] identifier[ignoreCase] operator[SEP] Keyword[throws] identifier[PageException] {
Keyword[return] identifier[replaceMap] operator[SEP] identifier[input] , identifier[map] , identifier[ignoreCase] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
protected void emitStartDocument() {
try {
if (mSerializeXMLDeclaration) {
write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
}
if (mSerializeRest) {
write("<rest:sequence xmlns:rest=\"REST\"><rest:item>");
}
} catch (final IOException exc) {
exc.printStackTrace();
}
}
|
class class_name[name] begin[{]
method[emitStartDocument, return_type[void], modifier[protected], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=MemberReference(member=mSerializeXMLDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MemberReference(member=mSerializeRest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<rest:sequence xmlns:rest=\"REST\"><rest:item>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=exc, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exc, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[emitStartDocument] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[mSerializeXMLDeclaration] operator[SEP] {
identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mSerializeRest] operator[SEP] {
identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[exc] operator[SEP] {
identifier[exc] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private boolean casNext(Node<E> cmp, Node<E> val) {
return compareAndSet(cmp, val);
}
|
class class_name[name] begin[{]
method[casNext, return_type[type[boolean]], modifier[private], parameter[cmp, val]] begin[{]
return[call[.compareAndSet, parameter[member[.cmp], member[.val]]]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[casNext] operator[SEP] identifier[Node] operator[<] identifier[E] operator[>] identifier[cmp] , identifier[Node] operator[<] identifier[E] operator[>] identifier[val] operator[SEP] {
Keyword[return] identifier[compareAndSet] operator[SEP] identifier[cmp] , identifier[val] operator[SEP] operator[SEP]
}
|
private void consumeNonExecutePrefix()
{
// fast forward through the leading whitespace
nextNonWhitespace(true);
pos--;
if (pos + NON_EXECUTE_PREFIX.length > limit && !fillBuffer(NON_EXECUTE_PREFIX.length)) {
return;
}
for (int i = 0; i < NON_EXECUTE_PREFIX.length; i++) {
if (buffer[pos + i] != NON_EXECUTE_PREFIX[i]) {
return; // not a security token!
}
}
// we consumed a security token!
pos += NON_EXECUTE_PREFIX.length;
}
|
class class_name[name] begin[{]
method[consumeNonExecutePrefix, return_type[void], modifier[private], parameter[]] begin[{]
call[.nextNonWhitespace, parameter[literal[true]]]
member[.pos]
if[binary_operation[binary_operation[binary_operation[member[.pos], +, member[NON_EXECUTE_PREFIX.length]], >, member[.limit]], &&, call[.fillBuffer, parameter[member[NON_EXECUTE_PREFIX.length]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), operandr=MemberReference(member=NON_EXECUTE_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=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=NON_EXECUTE_PREFIX, 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)
assign[member[.pos], member[NON_EXECUTE_PREFIX.length]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[consumeNonExecutePrefix] operator[SEP] operator[SEP] {
identifier[nextNonWhitespace] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[pos] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[+] identifier[NON_EXECUTE_PREFIX] operator[SEP] identifier[length] operator[>] identifier[limit] operator[&&] operator[!] identifier[fillBuffer] operator[SEP] identifier[NON_EXECUTE_PREFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[NON_EXECUTE_PREFIX] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[buffer] operator[SEP] identifier[pos] operator[+] identifier[i] operator[SEP] operator[!=] identifier[NON_EXECUTE_PREFIX] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
}
identifier[pos] operator[+=] identifier[NON_EXECUTE_PREFIX] operator[SEP] identifier[length] operator[SEP]
}
|
@Nullable
public static String getFromLastExcl (@Nullable final String sStr, final char cSearch)
{
return _getFromLast (sStr, cSearch, false);
}
|
class class_name[name] begin[{]
method[getFromLastExcl, return_type[type[String]], modifier[public static], parameter[sStr, cSearch]] begin[{]
return[call[._getFromLast, parameter[member[.sStr], member[.cSearch], literal[false]]]]
end[}]
END[}]
|
annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[String] identifier[getFromLastExcl] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sStr] , Keyword[final] Keyword[char] identifier[cSearch] operator[SEP] {
Keyword[return] identifier[_getFromLast] operator[SEP] identifier[sStr] , identifier[cSearch] , literal[boolean] operator[SEP] operator[SEP]
}
|
public Intent build() {
Intent filePicker = new Intent(mContext, useMaterial ? FilePicker.class : FilePickerActivity.class);
filePicker.putExtra(FilePicker.SCOPE, mScope);
filePicker.putExtra(FilePicker.REQUEST, requestCode);
filePicker.putExtra(FilePicker.INTENT_EXTRA_COLOR_ID, color);
filePicker.putExtra(FilePicker.MIME_TYPE, mimeType);
return filePicker;
}
|
class class_name[name] begin[{]
method[build, return_type[type[Intent]], modifier[public], parameter[]] begin[{]
local_variable[type[Intent], filePicker]
call[filePicker.putExtra, parameter[member[FilePicker.SCOPE], member[.mScope]]]
call[filePicker.putExtra, parameter[member[FilePicker.REQUEST], member[.requestCode]]]
call[filePicker.putExtra, parameter[member[FilePicker.INTENT_EXTRA_COLOR_ID], member[.color]]]
call[filePicker.putExtra, parameter[member[FilePicker.MIME_TYPE], member[.mimeType]]]
return[member[.filePicker]]
end[}]
END[}]
|
Keyword[public] identifier[Intent] identifier[build] operator[SEP] operator[SEP] {
identifier[Intent] identifier[filePicker] operator[=] Keyword[new] identifier[Intent] operator[SEP] identifier[mContext] , identifier[useMaterial] operator[?] identifier[FilePicker] operator[SEP] Keyword[class] operator[:] identifier[FilePickerActivity] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[filePicker] operator[SEP] identifier[putExtra] operator[SEP] identifier[FilePicker] operator[SEP] identifier[SCOPE] , identifier[mScope] operator[SEP] operator[SEP] identifier[filePicker] operator[SEP] identifier[putExtra] operator[SEP] identifier[FilePicker] operator[SEP] identifier[REQUEST] , identifier[requestCode] operator[SEP] operator[SEP] identifier[filePicker] operator[SEP] identifier[putExtra] operator[SEP] identifier[FilePicker] operator[SEP] identifier[INTENT_EXTRA_COLOR_ID] , identifier[color] operator[SEP] operator[SEP] identifier[filePicker] operator[SEP] identifier[putExtra] operator[SEP] identifier[FilePicker] operator[SEP] identifier[MIME_TYPE] , identifier[mimeType] operator[SEP] operator[SEP] Keyword[return] identifier[filePicker] operator[SEP]
}
|
public double randNormal(double mean, double standardDeviation) {
double x1, x2, w, y1;
do {
x1 = 2.0 * randomGenerator.nextDouble() - 1.0;
x2 = 2.0 * randomGenerator.nextDouble() - 1.0;
w = x1 * x1 + x2 * x2;
} while (w >= 1.0);
w = Math.sqrt((-2.0 * Math.log(w)) / w);
y1 = x1 * w;
y1 = y1 * standardDeviation + mean;
return y1;
}
|
class class_name[name] begin[{]
method[randNormal, return_type[type[double]], modifier[public], parameter[mean, standardDeviation]] begin[{]
local_variable[type[double], x1]
do[binary_operation[member[.w], >=, literal[1.0]]] begin[{]
assign[member[.x1], binary_operation[binary_operation[literal[2.0], *, call[randomGenerator.nextDouble, parameter[]]], -, literal[1.0]]]
assign[member[.x2], binary_operation[binary_operation[literal[2.0], *, call[randomGenerator.nextDouble, parameter[]]], -, literal[1.0]]]
assign[member[.w], binary_operation[binary_operation[member[.x1], *, member[.x1]], +, binary_operation[member[.x2], *, member[.x2]]]]
end[}]
assign[member[.w], call[Math.sqrt, parameter[binary_operation[binary_operation[literal[2.0], *, call[Math.log, parameter[member[.w]]]], /, member[.w]]]]]
assign[member[.y1], binary_operation[member[.x1], *, member[.w]]]
assign[member[.y1], binary_operation[binary_operation[member[.y1], *, member[.standardDeviation]], +, member[.mean]]]
return[member[.y1]]
end[}]
END[}]
|
Keyword[public] Keyword[double] identifier[randNormal] operator[SEP] Keyword[double] identifier[mean] , Keyword[double] identifier[standardDeviation] operator[SEP] {
Keyword[double] identifier[x1] , identifier[x2] , identifier[w] , identifier[y1] operator[SEP] Keyword[do] {
identifier[x1] operator[=] literal[Float] operator[*] identifier[randomGenerator] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[-] literal[Float] operator[SEP] identifier[x2] operator[=] literal[Float] operator[*] identifier[randomGenerator] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[-] literal[Float] operator[SEP] identifier[w] operator[=] identifier[x1] operator[*] identifier[x1] operator[+] identifier[x2] operator[*] identifier[x2] operator[SEP]
}
Keyword[while] operator[SEP] identifier[w] operator[>=] literal[Float] operator[SEP] operator[SEP] identifier[w] operator[=] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] operator[SEP] operator[-] literal[Float] operator[*] identifier[Math] operator[SEP] identifier[log] operator[SEP] identifier[w] operator[SEP] operator[SEP] operator[/] identifier[w] operator[SEP] operator[SEP] identifier[y1] operator[=] identifier[x1] operator[*] identifier[w] operator[SEP] identifier[y1] operator[=] identifier[y1] operator[*] identifier[standardDeviation] operator[+] identifier[mean] operator[SEP] Keyword[return] identifier[y1] operator[SEP]
}
|
public void setLocalSecondaryIndexes(java.util.Collection<LocalSecondaryIndexDescription> localSecondaryIndexes) {
if (localSecondaryIndexes == null) {
this.localSecondaryIndexes = null;
return;
}
this.localSecondaryIndexes = new java.util.ArrayList<LocalSecondaryIndexDescription>(localSecondaryIndexes);
}
|
class class_name[name] begin[{]
method[setLocalSecondaryIndexes, return_type[void], modifier[public], parameter[localSecondaryIndexes]] begin[{]
if[binary_operation[member[.localSecondaryIndexes], ==, literal[null]]] begin[{]
assign[THIS[member[None.localSecondaryIndexes]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.localSecondaryIndexes]], ClassCreator(arguments=[MemberReference(member=localSecondaryIndexes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=LocalSecondaryIndexDescription, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setLocalSecondaryIndexes] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[LocalSecondaryIndexDescription] operator[>] identifier[localSecondaryIndexes] operator[SEP] {
Keyword[if] operator[SEP] identifier[localSecondaryIndexes] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[localSecondaryIndexes] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[localSecondaryIndexes] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[LocalSecondaryIndexDescription] operator[>] operator[SEP] identifier[localSecondaryIndexes] operator[SEP] operator[SEP]
}
|
@Nonnull
public static <T1, T2> LBiObjBytePredicate<T1, T2> biObjBytePredicateFrom(Consumer<LBiObjBytePredicateBuilder<T1, T2>> buildingFunction) {
LBiObjBytePredicateBuilder builder = new LBiObjBytePredicateBuilder();
buildingFunction.accept(builder);
return builder.build();
}
|
class class_name[name] begin[{]
method[biObjBytePredicateFrom, return_type[type[LBiObjBytePredicate]], modifier[public static], parameter[buildingFunction]] begin[{]
local_variable[type[LBiObjBytePredicateBuilder], builder]
call[buildingFunction.accept, parameter[member[.builder]]]
return[call[builder.build, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T1] , identifier[T2] operator[>] identifier[LBiObjBytePredicate] operator[<] identifier[T1] , identifier[T2] operator[>] identifier[biObjBytePredicateFrom] operator[SEP] identifier[Consumer] operator[<] identifier[LBiObjBytePredicateBuilder] operator[<] identifier[T1] , identifier[T2] operator[>] operator[>] identifier[buildingFunction] operator[SEP] {
identifier[LBiObjBytePredicateBuilder] identifier[builder] operator[=] Keyword[new] identifier[LBiObjBytePredicateBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buildingFunction] operator[SEP] identifier[accept] operator[SEP] identifier[builder] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
@BetaApi
public final Operation deleteRoute(String route) {
DeleteRouteHttpRequest request = DeleteRouteHttpRequest.newBuilder().setRoute(route).build();
return deleteRoute(request);
}
|
class class_name[name] begin[{]
method[deleteRoute, return_type[type[Operation]], modifier[final public], parameter[route]] begin[{]
local_variable[type[DeleteRouteHttpRequest], request]
return[call[.deleteRoute, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[Operation] identifier[deleteRoute] operator[SEP] identifier[String] identifier[route] operator[SEP] {
identifier[DeleteRouteHttpRequest] identifier[request] operator[=] identifier[DeleteRouteHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setRoute] operator[SEP] identifier[route] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[deleteRoute] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static boolean isCase(Object switchValue, Object caseExpression) throws Throwable {
if (caseExpression == null) {
return switchValue == null;
}
return DefaultTypeTransformation.castToBoolean(invokeMethodN(caseExpression.getClass(), caseExpression, "isCase", new Object[]{switchValue}));
}
|
class class_name[name] begin[{]
method[isCase, return_type[type[boolean]], modifier[public static], parameter[switchValue, caseExpression]] begin[{]
if[binary_operation[member[.caseExpression], ==, literal[null]]] begin[{]
return[binary_operation[member[.switchValue], ==, literal[null]]]
else begin[{]
None
end[}]
return[call[DefaultTypeTransformation.castToBoolean, parameter[call[.invokeMethodN, parameter[call[caseExpression.getClass, parameter[]], member[.caseExpression], literal["isCase"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=switchValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isCase] operator[SEP] identifier[Object] identifier[switchValue] , identifier[Object] identifier[caseExpression] operator[SEP] Keyword[throws] identifier[Throwable] {
Keyword[if] operator[SEP] identifier[caseExpression] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[switchValue] operator[==] Other[null] operator[SEP]
}
Keyword[return] identifier[DefaultTypeTransformation] operator[SEP] identifier[castToBoolean] operator[SEP] identifier[invokeMethodN] operator[SEP] identifier[caseExpression] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[caseExpression] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[switchValue]
} operator[SEP] operator[SEP] operator[SEP]
}
|
public static Id normalize(Id id) {
return (new DefaultId(id.name())).withTags(id.tags()).normalize();
}
|
class class_name[name] begin[{]
method[normalize, return_type[type[Id]], modifier[public static], parameter[id]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=tags, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None)], member=withTags, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=normalize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DefaultId, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Id] identifier[normalize] operator[SEP] identifier[Id] identifier[id] operator[SEP] {
Keyword[return] operator[SEP] Keyword[new] identifier[DefaultId] operator[SEP] identifier[id] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withTags] operator[SEP] identifier[id] operator[SEP] identifier[tags] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[normalize] operator[SEP] operator[SEP] operator[SEP]
}
|
public ScanSpec withValueMap(Map<String, Object> valueMap) {
if (valueMap == null)
this.valueMap = null;
else
this.valueMap = Collections.unmodifiableMap(new LinkedHashMap<String, Object>(valueMap));
return this;
}
|
class class_name[name] begin[{]
method[withValueMap, return_type[type[ScanSpec]], modifier[public], parameter[valueMap]] begin[{]
if[binary_operation[member[.valueMap], ==, literal[null]]] begin[{]
assign[THIS[member[None.valueMap]], literal[null]]
else begin[{]
assign[THIS[member[None.valueMap]], call[Collections.unmodifiableMap, parameter[ClassCreator(arguments=[MemberReference(member=valueMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=LinkedHashMap, sub_type=None))]]]
end[}]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[ScanSpec] identifier[withValueMap] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[valueMap] operator[SEP] {
Keyword[if] operator[SEP] identifier[valueMap] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[valueMap] operator[=] Other[null] operator[SEP] Keyword[else] Keyword[this] operator[SEP] identifier[valueMap] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[valueMap] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Object evaluate(TaskRequest req, TaskResponse res) {
HttpServletRequest hreq = (HttpServletRequest) source.evaluate(req, res);
return hreq.getRemoteUser();
}
|
class class_name[name] begin[{]
method[evaluate, return_type[type[Object]], modifier[public], parameter[req, res]] begin[{]
local_variable[type[HttpServletRequest], hreq]
return[call[hreq.getRemoteUser, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[evaluate] operator[SEP] identifier[TaskRequest] identifier[req] , identifier[TaskResponse] identifier[res] operator[SEP] {
identifier[HttpServletRequest] identifier[hreq] operator[=] operator[SEP] identifier[HttpServletRequest] operator[SEP] identifier[source] operator[SEP] identifier[evaluate] operator[SEP] identifier[req] , identifier[res] operator[SEP] operator[SEP] Keyword[return] identifier[hreq] operator[SEP] identifier[getRemoteUser] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Integer getIntValue(@NonNull byte[] value, @IntFormatType int formatType, @IntRange(from = 0) int offset) {
if ((offset + getTypeLen(formatType)) > value.length) {
RxBleLog.w(
"Int formatType (0x%x) is longer than remaining bytes (%d) - returning null", formatType, value.length - offset
);
return null;
}
switch (formatType) {
case FORMAT_UINT8:
return unsignedByteToInt(value[offset]);
case FORMAT_UINT16:
return unsignedBytesToInt(value[offset], value[offset + 1]);
case FORMAT_UINT32:
return unsignedBytesToInt(value[offset], value[offset + 1],
value[offset + 2], value[offset + 3]);
case FORMAT_SINT8:
return unsignedToSigned(unsignedByteToInt(value[offset]), 8);
case FORMAT_SINT16:
return unsignedToSigned(unsignedBytesToInt(value[offset],
value[offset + 1]), 16);
case FORMAT_SINT32:
return unsignedToSigned(unsignedBytesToInt(value[offset],
value[offset + 1], value[offset + 2], value[offset + 3]), 32);
default:
RxBleLog.w("Passed an invalid integer formatType (0x%x) - returning null", formatType);
return null;
}
}
|
class class_name[name] begin[{]
method[getIntValue, return_type[type[Integer]], modifier[public static], parameter[value, formatType, offset]] begin[{]
if[binary_operation[binary_operation[member[.offset], +, call[.getTypeLen, parameter[member[.formatType]]]], >, member[value.length]]] begin[{]
call[RxBleLog.w, parameter[literal["Int formatType (0x%x) is longer than remaining bytes (%d) - returning null"], member[.formatType], binary_operation[member[value.length], -, member[.offset]]]]
return[literal[null]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['FORMAT_UINT8'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=unsignedByteToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FORMAT_UINT16'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))])], member=unsignedBytesToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FORMAT_UINT32'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=+))])], member=unsignedBytesToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FORMAT_SINT8'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=unsignedByteToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)], member=unsignedToSigned, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FORMAT_SINT16'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))])], member=unsignedBytesToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16)], member=unsignedToSigned, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FORMAT_SINT32'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+))]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=+))])], member=unsignedBytesToInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32)], member=unsignedToSigned, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Passed an invalid integer formatType (0x%x) - returning null"), MemberReference(member=formatType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=w, postfix_operators=[], prefix_operators=[], qualifier=RxBleLog, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])], expression=MemberReference(member=formatType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Integer] identifier[getIntValue] operator[SEP] annotation[@] identifier[NonNull] Keyword[byte] operator[SEP] operator[SEP] identifier[value] , annotation[@] identifier[IntFormatType] Keyword[int] identifier[formatType] , annotation[@] identifier[IntRange] operator[SEP] identifier[from] operator[=] Other[0] operator[SEP] Keyword[int] identifier[offset] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[offset] operator[+] identifier[getTypeLen] operator[SEP] identifier[formatType] operator[SEP] operator[SEP] operator[>] identifier[value] operator[SEP] identifier[length] operator[SEP] {
identifier[RxBleLog] operator[SEP] identifier[w] operator[SEP] literal[String] , identifier[formatType] , identifier[value] operator[SEP] identifier[length] operator[-] identifier[offset] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[formatType] operator[SEP] {
Keyword[case] identifier[FORMAT_UINT8] operator[:] Keyword[return] identifier[unsignedByteToInt] operator[SEP] identifier[value] operator[SEP] identifier[offset] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[FORMAT_UINT16] operator[:] Keyword[return] identifier[unsignedBytesToInt] operator[SEP] identifier[value] operator[SEP] identifier[offset] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[FORMAT_UINT32] operator[:] Keyword[return] identifier[unsignedBytesToInt] operator[SEP] identifier[value] operator[SEP] identifier[offset] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[2] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[3] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[FORMAT_SINT8] operator[:] Keyword[return] identifier[unsignedToSigned] operator[SEP] identifier[unsignedByteToInt] operator[SEP] identifier[value] operator[SEP] identifier[offset] operator[SEP] operator[SEP] , Other[8] operator[SEP] operator[SEP] Keyword[case] identifier[FORMAT_SINT16] operator[:] Keyword[return] identifier[unsignedToSigned] operator[SEP] identifier[unsignedBytesToInt] operator[SEP] identifier[value] operator[SEP] identifier[offset] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] operator[SEP] , Other[16] operator[SEP] operator[SEP] Keyword[case] identifier[FORMAT_SINT32] operator[:] Keyword[return] identifier[unsignedToSigned] operator[SEP] identifier[unsignedBytesToInt] operator[SEP] identifier[value] operator[SEP] identifier[offset] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[2] operator[SEP] , identifier[value] operator[SEP] identifier[offset] operator[+] Other[3] operator[SEP] operator[SEP] , Other[32] operator[SEP] operator[SEP] Keyword[default] operator[:] identifier[RxBleLog] operator[SEP] identifier[w] operator[SEP] literal[String] , identifier[formatType] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public void marshall(GetNamespaceRequest getNamespaceRequest, ProtocolMarshaller protocolMarshaller) {
if (getNamespaceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getNamespaceRequest.getId(), ID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
|
class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[getNamespaceRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getNamespaceRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=getNamespaceRequest, selectors=[], type_arguments=None), MemberReference(member=ID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[GetNamespaceRequest] identifier[getNamespaceRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getNamespaceRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getNamespaceRequest] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[ID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Nonnull
public Query startAfter(@Nonnull DocumentSnapshot snapshot) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.fieldOrders = createImplicitOrderBy();
newOptions.startCursor = createCursor(newOptions.fieldOrders, snapshot, false);
return new Query(firestore, path, newOptions);
}
|
class class_name[name] begin[{]
method[startAfter, return_type[type[Query]], modifier[public], parameter[snapshot]] begin[{]
local_variable[type[QueryOptions], newOptions]
assign[member[newOptions.fieldOrders], call[.createImplicitOrderBy, parameter[]]]
assign[member[newOptions.startCursor], call[.createCursor, parameter[member[newOptions.fieldOrders], member[.snapshot], literal[false]]]]
return[ClassCreator(arguments=[MemberReference(member=firestore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newOptions, 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=Query, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] identifier[Query] identifier[startAfter] operator[SEP] annotation[@] identifier[Nonnull] identifier[DocumentSnapshot] identifier[snapshot] operator[SEP] {
identifier[QueryOptions] identifier[newOptions] operator[=] Keyword[new] identifier[QueryOptions] operator[SEP] identifier[options] operator[SEP] operator[SEP] identifier[newOptions] operator[SEP] identifier[fieldOrders] operator[=] identifier[createImplicitOrderBy] operator[SEP] operator[SEP] operator[SEP] identifier[newOptions] operator[SEP] identifier[startCursor] operator[=] identifier[createCursor] operator[SEP] identifier[newOptions] operator[SEP] identifier[fieldOrders] , identifier[snapshot] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Query] operator[SEP] identifier[firestore] , identifier[path] , identifier[newOptions] operator[SEP] operator[SEP]
}
|
@Override
public void setAsText(final String text) {
if (BeanUtils.isNull(text)) {
setValue(null);
return;
}
try {
Object newValue = Long.valueOf(text);
setValue(newValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Failed to parse long.", e);
}
}
|
class class_name[name] begin[{]
method[setAsText, return_type[void], modifier[public], parameter[text]] begin[{]
if[call[BeanUtils.isNull, parameter[member[.text]]]] begin[{]
call[.setValue, parameter[literal[null]]]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), name=newValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to parse long."), 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setAsText] operator[SEP] Keyword[final] identifier[String] identifier[text] operator[SEP] {
Keyword[if] operator[SEP] identifier[BeanUtils] operator[SEP] identifier[isNull] operator[SEP] identifier[text] operator[SEP] operator[SEP] {
identifier[setValue] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[try] {
identifier[Object] identifier[newValue] operator[=] identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[text] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[newValue] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void setPos(Object p) {
Object[] a = (Object[]) p;
buf = (char[]) a[0];
int[] v = (int[]) a[1];
pos.setIndex(v[0]);
bufPos = v[1];
}
|
class class_name[name] begin[{]
method[setPos, return_type[void], modifier[public], parameter[p]] begin[{]
local_variable[type[Object], a]
assign[member[.buf], Cast(expression=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type=BasicType(dimensions=[None], name=char))]
local_variable[type[int], v]
call[pos.setIndex, parameter[member[.v]]]
assign[member[.bufPos], member[.v]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setPos] operator[SEP] identifier[Object] identifier[p] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[a] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[SEP] identifier[buf] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] identifier[a] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[v] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[a] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[setIndex] operator[SEP] identifier[v] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[bufPos] operator[=] identifier[v] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
|
public void setAnnotType(String v) {
if (DictTerm_Type.featOkTst && ((DictTerm_Type)jcasType).casFeat_annotType == null)
jcasType.jcas.throwFeatMissing("annotType", "ch.epfl.bbp.uima.types.DictTerm");
jcasType.ll_cas.ll_setStringValue(addr, ((DictTerm_Type)jcasType).casFeatCode_annotType, v);}
|
class class_name[name] begin[{]
method[setAnnotType, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[DictTerm_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DictTerm_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["annotType"], literal["ch.epfl.bbp.uima.types.DictTerm"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DictTerm_Type, sub_type=None)), member[.v]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setAnnotType] operator[SEP] identifier[String] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[DictTerm_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[DictTerm_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_annotType] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[DictTerm_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_annotType] , identifier[v] operator[SEP] operator[SEP]
}
|
@Override
public KType get(int index) {
assert (index >= 0 && index < size()) : "Index " + index + " out of bounds [" + 0 + ", " + size() + ").";
return Intrinsics.<KType> cast(buffer[index]);
}
|
class class_name[name] begin[{]
method[get, return_type[type[KType]], modifier[public], parameter[index]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=<), operator=&&), label=None, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Index "), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" out of bounds ["), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", "), operator=+), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")."), operator=+))
return[call[.Intrinsics, parameter[member[.buffer]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[KType] identifier[get] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[assert] operator[SEP] identifier[index] operator[>=] Other[0] operator[&&] identifier[index] operator[<] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[:] literal[String] operator[+] identifier[index] operator[+] literal[String] operator[+] Other[0] operator[+] literal[String] operator[+] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[return] identifier[Intrinsics] operator[SEP] operator[<] identifier[KType] operator[>] identifier[cast] operator[SEP] identifier[buffer] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Period positive(final Period self) {
return !self.isNegative() ? self : self.withDays(Math.abs(self.getDays()))
.withMonths(Math.abs(self.getMonths()))
.withYears(Math.abs(self.getYears()));
}
|
class class_name[name] begin[{]
method[positive, return_type[type[Period]], modifier[public static], parameter[self]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isNegative, postfix_operators=[], prefix_operators=['!'], qualifier=self, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDays, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[], type_arguments=None)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=withDays, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMonths, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[], type_arguments=None)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=withMonths, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getYears, postfix_operators=[], prefix_operators=[], qualifier=self, selectors=[], type_arguments=None)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=withYears, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=MemberReference(member=self, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Period] identifier[positive] operator[SEP] Keyword[final] identifier[Period] identifier[self] operator[SEP] {
Keyword[return] operator[!] identifier[self] operator[SEP] identifier[isNegative] operator[SEP] operator[SEP] operator[?] identifier[self] operator[:] identifier[self] operator[SEP] identifier[withDays] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[self] operator[SEP] identifier[getDays] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withMonths] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[self] operator[SEP] identifier[getMonths] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withYears] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[self] operator[SEP] identifier[getYears] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static byte[] decodeToBytes(String string, String enc)
throws UnsupportedEncodingException {
return decode(string.getBytes(enc));
}
|
class class_name[name] begin[{]
method[decodeToBytes, return_type[type[byte]], modifier[public static], parameter[string, enc]] begin[{]
return[call[.decode, parameter[call[string.getBytes, parameter[member[.enc]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[decodeToBytes] operator[SEP] identifier[String] identifier[string] , identifier[String] identifier[enc] operator[SEP] Keyword[throws] identifier[UnsupportedEncodingException] {
Keyword[return] identifier[decode] operator[SEP] identifier[string] operator[SEP] identifier[getBytes] operator[SEP] identifier[enc] operator[SEP] operator[SEP] operator[SEP]
}
|
public ServiceFuture<List<SkuInfoInner>> listMultiRolePoolSkusAsync(final String resourceGroupName, final String name, final ListOperationCallback<SkuInfoInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listMultiRolePoolSkusSinglePageAsync(resourceGroupName, name),
new Func1<String, Observable<ServiceResponse<Page<SkuInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SkuInfoInner>>> call(String nextPageLink) {
return listMultiRolePoolSkusNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
|
class class_name[name] begin[{]
method[listMultiRolePoolSkusAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, name, serviceCallback]] begin[{]
return[call[AzureServiceFuture.fromPageResponse, parameter[call[.listMultiRolePoolSkusSinglePageAsync, parameter[member[.resourceGroupName], member[.name]]], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listMultiRolePoolSkusNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SkuInfoInner, sub_type=None))], dimensions=[], name=Page, sub_type=None))], dimensions=[], name=ServiceResponse, sub_type=None))], dimensions=[], name=Observable, 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=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SkuInfoInner, sub_type=None))], dimensions=[], name=Page, sub_type=None))], dimensions=[], name=ServiceResponse, sub_type=None))], dimensions=[], name=Observable, sub_type=None))], dimensions=None, name=Func1, sub_type=None)), member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[List] operator[<] identifier[SkuInfoInner] operator[>] operator[>] identifier[listMultiRolePoolSkusAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[ListOperationCallback] operator[<] identifier[SkuInfoInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[AzureServiceFuture] operator[SEP] identifier[fromPageResponse] operator[SEP] identifier[listMultiRolePoolSkusSinglePageAsync] operator[SEP] identifier[resourceGroupName] , identifier[name] operator[SEP] , Keyword[new] identifier[Func1] operator[<] identifier[String] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SkuInfoInner] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SkuInfoInner] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listMultiRolePoolSkusNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP]
}
} , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public Object process(BinaryEntry entry) {
Binary binValue = entry.getBinaryValue();
if (binValue == null || navigator == null) {
return binValue;
}
PofValue root = PofValueParser.parse(binValue, getPofContext());
PofValue child = navigator.navigate(root);
return ((AbstractPofValue) child).getSerializedValue().toBinary();
}
|
class class_name[name] begin[{]
method[process, return_type[type[Object]], modifier[public], parameter[entry]] begin[{]
local_variable[type[Binary], binValue]
if[binary_operation[binary_operation[member[.binValue], ==, literal[null]], ||, binary_operation[member[.navigator], ==, literal[null]]]] begin[{]
return[member[.binValue]]
else begin[{]
None
end[}]
local_variable[type[PofValue], root]
local_variable[type[PofValue], child]
return[Cast(expression=MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AbstractPofValue, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[process] operator[SEP] identifier[BinaryEntry] identifier[entry] operator[SEP] {
identifier[Binary] identifier[binValue] operator[=] identifier[entry] operator[SEP] identifier[getBinaryValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binValue] operator[==] Other[null] operator[||] identifier[navigator] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[binValue] operator[SEP]
}
identifier[PofValue] identifier[root] operator[=] identifier[PofValueParser] operator[SEP] identifier[parse] operator[SEP] identifier[binValue] , identifier[getPofContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PofValue] identifier[child] operator[=] identifier[navigator] operator[SEP] identifier[navigate] operator[SEP] identifier[root] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[AbstractPofValue] operator[SEP] identifier[child] operator[SEP] operator[SEP] identifier[getSerializedValue] operator[SEP] operator[SEP] operator[SEP] identifier[toBinary] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void sqlltrim(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "trim(leading from ", "ltrim", parsedArgs);
}
|
class class_name[name] begin[{]
method[sqlltrim, return_type[void], modifier[public static], parameter[buf, parsedArgs]] begin[{]
call[.singleArgumentFunctionCall, parameter[member[.buf], literal["trim(leading from "], literal["ltrim"], member[.parsedArgs]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[sqlltrim] operator[SEP] identifier[StringBuilder] identifier[buf] , identifier[List] operator[<] operator[?] Keyword[extends] identifier[CharSequence] operator[>] identifier[parsedArgs] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[singleArgumentFunctionCall] operator[SEP] identifier[buf] , literal[String] , literal[String] , identifier[parsedArgs] operator[SEP] operator[SEP]
}
|
public AwsSecurityFindingFilters withNoteUpdatedAt(DateFilter... noteUpdatedAt) {
if (this.noteUpdatedAt == null) {
setNoteUpdatedAt(new java.util.ArrayList<DateFilter>(noteUpdatedAt.length));
}
for (DateFilter ele : noteUpdatedAt) {
this.noteUpdatedAt.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withNoteUpdatedAt, return_type[type[AwsSecurityFindingFilters]], modifier[public], parameter[noteUpdatedAt]] begin[{]
if[binary_operation[THIS[member[None.noteUpdatedAt]], ==, literal[null]]] begin[{]
call[.setNoteUpdatedAt, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=noteUpdatedAt, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DateFilter, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=noteUpdatedAt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=noteUpdatedAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DateFilter, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[AwsSecurityFindingFilters] identifier[withNoteUpdatedAt] operator[SEP] identifier[DateFilter] operator[...] identifier[noteUpdatedAt] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[noteUpdatedAt] operator[==] Other[null] operator[SEP] {
identifier[setNoteUpdatedAt] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[DateFilter] operator[>] operator[SEP] identifier[noteUpdatedAt] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[DateFilter] identifier[ele] operator[:] identifier[noteUpdatedAt] operator[SEP] {
Keyword[this] operator[SEP] identifier[noteUpdatedAt] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@SuppressWarnings("null") // bytes will be null only if empty == true
public byte[] toByteArray(final ArrayOfItemsSerDe<? super T> serDe, final Class<?> clazz) {
final int preLongs, numMarkBytes, outBytes;
final boolean empty = (r_ == 0) && (h_ == 0);
byte[] itemBytes = null; // for serialized items from serDe
int flags = marks_ == null ? 0 : GADGET_FLAG_MASK;
if (empty) {
preLongs = Family.VAROPT.getMinPreLongs();
outBytes = Family.VAROPT.getMinPreLongs() << 3; // only contains the minimum header info
flags |= EMPTY_FLAG_MASK;
} else {
preLongs = (r_ == 0 ? PreambleUtil.VO_WARMUP_PRELONGS : Family.VAROPT.getMaxPreLongs());
itemBytes = serDe.serializeToByteArray(getDataSamples(clazz));
numMarkBytes = marks_ == null ? 0 : ArrayOfBooleansSerDe.computeBytesNeeded(h_);
outBytes = (preLongs << 3) + (h_ * Double.BYTES) + numMarkBytes + itemBytes.length;
}
final byte[] outArr = new byte[outBytes];
final WritableMemory mem = WritableMemory.wrap(outArr);
// build first preLong
PreambleUtil.insertPreLongs(mem, preLongs); // Byte 0
PreambleUtil.insertLgResizeFactor(mem, rf_.lg());
PreambleUtil.insertSerVer(mem, SER_VER); // Byte 1
PreambleUtil.insertFamilyID(mem, Family.VAROPT.getID()); // Byte 2
PreambleUtil.insertFlags(mem, flags); // Byte 3
PreambleUtil.insertK(mem, k_); // Bytes 4-7
if (!empty) {
PreambleUtil.insertN(mem, n_); // Bytes 8-15
PreambleUtil.insertHRegionItemCount(mem, h_); // Bytes 16-19
PreambleUtil.insertRRegionItemCount(mem, r_); // Bytes 20-23
if (r_ > 0) {
PreambleUtil.insertTotalRWeight(mem, totalWtR_); // Bytes 24-31
}
// write the first h_ weights
int offset = preLongs << 3;
for (int i = 0; i < h_; ++i) {
mem.putDouble(offset, weights_.get(i));
offset += Double.BYTES;
}
// write the first h_ marks, iff we have a gadget
if (marks_ != null) {
final byte[] markBytes;
markBytes = MARK_SERDE.serializeToByteArray(marks_.subList(0, h_).toArray(new Boolean[0]));
mem.putByteArray(offset, markBytes, 0, markBytes.length);
offset += markBytes.length;
}
// write the sample items, using offset from earlier
mem.putByteArray(offset, itemBytes, 0, itemBytes.length);
}
return outArr;
}
|
class class_name[name] begin[{]
method[toByteArray, return_type[type[byte]], modifier[public], parameter[serDe, clazz]] begin[{]
local_variable[type[int], preLongs]
local_variable[type[boolean], empty]
local_variable[type[byte], itemBytes]
local_variable[type[int], flags]
if[member[.empty]] begin[{]
assign[member[.preLongs], call[Family.VAROPT.getMinPreLongs, parameter[]]]
assign[member[.outBytes], binary_operation[call[Family.VAROPT.getMinPreLongs, parameter[]], <<, literal[3]]]
assign[member[.flags], member[.EMPTY_FLAG_MASK]]
else begin[{]
assign[member[.preLongs], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=r_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MethodInvocation(arguments=[], member=getMaxPreLongs, postfix_operators=[], prefix_operators=[], qualifier=Family.VAROPT, selectors=[], type_arguments=None), if_true=MemberReference(member=VO_WARMUP_PRELONGS, postfix_operators=[], prefix_operators=[], qualifier=PreambleUtil, selectors=[]))]
assign[member[.itemBytes], call[serDe.serializeToByteArray, parameter[call[.getDataSamples, parameter[member[.clazz]]]]]]
assign[member[.numMarkBytes], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=marks_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=h_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=computeBytesNeeded, postfix_operators=[], prefix_operators=[], qualifier=ArrayOfBooleansSerDe, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]
assign[member[.outBytes], binary_operation[binary_operation[binary_operation[binary_operation[member[.preLongs], <<, literal[3]], +, binary_operation[member[.h_], *, member[Double.BYTES]]], +, member[.numMarkBytes]], +, member[itemBytes.length]]]
end[}]
local_variable[type[byte], outArr]
local_variable[type[WritableMemory], mem]
call[PreambleUtil.insertPreLongs, parameter[member[.mem], member[.preLongs]]]
call[PreambleUtil.insertLgResizeFactor, parameter[member[.mem], call[rf_.lg, parameter[]]]]
call[PreambleUtil.insertSerVer, parameter[member[.mem], member[.SER_VER]]]
call[PreambleUtil.insertFamilyID, parameter[member[.mem], call[Family.VAROPT.getID, parameter[]]]]
call[PreambleUtil.insertFlags, parameter[member[.mem], member[.flags]]]
call[PreambleUtil.insertK, parameter[member[.mem], member[.k_]]]
if[member[.empty]] begin[{]
call[PreambleUtil.insertN, parameter[member[.mem], member[.n_]]]
call[PreambleUtil.insertHRegionItemCount, parameter[member[.mem], member[.h_]]]
call[PreambleUtil.insertRRegionItemCount, parameter[member[.mem], member[.r_]]]
if[binary_operation[member[.r_], >, literal[0]]] begin[{]
call[PreambleUtil.insertTotalRWeight, parameter[member[.mem], member[.totalWtR_]]]
else begin[{]
None
end[}]
local_variable[type[int], offset]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=weights_, selectors=[], type_arguments=None)], member=putDouble, postfix_operators=[], prefix_operators=[], qualifier=mem, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=BYTES, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=h_, 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)
if[binary_operation[member[.marks_], !=, literal[null]]] begin[{]
local_variable[type[byte], markBytes]
assign[member[.markBytes], call[MARK_SERDE.serializeToByteArray, parameter[call[marks_.subList, parameter[literal[0], member[.h_]]]]]]
call[mem.putByteArray, parameter[member[.offset], member[.markBytes], literal[0], member[markBytes.length]]]
assign[member[.offset], member[markBytes.length]]
else begin[{]
None
end[}]
call[mem.putByteArray, parameter[member[.offset], member[.itemBytes], literal[0], member[itemBytes.length]]]
else begin[{]
None
end[}]
return[member[.outArr]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[toByteArray] operator[SEP] Keyword[final] identifier[ArrayOfItemsSerDe] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[serDe] , Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] {
Keyword[final] Keyword[int] identifier[preLongs] , identifier[numMarkBytes] , identifier[outBytes] operator[SEP] Keyword[final] Keyword[boolean] identifier[empty] operator[=] operator[SEP] identifier[r_] operator[==] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[h_] operator[==] Other[0] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[itemBytes] operator[=] Other[null] operator[SEP] Keyword[int] identifier[flags] operator[=] identifier[marks_] operator[==] Other[null] operator[?] Other[0] operator[:] identifier[GADGET_FLAG_MASK] operator[SEP] Keyword[if] operator[SEP] identifier[empty] operator[SEP] {
identifier[preLongs] operator[=] identifier[Family] operator[SEP] identifier[VAROPT] operator[SEP] identifier[getMinPreLongs] operator[SEP] operator[SEP] operator[SEP] identifier[outBytes] operator[=] identifier[Family] operator[SEP] identifier[VAROPT] operator[SEP] identifier[getMinPreLongs] operator[SEP] operator[SEP] operator[<<] Other[3] operator[SEP] identifier[flags] operator[|=] identifier[EMPTY_FLAG_MASK] operator[SEP]
}
Keyword[else] {
identifier[preLongs] operator[=] operator[SEP] identifier[r_] operator[==] Other[0] operator[?] identifier[PreambleUtil] operator[SEP] identifier[VO_WARMUP_PRELONGS] operator[:] identifier[Family] operator[SEP] identifier[VAROPT] operator[SEP] identifier[getMaxPreLongs] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[itemBytes] operator[=] identifier[serDe] operator[SEP] identifier[serializeToByteArray] operator[SEP] identifier[getDataSamples] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] operator[SEP] identifier[numMarkBytes] operator[=] identifier[marks_] operator[==] Other[null] operator[?] Other[0] operator[:] identifier[ArrayOfBooleansSerDe] operator[SEP] identifier[computeBytesNeeded] operator[SEP] identifier[h_] operator[SEP] operator[SEP] identifier[outBytes] operator[=] operator[SEP] identifier[preLongs] operator[<<] Other[3] operator[SEP] operator[+] operator[SEP] identifier[h_] operator[*] identifier[Double] operator[SEP] identifier[BYTES] operator[SEP] operator[+] identifier[numMarkBytes] operator[+] identifier[itemBytes] operator[SEP] identifier[length] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[outArr] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[outBytes] operator[SEP] operator[SEP] Keyword[final] identifier[WritableMemory] identifier[mem] operator[=] identifier[WritableMemory] operator[SEP] identifier[wrap] operator[SEP] identifier[outArr] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertPreLongs] operator[SEP] identifier[mem] , identifier[preLongs] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertLgResizeFactor] operator[SEP] identifier[mem] , identifier[rf_] operator[SEP] identifier[lg] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertSerVer] operator[SEP] identifier[mem] , identifier[SER_VER] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertFamilyID] operator[SEP] identifier[mem] , identifier[Family] operator[SEP] identifier[VAROPT] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertFlags] operator[SEP] identifier[mem] , identifier[flags] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertK] operator[SEP] identifier[mem] , identifier[k_] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[empty] operator[SEP] {
identifier[PreambleUtil] operator[SEP] identifier[insertN] operator[SEP] identifier[mem] , identifier[n_] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertHRegionItemCount] operator[SEP] identifier[mem] , identifier[h_] operator[SEP] operator[SEP] identifier[PreambleUtil] operator[SEP] identifier[insertRRegionItemCount] operator[SEP] identifier[mem] , identifier[r_] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r_] operator[>] Other[0] operator[SEP] {
identifier[PreambleUtil] operator[SEP] identifier[insertTotalRWeight] operator[SEP] identifier[mem] , identifier[totalWtR_] operator[SEP] operator[SEP]
}
Keyword[int] identifier[offset] operator[=] identifier[preLongs] operator[<<] Other[3] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[h_] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[mem] operator[SEP] identifier[putDouble] operator[SEP] identifier[offset] , identifier[weights_] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[offset] operator[+=] identifier[Double] operator[SEP] identifier[BYTES] operator[SEP]
}
Keyword[if] operator[SEP] identifier[marks_] operator[!=] Other[null] operator[SEP] {
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[markBytes] operator[SEP] identifier[markBytes] operator[=] identifier[MARK_SERDE] operator[SEP] identifier[serializeToByteArray] operator[SEP] identifier[marks_] operator[SEP] identifier[subList] operator[SEP] Other[0] , identifier[h_] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Boolean] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mem] operator[SEP] identifier[putByteArray] operator[SEP] identifier[offset] , identifier[markBytes] , Other[0] , identifier[markBytes] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[offset] operator[+=] identifier[markBytes] operator[SEP] identifier[length] operator[SEP]
}
identifier[mem] operator[SEP] identifier[putByteArray] operator[SEP] identifier[offset] , identifier[itemBytes] , Other[0] , identifier[itemBytes] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[return] identifier[outArr] operator[SEP]
}
|
@Override
public Map<String, Object> getValues(double evaluationTime, MonteCarloSimulationModel model) throws CalculationException
{
RandomVariable values = getValue(evaluationTime, model);
if(values == null) {
return null;
}
// Sum up values on path
double value = values.getAverage();
double error = values.getStandardError();
Map<String, Object> results = new HashMap<>();
results.put("value", value);
results.put("error", error);
return results;
}
|
class class_name[name] begin[{]
method[getValues, return_type[type[Map]], modifier[public], parameter[evaluationTime, model]] begin[{]
local_variable[type[RandomVariable], values]
if[binary_operation[member[.values], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[double], value]
local_variable[type[double], error]
local_variable[type[Map], results]
call[results.put, parameter[literal["value"], member[.value]]]
call[results.put, parameter[literal["error"], member[.error]]]
return[member[.results]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getValues] operator[SEP] Keyword[double] identifier[evaluationTime] , identifier[MonteCarloSimulationModel] identifier[model] operator[SEP] Keyword[throws] identifier[CalculationException] {
identifier[RandomVariable] identifier[values] operator[=] identifier[getValue] operator[SEP] identifier[evaluationTime] , identifier[model] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[values] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[double] identifier[value] operator[=] identifier[values] operator[SEP] identifier[getAverage] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[error] operator[=] identifier[values] operator[SEP] identifier[getStandardError] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[results] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[value] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[error] operator[SEP] operator[SEP] Keyword[return] identifier[results] operator[SEP]
}
|
public static PeriodDuration of(Duration duration) {
Objects.requireNonNull(duration, "The duration must not be null");
return new PeriodDuration(Period.ZERO, duration);
}
|
class class_name[name] begin[{]
method[of, return_type[type[PeriodDuration]], modifier[public static], parameter[duration]] begin[{]
call[Objects.requireNonNull, parameter[member[.duration], literal["The duration must not be null"]]]
return[ClassCreator(arguments=[MemberReference(member=ZERO, postfix_operators=[], prefix_operators=[], qualifier=Period, selectors=[]), MemberReference(member=duration, 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=PeriodDuration, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[PeriodDuration] identifier[of] operator[SEP] identifier[Duration] identifier[duration] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[duration] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PeriodDuration] operator[SEP] identifier[Period] operator[SEP] identifier[ZERO] , identifier[duration] operator[SEP] operator[SEP]
}
|
public static Method lookupMethod( Class parentClass, String methodName, Class[] signature )
{
try
{
return parentClass.getDeclaredMethod( methodName, signature );
}
catch ( NoSuchMethodException e )
{
Class superClass = parentClass.getSuperclass();
return superClass != null ? lookupMethod( superClass, methodName, signature ) : null;
}
}
|
class class_name[name] begin[{]
method[lookupMethod, return_type[type[Method]], modifier[public static], parameter[parentClass, methodName, signature]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclaredMethod, postfix_operators=[], prefix_operators=[], qualifier=parentClass, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSuperclass, postfix_operators=[], prefix_operators=[], qualifier=parentClass, selectors=[], type_arguments=None), name=superClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None)), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=superClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[MemberReference(member=superClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lookupMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Method] identifier[lookupMethod] operator[SEP] identifier[Class] identifier[parentClass] , identifier[String] identifier[methodName] , identifier[Class] operator[SEP] operator[SEP] identifier[signature] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[parentClass] operator[SEP] identifier[getDeclaredMethod] operator[SEP] identifier[methodName] , identifier[signature] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
identifier[Class] identifier[superClass] operator[=] identifier[parentClass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[superClass] operator[!=] Other[null] operator[?] identifier[lookupMethod] operator[SEP] identifier[superClass] , identifier[methodName] , identifier[signature] operator[SEP] operator[:] Other[null] operator[SEP]
}
}
|
Object eval(Class scriptClass, final ScriptContext ctx) throws ScriptException {
// Bindings so script has access to this environment.
// Only initialize once.
if (null == ctx.getAttribute("context", ScriptContext.ENGINE_SCOPE)) {
// add context to bindings
ctx.setAttribute("context", ctx, ScriptContext.ENGINE_SCOPE);
// direct output to ctx.getWriter
// If we're wrapping with a PrintWriter here,
// enable autoFlush because otherwise it might not get done!
final Writer writer = ctx.getWriter();
ctx.setAttribute("out", (writer instanceof PrintWriter) ?
writer :
new PrintWriter(writer, true),
ScriptContext.ENGINE_SCOPE);
// Not going to do this after all (at least for now).
// Scripts can use context.{reader, writer, errorWriter}.
// That is a modern version of System.{in, out, err} or Console.{reader, writer}().
//
// // New I/O names consistent with ScriptContext and java.io.Console.
//
// ctx.setAttribute("writer", writer, ScriptContext.ENGINE_SCOPE);
//
// // Direct errors to ctx.getErrorWriter
// final Writer errorWriter = ctx.getErrorWriter();
// ctx.setAttribute("errorWriter", (errorWriter instanceof PrintWriter) ?
// errorWriter :
// new PrintWriter(errorWriter),
// ScriptContext.ENGINE_SCOPE);
//
// // Get input from ctx.getReader
// // We don't wrap with BufferedReader here because we expect that if
// // the host wants that they do it. Either way Groovy scripts will
// // always have readLine because the GDK supplies it for Reader.
// ctx.setAttribute("reader", ctx.getReader(), ScriptContext.ENGINE_SCOPE);
}
// Fix for GROOVY-3669: Can't use several times the same JSR-223 ScriptContext for differents groovy script
if (ctx.getWriter() != null) {
ctx.setAttribute("out", new PrintWriter(ctx.getWriter(), true), ScriptContext.ENGINE_SCOPE);
}
/*
* We use the following Binding instance so that global variable lookup
* will be done in the current ScriptContext instance.
*/
Binding binding = new Binding(ctx.getBindings(ScriptContext.ENGINE_SCOPE)) {
@Override
public Object getVariable(String name) {
synchronized (ctx) {
int scope = ctx.getAttributesScope(name);
if (scope != -1) {
return ctx.getAttribute(name, scope);
}
}
throw new MissingPropertyException(name, getClass());
}
@Override
public void setVariable(String name, Object value) {
synchronized (ctx) {
int scope = ctx.getAttributesScope(name);
if (scope == -1) {
scope = ScriptContext.ENGINE_SCOPE;
}
ctx.setAttribute(name, value, scope);
}
}
};
try {
// if this class is not an instance of Script, it's a full-blown class
// then simply return that class
if (!Script.class.isAssignableFrom(scriptClass)) {
return scriptClass;
} else {
// it's a script
Script scriptObject = InvokerHelper.createScript(scriptClass, binding);
// save all current closures into global closures map
Method[] methods = scriptClass.getMethods();
for (Method m : methods) {
String name = m.getName();
globalClosures.put(name, new MethodClosure(scriptObject, name));
}
MetaClass oldMetaClass = scriptObject.getMetaClass();
/*
* We override the MetaClass of this script object so that we can
* forward calls to global closures (of previous or future "eval" calls)
* This gives the illusion of working on the same "global" scope.
*/
scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
@Override
public Object invokeMethod(Object object, String name, Object args) {
if (args == null) {
return invokeMethod(object, name, MetaClassHelper.EMPTY_ARRAY);
}
if (args instanceof Tuple) {
return invokeMethod(object, name, ((Tuple) args).toArray());
}
if (args instanceof Object[]) {
return invokeMethod(object, name, (Object[]) args);
} else {
return invokeMethod(object, name, new Object[]{args});
}
}
@Override
public Object invokeMethod(Object object, String name, Object[] args) {
try {
return super.invokeMethod(object, name, args);
} catch (MissingMethodException mme) {
return callGlobal(name, args, ctx);
}
}
@Override
public Object invokeStaticMethod(Object object, String name, Object[] args) {
try {
return super.invokeStaticMethod(object, name, args);
} catch (MissingMethodException mme) {
return callGlobal(name, args, ctx);
}
}
});
return scriptObject.run();
}
} catch (Exception e) {
throw new ScriptException(e);
} finally {
// Fix for GROOVY-3669: Can't use several times the same JSR-223 ScriptContext for different groovy script
// Groovy's scripting engine implementation adds those two variables in the binding
// but should clean up afterwards
ctx.removeAttribute("context", ScriptContext.ENGINE_SCOPE);
ctx.removeAttribute("out", ScriptContext.ENGINE_SCOPE);
}
}
|
class class_name[name] begin[{]
method[eval, return_type[type[Object]], modifier[default], parameter[scriptClass, ctx]] begin[{]
if[binary_operation[literal[null], ==, call[ctx.getAttribute, parameter[literal["context"], member[ScriptContext.ENGINE_SCOPE]]]]] begin[{]
call[ctx.setAttribute, parameter[literal["context"], member[.ctx], member[ScriptContext.ENGINE_SCOPE]]]
local_variable[type[Writer], writer]
call[ctx.setAttribute, parameter[literal["out"], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=PrintWriter, sub_type=None), operator=instanceof), if_false=ClassCreator(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintWriter, sub_type=None)), if_true=MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), member[ScriptContext.ENGINE_SCOPE]]]
else begin[{]
None
end[}]
if[binary_operation[call[ctx.getWriter, parameter[]], !=, literal[null]]] begin[{]
call[ctx.setAttribute, parameter[literal["out"], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getWriter, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintWriter, sub_type=None)), member[ScriptContext.ENGINE_SCOPE]]]
else begin[{]
None
end[}]
local_variable[type[Binding], binding]
TryStatement(block=[IfStatement(condition=ClassReference(postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=scriptClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Script, sub_type=None)), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=scriptClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=binding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createScript, postfix_operators=[], prefix_operators=[], qualifier=InvokerHelper, selectors=[], type_arguments=None), name=scriptObject)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Script, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=scriptClass, selectors=[], type_arguments=None), name=methods)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Method, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=scriptObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, 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=MethodClosure, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=globalClosures, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=methods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetaClass, postfix_operators=[], prefix_operators=[], qualifier=scriptObject, selectors=[], type_arguments=None), name=oldMetaClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetaClass, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=oldMetaClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=args, 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=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=EMPTY_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=MetaClassHelper, selectors=[])], member=invokeMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Tuple, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Tuple, sub_type=None))], member=invokeMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=invokeMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))], member=invokeMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=invokeMethod, parameters=[FormalParameter(annotations=[], modifiers=set(), name=object, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=name, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=args, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[ReturnStatement(expression=SuperMethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invokeMethod, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callGlobal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=mme, types=['MissingMethodException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=invokeMethod, parameters=[FormalParameter(annotations=[], modifiers=set(), name=object, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=name, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=args, type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[ReturnStatement(expression=SuperMethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invokeStaticMethod, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callGlobal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=mme, types=['MissingMethodException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=invokeStaticMethod, parameters=[FormalParameter(annotations=[], modifiers=set(), name=object, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=name, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=args, type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DelegatingMetaClass, sub_type=None))], member=setMetaClass, postfix_operators=[], prefix_operators=[], qualifier=scriptObject, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=run, postfix_operators=[], prefix_operators=[], qualifier=scriptObject, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=scriptClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=ScriptException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="context"), MemberReference(member=ENGINE_SCOPE, postfix_operators=[], prefix_operators=[], qualifier=ScriptContext, selectors=[])], member=removeAttribute, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="out"), MemberReference(member=ENGINE_SCOPE, postfix_operators=[], prefix_operators=[], qualifier=ScriptContext, selectors=[])], member=removeAttribute, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
identifier[Object] identifier[eval] operator[SEP] identifier[Class] identifier[scriptClass] , Keyword[final] identifier[ScriptContext] identifier[ctx] operator[SEP] Keyword[throws] identifier[ScriptException] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[ctx] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] , identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP] {
identifier[ctx] operator[SEP] identifier[setAttribute] operator[SEP] literal[String] , identifier[ctx] , identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP] Keyword[final] identifier[Writer] identifier[writer] operator[=] identifier[ctx] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[setAttribute] operator[SEP] literal[String] , operator[SEP] identifier[writer] Keyword[instanceof] identifier[PrintWriter] operator[SEP] operator[?] identifier[writer] operator[:] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[writer] , literal[boolean] operator[SEP] , identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ctx] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[ctx] operator[SEP] identifier[setAttribute] operator[SEP] literal[String] , Keyword[new] identifier[PrintWriter] operator[SEP] identifier[ctx] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] , identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP]
}
identifier[Binding] identifier[binding] operator[=] Keyword[new] identifier[Binding] operator[SEP] identifier[ctx] operator[SEP] identifier[getBindings] operator[SEP] identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[getVariable] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[ctx] operator[SEP] {
Keyword[int] identifier[scope] operator[=] identifier[ctx] operator[SEP] identifier[getAttributesScope] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scope] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[ctx] operator[SEP] identifier[getAttribute] operator[SEP] identifier[name] , identifier[scope] operator[SEP] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[MissingPropertyException] operator[SEP] identifier[name] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setVariable] operator[SEP] identifier[String] identifier[name] , identifier[Object] identifier[value] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[ctx] operator[SEP] {
Keyword[int] identifier[scope] operator[=] identifier[ctx] operator[SEP] identifier[getAttributesScope] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scope] operator[==] operator[-] Other[1] operator[SEP] {
identifier[scope] operator[=] identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP]
}
identifier[ctx] operator[SEP] identifier[setAttribute] operator[SEP] identifier[name] , identifier[value] , identifier[scope] operator[SEP] operator[SEP]
}
}
} operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[Script] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[scriptClass] operator[SEP] operator[SEP] {
Keyword[return] identifier[scriptClass] operator[SEP]
}
Keyword[else] {
identifier[Script] identifier[scriptObject] operator[=] identifier[InvokerHelper] operator[SEP] identifier[createScript] operator[SEP] identifier[scriptClass] , identifier[binding] operator[SEP] operator[SEP] identifier[Method] operator[SEP] operator[SEP] identifier[methods] operator[=] identifier[scriptClass] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[m] operator[:] identifier[methods] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[m] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[globalClosures] operator[SEP] identifier[put] operator[SEP] identifier[name] , Keyword[new] identifier[MethodClosure] operator[SEP] identifier[scriptObject] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
identifier[MetaClass] identifier[oldMetaClass] operator[=] identifier[scriptObject] operator[SEP] identifier[getMetaClass] operator[SEP] operator[SEP] operator[SEP] identifier[scriptObject] operator[SEP] identifier[setMetaClass] operator[SEP] Keyword[new] identifier[DelegatingMetaClass] operator[SEP] identifier[oldMetaClass] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[invokeMethod] operator[SEP] identifier[Object] identifier[object] , identifier[String] identifier[name] , identifier[Object] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[invokeMethod] operator[SEP] identifier[object] , identifier[name] , identifier[MetaClassHelper] operator[SEP] identifier[EMPTY_ARRAY] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[args] Keyword[instanceof] identifier[Tuple] operator[SEP] {
Keyword[return] identifier[invokeMethod] operator[SEP] identifier[object] , identifier[name] , operator[SEP] operator[SEP] identifier[Tuple] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[args] Keyword[instanceof] identifier[Object] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[invokeMethod] operator[SEP] identifier[object] , identifier[name] , operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[args] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[invokeMethod] operator[SEP] identifier[object] , identifier[name] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[args]
} operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[invokeMethod] operator[SEP] identifier[Object] identifier[object] , identifier[String] identifier[name] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[super] operator[SEP] identifier[invokeMethod] operator[SEP] identifier[object] , identifier[name] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MissingMethodException] identifier[mme] operator[SEP] {
Keyword[return] identifier[callGlobal] operator[SEP] identifier[name] , identifier[args] , identifier[ctx] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[invokeStaticMethod] operator[SEP] identifier[Object] identifier[object] , identifier[String] identifier[name] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[super] operator[SEP] identifier[invokeStaticMethod] operator[SEP] identifier[object] , identifier[name] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MissingMethodException] identifier[mme] operator[SEP] {
Keyword[return] identifier[callGlobal] operator[SEP] identifier[name] , identifier[args] , identifier[ctx] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] Keyword[return] identifier[scriptObject] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ScriptException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[ctx] operator[SEP] identifier[removeAttribute] operator[SEP] literal[String] , identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[removeAttribute] operator[SEP] literal[String] , identifier[ScriptContext] operator[SEP] identifier[ENGINE_SCOPE] operator[SEP] operator[SEP]
}
}
|
public void suspendFlexResponse() {
for (int i = 0; i < m_flexResponseList.size(); i++) {
CmsFlexResponse res = m_flexResponseList.get(i);
res.setSuspended(true);
}
}
|
class class_name[name] begin[{]
method[suspendFlexResponse, return_type[void], modifier[public], parameter[]] begin[{]
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=m_flexResponseList, selectors=[], type_arguments=None), name=res)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsFlexResponse, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setSuspended, postfix_operators=[], prefix_operators=[], qualifier=res, 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=m_flexResponseList, 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)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[suspendFlexResponse] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[m_flexResponseList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[CmsFlexResponse] identifier[res] operator[=] identifier[m_flexResponseList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[res] operator[SEP] identifier[setSuspended] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
public void marshall(DestinationBackup destinationBackup, ProtocolMarshaller protocolMarshaller) {
if (destinationBackup == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(destinationBackup.getCreateTimestamp(), CREATETIMESTAMP_BINDING);
protocolMarshaller.marshall(destinationBackup.getSourceRegion(), SOURCEREGION_BINDING);
protocolMarshaller.marshall(destinationBackup.getSourceBackup(), SOURCEBACKUP_BINDING);
protocolMarshaller.marshall(destinationBackup.getSourceCluster(), SOURCECLUSTER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
|
class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[destinationBackup, protocolMarshaller]] begin[{]
if[binary_operation[member[.destinationBackup], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCreateTimestamp, postfix_operators=[], prefix_operators=[], qualifier=destinationBackup, selectors=[], type_arguments=None), MemberReference(member=CREATETIMESTAMP_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSourceRegion, postfix_operators=[], prefix_operators=[], qualifier=destinationBackup, selectors=[], type_arguments=None), MemberReference(member=SOURCEREGION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSourceBackup, postfix_operators=[], prefix_operators=[], qualifier=destinationBackup, selectors=[], type_arguments=None), MemberReference(member=SOURCEBACKUP_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSourceCluster, postfix_operators=[], prefix_operators=[], qualifier=destinationBackup, selectors=[], type_arguments=None), MemberReference(member=SOURCECLUSTER_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DestinationBackup] identifier[destinationBackup] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[destinationBackup] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[destinationBackup] operator[SEP] identifier[getCreateTimestamp] operator[SEP] operator[SEP] , identifier[CREATETIMESTAMP_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[destinationBackup] operator[SEP] identifier[getSourceRegion] operator[SEP] operator[SEP] , identifier[SOURCEREGION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[destinationBackup] operator[SEP] identifier[getSourceBackup] operator[SEP] operator[SEP] , identifier[SOURCEBACKUP_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[destinationBackup] operator[SEP] identifier[getSourceCluster] operator[SEP] operator[SEP] , identifier[SOURCECLUSTER_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void marshall(GetServersRequest getServersRequest, ProtocolMarshaller protocolMarshaller) {
if (getServersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getServersRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(getServersRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(getServersRequest.getVmServerAddressList(), VMSERVERADDRESSLIST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
|
class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[getServersRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getServersRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=getServersRequest, selectors=[], type_arguments=None), MemberReference(member=NEXTTOKEN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMaxResults, postfix_operators=[], prefix_operators=[], qualifier=getServersRequest, selectors=[], type_arguments=None), MemberReference(member=MAXRESULTS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getVmServerAddressList, postfix_operators=[], prefix_operators=[], qualifier=getServersRequest, selectors=[], type_arguments=None), MemberReference(member=VMSERVERADDRESSLIST_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[GetServersRequest] identifier[getServersRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getServersRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getServersRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getServersRequest] operator[SEP] identifier[getMaxResults] operator[SEP] operator[SEP] , identifier[MAXRESULTS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getServersRequest] operator[SEP] identifier[getVmServerAddressList] operator[SEP] operator[SEP] , identifier[VMSERVERADDRESSLIST_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Path("/{roleName}/users/{cuid}")
@ApiOperation(value="Delete a role or remove a user from a role",
notes="If users/{cuid} is present, user is removed from role.", response=StatusMessage.class)
public JSONObject delete(String path, JSONObject content, Map<String,String> headers)
throws ServiceException, JSONException {
String name = getSegment(path, 1);
String rel = getSegment(path, 2);
UserServices userServices = ServiceLocator.getUserServices();
try {
if (rel == null) {
userServices.deleteRole(name);
}
else if (rel.equals("users")) {
String cuid = getSegment(path, 3);
userServices.removeUserFromRole(cuid, name);
}
}
catch (DataAccessException ex) {
throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
}
return null;
}
|
class class_name[name] begin[{]
method[delete, return_type[type[JSONObject]], modifier[public], parameter[path, content, headers]] begin[{]
local_variable[type[String], name]
local_variable[type[String], rel]
local_variable[type[UserServices], userServices]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="users")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=rel, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], member=getSegment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=cuid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cuid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeUserFromRole, postfix_operators=[], prefix_operators=[], qualifier=userServices, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deleteRole, postfix_operators=[], prefix_operators=[], qualifier=userServices, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_500_INTERNAL_ERROR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DataAccessException']))], finally_block=None, label=None, resources=None)
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[ApiOperation] operator[SEP] identifier[value] operator[=] literal[String] , identifier[notes] operator[=] literal[String] , identifier[response] operator[=] identifier[StatusMessage] operator[SEP] Keyword[class] operator[SEP] Keyword[public] identifier[JSONObject] identifier[delete] operator[SEP] identifier[String] identifier[path] , identifier[JSONObject] identifier[content] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[headers] operator[SEP] Keyword[throws] identifier[ServiceException] , identifier[JSONException] {
identifier[String] identifier[name] operator[=] identifier[getSegment] operator[SEP] identifier[path] , Other[1] operator[SEP] operator[SEP] identifier[String] identifier[rel] operator[=] identifier[getSegment] operator[SEP] identifier[path] , Other[2] operator[SEP] operator[SEP] identifier[UserServices] identifier[userServices] operator[=] identifier[ServiceLocator] operator[SEP] identifier[getUserServices] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[rel] operator[==] Other[null] operator[SEP] {
identifier[userServices] operator[SEP] identifier[deleteRole] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[rel] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[cuid] operator[=] identifier[getSegment] operator[SEP] identifier[path] , Other[3] operator[SEP] operator[SEP] identifier[userServices] operator[SEP] identifier[removeUserFromRole] operator[SEP] identifier[cuid] , identifier[name] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[DataAccessException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[HTTP_500_INTERNAL_ERROR] , identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected void configureSigningKey(final String signingSecretKey) {
try {
if (ResourceUtils.doesResourceExist(signingSecretKey)) {
configureSigningKeyFromPrivateKeyResource(signingSecretKey);
}
} finally {
if (this.signingKey == null) {
setSigningKey(new AesKey(signingSecretKey.getBytes(StandardCharsets.UTF_8)));
LOGGER.trace("Created signing key instance [{}] based on provided secret key", this.signingKey.getClass().getSimpleName());
}
}
}
|
class class_name[name] begin[{]
method[configureSigningKey, return_type[void], modifier[protected], parameter[signingSecretKey]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=signingSecretKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doesResourceExist, postfix_operators=[], prefix_operators=[], qualifier=ResourceUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=signingSecretKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=configureSigningKeyFromPrivateKeyResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=signingKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=signingSecretKey, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AesKey, sub_type=None))], member=setSigningKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Created signing key instance [{}] based on provided secret key"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=signingKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=trace, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[configureSigningKey] operator[SEP] Keyword[final] identifier[String] identifier[signingSecretKey] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[ResourceUtils] operator[SEP] identifier[doesResourceExist] operator[SEP] identifier[signingSecretKey] operator[SEP] operator[SEP] {
identifier[configureSigningKeyFromPrivateKeyResource] operator[SEP] identifier[signingSecretKey] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[signingKey] operator[==] Other[null] operator[SEP] {
identifier[setSigningKey] operator[SEP] Keyword[new] identifier[AesKey] operator[SEP] identifier[signingSecretKey] operator[SEP] identifier[getBytes] operator[SEP] identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[signingKey] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static Collection<String> listPackageResources(String packageName, String fileNamesPattern)
{
String packagePath = Files.dot2urlpath(packageName);
Set<URL> packageURLs = new HashSet<>();
for(ClassLoader classLoader : new ClassLoader[]
{
Thread.currentThread().getContextClassLoader(), Classes.class.getClassLoader(), ClassLoader.getSystemClassLoader()
}) {
try {
packageURLs.addAll(Collections.list(classLoader.getResources(packagePath)));
}
catch(IOException e) {
log.error(e);
}
}
if(packageURLs.isEmpty()) {
throw new NoSuchBeingException("Package |%s| not found.", packageName);
}
Set<String> resources = new HashSet<>();
for(URL packageURL : packageURLs) {
resources.addAll(listPackageResources(packageURL, packagePath, fileNamesPattern));
}
return resources;
}
|
class class_name[name] begin[{]
method[listPackageResources, return_type[type[Collection]], modifier[public static], parameter[packageName, fileNamesPattern]] begin[{]
local_variable[type[String], packagePath]
local_variable[type[Set], packageURLs]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=packagePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResources, postfix_operators=[], prefix_operators=[], qualifier=classLoader, selectors=[], type_arguments=None)], member=list, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=packageURLs, 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=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=EnhancedForControl(iterable=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=getContextClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Classes, sub_type=None)), MethodInvocation(arguments=[], member=getSystemClassLoader, postfix_operators=[], prefix_operators=[], qualifier=ClassLoader, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassLoader, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=classLoader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ClassLoader, sub_type=None))), label=None)
if[call[packageURLs.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Package |%s| not found."), MemberReference(member=packageName, 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=NoSuchBeingException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Set], resources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=packageURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=packagePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileNamesPattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listPackageResources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=resources, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=packageURLs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=packageURL)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None))), label=None)
return[member[.resources]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Collection] operator[<] identifier[String] operator[>] identifier[listPackageResources] operator[SEP] identifier[String] identifier[packageName] , identifier[String] identifier[fileNamesPattern] operator[SEP] {
identifier[String] identifier[packagePath] operator[=] identifier[Files] operator[SEP] identifier[dot2urlpath] operator[SEP] identifier[packageName] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[URL] operator[>] identifier[packageURLs] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ClassLoader] identifier[classLoader] operator[:] Keyword[new] identifier[ClassLoader] operator[SEP] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] , identifier[Classes] operator[SEP] Keyword[class] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] , identifier[ClassLoader] operator[SEP] identifier[getSystemClassLoader] operator[SEP] operator[SEP]
} operator[SEP] {
Keyword[try] {
identifier[packageURLs] operator[SEP] identifier[addAll] operator[SEP] identifier[Collections] operator[SEP] identifier[list] operator[SEP] identifier[classLoader] operator[SEP] identifier[getResources] operator[SEP] identifier[packagePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[packageURLs] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchBeingException] operator[SEP] literal[String] , identifier[packageName] operator[SEP] operator[SEP]
}
identifier[Set] operator[<] identifier[String] operator[>] identifier[resources] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[URL] identifier[packageURL] operator[:] identifier[packageURLs] operator[SEP] {
identifier[resources] operator[SEP] identifier[addAll] operator[SEP] identifier[listPackageResources] operator[SEP] identifier[packageURL] , identifier[packagePath] , identifier[fileNamesPattern] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[resources] operator[SEP]
}
|
@Override
public boolean isPushSupported() {
// Find the existing H2 connection and stream so we can use them to send the
// push_promise frame to the client.
HttpInboundServiceContext isc = (HttpInboundServiceContext) getServiceContext();
HttpInboundLink link = ((HttpInboundServiceContextImpl) isc).getLink();
if (!(link instanceof H2HttpInboundLinkWrap)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "HTTPRequestMessageImpl.isPushSupported(): Error: This is not an HTTP2 connection, push() was ignored.");
}
return false;
}
if ((((H2HttpInboundLinkWrap) link).muxLink == null) ||
(((H2HttpInboundLinkWrap) link).muxLink.getRemoteConnectionSettings() == null)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "HTTPRequestMessageImpl.isPushSupported(): The H2HttpInboundLinkWrap muxlink is null, push() was ignored.");
}
return false;
}
// If the link is closing, don't bother
//if (((H2InboundLink) link).linkStatus == LINK_STATUS.CLOSING) {
// if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "HTTPRequestMessageImpl.pushNewRequest(): Link is closing, push() was ignored.");
// }
// return false;
// }
// Don't send the push_promise frame if the client doesn't want it
if (((H2HttpInboundLinkWrap) link).muxLink.getRemoteConnectionSettings().getEnablePush() != 1) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "HTTPRequestMessageImpl.isPushSupported(): The client does not accept push_promise frames, push() was ignored.");
}
return false;
}
return true;
}
|
class class_name[name] begin[{]
method[isPushSupported, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[HttpInboundServiceContext], isc]
local_variable[type[HttpInboundLink], link]
if[binary_operation[member[.link], instanceof, type[H2HttpInboundLinkWrap]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["HTTPRequestMessageImpl.isPushSupported(): Error: This is not an HTTP2 connection, push() was ignored."]]]
else begin[{]
None
end[}]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[Cast(expression=MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=H2HttpInboundLinkWrap, sub_type=None)), ==, literal[null]], ||, binary_operation[Cast(expression=MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=H2HttpInboundLinkWrap, sub_type=None)), ==, literal[null]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["HTTPRequestMessageImpl.isPushSupported(): The H2HttpInboundLinkWrap muxlink is null, push() was ignored."]]]
else begin[{]
None
end[}]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[Cast(expression=MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=H2HttpInboundLinkWrap, sub_type=None)), !=, literal[1]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["HTTPRequestMessageImpl.isPushSupported(): The client does not accept push_promise frames, push() was ignored."]]]
else begin[{]
None
end[}]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isPushSupported] operator[SEP] operator[SEP] {
identifier[HttpInboundServiceContext] identifier[isc] operator[=] operator[SEP] identifier[HttpInboundServiceContext] operator[SEP] identifier[getServiceContext] operator[SEP] operator[SEP] operator[SEP] identifier[HttpInboundLink] identifier[link] operator[=] operator[SEP] operator[SEP] identifier[HttpInboundServiceContextImpl] operator[SEP] identifier[isc] operator[SEP] operator[SEP] identifier[getLink] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[link] Keyword[instanceof] identifier[H2HttpInboundLinkWrap] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[H2HttpInboundLinkWrap] operator[SEP] identifier[link] operator[SEP] operator[SEP] identifier[muxLink] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] operator[SEP] operator[SEP] identifier[H2HttpInboundLinkWrap] operator[SEP] identifier[link] operator[SEP] operator[SEP] identifier[muxLink] operator[SEP] identifier[getRemoteConnectionSettings] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[H2HttpInboundLinkWrap] operator[SEP] identifier[link] operator[SEP] operator[SEP] identifier[muxLink] operator[SEP] identifier[getRemoteConnectionSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getEnablePush] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static void checkDateElements(List<Vertex> linkedArray)
{
if (linkedArray.size() < 2)
return;
ListIterator<Vertex> listIterator = linkedArray.listIterator();
Vertex next = listIterator.next();
Vertex current = next;
while (listIterator.hasNext())
{
next = listIterator.next();
if (TextUtility.isAllNum(current.realWord) || TextUtility.isAllChineseNum(current.realWord))
{
//===== 1、如果当前词是数字,下一个词是“月、日、时、分、秒、月份”中的一个,则合并且当前词词性是时间
String nextWord = next.realWord;
if ((nextWord.length() == 1 && "月日时分秒".contains(nextWord)) || (nextWord.length() == 2 && nextWord.equals("月份")))
{
mergeDate(listIterator, next, current);
}
//===== 2、如果当前词是可以作为年份的数字,下一个词是“年”,则合并,词性为时间,否则为数字。
else if (nextWord.equals("年"))
{
if (TextUtility.isYearTime(current.realWord))
{
mergeDate(listIterator, next, current);
}
//===== 否则当前词就是数字了 =====
else
{
current.confirmNature(Nature.m);
}
}
else
{
//===== 3、如果最后一个汉字是"点" ,则认为当前数字是时间
if (current.realWord.endsWith("点"))
{
current.confirmNature(Nature.t, true);
}
else
{
char[] tmpCharArray = current.realWord.toCharArray();
String lastChar = String.valueOf(tmpCharArray[tmpCharArray.length - 1]);
//===== 4、如果当前串最后一个汉字不是"∶·./"和半角的'.''/',那么是数
if (!"∶·././".contains(lastChar))
{
current.confirmNature(Nature.m, true);
}
//===== 5、当前串最后一个汉字是"∶·./"和半角的'.''/',且长度大于1,那么去掉最后一个字符。例如"1."
else if (current.realWord.length() > 1)
{
char last = current.realWord.charAt(current.realWord.length() - 1);
current = Vertex.newNumberInstance(current.realWord.substring(0, current.realWord.length() - 1));
listIterator.previous();
listIterator.previous();
listIterator.set(current);
listIterator.next();
listIterator.add(Vertex.newPunctuationInstance(String.valueOf(last)));
}
}
}
}
current = next;
}
// logger.trace("日期识别后:" + Graph.parseResult(linkedArray));
}
|
class class_name[name] begin[{]
method[checkDateElements, return_type[void], modifier[private static], parameter[linkedArray]] begin[{]
if[binary_operation[call[linkedArray.size, parameter[]], <, literal[2]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[ListIterator], listIterator]
local_variable[type[Vertex], next]
local_variable[type[Vertex], current]
while[call[listIterator.hasNext, parameter[]]] begin[{]
assign[member[.next], call[listIterator.next, parameter[]]]
if[binary_operation[call[TextUtility.isAllNum, parameter[member[current.realWord]]], ||, call[TextUtility.isAllChineseNum, parameter[member[current.realWord]]]]] begin[{]
local_variable[type[String], nextWord]
if[binary_operation[binary_operation[binary_operation[call[nextWord.length, parameter[]], ==, literal[1]], &&, literal["月日时分秒"]], ||, binary_operation[binary_operation[call[nextWord.length, parameter[]], ==, literal[2]], &&, call[nextWord.equals, parameter[literal["月份"]]]]]] begin[{]
call[.mergeDate, parameter[member[.listIterator], member[.next], member[.current]]]
else begin[{]
if[call[nextWord.equals, parameter[literal["年"]]]] begin[{]
if[call[TextUtility.isYearTime, parameter[member[current.realWord]]]] begin[{]
call[.mergeDate, parameter[member[.listIterator], member[.next], member[.current]]]
else begin[{]
call[current.confirmNature, parameter[member[Nature.m]]]
end[}]
else begin[{]
if[call[current.realWord.endsWith, parameter[literal["点"]]]] begin[{]
call[current.confirmNature, parameter[member[Nature.t], literal[true]]]
else begin[{]
local_variable[type[char], tmpCharArray]
local_variable[type[String], lastChar]
if[literal["∶·././"]] begin[{]
call[current.confirmNature, parameter[member[Nature.m], literal[true]]]
else begin[{]
if[binary_operation[call[current.realWord.length, parameter[]], >, literal[1]]] begin[{]
local_variable[type[char], last]
assign[member[.current], call[Vertex.newNumberInstance, parameter[call[current.realWord.substring, parameter[literal[0], binary_operation[call[current.realWord.length, parameter[]], -, literal[1]]]]]]]
call[listIterator.previous, parameter[]]
call[listIterator.previous, parameter[]]
call[listIterator.set, parameter[member[.current]]]
call[listIterator.next, parameter[]]
call[listIterator.add, parameter[call[Vertex.newPunctuationInstance, parameter[call[String.valueOf, parameter[member[.last]]]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
else begin[{]
None
end[}]
assign[member[.current], member[.next]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[checkDateElements] operator[SEP] identifier[List] operator[<] identifier[Vertex] operator[>] identifier[linkedArray] operator[SEP] {
Keyword[if] operator[SEP] identifier[linkedArray] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[2] operator[SEP] Keyword[return] operator[SEP] identifier[ListIterator] operator[<] identifier[Vertex] operator[>] identifier[listIterator] operator[=] identifier[linkedArray] operator[SEP] identifier[listIterator] operator[SEP] operator[SEP] operator[SEP] identifier[Vertex] identifier[next] operator[=] identifier[listIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[Vertex] identifier[current] operator[=] identifier[next] operator[SEP] Keyword[while] operator[SEP] identifier[listIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[next] operator[=] identifier[listIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TextUtility] operator[SEP] identifier[isAllNum] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] operator[||] identifier[TextUtility] operator[SEP] identifier[isAllChineseNum] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] operator[SEP] {
identifier[String] identifier[nextWord] operator[=] identifier[next] operator[SEP] identifier[realWord] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[nextWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] literal[String] operator[SEP] identifier[contains] operator[SEP] identifier[nextWord] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[nextWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[2] operator[&&] identifier[nextWord] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[mergeDate] operator[SEP] identifier[listIterator] , identifier[next] , identifier[current] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[nextWord] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TextUtility] operator[SEP] identifier[isYearTime] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] operator[SEP] {
identifier[mergeDate] operator[SEP] identifier[listIterator] , identifier[next] , identifier[current] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[current] operator[SEP] identifier[confirmNature] operator[SEP] identifier[Nature] operator[SEP] identifier[m] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[current] operator[SEP] identifier[confirmNature] operator[SEP] identifier[Nature] operator[SEP] identifier[t] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[char] operator[SEP] operator[SEP] identifier[tmpCharArray] operator[=] identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[lastChar] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[tmpCharArray] operator[SEP] identifier[tmpCharArray] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[contains] operator[SEP] identifier[lastChar] operator[SEP] operator[SEP] {
identifier[current] operator[SEP] identifier[confirmNature] operator[SEP] identifier[Nature] operator[SEP] identifier[m] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[char] identifier[last] operator[=] identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[charAt] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[current] operator[=] identifier[Vertex] operator[SEP] identifier[newNumberInstance] operator[SEP] identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[current] operator[SEP] identifier[realWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[listIterator] operator[SEP] identifier[previous] operator[SEP] operator[SEP] operator[SEP] identifier[listIterator] operator[SEP] identifier[previous] operator[SEP] operator[SEP] operator[SEP] identifier[listIterator] operator[SEP] identifier[set] operator[SEP] identifier[current] operator[SEP] operator[SEP] identifier[listIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[listIterator] operator[SEP] identifier[add] operator[SEP] identifier[Vertex] operator[SEP] identifier[newPunctuationInstance] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
identifier[current] operator[=] identifier[next] operator[SEP]
}
}
|
public Set<Evse> getEvses(Long chargingStationTypeId) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
return chargingStationType.getEvses();
}
|
class class_name[name] begin[{]
method[getEvses, return_type[type[Set]], modifier[public], parameter[chargingStationTypeId]] begin[{]
local_variable[type[ChargingStationType], chargingStationType]
return[call[chargingStationType.getEvses, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Set] operator[<] identifier[Evse] operator[>] identifier[getEvses] operator[SEP] identifier[Long] identifier[chargingStationTypeId] operator[SEP] {
identifier[ChargingStationType] identifier[chargingStationType] operator[=] identifier[chargingStationTypeRepository] operator[SEP] identifier[findOne] operator[SEP] identifier[chargingStationTypeId] operator[SEP] operator[SEP] Keyword[return] identifier[chargingStationType] operator[SEP] identifier[getEvses] operator[SEP] operator[SEP] operator[SEP]
}
|
public static LongStream interval(final long delay, final long interval, final TimeUnit unit) {
return of(new LongIteratorEx() {
private final long intervalInMillis = unit.toMillis(interval);
private long nextTime = System.currentTimeMillis() + unit.toMillis(delay);
private long val = 0;
@Override
public boolean hasNext() {
return true;
}
@Override
public long nextLong() {
long now = System.currentTimeMillis();
if (now < nextTime) {
N.sleep(nextTime - now);
}
nextTime += intervalInMillis;
return val++;
}
});
}
|
class class_name[name] begin[{]
method[interval, return_type[type[LongStream]], modifier[public static], parameter[delay, interval, unit]] begin[{]
return[call[.of, parameter[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=interval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toMillis, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[], type_arguments=None), name=intervalInMillis)], documentation=None, modifiers={'final', 'private'}, type=BasicType(dimensions=[], name=long)), FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=delay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toMillis, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[], type_arguments=None), operator=+), name=nextTime)], documentation=None, modifiers={'private'}, type=BasicType(dimensions=[], name=long)), FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=val)], documentation=None, modifiers={'private'}, type=BasicType(dimensions=[], name=long)), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], documentation=None, modifiers={'public'}, name=hasNext, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=now)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=now, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nextTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=nextTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=now, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=N, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=nextTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=intervalInMillis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ReturnStatement(expression=MemberReference(member=val, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=nextLong, parameters=[], return_type=BasicType(dimensions=[], name=long), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LongIteratorEx, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LongStream] identifier[interval] operator[SEP] Keyword[final] Keyword[long] identifier[delay] , Keyword[final] Keyword[long] identifier[interval] , Keyword[final] identifier[TimeUnit] identifier[unit] operator[SEP] {
Keyword[return] identifier[of] operator[SEP] Keyword[new] identifier[LongIteratorEx] operator[SEP] operator[SEP] {
Keyword[private] Keyword[final] Keyword[long] identifier[intervalInMillis] operator[=] identifier[unit] operator[SEP] identifier[toMillis] operator[SEP] identifier[interval] operator[SEP] operator[SEP] Keyword[private] Keyword[long] identifier[nextTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[+] identifier[unit] operator[SEP] identifier[toMillis] operator[SEP] identifier[delay] operator[SEP] operator[SEP] Keyword[private] Keyword[long] identifier[val] operator[=] Other[0] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[nextLong] operator[SEP] operator[SEP] {
Keyword[long] identifier[now] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[now] operator[<] identifier[nextTime] operator[SEP] {
identifier[N] operator[SEP] identifier[sleep] operator[SEP] identifier[nextTime] operator[-] identifier[now] operator[SEP] operator[SEP]
}
identifier[nextTime] operator[+=] identifier[intervalInMillis] operator[SEP] Keyword[return] identifier[val] operator[++] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static Trace fromString(String logcatTrace) throws IllegalTraceException {
if (logcatTrace == null
|| logcatTrace.length() < MIN_TRACE_SIZE
|| logcatTrace.charAt(20) != TRACE_LEVEL_SEPARATOR) {
throw new IllegalTraceException(
"You are trying to create a Trace object from a invalid String. Your trace have to be "
+ "something like: '02-07 17:45:33.014 D/Any debug trace'.");
}
TraceLevel level = TraceLevel.getTraceLevel(logcatTrace.charAt(TRACE_LEVEL_INDEX));
String date = logcatTrace.substring(0, END_OF_DATE_INDEX);
String message = logcatTrace.substring(START_OF_MESSAGE_INDEX, logcatTrace.length());
return new Trace(level, date + " " + message);
}
|
class class_name[name] begin[{]
method[fromString, return_type[type[Trace]], modifier[public static], parameter[logcatTrace]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.logcatTrace], ==, literal[null]], ||, binary_operation[call[logcatTrace.length, parameter[]], <, member[.MIN_TRACE_SIZE]]], ||, binary_operation[call[logcatTrace.charAt, parameter[literal[20]]], !=, member[.TRACE_LEVEL_SEPARATOR]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You are trying to create a Trace object from a invalid String. Your trace have to be "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="something like: '02-07 17:45:33.014 D/Any debug trace'."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalTraceException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[TraceLevel], level]
local_variable[type[String], date]
local_variable[type[String], message]
return[ClassCreator(arguments=[MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Trace, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Trace] identifier[fromString] operator[SEP] identifier[String] identifier[logcatTrace] operator[SEP] Keyword[throws] identifier[IllegalTraceException] {
Keyword[if] operator[SEP] identifier[logcatTrace] operator[==] Other[null] operator[||] identifier[logcatTrace] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] identifier[MIN_TRACE_SIZE] operator[||] identifier[logcatTrace] operator[SEP] identifier[charAt] operator[SEP] Other[20] operator[SEP] operator[!=] identifier[TRACE_LEVEL_SEPARATOR] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalTraceException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[TraceLevel] identifier[level] operator[=] identifier[TraceLevel] operator[SEP] identifier[getTraceLevel] operator[SEP] identifier[logcatTrace] operator[SEP] identifier[charAt] operator[SEP] identifier[TRACE_LEVEL_INDEX] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[date] operator[=] identifier[logcatTrace] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[END_OF_DATE_INDEX] operator[SEP] operator[SEP] identifier[String] identifier[message] operator[=] identifier[logcatTrace] operator[SEP] identifier[substring] operator[SEP] identifier[START_OF_MESSAGE_INDEX] , identifier[logcatTrace] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Trace] operator[SEP] identifier[level] , identifier[date] operator[+] literal[String] operator[+] identifier[message] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"UnnecessaryContinue"})
public static boolean descendOnlyFilePath(String path) {
String[] pathSegments = path.split("/");
//String[] newPathSegments = new String[pathSegments.length];
int i = 0;
for (int indxOrigSegs = 0; indxOrigSegs < pathSegments.length; indxOrigSegs++) {
String s = pathSegments[indxOrigSegs];
if (s.equals("."))
continue;
else if (s.equals("..")) {
if (i == 0)
return false;
i--;
} else {
//newPathSegments[i] = s;
i++;
}
}
return true;
}
|
class class_name[name] begin[{]
method[descendOnlyFilePath, return_type[type[boolean]], modifier[public static], parameter[path]] begin[{]
local_variable[type[String], pathSegments]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=pathSegments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=indxOrigSegs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=s)], 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=".")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="..")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)), StatementExpression(expression=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None)])), label=None, then_statement=ContinueStatement(goto=None, label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=indxOrigSegs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pathSegments, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=indxOrigSegs)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=indxOrigSegs, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[true]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String]
} operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[descendOnlyFilePath] operator[SEP] identifier[String] identifier[path] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[pathSegments] operator[=] identifier[path] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[indxOrigSegs] operator[=] Other[0] operator[SEP] identifier[indxOrigSegs] operator[<] identifier[pathSegments] operator[SEP] identifier[length] operator[SEP] identifier[indxOrigSegs] operator[++] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[pathSegments] operator[SEP] identifier[indxOrigSegs] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] Other[0] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[i] operator[--] operator[SEP]
}
Keyword[else] {
identifier[i] operator[++] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static FlowControlSupplier multicastFlowControlSupplier()
{
FlowControlSupplier supplier = null;
try
{
final String className = getProperty(MULTICAST_FLOW_CONTROL_STRATEGY_SUPPLIER_PROP_NAME);
if (null == className)
{
return new DefaultMulticastFlowControlSupplier();
}
supplier = (FlowControlSupplier)Class.forName(className).getConstructor().newInstance();
}
catch (final Exception ex)
{
LangUtil.rethrowUnchecked(ex);
}
return supplier;
}
|
class class_name[name] begin[{]
method[multicastFlowControlSupplier, return_type[type[FlowControlSupplier]], modifier[public static], parameter[]] begin[{]
local_variable[type[FlowControlSupplier], supplier]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=MULTICAST_FLOW_CONTROL_STRATEGY_SUPPLIER_PROP_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=className)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultMulticastFlowControlSupplier, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=supplier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[MethodInvocation(arguments=[], member=getConstructor, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FlowControlSupplier, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rethrowUnchecked, postfix_operators=[], prefix_operators=[], qualifier=LangUtil, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.supplier]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[FlowControlSupplier] identifier[multicastFlowControlSupplier] operator[SEP] operator[SEP] {
identifier[FlowControlSupplier] identifier[supplier] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[String] identifier[className] operator[=] identifier[getProperty] operator[SEP] identifier[MULTICAST_FLOW_CONTROL_STRATEGY_SUPPLIER_PROP_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[className] operator[SEP] {
Keyword[return] Keyword[new] identifier[DefaultMulticastFlowControlSupplier] operator[SEP] operator[SEP] operator[SEP]
}
identifier[supplier] operator[=] operator[SEP] identifier[FlowControlSupplier] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[ex] operator[SEP] {
identifier[LangUtil] operator[SEP] identifier[rethrowUnchecked] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[return] identifier[supplier] operator[SEP]
}
|
public static JaxInfo build(Class<?> cls, String ... rootNns) throws SecurityException, NoSuchFieldException, ClassNotFoundException, ParseException {
String defaultNS;
if(rootNns.length>0 && rootNns[0]!=null) {
defaultNS = rootNns[0];
} else {
Package pkg = cls.getPackage();
XmlSchema xs = pkg.getAnnotation(XmlSchema.class);
defaultNS = xs==null?"":xs.namespace();
}
String name;
if(rootNns.length>1) {
name = rootNns[1];
} else {
XmlRootElement xre = cls.getAnnotation(XmlRootElement.class);
if(xre!=null) {
name = xre.name();
} else {
XmlType xt = cls.getAnnotation(XmlType.class);
if(xt!=null) {
name=xt.name();
} else {
throw new ParseException("Need a JAXB Object with XmlRootElement, or stipulate in parms");
}
}
}
return new JaxInfo(name,defaultNS, cls,buildFields(cls,defaultNS),false,false,false,false);
}
|
class class_name[name] begin[{]
method[build, return_type[type[JaxInfo]], modifier[public static], parameter[cls, rootNns]] begin[{]
local_variable[type[String], defaultNS]
if[binary_operation[binary_operation[member[rootNns.length], >, literal[0]], &&, binary_operation[member[.rootNns], !=, literal[null]]]] begin[{]
assign[member[.defaultNS], member[.rootNns]]
else begin[{]
local_variable[type[Package], pkg]
local_variable[type[XmlSchema], xs]
assign[member[.defaultNS], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=xs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=namespace, postfix_operators=[], prefix_operators=[], qualifier=xs, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]
end[}]
local_variable[type[String], name]
if[binary_operation[member[rootNns.length], >, literal[1]]] begin[{]
assign[member[.name], member[.rootNns]]
else begin[{]
local_variable[type[XmlRootElement], xre]
if[binary_operation[member[.xre], !=, literal[null]]] begin[{]
assign[member[.name], call[xre.name, parameter[]]]
else begin[{]
local_variable[type[XmlType], xt]
if[binary_operation[member[.xt], !=, literal[null]]] begin[{]
assign[member[.name], call[xt.name, parameter[]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Need a JAXB Object with XmlRootElement, or stipulate in parms")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultNS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultNS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), 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=JaxInfo, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[JaxInfo] identifier[build] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[cls] , identifier[String] operator[...] identifier[rootNns] operator[SEP] Keyword[throws] identifier[SecurityException] , identifier[NoSuchFieldException] , identifier[ClassNotFoundException] , identifier[ParseException] {
identifier[String] identifier[defaultNS] operator[SEP] Keyword[if] operator[SEP] identifier[rootNns] operator[SEP] identifier[length] operator[>] Other[0] operator[&&] identifier[rootNns] operator[SEP] Other[0] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[defaultNS] operator[=] identifier[rootNns] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Package] identifier[pkg] operator[=] identifier[cls] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[XmlSchema] identifier[xs] operator[=] identifier[pkg] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[XmlSchema] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[defaultNS] operator[=] identifier[xs] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[xs] operator[SEP] identifier[namespace] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[name] operator[SEP] Keyword[if] operator[SEP] identifier[rootNns] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
identifier[name] operator[=] identifier[rootNns] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[XmlRootElement] identifier[xre] operator[=] identifier[cls] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[XmlRootElement] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[xre] operator[!=] Other[null] operator[SEP] {
identifier[name] operator[=] identifier[xre] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[XmlType] identifier[xt] operator[=] identifier[cls] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[XmlType] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[xt] operator[!=] Other[null] operator[SEP] {
identifier[name] operator[=] identifier[xt] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Keyword[new] identifier[JaxInfo] operator[SEP] identifier[name] , identifier[defaultNS] , identifier[cls] , identifier[buildFields] operator[SEP] identifier[cls] , identifier[defaultNS] operator[SEP] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
public MMCPARAMETER1 createMMCPARAMETER1FromString(EDataType eDataType, String initialValue) {
MMCPARAMETER1 result = MMCPARAMETER1.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
|
class class_name[name] begin[{]
method[createMMCPARAMETER1FromString, return_type[type[MMCPARAMETER1]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[MMCPARAMETER1], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[MMCPARAMETER1] identifier[createMMCPARAMETER1FromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[MMCPARAMETER1] identifier[result] operator[=] identifier[MMCPARAMETER1] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public void configure(FeatureContext context) {
if (!context.getConfiguration().isRegistered(SwaggerFeature.class)) {
context.register(SwaggerFeature.class);
}
}
|
class class_name[name] begin[{]
method[configure, return_type[void], modifier[public], parameter[context]] begin[{]
if[call[context.getConfiguration, parameter[]]] begin[{]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SwaggerFeature, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[configure] operator[SEP] identifier[FeatureContext] identifier[context] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[context] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[isRegistered] operator[SEP] identifier[SwaggerFeature] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[SwaggerFeature] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
}
|
@Override
public Collection<MonetaryRounding> getRoundings(RoundingQuery query) {
List<MonetaryRounding> result = new ArrayList<>();
Collection<String> providerNames = query.getProviderNames();
if (providerNames == null || providerNames.isEmpty()) {
providerNames = getDefaultProviderChain();
}
for (String providerName : providerNames) {
Bootstrap.getServices(RoundingProviderSpi.class).stream()
.filter(prov -> providerName.equals(prov.getProviderName())).forEach(prov -> {
try {
MonetaryRounding r = prov.getRounding(query);
if (r != null) {
result.add(r);
}
} catch (Exception e) {
Logger.getLogger(DefaultMonetaryRoundingsSingletonSpi.class.getName())
.log(Level.SEVERE, "Error loading RoundingProviderSpi from provider: " + prov, e);
}
});
}
return result;
}
|
class class_name[name] begin[{]
method[getRoundings, return_type[type[Collection]], modifier[public], parameter[query]] begin[{]
local_variable[type[List], result]
local_variable[type[Collection], providerNames]
if[binary_operation[binary_operation[member[.providerNames], ==, literal[null]], ||, call[providerNames.isEmpty, parameter[]]]] begin[{]
assign[member[.providerNames], call[.getDefaultProviderChain, parameter[]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RoundingProviderSpi, sub_type=None))], member=getServices, postfix_operators=[], prefix_operators=[], qualifier=Bootstrap, selectors=[MethodInvocation(arguments=[], member=stream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProviderName, postfix_operators=[], prefix_operators=[], qualifier=prov, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=providerName, selectors=[], type_arguments=None), parameters=[MemberReference(member=prov, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=filter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRounding, postfix_operators=[], prefix_operators=[], qualifier=prov, selectors=[], type_arguments=None), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MonetaryRounding, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DefaultMonetaryRoundingsSingletonSpi, sub_type=None))], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=Logger, selectors=[MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error loading RoundingProviderSpi from provider: "), operandr=MemberReference(member=prov, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], parameters=[MemberReference(member=prov, 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=MemberReference(member=providerNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=providerName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Collection] operator[<] identifier[MonetaryRounding] operator[>] identifier[getRoundings] operator[SEP] identifier[RoundingQuery] identifier[query] operator[SEP] {
identifier[List] operator[<] identifier[MonetaryRounding] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[providerNames] operator[=] identifier[query] operator[SEP] identifier[getProviderNames] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[providerNames] operator[==] Other[null] operator[||] identifier[providerNames] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[providerNames] operator[=] identifier[getDefaultProviderChain] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[providerName] operator[:] identifier[providerNames] operator[SEP] {
identifier[Bootstrap] operator[SEP] identifier[getServices] operator[SEP] identifier[RoundingProviderSpi] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[prov] operator[->] identifier[providerName] operator[SEP] identifier[equals] operator[SEP] identifier[prov] operator[SEP] identifier[getProviderName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[prov] operator[->] {
Keyword[try] {
identifier[MonetaryRounding] identifier[r] operator[=] identifier[prov] operator[SEP] identifier[getRounding] operator[SEP] identifier[query] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[r] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[Logger] operator[SEP] identifier[getLogger] operator[SEP] identifier[DefaultMonetaryRoundingsSingletonSpi] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] operator[+] identifier[prov] , identifier[e] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static void rewriteStackTrace(Throwable throwable) {
StackTraceElement[] stack = throwable.getStackTrace();
for (int i = 0; i < stack.length; i++) {
StackTraceElement curr = stack[i];
if (curr.getClassName().startsWith(CLASS_PREFIX)) {
stack[i] =
new StackTraceElement(
soyTemplateNameFromJavaClassName(curr.getClassName()),
// TODO(lukes): remove the method name? only if it == 'render'?
curr.getMethodName(),
curr.getFileName(),
curr.getLineNumber());
}
}
throwable.setStackTrace(stack);
}
|
class class_name[name] begin[{]
method[rewriteStackTrace, return_type[void], modifier[public static], parameter[throwable]] begin[{]
local_variable[type[StackTraceElement], stack]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=stack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=curr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StackTraceElement, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[MethodInvocation(arguments=[MemberReference(member=CLASS_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, 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=Assignment(expressionl=MemberReference(member=stack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None)], member=soyTemplateNameFromJavaClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMethodName, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFileName, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getLineNumber, postfix_operators=[], prefix_operators=[], qualifier=curr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StackTraceElement, sub_type=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=stack, 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)
call[throwable.setStackTrace, parameter[member[.stack]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[rewriteStackTrace] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
identifier[StackTraceElement] operator[SEP] operator[SEP] identifier[stack] operator[=] identifier[throwable] operator[SEP] identifier[getStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[stack] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[StackTraceElement] identifier[curr] operator[=] identifier[stack] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[curr] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[CLASS_PREFIX] operator[SEP] operator[SEP] {
identifier[stack] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[StackTraceElement] operator[SEP] identifier[soyTemplateNameFromJavaClassName] operator[SEP] identifier[curr] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] , identifier[curr] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] , identifier[curr] operator[SEP] identifier[getFileName] operator[SEP] operator[SEP] , identifier[curr] operator[SEP] identifier[getLineNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[throwable] operator[SEP] identifier[setStackTrace] operator[SEP] identifier[stack] operator[SEP] operator[SEP]
}
|
public void sessionPostInvoke(HttpSession sess) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[SESSION_POST_INVOKE]);
}
SessionData s = (SessionData) sess;
if (_smc.getAllowSerializedSessionAccess()) {
unlockSession(sess);
}
if (s != null) {
synchronized (s) {
SessionAffinityContext sac = null;
_coreHttpSessionManager.releaseSession(s.getISession(), sac);
if (_coreHttpAppSessionManager != null) {
// try and get the Application Session in memory ... if it is there,
// make sure you update the backend via releaseSession
ISession iSess = (ISession) _coreHttpAppSessionManager.getIStore().getFromMemory(s.getId());
if (iSess != null) {
// iSess.decrementRefCount();
_coreHttpAppSessionManager.releaseSession(iSess, sac);
}
}
}
}
if (_smc.isDebugSessionCrossover()) {
currentThreadSacHashtable.set(null);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[SESSION_POST_INVOKE]);
}
}
|
class class_name[name] begin[{]
method[sessionPostInvoke, return_type[void], modifier[public], parameter[sess]] begin[{]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[LoggingUtil.SESSION_LOGGER_CORE.entering, parameter[member[.methodClassName], member[.methodNames]]]
else begin[{]
None
end[}]
local_variable[type[SessionData], s]
if[call[_smc.getAllowSerializedSessionAccess, parameter[]]] begin[{]
call[.unlockSession, parameter[member[.sess]]]
else begin[{]
None
end[}]
if[binary_operation[member[.s], !=, literal[null]]] begin[{]
SYNCHRONIZED[member[.s]] BEGIN[{]
local_variable[type[SessionAffinityContext], sac]
call[_coreHttpSessionManager.releaseSession, parameter[call[s.getISession, parameter[]], member[.sac]]]
if[binary_operation[member[._coreHttpAppSessionManager], !=, literal[null]]] begin[{]
local_variable[type[ISession], iSess]
if[binary_operation[member[.iSess], !=, literal[null]]] begin[{]
call[_coreHttpAppSessionManager.releaseSession, parameter[member[.iSess], member[.sac]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
if[call[_smc.isDebugSessionCrossover, parameter[]]] begin[{]
call[currentThreadSacHashtable.set, parameter[literal[null]]]
else begin[{]
None
end[}]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[LoggingUtil.SESSION_LOGGER_CORE.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[LoggingUtil.SESSION_LOGGER_CORE.exiting, parameter[member[.methodClassName], member[.methodNames]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[sessionPostInvoke] operator[SEP] identifier[HttpSession] identifier[sess] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[entering] operator[SEP] identifier[methodClassName] , identifier[methodNames] operator[SEP] identifier[SESSION_POST_INVOKE] operator[SEP] operator[SEP] operator[SEP]
}
identifier[SessionData] identifier[s] operator[=] operator[SEP] identifier[SessionData] operator[SEP] identifier[sess] operator[SEP] Keyword[if] operator[SEP] identifier[_smc] operator[SEP] identifier[getAllowSerializedSessionAccess] operator[SEP] operator[SEP] operator[SEP] {
identifier[unlockSession] operator[SEP] identifier[sess] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[s] operator[!=] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[s] operator[SEP] {
identifier[SessionAffinityContext] identifier[sac] operator[=] Other[null] operator[SEP] identifier[_coreHttpSessionManager] operator[SEP] identifier[releaseSession] operator[SEP] identifier[s] operator[SEP] identifier[getISession] operator[SEP] operator[SEP] , identifier[sac] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_coreHttpAppSessionManager] operator[!=] Other[null] operator[SEP] {
identifier[ISession] identifier[iSess] operator[=] operator[SEP] identifier[ISession] operator[SEP] identifier[_coreHttpAppSessionManager] operator[SEP] identifier[getIStore] operator[SEP] operator[SEP] operator[SEP] identifier[getFromMemory] operator[SEP] identifier[s] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iSess] operator[!=] Other[null] operator[SEP] {
identifier[_coreHttpAppSessionManager] operator[SEP] identifier[releaseSession] operator[SEP] identifier[iSess] , identifier[sac] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[_smc] operator[SEP] identifier[isDebugSessionCrossover] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentThreadSacHashtable] operator[SEP] identifier[set] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[LoggingUtil] operator[SEP] identifier[SESSION_LOGGER_CORE] operator[SEP] identifier[exiting] operator[SEP] identifier[methodClassName] , identifier[methodNames] operator[SEP] identifier[SESSION_POST_INVOKE] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public String getBatchAppNameFromInstance(long instanceId) throws NoSuchJobInstanceException, JobSecurityException {
return persistenceManagerService.getJobInstanceAppName(authorizedInstanceRead(instanceId));
}
|
class class_name[name] begin[{]
method[getBatchAppNameFromInstance, return_type[type[String]], modifier[public], parameter[instanceId]] begin[{]
return[call[persistenceManagerService.getJobInstanceAppName, parameter[call[.authorizedInstanceRead, parameter[member[.instanceId]]]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getBatchAppNameFromInstance] operator[SEP] Keyword[long] identifier[instanceId] operator[SEP] Keyword[throws] identifier[NoSuchJobInstanceException] , identifier[JobSecurityException] {
Keyword[return] identifier[persistenceManagerService] operator[SEP] identifier[getJobInstanceAppName] operator[SEP] identifier[authorizedInstanceRead] operator[SEP] identifier[instanceId] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int framebufferStatusToGL(
final JCGLFramebufferStatus status)
{
switch (status) {
case FRAMEBUFFER_STATUS_COMPLETE:
return GL30.GL_FRAMEBUFFER_COMPLETE;
case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_ATTACHMENT:
return GL30.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
case FRAMEBUFFER_STATUS_ERROR_MISSING_IMAGE_ATTACHMENT:
return GL30.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_DRAW_BUFFER:
return GL30.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER;
case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_READ_BUFFER:
return GL30.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER;
case FRAMEBUFFER_STATUS_ERROR_UNSUPPORTED:
return GL30.GL_FRAMEBUFFER_UNSUPPORTED;
case FRAMEBUFFER_STATUS_ERROR_UNKNOWN:
return -1;
}
throw new UnreachableCodeException();
}
|
class class_name[name] begin[{]
method[framebufferStatusToGL, return_type[type[int]], modifier[public static], parameter[status]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['FRAMEBUFFER_STATUS_COMPLETE'], statements=[ReturnStatement(expression=MemberReference(member=GL_FRAMEBUFFER_COMPLETE, postfix_operators=[], prefix_operators=[], qualifier=GL30, selectors=[]), label=None)]), SwitchStatementCase(case=['FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_ATTACHMENT'], statements=[ReturnStatement(expression=MemberReference(member=GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, postfix_operators=[], prefix_operators=[], qualifier=GL30, selectors=[]), label=None)]), SwitchStatementCase(case=['FRAMEBUFFER_STATUS_ERROR_MISSING_IMAGE_ATTACHMENT'], statements=[ReturnStatement(expression=MemberReference(member=GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, postfix_operators=[], prefix_operators=[], qualifier=GL30, selectors=[]), label=None)]), SwitchStatementCase(case=['FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_DRAW_BUFFER'], statements=[ReturnStatement(expression=MemberReference(member=GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, postfix_operators=[], prefix_operators=[], qualifier=GL30, selectors=[]), label=None)]), SwitchStatementCase(case=['FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_READ_BUFFER'], statements=[ReturnStatement(expression=MemberReference(member=GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER, postfix_operators=[], prefix_operators=[], qualifier=GL30, selectors=[]), label=None)]), SwitchStatementCase(case=['FRAMEBUFFER_STATUS_ERROR_UNSUPPORTED'], statements=[ReturnStatement(expression=MemberReference(member=GL_FRAMEBUFFER_UNSUPPORTED, postfix_operators=[], prefix_operators=[], qualifier=GL30, selectors=[]), label=None)]), SwitchStatementCase(case=['FRAMEBUFFER_STATUS_ERROR_UNKNOWN'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)])], expression=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnreachableCodeException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[framebufferStatusToGL] operator[SEP] Keyword[final] identifier[JCGLFramebufferStatus] identifier[status] operator[SEP] {
Keyword[switch] operator[SEP] identifier[status] operator[SEP] {
Keyword[case] identifier[FRAMEBUFFER_STATUS_COMPLETE] operator[:] Keyword[return] identifier[GL30] operator[SEP] identifier[GL_FRAMEBUFFER_COMPLETE] operator[SEP] Keyword[case] identifier[FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_ATTACHMENT] operator[:] Keyword[return] identifier[GL30] operator[SEP] identifier[GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT] operator[SEP] Keyword[case] identifier[FRAMEBUFFER_STATUS_ERROR_MISSING_IMAGE_ATTACHMENT] operator[:] Keyword[return] identifier[GL30] operator[SEP] identifier[GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT] operator[SEP] Keyword[case] identifier[FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_DRAW_BUFFER] operator[:] Keyword[return] identifier[GL30] operator[SEP] identifier[GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER] operator[SEP] Keyword[case] identifier[FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_READ_BUFFER] operator[:] Keyword[return] identifier[GL30] operator[SEP] identifier[GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER] operator[SEP] Keyword[case] identifier[FRAMEBUFFER_STATUS_ERROR_UNSUPPORTED] operator[:] Keyword[return] identifier[GL30] operator[SEP] identifier[GL_FRAMEBUFFER_UNSUPPORTED] operator[SEP] Keyword[case] identifier[FRAMEBUFFER_STATUS_ERROR_UNKNOWN] operator[:] Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[UnreachableCodeException] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void removeInstance(long key, T instance) {
if (first.value == key && instance == first.element) {
removeMin();
return;
}
if (last.value == key && instance == last.element) {
removeMax();
return;
}
// if both children of root are black, set root to red
if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red))
root.red = true;
root = removeInstance(root, key, instance);
if (root != null) root.red = false;
}
|
class class_name[name] begin[{]
method[removeInstance, return_type[void], modifier[public], parameter[key, instance]] begin[{]
if[binary_operation[binary_operation[member[first.value], ==, member[.key]], &&, binary_operation[member[.instance], ==, member[first.element]]]] begin[{]
call[.removeMin, parameter[]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[last.value], ==, member[.key]], &&, binary_operation[member[.instance], ==, member[last.element]]]] begin[{]
call[.removeMax, parameter[]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[root.left], ==, literal[null]], ||, member[root.left.red]], &&, binary_operation[binary_operation[member[root.right], ==, literal[null]], ||, member[root.right.red]]]] begin[{]
assign[member[root.red], literal[true]]
else begin[{]
None
end[}]
assign[member[.root], call[.removeInstance, parameter[member[.root], member[.key], member[.instance]]]]
if[binary_operation[member[.root], !=, literal[null]]] begin[{]
assign[member[root.red], literal[false]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[removeInstance] operator[SEP] Keyword[long] identifier[key] , identifier[T] identifier[instance] operator[SEP] {
Keyword[if] operator[SEP] identifier[first] operator[SEP] identifier[value] operator[==] identifier[key] operator[&&] identifier[instance] operator[==] identifier[first] operator[SEP] identifier[element] operator[SEP] {
identifier[removeMin] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[last] operator[SEP] identifier[value] operator[==] identifier[key] operator[&&] identifier[instance] operator[==] identifier[last] operator[SEP] identifier[element] operator[SEP] {
identifier[removeMax] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[left] operator[==] Other[null] operator[||] operator[!] identifier[root] operator[SEP] identifier[left] operator[SEP] identifier[red] operator[SEP] operator[&&] operator[SEP] identifier[root] operator[SEP] identifier[right] operator[==] Other[null] operator[||] operator[!] identifier[root] operator[SEP] identifier[right] operator[SEP] identifier[red] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[red] operator[=] literal[boolean] operator[SEP] identifier[root] operator[=] identifier[removeInstance] operator[SEP] identifier[root] , identifier[key] , identifier[instance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[root] operator[!=] Other[null] operator[SEP] identifier[root] operator[SEP] identifier[red] operator[=] literal[boolean] operator[SEP]
}
|
public void set(List<Double> coefficients, Engine engine) {
setCoefficients(coefficients);
setEngine(engine);
}
|
class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[coefficients, engine]] begin[{]
call[.setCoefficients, parameter[member[.coefficients]]]
call[.setEngine, parameter[member[.engine]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[set] operator[SEP] identifier[List] operator[<] identifier[Double] operator[>] identifier[coefficients] , identifier[Engine] identifier[engine] operator[SEP] {
identifier[setCoefficients] operator[SEP] identifier[coefficients] operator[SEP] operator[SEP] identifier[setEngine] operator[SEP] identifier[engine] operator[SEP] operator[SEP]
}
|
private static final int findSameDataBlock(int data[], int dataLength,
int otherBlock, int step)
{
// ensure that we do not even partially get past dataLength
dataLength -= DATA_BLOCK_LENGTH;
for (int block = 0; block <= dataLength; block += step) {
if(equal_int(data, block, otherBlock, DATA_BLOCK_LENGTH)) {
return block;
}
}
return -1;
}
|
class class_name[name] begin[{]
method[findSameDataBlock, return_type[type[int]], modifier[final private static], parameter[data, dataLength, otherBlock, step]] begin[{]
assign[member[.dataLength], member[.DATA_BLOCK_LENGTH]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=otherBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equal_int, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dataLength, 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=block)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=block, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)
return[literal[1]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[final] Keyword[int] identifier[findSameDataBlock] operator[SEP] Keyword[int] identifier[data] operator[SEP] operator[SEP] , Keyword[int] identifier[dataLength] , Keyword[int] identifier[otherBlock] , Keyword[int] identifier[step] operator[SEP] {
identifier[dataLength] operator[-=] identifier[DATA_BLOCK_LENGTH] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[block] operator[=] Other[0] operator[SEP] identifier[block] operator[<=] identifier[dataLength] operator[SEP] identifier[block] operator[+=] identifier[step] operator[SEP] {
Keyword[if] operator[SEP] identifier[equal_int] operator[SEP] identifier[data] , identifier[block] , identifier[otherBlock] , identifier[DATA_BLOCK_LENGTH] operator[SEP] operator[SEP] {
Keyword[return] identifier[block] operator[SEP]
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public ServiceFuture<CheckNameAvailabilityResponseInner> checkNameAvailabilityLocalAsync(String location, CheckNameAvailabilityRequest checkNameAvailability, final ServiceCallback<CheckNameAvailabilityResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(checkNameAvailabilityLocalWithServiceResponseAsync(location, checkNameAvailability), serviceCallback);
}
|
class class_name[name] begin[{]
method[checkNameAvailabilityLocalAsync, return_type[type[ServiceFuture]], modifier[public], parameter[location, checkNameAvailability, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.checkNameAvailabilityLocalWithServiceResponseAsync, parameter[member[.location], member[.checkNameAvailability]]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[CheckNameAvailabilityResponseInner] operator[>] identifier[checkNameAvailabilityLocalAsync] operator[SEP] identifier[String] identifier[location] , identifier[CheckNameAvailabilityRequest] identifier[checkNameAvailability] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[CheckNameAvailabilityResponseInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[checkNameAvailabilityLocalWithServiceResponseAsync] operator[SEP] identifier[location] , identifier[checkNameAvailability] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@Override
public int indexOf(Object arg0) {
int indexOf = allResults.indexOf(arg0);
if ( indexOf >= 0 )
return indexOf;
while ( nextResultsAvailable() ) {
indexOf = nextResults.indexOf(arg0);
int size = allResults.size();
moveNextResults();
if ( indexOf >= 0 )
return indexOf + size;
}
return -1;
}
|
class class_name[name] begin[{]
method[indexOf, return_type[type[int]], modifier[public], parameter[arg0]] begin[{]
local_variable[type[int], indexOf]
if[binary_operation[member[.indexOf], >=, literal[0]]] begin[{]
return[member[.indexOf]]
else begin[{]
None
end[}]
while[call[.nextResultsAvailable, parameter[]]] begin[{]
assign[member[.indexOf], call[nextResults.indexOf, parameter[member[.arg0]]]]
local_variable[type[int], size]
call[.moveNextResults, parameter[]]
if[binary_operation[member[.indexOf], >=, literal[0]]] begin[{]
return[binary_operation[member[.indexOf], +, member[.size]]]
else begin[{]
None
end[}]
end[}]
return[literal[1]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[indexOf] operator[SEP] identifier[Object] identifier[arg0] operator[SEP] {
Keyword[int] identifier[indexOf] operator[=] identifier[allResults] operator[SEP] identifier[indexOf] operator[SEP] identifier[arg0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexOf] operator[>=] Other[0] operator[SEP] Keyword[return] identifier[indexOf] operator[SEP] Keyword[while] operator[SEP] identifier[nextResultsAvailable] operator[SEP] operator[SEP] operator[SEP] {
identifier[indexOf] operator[=] identifier[nextResults] operator[SEP] identifier[indexOf] operator[SEP] identifier[arg0] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[allResults] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[moveNextResults] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexOf] operator[>=] Other[0] operator[SEP] Keyword[return] identifier[indexOf] operator[+] identifier[size] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public static mail_profile update(nitro_service client, mail_profile resource) throws Exception
{
resource.validate("modify");
return ((mail_profile[]) resource.update_resource(client))[0];
}
|
class class_name[name] begin[{]
method[update, return_type[type[mail_profile]], modifier[public static], parameter[client, resource]] begin[{]
call[resource.validate, parameter[literal["modify"]]]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update_resource, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=mail_profile, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[mail_profile] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[mail_profile] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[resource] operator[SEP] identifier[validate] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[mail_profile] operator[SEP] operator[SEP] operator[SEP] identifier[resource] operator[SEP] identifier[update_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public ScheduleInner createOrUpdate(String resourceGroupName, String automationAccountName, String scheduleName, ScheduleCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName, parameters).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[createOrUpdate, return_type[type[ScheduleInner]], modifier[public], parameter[resourceGroupName, automationAccountName, scheduleName, parameters]] begin[{]
return[call[.createOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.automationAccountName], member[.scheduleName], member[.parameters]]]]
end[}]
END[}]
|
Keyword[public] identifier[ScheduleInner] identifier[createOrUpdate] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[automationAccountName] , identifier[String] identifier[scheduleName] , identifier[ScheduleCreateOrUpdateParameters] identifier[parameters] operator[SEP] {
Keyword[return] identifier[createOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[automationAccountName] , identifier[scheduleName] , identifier[parameters] 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]
}
|
void transferBlocksTo(RegularFile target, int count) {
copyBlocksTo(target, count);
truncateBlocks(blockCount - count);
}
|
class class_name[name] begin[{]
method[transferBlocksTo, return_type[void], modifier[default], parameter[target, count]] begin[{]
call[.copyBlocksTo, parameter[member[.target], member[.count]]]
call[.truncateBlocks, parameter[binary_operation[member[.blockCount], -, member[.count]]]]
end[}]
END[}]
|
Keyword[void] identifier[transferBlocksTo] operator[SEP] identifier[RegularFile] identifier[target] , Keyword[int] identifier[count] operator[SEP] {
identifier[copyBlocksTo] operator[SEP] identifier[target] , identifier[count] operator[SEP] operator[SEP] identifier[truncateBlocks] operator[SEP] identifier[blockCount] operator[-] identifier[count] operator[SEP] operator[SEP]
}
|
private void rollover(RollingSegmentHandle handle) throws StreamSegmentException {
Preconditions.checkArgument(handle.getHeaderHandle() != null, "Cannot rollover a Segment with no header.");
Preconditions.checkArgument(!handle.isReadOnly(), "Cannot rollover using a read-only handle.");
Preconditions.checkArgument(!handle.isSealed(), "Cannot rollover a Sealed Segment.");
log.debug("Rolling over '{}'.", handle);
sealActiveChunk(handle);
try {
createChunk(handle);
} catch (StreamSegmentExistsException ex) {
// It may be possible that a concurrent rollover request using a different handle (either from this instance
// or another) has already created the new chunk. Refresh the handle and try again. This is usually the case
// with concurrent Storage instances trying to modify the same segment at the same time.
int chunkCount = handle.chunks().size();
handle.refresh(openHandle(handle.getSegmentName(), false));
if (chunkCount == handle.chunks().size()) {
// Nothing changed; re-throw the exception.
throw ex;
} else {
// We've just refreshed the handle and picked up the latest chunk. Move on.
log.warn("Aborted rollover due to concurrent rollover detected ('{}').", handle);
}
}
}
|
class class_name[name] begin[{]
method[rollover, return_type[void], modifier[private], parameter[handle]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[call[handle.getHeaderHandle, parameter[]], !=, literal[null]], literal["Cannot rollover a Segment with no header."]]]
call[Preconditions.checkArgument, parameter[call[handle.isReadOnly, parameter[]], literal["Cannot rollover using a read-only handle."]]]
call[Preconditions.checkArgument, parameter[call[handle.isSealed, parameter[]], literal["Cannot rollover a Sealed Segment."]]]
call[log.debug, parameter[literal["Rolling over '{}'."], member[.handle]]]
call[.sealActiveChunk, parameter[member[.handle]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createChunk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=chunks, postfix_operators=[], prefix_operators=[], qualifier=handle, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=chunkCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSegmentName, postfix_operators=[], prefix_operators=[], qualifier=handle, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=openHandle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=refresh, postfix_operators=[], prefix_operators=[], qualifier=handle, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=chunkCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=chunks, postfix_operators=[], prefix_operators=[], qualifier=handle, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Aborted rollover due to concurrent rollover detected ('{}')."), MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['StreamSegmentExistsException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[rollover] operator[SEP] identifier[RollingSegmentHandle] identifier[handle] operator[SEP] Keyword[throws] identifier[StreamSegmentException] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[handle] operator[SEP] identifier[getHeaderHandle] operator[SEP] operator[SEP] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[handle] operator[SEP] identifier[isReadOnly] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[handle] operator[SEP] identifier[isSealed] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[handle] operator[SEP] operator[SEP] identifier[sealActiveChunk] operator[SEP] identifier[handle] operator[SEP] operator[SEP] Keyword[try] {
identifier[createChunk] operator[SEP] identifier[handle] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[StreamSegmentExistsException] identifier[ex] operator[SEP] {
Keyword[int] identifier[chunkCount] operator[=] identifier[handle] operator[SEP] identifier[chunks] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[handle] operator[SEP] identifier[refresh] operator[SEP] identifier[openHandle] operator[SEP] identifier[handle] operator[SEP] identifier[getSegmentName] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[chunkCount] operator[==] identifier[handle] operator[SEP] identifier[chunks] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[ex] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[handle] operator[SEP] operator[SEP]
}
}
}
|
public CollectionRequest<Task> getTasksWithTag(String tag) {
String path = String.format("/tags/%s/tasks", tag);
return new CollectionRequest<Task>(this, Task.class, path, "GET");
}
|
class class_name[name] begin[{]
method[getTasksWithTag, return_type[type[CollectionRequest]], modifier[public], parameter[tag]] begin[{]
local_variable[type[String], path]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Task, sub_type=None)), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="GET")], 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=Task, sub_type=None))], dimensions=None, name=CollectionRequest, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[CollectionRequest] operator[<] identifier[Task] operator[>] identifier[getTasksWithTag] operator[SEP] identifier[String] identifier[tag] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[tag] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CollectionRequest] operator[<] identifier[Task] operator[>] operator[SEP] Keyword[this] , identifier[Task] operator[SEP] Keyword[class] , identifier[path] , literal[String] operator[SEP] operator[SEP]
}
|
private static int EquivalentYear(int year)
{
int day = (int) DayFromYear(year) + 4;
day = day % 7;
if (day < 0)
day += 7;
// Years and leap years on which Jan 1 is a Sunday, Monday, etc.
if (IsLeapYear(year)) {
switch (day) {
case 0: return 1984;
case 1: return 1996;
case 2: return 1980;
case 3: return 1992;
case 4: return 1976;
case 5: return 1988;
case 6: return 1972;
}
} else {
switch (day) {
case 0: return 1978;
case 1: return 1973;
case 2: return 1985;
case 3: return 1986;
case 4: return 1981;
case 5: return 1971;
case 6: return 1977;
}
}
// Unreachable
throw Kit.codeBug();
}
|
class class_name[name] begin[{]
method[EquivalentYear, return_type[type[int]], modifier[private static], parameter[year]] begin[{]
local_variable[type[int], day]
assign[member[.day], binary_operation[member[.day], %, literal[7]]]
if[binary_operation[member[.day], <, literal[0]]] begin[{]
assign[member[.day], literal[7]]
else begin[{]
None
end[}]
if[call[.IsLeapYear, parameter[member[.year]]]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1984), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1996), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1980), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1992), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1976), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1988), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1972), label=None)])], expression=MemberReference(member=day, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1978), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1973), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1985), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1986), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1981), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1971), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1977), label=None)])], expression=MemberReference(member=day, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
ThrowStatement(expression=MethodInvocation(arguments=[], member=codeBug, postfix_operators=[], prefix_operators=[], qualifier=Kit, selectors=[], type_arguments=None), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[int] identifier[EquivalentYear] operator[SEP] Keyword[int] identifier[year] operator[SEP] {
Keyword[int] identifier[day] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[DayFromYear] operator[SEP] identifier[year] operator[SEP] operator[+] Other[4] operator[SEP] identifier[day] operator[=] identifier[day] operator[%] Other[7] operator[SEP] Keyword[if] operator[SEP] identifier[day] operator[<] Other[0] operator[SEP] identifier[day] operator[+=] Other[7] operator[SEP] Keyword[if] operator[SEP] identifier[IsLeapYear] operator[SEP] identifier[year] operator[SEP] operator[SEP] {
Keyword[switch] operator[SEP] identifier[day] operator[SEP] {
Keyword[case] Other[0] operator[:] Keyword[return] Other[1984] operator[SEP] Keyword[case] Other[1] operator[:] Keyword[return] Other[1996] operator[SEP] Keyword[case] Other[2] operator[:] Keyword[return] Other[1980] operator[SEP] Keyword[case] Other[3] operator[:] Keyword[return] Other[1992] operator[SEP] Keyword[case] Other[4] operator[:] Keyword[return] Other[1976] operator[SEP] Keyword[case] Other[5] operator[:] Keyword[return] Other[1988] operator[SEP] Keyword[case] Other[6] operator[:] Keyword[return] Other[1972] operator[SEP]
}
}
Keyword[else] {
Keyword[switch] operator[SEP] identifier[day] operator[SEP] {
Keyword[case] Other[0] operator[:] Keyword[return] Other[1978] operator[SEP] Keyword[case] Other[1] operator[:] Keyword[return] Other[1973] operator[SEP] Keyword[case] Other[2] operator[:] Keyword[return] Other[1985] operator[SEP] Keyword[case] Other[3] operator[:] Keyword[return] Other[1986] operator[SEP] Keyword[case] Other[4] operator[:] Keyword[return] Other[1981] operator[SEP] Keyword[case] Other[5] operator[:] Keyword[return] Other[1971] operator[SEP] Keyword[case] Other[6] operator[:] Keyword[return] Other[1977] operator[SEP]
}
}
Keyword[throw] identifier[Kit] operator[SEP] identifier[codeBug] operator[SEP] operator[SEP] operator[SEP]
}
|
public Connection getConnection(final String username, final String password)
throws SQLException {
try {
if (pool == null) {
this.user = username;
this.password = password;
initialize();
return pool.getConnection();
}
if ((urlParser.getUsername() != null ? urlParser.getUsername().equals(username)
: username == null)
&& (urlParser.getPassword() != null ? urlParser.getPassword().equals(password)
: (password == null || password.isEmpty()))) {
return pool.getConnection();
}
//username / password are different from the one already used to initialize pool
//-> return a real new connection.
UrlParser urlParser = (UrlParser) this.urlParser.clone();
urlParser.setUsername(username);
urlParser.setPassword(password);
return MariaDbConnection.newConnection(urlParser, pool.getGlobalInfo());
} catch (SQLException e) {
throw ExceptionMapper.getException(e, null, null, false);
} catch (CloneNotSupportedException cloneException) {
throw new SQLException("Error in configuration");
}
}
|
class class_name[name] begin[{]
method[getConnection, return_type[type[Connection]], modifier[public], parameter[username, password]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pool, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=user, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=password, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=initialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=pool, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getUsername, postfix_operators=[], prefix_operators=[], qualifier=urlParser, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=BinaryOperation(operandl=MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_true=MethodInvocation(arguments=[], member=getUsername, postfix_operators=[], prefix_operators=[], qualifier=urlParser, selectors=[MethodInvocation(arguments=[MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), operandr=TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPassword, postfix_operators=[], prefix_operators=[], qualifier=urlParser, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=password, 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=password, selectors=[], type_arguments=None), operator=||), if_true=MethodInvocation(arguments=[], member=getPassword, postfix_operators=[], prefix_operators=[], qualifier=urlParser, selectors=[MethodInvocation(arguments=[MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=pool, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=urlParser, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=clone, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=UrlParser, sub_type=None)), name=urlParser)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=UrlParser, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUsername, postfix_operators=[], prefix_operators=[], qualifier=urlParser, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPassword, postfix_operators=[], prefix_operators=[], qualifier=urlParser, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=urlParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getGlobalInfo, postfix_operators=[], prefix_operators=[], qualifier=pool, selectors=[], type_arguments=None)], member=newConnection, postfix_operators=[], prefix_operators=[], qualifier=MariaDbConnection, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getException, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMapper, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error in configuration")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=cloneException, types=['CloneNotSupportedException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[Connection] identifier[getConnection] operator[SEP] Keyword[final] identifier[String] identifier[username] , Keyword[final] identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[pool] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[user] operator[=] identifier[username] operator[SEP] Keyword[this] operator[SEP] identifier[password] operator[=] identifier[password] operator[SEP] identifier[initialize] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[pool] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[urlParser] operator[SEP] identifier[getUsername] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[urlParser] operator[SEP] identifier[getUsername] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[username] operator[SEP] operator[:] identifier[username] operator[==] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[urlParser] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[urlParser] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[password] operator[SEP] operator[:] operator[SEP] identifier[password] operator[==] Other[null] operator[||] identifier[password] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[pool] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP]
}
identifier[UrlParser] identifier[urlParser] operator[=] operator[SEP] identifier[UrlParser] operator[SEP] Keyword[this] operator[SEP] identifier[urlParser] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[urlParser] operator[SEP] identifier[setUsername] operator[SEP] identifier[username] operator[SEP] operator[SEP] identifier[urlParser] operator[SEP] identifier[setPassword] operator[SEP] identifier[password] operator[SEP] operator[SEP] Keyword[return] identifier[MariaDbConnection] operator[SEP] identifier[newConnection] operator[SEP] identifier[urlParser] , identifier[pool] operator[SEP] identifier[getGlobalInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] identifier[ExceptionMapper] operator[SEP] identifier[getException] operator[SEP] identifier[e] , Other[null] , Other[null] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CloneNotSupportedException] identifier[cloneException] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.