code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
protected <T extends VaadinServlet> Wrapper initializeVaadinServlet(T servlet) {
// Setup vaadin servlet
final Wrapper wrapper = Tomcat.addServlet(getContext(),
"vaadin", servlet);
if (getConfig().getWidgetSet() != null) {
wrapper.addInitParameter("widgetset", getConfig().getWidgetSet());
}
wrapper.addMapping("/*");
return wrapper;
} | class class_name[name] begin[{]
method[initializeVaadinServlet, return_type[type[Wrapper]], modifier[protected], parameter[servlet]] begin[{]
local_variable[type[Wrapper], wrapper]
if[binary_operation[call[.getConfig, parameter[]], !=, literal[null]]] begin[{]
call[wrapper.addInitParameter, parameter[literal["widgetset"], call[.getConfig, parameter[]]]]
else begin[{]
None
end[}]
call[wrapper.addMapping, parameter[literal["/*"]]]
return[member[.wrapper]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[T] Keyword[extends] identifier[VaadinServlet] operator[>] identifier[Wrapper] identifier[initializeVaadinServlet] operator[SEP] identifier[T] identifier[servlet] operator[SEP] {
Keyword[final] identifier[Wrapper] identifier[wrapper] operator[=] identifier[Tomcat] operator[SEP] identifier[addServlet] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] , literal[String] , identifier[servlet] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getWidgetSet] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[wrapper] operator[SEP] identifier[addInitParameter] operator[SEP] literal[String] , identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getWidgetSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[wrapper] operator[SEP] identifier[addMapping] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[wrapper] operator[SEP]
}
|
public void close(Result<Boolean> result)
{
_lifecycle.toDestroy();
SegmentStream nodeStream = _nodeStream;
_nodeStream = null;
if (nodeStream != null) {
nodeStream.closeFsync(result.then(v->closeImpl()));
}
else {
result.ok(true);
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[result]] begin[{]
call[_lifecycle.toDestroy, parameter[]]
local_variable[type[SegmentStream], nodeStream]
assign[member[._nodeStream], literal[null]]
if[binary_operation[member[.nodeStream], !=, literal[null]]] begin[{]
call[nodeStream.closeFsync, parameter[call[result.then, parameter[LambdaExpression(body=MethodInvocation(arguments=[], member=closeImpl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]]
else begin[{]
call[result.ok, parameter[literal[true]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[close] operator[SEP] identifier[Result] operator[<] identifier[Boolean] operator[>] identifier[result] operator[SEP] {
identifier[_lifecycle] operator[SEP] identifier[toDestroy] operator[SEP] operator[SEP] operator[SEP] identifier[SegmentStream] identifier[nodeStream] operator[=] identifier[_nodeStream] operator[SEP] identifier[_nodeStream] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[nodeStream] operator[!=] Other[null] operator[SEP] {
identifier[nodeStream] operator[SEP] identifier[closeFsync] operator[SEP] identifier[result] operator[SEP] identifier[then] operator[SEP] identifier[v] operator[->] identifier[closeImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[SEP] identifier[ok] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
private <T> Key<T> assistKey(Method method, Key<T> key, Errors errors) throws ErrorsException {
if (key.getAnnotationType() == null) {
return Key.get(key.getTypeLiteral(), DEFAULT_ANNOTATION);
} else if (key.getAnnotationType() == Assisted.class) {
return key;
} else {
errors.withSource(method).addMessage(PrettyPrinter.format(
"Only @Assisted is allowed for factory parameters, but found @%s",
key.getAnnotationType()));
throw errors.toException();
}
} | class class_name[name] begin[{]
method[assistKey, return_type[type[Key]], modifier[private], parameter[method, key, errors]] begin[{]
if[binary_operation[call[key.getAnnotationType, parameter[]], ==, literal[null]]] begin[{]
return[call[Key.get, parameter[call[key.getTypeLiteral, parameter[]], member[.DEFAULT_ANNOTATION]]]]
else begin[{]
if[binary_operation[call[key.getAnnotationType, parameter[]], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Assisted, sub_type=None))]] begin[{]
return[member[.key]]
else begin[{]
call[errors.withSource, parameter[member[.method]]]
ThrowStatement(expression=MethodInvocation(arguments=[], member=toException, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)
end[}]
end[}]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[Key] operator[<] identifier[T] operator[>] identifier[assistKey] operator[SEP] identifier[Method] identifier[method] , identifier[Key] operator[<] identifier[T] operator[>] identifier[key] , identifier[Errors] identifier[errors] operator[SEP] Keyword[throws] identifier[ErrorsException] {
Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[getAnnotationType] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Key] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] identifier[getTypeLiteral] operator[SEP] operator[SEP] , identifier[DEFAULT_ANNOTATION] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[getAnnotationType] operator[SEP] operator[SEP] operator[==] identifier[Assisted] operator[SEP] Keyword[class] operator[SEP] {
Keyword[return] identifier[key] operator[SEP]
}
Keyword[else] {
identifier[errors] operator[SEP] identifier[withSource] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[addMessage] operator[SEP] identifier[PrettyPrinter] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[key] operator[SEP] identifier[getAnnotationType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] identifier[errors] operator[SEP] identifier[toException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Webcam getDefault(long timeout) throws TimeoutException, WebcamException {
if (timeout < 0) {
throw new IllegalArgumentException(String.format("Timeout cannot be negative (%d)", timeout));
}
return getDefault(timeout, TimeUnit.MILLISECONDS);
} | class class_name[name] begin[{]
method[getDefault, return_type[type[Webcam]], modifier[public static], parameter[timeout]] begin[{]
if[binary_operation[member[.timeout], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timeout cannot be negative (%d)"), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.getDefault, parameter[member[.timeout], member[TimeUnit.MILLISECONDS]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Webcam] identifier[getDefault] operator[SEP] Keyword[long] identifier[timeout] operator[SEP] Keyword[throws] identifier[TimeoutException] , identifier[WebcamException] {
Keyword[if] operator[SEP] identifier[timeout] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[timeout] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getDefault] operator[SEP] identifier[timeout] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
|
public static <R extends Random, T> T with(
final ThreadLocal<R> random,
final Function<? super R, ? extends T> function
) {
return CONTEXT.with(random::get, s -> function.apply(random.get()));
} | class class_name[name] begin[{]
method[with, return_type[type[T]], modifier[public static], parameter[random, function]] begin[{]
return[call[CONTEXT.with, parameter[MethodReference(expression=MemberReference(member=random, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=random, selectors=[], type_arguments=None)], member=apply, postfix_operators=[], prefix_operators=[], qualifier=function, selectors=[], type_arguments=None), parameters=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[R] Keyword[extends] identifier[Random] , identifier[T] operator[>] identifier[T] identifier[with] operator[SEP] Keyword[final] identifier[ThreadLocal] operator[<] identifier[R] operator[>] identifier[random] , Keyword[final] identifier[Function] operator[<] operator[?] Keyword[super] identifier[R] , operator[?] Keyword[extends] identifier[T] operator[>] identifier[function] operator[SEP] {
Keyword[return] identifier[CONTEXT] operator[SEP] identifier[with] operator[SEP] identifier[random] operator[::] identifier[get] , identifier[s] operator[->] identifier[function] operator[SEP] identifier[apply] operator[SEP] identifier[random] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Credentials userSignUp(Credentials credentials) throws DAOException{
if (getUserByEmail(dao,credentials.getEmailAddress())!=null){
throw new DAOException(HttpStatus.SC_CONFLICT,"User Already Exists");
}
ServerCredentials toSave = new ServerCredentials(credentials);
toSave.decryptPassword(keyManager.getPrivateKey()); //decrypt the password
String de = toSave.getPassword();
String ha = BCrypt.hashpw(de, BCrypt.gensalt(10));
toSave.setOwnerId(dao.count(Credentials.class.getName()) + 1);
toSave.setPassword(ha); //hash the password for storage
toSave.setAuthToken(AuthTokenUtils.getNewToken(keyManager.getSymmetricKey(), toSave));
toSave.setRecoveryToken(AuthTokenUtils.getNewToken(keyManager.getSymmetricKey(), toSave));
dao.save(toSave);
return toSave;
} | class class_name[name] begin[{]
method[userSignUp, return_type[type[Credentials]], modifier[public], parameter[credentials]] begin[{]
if[binary_operation[call[.getUserByEmail, parameter[member[.dao], call[credentials.getEmailAddress, parameter[]]]], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=SC_CONFLICT, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="User Already Exists")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DAOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ServerCredentials], toSave]
call[toSave.decryptPassword, parameter[call[keyManager.getPrivateKey, parameter[]]]]
local_variable[type[String], de]
local_variable[type[String], ha]
call[toSave.setOwnerId, parameter[binary_operation[call[dao.count, parameter[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=Credentials, sub_type=None))]], +, literal[1]]]]
call[toSave.setPassword, parameter[member[.ha]]]
call[toSave.setAuthToken, parameter[call[AuthTokenUtils.getNewToken, parameter[call[keyManager.getSymmetricKey, parameter[]], member[.toSave]]]]]
call[toSave.setRecoveryToken, parameter[call[AuthTokenUtils.getNewToken, parameter[call[keyManager.getSymmetricKey, parameter[]], member[.toSave]]]]]
call[dao.save, parameter[member[.toSave]]]
return[member[.toSave]]
end[}]
END[}] | Keyword[public] identifier[Credentials] identifier[userSignUp] operator[SEP] identifier[Credentials] identifier[credentials] operator[SEP] Keyword[throws] identifier[DAOException] {
Keyword[if] operator[SEP] identifier[getUserByEmail] operator[SEP] identifier[dao] , identifier[credentials] operator[SEP] identifier[getEmailAddress] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DAOException] operator[SEP] identifier[HttpStatus] operator[SEP] identifier[SC_CONFLICT] , literal[String] operator[SEP] operator[SEP]
}
identifier[ServerCredentials] identifier[toSave] operator[=] Keyword[new] identifier[ServerCredentials] operator[SEP] identifier[credentials] operator[SEP] operator[SEP] identifier[toSave] operator[SEP] identifier[decryptPassword] operator[SEP] identifier[keyManager] operator[SEP] identifier[getPrivateKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[de] operator[=] identifier[toSave] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[ha] operator[=] identifier[BCrypt] operator[SEP] identifier[hashpw] operator[SEP] identifier[de] , identifier[BCrypt] operator[SEP] identifier[gensalt] operator[SEP] Other[10] operator[SEP] operator[SEP] operator[SEP] identifier[toSave] operator[SEP] identifier[setOwnerId] operator[SEP] identifier[dao] operator[SEP] identifier[count] operator[SEP] identifier[Credentials] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[toSave] operator[SEP] identifier[setPassword] operator[SEP] identifier[ha] operator[SEP] operator[SEP] identifier[toSave] operator[SEP] identifier[setAuthToken] operator[SEP] identifier[AuthTokenUtils] operator[SEP] identifier[getNewToken] operator[SEP] identifier[keyManager] operator[SEP] identifier[getSymmetricKey] operator[SEP] operator[SEP] , identifier[toSave] operator[SEP] operator[SEP] operator[SEP] identifier[toSave] operator[SEP] identifier[setRecoveryToken] operator[SEP] identifier[AuthTokenUtils] operator[SEP] identifier[getNewToken] operator[SEP] identifier[keyManager] operator[SEP] identifier[getSymmetricKey] operator[SEP] operator[SEP] , identifier[toSave] operator[SEP] operator[SEP] operator[SEP] identifier[dao] operator[SEP] identifier[save] operator[SEP] identifier[toSave] operator[SEP] operator[SEP] Keyword[return] identifier[toSave] operator[SEP]
}
|
public static void printTree(Cluster a,String file) {
int depth = getDepth(a);
width = wunit*(depth+1);
height = hunit*(depth+1);
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image .createGraphics();
g.setColor(new Color(0,0,0));
g.setStroke(new BasicStroke(1));
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Font font = new Font("ๅฎไฝ", Font.BOLD, 20);
g.setFont(font);
drawTree(a, g, width/2, 0 , 1);
//้ๆพๅฏน่ฑก
g.dispose();
// ไฟๅญๆไปถ
try {
ImageIO.write(image, "png", new File(file));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | class class_name[name] begin[{]
method[printTree, return_type[void], modifier[public static], parameter[a, file]] begin[{]
local_variable[type[int], depth]
assign[member[.width], binary_operation[member[.wunit], *, binary_operation[member[.depth], +, literal[1]]]]
assign[member[.height], binary_operation[member[.hunit], *, binary_operation[member[.depth], +, literal[1]]]]
local_variable[type[BufferedImage], image]
local_variable[type[Graphics2D], g]
call[g.setColor, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Color, sub_type=None))]]
call[g.setStroke, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicStroke, sub_type=None))]]
call[g.setRenderingHint, parameter[member[RenderingHints.KEY_ANTIALIASING], member[RenderingHints.VALUE_ANTIALIAS_ON]]]
local_variable[type[Font], font]
call[g.setFont, parameter[member[.font]]]
call[.drawTree, parameter[member[.a], member[.g], binary_operation[member[.width], /, literal[2]], literal[0], literal[1]]]
call[g.dispose, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=image, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="png"), ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=write, postfix_operators=[], prefix_operators=[], qualifier=ImageIO, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[printTree] operator[SEP] identifier[Cluster] identifier[a] , identifier[String] identifier[file] operator[SEP] {
Keyword[int] identifier[depth] operator[=] identifier[getDepth] operator[SEP] identifier[a] operator[SEP] operator[SEP] identifier[width] operator[=] identifier[wunit] operator[*] operator[SEP] identifier[depth] operator[+] Other[1] operator[SEP] operator[SEP] identifier[height] operator[=] identifier[hunit] operator[*] operator[SEP] identifier[depth] operator[+] Other[1] operator[SEP] operator[SEP] identifier[BufferedImage] identifier[image] operator[=] Keyword[new] identifier[BufferedImage] operator[SEP] identifier[width] , identifier[height] , identifier[BufferedImage] operator[SEP] identifier[TYPE_INT_ARGB] operator[SEP] operator[SEP] identifier[Graphics2D] identifier[g] operator[=] identifier[image] operator[SEP] identifier[createGraphics] operator[SEP] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[setColor] operator[SEP] Keyword[new] identifier[Color] operator[SEP] Other[0] , Other[0] , Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[setStroke] operator[SEP] Keyword[new] identifier[BasicStroke] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[setRenderingHint] operator[SEP] identifier[RenderingHints] operator[SEP] identifier[KEY_ANTIALIASING] , identifier[RenderingHints] operator[SEP] identifier[VALUE_ANTIALIAS_ON] operator[SEP] operator[SEP] identifier[Font] identifier[font] operator[=] Keyword[new] identifier[Font] operator[SEP] literal[String] , identifier[Font] operator[SEP] identifier[BOLD] , Other[20] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[setFont] operator[SEP] identifier[font] operator[SEP] operator[SEP] identifier[drawTree] operator[SEP] identifier[a] , identifier[g] , identifier[width] operator[/] Other[2] , Other[0] , Other[1] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[ImageIO] operator[SEP] identifier[write] operator[SEP] identifier[image] , literal[String] , Keyword[new] identifier[File] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
protected void prepareQueries() throws SQLException
{
FIND_ITEM_BY_ID = "select * from JCR_SITEM where ID=?";
FIND_ITEM_BY_NAME =
"select * from JCR_SITEM"
+ " where CONTAINER_NAME=? and PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS, VERSION DESC";
FIND_PROPERTY_BY_NAME =
"select V.DATA"
+ " from JCR_SITEM I, JCR_SVALUE V"
+ " where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.PARENT_ID=? and I.NAME=? and"
+ " I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_REFERENCES =
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_SREF R, JCR_SITEM P"
+ " where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
FIND_VALUES_BY_PROPERTYID =
"select PROPERTY_ID, ORDER_NUM, DATA, STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=? order by ORDER_NUM";
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?" + " order by N_ORDER_NUM";
FIND_LAST_ORDER_NUMBER_BY_PARENTID =
"select count(*), max(N_ORDER_NUM) from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
FIND_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=2 and CONTAINER_NAME=? and PARENT_ID=?" + " order by ID";
FIND_MAX_PROPERTY_VERSIONS =
"select max(VERSION) FROM JCR_SITEM WHERE PARENT_ID=? and CONTAINER_NAME=? and NAME=? and I_INDEX=? and I_CLASS=2";
INSERT_NODE =
"insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,?,"
+ I_CLASS_NODE + ",?,?)";
INSERT_PROPERTY =
"insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, P_TYPE, P_MULTIVALUED) "
+ "VALUES(?,?,?,?,?," + I_CLASS_PROPERTY + ",?,?,?)";
INSERT_VALUE = "insert into JCR_SVALUE(DATA, ORDER_NUM, PROPERTY_ID, STORAGE_DESC) VALUES(?,?,?,?)";
INSERT_REF = "insert into JCR_SREF(NODE_ID, PROPERTY_ID, ORDER_NUM) VALUES(?,?,?)";
RENAME_NODE = "update JCR_SITEM set PARENT_ID=?, NAME=?, VERSION=?, I_INDEX=?, N_ORDER_NUM=? where ID=?";
UPDATE_NODE = "update JCR_SITEM set VERSION=?, I_INDEX=?, N_ORDER_NUM=? where ID=?";
UPDATE_PROPERTY = "update JCR_SITEM set VERSION=?, P_TYPE=? where ID=?";
DELETE_ITEM = "delete from JCR_SITEM where ID=?";
DELETE_VALUE = "delete from JCR_SVALUE where PROPERTY_ID=?";
DELETE_REF = "delete from JCR_SREF where PROPERTY_ID=?";
FIND_NODES_COUNT = "select count(*) from JCR_SITEM I where I.I_CLASS=1 and I.CONTAINER_NAME=?";
FIND_WORKSPACE_DATA_SIZE =
"select sum(length(DATA)) from JCR_SITEM I, JCR_SVALUE V where I.I_CLASS=2 and I.CONTAINER_NAME=?"
+ " and I.ID=V.PROPERTY_ID";
FIND_WORKSPACE_PROPERTIES_ON_VALUE_STORAGE =
"select V.PROPERTY_ID, V.STORAGE_DESC, V.ORDER_NUM from JCR_SITEM I, JCR_SVALUE V"
+ " where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID and V.STORAGE_DESC is not null";
FIND_NODE_DATA_SIZE =
"select sum(length(DATA)) from JCR_SITEM I, JCR_SVALUE V where I.PARENT_ID=? and I.I_CLASS=2"
+ " and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID";
FIND_NODE_PROPERTIES_ON_VALUE_STORAGE =
"select V.PROPERTY_ID, V.STORAGE_DESC, V.ORDER_NUM from JCR_SITEM I, JCR_SVALUE V"
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID"
+ " and V.STORAGE_DESC is not null";
FIND_VALUE_STORAGE_DESC_AND_SIZE = "select length(DATA), STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=?";
} | class class_name[name] begin[{]
method[prepareQueries, return_type[void], modifier[protected], parameter[]] begin[{]
assign[member[.FIND_ITEM_BY_ID], literal["select * from JCR_SITEM where ID=?"]]
assign[member[.FIND_ITEM_BY_NAME], binary_operation[literal["select * from JCR_SITEM"], +, literal[" where CONTAINER_NAME=? and PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS, VERSION DESC"]]]
assign[member[.FIND_PROPERTY_BY_NAME], binary_operation[binary_operation[binary_operation[literal["select V.DATA"], +, literal[" from JCR_SITEM I, JCR_SVALUE V"]], +, literal[" where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.PARENT_ID=? and I.NAME=? and"]], +, literal[" I.ID=V.PROPERTY_ID order by V.ORDER_NUM"]]]
assign[member[.FIND_REFERENCES], binary_operation[binary_operation[literal["select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME"], +, literal[" from JCR_SREF R, JCR_SITEM P"]], +, literal[" where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2"]]]
assign[member[.FIND_VALUES_BY_PROPERTYID], literal["select PROPERTY_ID, ORDER_NUM, DATA, STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=? order by ORDER_NUM"]]
assign[member[.FIND_NODES_BY_PARENTID], binary_operation[binary_operation[literal["select * from JCR_SITEM"], +, literal[" where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?"]], +, literal[" order by N_ORDER_NUM"]]]
assign[member[.FIND_LAST_ORDER_NUMBER_BY_PARENTID], literal["select count(*), max(N_ORDER_NUM) from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?"]]
assign[member[.FIND_NODES_COUNT_BY_PARENTID], binary_operation[literal["select count(ID) from JCR_SITEM"], +, literal[" where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?"]]]
assign[member[.FIND_PROPERTIES_BY_PARENTID], binary_operation[binary_operation[literal["select * from JCR_SITEM"], +, literal[" where I_CLASS=2 and CONTAINER_NAME=? and PARENT_ID=?"]], +, literal[" order by ID"]]]
assign[member[.FIND_MAX_PROPERTY_VERSIONS], literal["select max(VERSION) FROM JCR_SITEM WHERE PARENT_ID=? and CONTAINER_NAME=? and NAME=? and I_INDEX=? and I_CLASS=2"]]
assign[member[.INSERT_NODE], binary_operation[binary_operation[literal["insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,?,"], +, member[.I_CLASS_NODE]], +, literal[",?,?)"]]]
assign[member[.INSERT_PROPERTY], binary_operation[binary_operation[binary_operation[literal["insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, P_TYPE, P_MULTIVALUED) "], +, literal["VALUES(?,?,?,?,?,"]], +, member[.I_CLASS_PROPERTY]], +, literal[",?,?,?)"]]]
assign[member[.INSERT_VALUE], literal["insert into JCR_SVALUE(DATA, ORDER_NUM, PROPERTY_ID, STORAGE_DESC) VALUES(?,?,?,?)"]]
assign[member[.INSERT_REF], literal["insert into JCR_SREF(NODE_ID, PROPERTY_ID, ORDER_NUM) VALUES(?,?,?)"]]
assign[member[.RENAME_NODE], literal["update JCR_SITEM set PARENT_ID=?, NAME=?, VERSION=?, I_INDEX=?, N_ORDER_NUM=? where ID=?"]]
assign[member[.UPDATE_NODE], literal["update JCR_SITEM set VERSION=?, I_INDEX=?, N_ORDER_NUM=? where ID=?"]]
assign[member[.UPDATE_PROPERTY], literal["update JCR_SITEM set VERSION=?, P_TYPE=? where ID=?"]]
assign[member[.DELETE_ITEM], literal["delete from JCR_SITEM where ID=?"]]
assign[member[.DELETE_VALUE], literal["delete from JCR_SVALUE where PROPERTY_ID=?"]]
assign[member[.DELETE_REF], literal["delete from JCR_SREF where PROPERTY_ID=?"]]
assign[member[.FIND_NODES_COUNT], literal["select count(*) from JCR_SITEM I where I.I_CLASS=1 and I.CONTAINER_NAME=?"]]
assign[member[.FIND_WORKSPACE_DATA_SIZE], binary_operation[literal["select sum(length(DATA)) from JCR_SITEM I, JCR_SVALUE V where I.I_CLASS=2 and I.CONTAINER_NAME=?"], +, literal[" and I.ID=V.PROPERTY_ID"]]]
assign[member[.FIND_WORKSPACE_PROPERTIES_ON_VALUE_STORAGE], binary_operation[literal["select V.PROPERTY_ID, V.STORAGE_DESC, V.ORDER_NUM from JCR_SITEM I, JCR_SVALUE V"], +, literal[" where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID and V.STORAGE_DESC is not null"]]]
assign[member[.FIND_NODE_DATA_SIZE], binary_operation[literal["select sum(length(DATA)) from JCR_SITEM I, JCR_SVALUE V where I.PARENT_ID=? and I.I_CLASS=2"], +, literal[" and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID"]]]
assign[member[.FIND_NODE_PROPERTIES_ON_VALUE_STORAGE], binary_operation[binary_operation[literal["select V.PROPERTY_ID, V.STORAGE_DESC, V.ORDER_NUM from JCR_SITEM I, JCR_SVALUE V"], +, literal[" where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? and I.ID=V.PROPERTY_ID"]], +, literal[" and V.STORAGE_DESC is not null"]]]
assign[member[.FIND_VALUE_STORAGE_DESC_AND_SIZE], literal["select length(DATA), STORAGE_DESC from JCR_SVALUE where PROPERTY_ID=?"]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[prepareQueries] operator[SEP] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[FIND_ITEM_BY_ID] operator[=] literal[String] operator[SEP] identifier[FIND_ITEM_BY_NAME] operator[=] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_PROPERTY_BY_NAME] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_REFERENCES] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_VALUES_BY_PROPERTYID] operator[=] literal[String] operator[SEP] identifier[FIND_NODES_BY_PARENTID] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_LAST_ORDER_NUMBER_BY_PARENTID] operator[=] literal[String] operator[SEP] identifier[FIND_NODES_COUNT_BY_PARENTID] operator[=] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_PROPERTIES_BY_PARENTID] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_MAX_PROPERTY_VERSIONS] operator[=] literal[String] operator[SEP] identifier[INSERT_NODE] operator[=] literal[String] operator[+] identifier[I_CLASS_NODE] operator[+] literal[String] operator[SEP] identifier[INSERT_PROPERTY] operator[=] literal[String] operator[+] literal[String] operator[+] identifier[I_CLASS_PROPERTY] operator[+] literal[String] operator[SEP] identifier[INSERT_VALUE] operator[=] literal[String] operator[SEP] identifier[INSERT_REF] operator[=] literal[String] operator[SEP] identifier[RENAME_NODE] operator[=] literal[String] operator[SEP] identifier[UPDATE_NODE] operator[=] literal[String] operator[SEP] identifier[UPDATE_PROPERTY] operator[=] literal[String] operator[SEP] identifier[DELETE_ITEM] operator[=] literal[String] operator[SEP] identifier[DELETE_VALUE] operator[=] literal[String] operator[SEP] identifier[DELETE_REF] operator[=] literal[String] operator[SEP] identifier[FIND_NODES_COUNT] operator[=] literal[String] operator[SEP] identifier[FIND_WORKSPACE_DATA_SIZE] operator[=] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_WORKSPACE_PROPERTIES_ON_VALUE_STORAGE] operator[=] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_NODE_DATA_SIZE] operator[=] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_NODE_PROPERTIES_ON_VALUE_STORAGE] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] identifier[FIND_VALUE_STORAGE_DESC_AND_SIZE] operator[=] literal[String] operator[SEP]
}
|
public static void renderWrappedText(StringBuilder sb, int width, int nextLineTabStop, String text) {
int pos = OptionUtils.findWrapPos(text, width, 0);
if (pos == -1) {
sb.append(OptionUtils.rtrim(text));
return;
}
sb.append(OptionUtils.rtrim(text.substring(0, pos))).append(NEW_LINE);
if (nextLineTabStop >= width) {
// stops infinite loop happening
nextLineTabStop = 1;
}
// all following lines must be padded with nextLineTabStop space characters
String padding = OptionUtils.createPadding(nextLineTabStop);
String line = text;
while (true) {
line = padding + line.substring(pos).trim();
pos = OptionUtils.findWrapPos(line, width, 0);
if (pos == -1) {
sb.append(line);
return;
}
if (line.length() > width && pos == nextLineTabStop - 1) {
pos = width;
}
sb.append(OptionUtils.rtrim(line.substring(0, pos))).append(NEW_LINE);
}
} | class class_name[name] begin[{]
method[renderWrappedText, return_type[void], modifier[public static], parameter[sb, width, nextLineTabStop, text]] begin[{]
local_variable[type[int], pos]
if[binary_operation[member[.pos], ==, literal[1]]] begin[{]
call[sb.append, parameter[call[OptionUtils.rtrim, parameter[member[.text]]]]]
return[None]
else begin[{]
None
end[}]
call[sb.append, parameter[call[OptionUtils.rtrim, parameter[call[text.substring, parameter[literal[0], member[.pos]]]]]]]
if[binary_operation[member[.nextLineTabStop], >=, member[.width]]] begin[{]
assign[member[.nextLineTabStop], literal[1]]
else begin[{]
None
end[}]
local_variable[type[String], padding]
local_variable[type[String], line]
while[literal[true]] begin[{]
assign[member[.line], binary_operation[member[.padding], +, call[line.substring, parameter[member[.pos]]]]]
assign[member[.pos], call[OptionUtils.findWrapPos, parameter[member[.line], member[.width], literal[0]]]]
if[binary_operation[member[.pos], ==, literal[1]]] begin[{]
call[sb.append, parameter[member[.line]]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[line.length, parameter[]], >, member[.width]], &&, binary_operation[member[.pos], ==, binary_operation[member[.nextLineTabStop], -, literal[1]]]]] begin[{]
assign[member[.pos], member[.width]]
else begin[{]
None
end[}]
call[sb.append, parameter[call[OptionUtils.rtrim, parameter[call[line.substring, parameter[literal[0], member[.pos]]]]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[renderWrappedText] operator[SEP] identifier[StringBuilder] identifier[sb] , Keyword[int] identifier[width] , Keyword[int] identifier[nextLineTabStop] , identifier[String] identifier[text] operator[SEP] {
Keyword[int] identifier[pos] operator[=] identifier[OptionUtils] operator[SEP] identifier[findWrapPos] operator[SEP] identifier[text] , identifier[width] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[==] operator[-] Other[1] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[OptionUtils] operator[SEP] identifier[rtrim] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[OptionUtils] operator[SEP] identifier[rtrim] operator[SEP] identifier[text] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[pos] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[NEW_LINE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nextLineTabStop] operator[>=] identifier[width] operator[SEP] {
identifier[nextLineTabStop] operator[=] Other[1] operator[SEP]
}
identifier[String] identifier[padding] operator[=] identifier[OptionUtils] operator[SEP] identifier[createPadding] operator[SEP] identifier[nextLineTabStop] operator[SEP] operator[SEP] identifier[String] identifier[line] operator[=] identifier[text] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[line] operator[=] identifier[padding] operator[+] identifier[line] operator[SEP] identifier[substring] operator[SEP] identifier[pos] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[pos] operator[=] identifier[OptionUtils] operator[SEP] identifier[findWrapPos] operator[SEP] identifier[line] , identifier[width] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[==] operator[-] Other[1] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[line] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] identifier[width] operator[&&] identifier[pos] operator[==] identifier[nextLineTabStop] operator[-] Other[1] operator[SEP] {
identifier[pos] operator[=] identifier[width] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[OptionUtils] operator[SEP] identifier[rtrim] operator[SEP] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[pos] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[NEW_LINE] operator[SEP] operator[SEP]
}
}
|
@Override
public void init() {
// create db schema if needed
Connection connection = null;
try {
connection = jdbcRA.getConnection();
connection.createStatement().execute(
DataSourceSchemaInfo._QUERY_DROP);
connection.createStatement().execute(
DataSourceSchemaInfo._QUERY_CREATE);
} catch (SQLException e) {
tracer.warning("failed to create db schema", e);
} finally {
try {
connection.close();
} catch (SQLException e) {
tracer.severe("failed to close db connection", e);
}
}
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Connection], connection]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=jdbcRA, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=createStatement, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[MethodInvocation(arguments=[MemberReference(member=_QUERY_DROP, postfix_operators=[], prefix_operators=[], qualifier=DataSourceSchemaInfo, selectors=[])], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=createStatement, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[MethodInvocation(arguments=[MemberReference(member=_QUERY_CREATE, postfix_operators=[], prefix_operators=[], qualifier=DataSourceSchemaInfo, selectors=[])], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to create db schema"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=tracer, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to close db connection"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=severe, postfix_operators=[], prefix_operators=[], qualifier=tracer, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[init] operator[SEP] operator[SEP] {
identifier[Connection] identifier[connection] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[connection] operator[=] identifier[jdbcRA] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[createStatement] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] identifier[DataSourceSchemaInfo] operator[SEP] identifier[_QUERY_DROP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[createStatement] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] identifier[DataSourceSchemaInfo] operator[SEP] identifier[_QUERY_CREATE] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[tracer] operator[SEP] identifier[warning] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[connection] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[tracer] operator[SEP] identifier[severe] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
@Override
public RandomVariableDifferentiable mult(RandomVariable randomVariable) {
return new RandomVariableDifferentiableAADPathwise(
getValues().mult(randomVariable),
Arrays.asList(this, randomVariable),
OperatorType.MULT);
} | class class_name[name] begin[{]
method[mult, return_type[type[RandomVariableDifferentiable]], modifier[public], parameter[randomVariable]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=randomVariable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mult, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=randomVariable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), MemberReference(member=MULT, postfix_operators=[], prefix_operators=[], qualifier=OperatorType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RandomVariableDifferentiableAADPathwise, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RandomVariableDifferentiable] identifier[mult] operator[SEP] identifier[RandomVariable] identifier[randomVariable] operator[SEP] {
Keyword[return] Keyword[new] identifier[RandomVariableDifferentiableAADPathwise] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[mult] operator[SEP] identifier[randomVariable] operator[SEP] , identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] Keyword[this] , identifier[randomVariable] operator[SEP] , identifier[OperatorType] operator[SEP] identifier[MULT] operator[SEP] operator[SEP]
}
|
public boolean push(String newText) {
if (stackTop < stack.length - 1) {
stack[stackTop++] = newText;
return true;
} else {
return false;
}
} | class class_name[name] begin[{]
method[push, return_type[type[boolean]], modifier[public], parameter[newText]] begin[{]
if[binary_operation[member[.stackTop], <, binary_operation[member[stack.length], -, literal[1]]]] begin[{]
assign[member[.stack], member[.newText]]
return[literal[true]]
else begin[{]
return[literal[false]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[push] operator[SEP] identifier[String] identifier[newText] operator[SEP] {
Keyword[if] operator[SEP] identifier[stackTop] operator[<] identifier[stack] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] {
identifier[stack] operator[SEP] identifier[stackTop] operator[++] operator[SEP] operator[=] identifier[newText] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public URL getServiceURL() {
return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes,
this.serviceUUID, null, null);
} | class class_name[name] begin[{]
method[getServiceURL, return_type[type[URL]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=protocol, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=adapterAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=deviceAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=deviceAttributes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serviceUUID, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[URL] identifier[getServiceURL] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[URL] operator[SEP] Keyword[this] operator[SEP] identifier[protocol] , Keyword[this] operator[SEP] identifier[adapterAddress] , Keyword[this] operator[SEP] identifier[deviceAddress] , Keyword[this] operator[SEP] identifier[deviceAttributes] , Keyword[this] operator[SEP] identifier[serviceUUID] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public Option getOptionWithLongForm( String longForm ) throws InvalidOptionException
{
for (Option option : options)
{
if (longForm.equals( option.getLongForm() )) return option;
}
throw new InvalidOptionException( longForm );
} | class class_name[name] begin[{]
method[getOptionWithLongForm, return_type[type[Option]], modifier[public], parameter[longForm]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLongForm, postfix_operators=[], prefix_operators=[], qualifier=option, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=longForm, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=option, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=option)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Option, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=longForm, 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=InvalidOptionException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] identifier[Option] identifier[getOptionWithLongForm] operator[SEP] identifier[String] identifier[longForm] operator[SEP] Keyword[throws] identifier[InvalidOptionException] {
Keyword[for] operator[SEP] identifier[Option] identifier[option] operator[:] identifier[options] operator[SEP] {
Keyword[if] operator[SEP] identifier[longForm] operator[SEP] identifier[equals] operator[SEP] identifier[option] operator[SEP] identifier[getLongForm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[option] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[InvalidOptionException] operator[SEP] identifier[longForm] operator[SEP] operator[SEP]
}
|
public CalendarQuarter plus(Quarters quarters) {
if (quarters.isEmpty()) {
return this;
}
long value = this.year * 4L + this.quarter.getValue() - 1 + quarters.getAmount();
int y = MathUtils.safeCast(MathUtils.floorDivide(value, 4));
Quarter q = Quarter.valueOf(MathUtils.floorModulo(value, 4) + 1);
return CalendarQuarter.of(y, q);
} | class class_name[name] begin[{]
method[plus, return_type[type[CalendarQuarter]], modifier[public], parameter[quarters]] begin[{]
if[call[quarters.isEmpty, parameter[]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[long], value]
local_variable[type[int], y]
local_variable[type[Quarter], q]
return[call[CalendarQuarter.of, parameter[member[.y], member[.q]]]]
end[}]
END[}] | Keyword[public] identifier[CalendarQuarter] identifier[plus] operator[SEP] identifier[Quarters] identifier[quarters] operator[SEP] {
Keyword[if] operator[SEP] identifier[quarters] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[long] identifier[value] operator[=] Keyword[this] operator[SEP] identifier[year] operator[*] Other[4L] operator[+] Keyword[this] operator[SEP] identifier[quarter] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[-] Other[1] operator[+] identifier[quarters] operator[SEP] identifier[getAmount] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[y] operator[=] identifier[MathUtils] operator[SEP] identifier[safeCast] operator[SEP] identifier[MathUtils] operator[SEP] identifier[floorDivide] operator[SEP] identifier[value] , Other[4] operator[SEP] operator[SEP] operator[SEP] identifier[Quarter] identifier[q] operator[=] identifier[Quarter] operator[SEP] identifier[valueOf] operator[SEP] identifier[MathUtils] operator[SEP] identifier[floorModulo] operator[SEP] identifier[value] , Other[4] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[CalendarQuarter] operator[SEP] identifier[of] operator[SEP] identifier[y] , identifier[q] operator[SEP] operator[SEP]
}
|
public String getEditorClass()
{
PropertyInfo pi = getPropertyInfo();
if (pi == null)
return null;
//
// This is trickier, because APT doesn't allow access to Class-valued annotations,
// because the type may not yet have been compiled.
//
Collection<AnnotationMirror> annotMirrors = _propDecl.getAnnotationMirrors();
for (AnnotationMirror am: annotMirrors)
{
if (am.getAnnotationType().toString().equals(
"org.apache.beehive.controls.api.packaging.PropertyInfo"))
{
Map<AnnotationTypeElementDeclaration,AnnotationValue> avs =
am.getElementValues();
for (AnnotationTypeElementDeclaration ated: avs.keySet())
{
if (ated.toString().equals("editorClass()"))
{
//
// Get the annotation value, and ignore the default value which implies
// no editor class (because 'null' cannot be a default value)
//
String editorClass = avs.get(ated).getValue().toString();
if (editorClass.equals("org.apache.beehive.controls.api.packaging.PropertyInfo.NoEditor.class"))
return null;
return editorClass;
}
}
break;
}
}
return null;
} | class class_name[name] begin[{]
method[getEditorClass, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[PropertyInfo], pi]
if[binary_operation[member[.pi], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Collection], annotMirrors]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getAnnotationType, postfix_operators=[], prefix_operators=[], qualifier=am, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.apache.beehive.controls.api.packaging.PropertyInfo")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getElementValues, postfix_operators=[], prefix_operators=[], qualifier=am, selectors=[], type_arguments=None), name=avs)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AnnotationTypeElementDeclaration, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AnnotationValue, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=ated, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="editorClass()")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=avs, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=editorClass)], 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="org.apache.beehive.controls.api.packaging.PropertyInfo.NoEditor.class")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=editorClass, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), ReturnStatement(expression=MemberReference(member=editorClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=avs, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ated)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AnnotationTypeElementDeclaration, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=annotMirrors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=am)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AnnotationMirror, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getEditorClass] operator[SEP] operator[SEP] {
identifier[PropertyInfo] identifier[pi] operator[=] identifier[getPropertyInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pi] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[Collection] operator[<] identifier[AnnotationMirror] operator[>] identifier[annotMirrors] operator[=] identifier[_propDecl] operator[SEP] identifier[getAnnotationMirrors] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AnnotationMirror] identifier[am] operator[:] identifier[annotMirrors] operator[SEP] {
Keyword[if] operator[SEP] identifier[am] operator[SEP] identifier[getAnnotationType] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[AnnotationTypeElementDeclaration] , identifier[AnnotationValue] operator[>] identifier[avs] operator[=] identifier[am] operator[SEP] identifier[getElementValues] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AnnotationTypeElementDeclaration] identifier[ated] operator[:] identifier[avs] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ated] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[editorClass] operator[=] identifier[avs] operator[SEP] identifier[get] operator[SEP] identifier[ated] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[editorClass] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[editorClass] operator[SEP]
}
}
Keyword[break] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
TextOutline positionChargeLabel(int hydrogens, HydrogenPosition position, TextOutline charge, TextOutline element,
TextOutline hydrogen) {
final Rectangle2D chargeBounds = charge.getBounds();
// the charge is placed to the top right of the element symbol
// unless either the hydrogen label or the hydrogen count label
// are in the way - in which case we place it relative to the
// hydrogen
Rectangle2D referenceBounds = element.getBounds();
if (hydrogens > 0 && position == Right)
referenceBounds = hydrogen.getBounds();
else if (hydrogens > 1 && position == Above) referenceBounds = hydrogen.getBounds();
return charge.translate((referenceBounds.getMaxX() + padding) - chargeBounds.getMinX(),
(referenceBounds.getMinY() - (chargeBounds.getHeight() / 2)) - chargeBounds.getMinY());
} | class class_name[name] begin[{]
method[positionChargeLabel, return_type[type[TextOutline]], modifier[default], parameter[hydrogens, position, charge, element, hydrogen]] begin[{]
local_variable[type[Rectangle2D], chargeBounds]
local_variable[type[Rectangle2D], referenceBounds]
if[binary_operation[binary_operation[member[.hydrogens], >, literal[0]], &&, binary_operation[member[.position], ==, member[.Right]]]] begin[{]
assign[member[.referenceBounds], call[hydrogen.getBounds, parameter[]]]
else begin[{]
if[binary_operation[binary_operation[member[.hydrogens], >, literal[1]], &&, binary_operation[member[.position], ==, member[.Above]]]] begin[{]
assign[member[.referenceBounds], call[hydrogen.getBounds, parameter[]]]
else begin[{]
None
end[}]
end[}]
return[call[charge.translate, parameter[binary_operation[binary_operation[call[referenceBounds.getMaxX, parameter[]], +, member[.padding]], -, call[chargeBounds.getMinX, parameter[]]], binary_operation[binary_operation[call[referenceBounds.getMinY, parameter[]], -, binary_operation[call[chargeBounds.getHeight, parameter[]], /, literal[2]]], -, call[chargeBounds.getMinY, parameter[]]]]]]
end[}]
END[}] | identifier[TextOutline] identifier[positionChargeLabel] operator[SEP] Keyword[int] identifier[hydrogens] , identifier[HydrogenPosition] identifier[position] , identifier[TextOutline] identifier[charge] , identifier[TextOutline] identifier[element] , identifier[TextOutline] identifier[hydrogen] operator[SEP] {
Keyword[final] identifier[Rectangle2D] identifier[chargeBounds] operator[=] identifier[charge] operator[SEP] identifier[getBounds] operator[SEP] operator[SEP] operator[SEP] identifier[Rectangle2D] identifier[referenceBounds] operator[=] identifier[element] operator[SEP] identifier[getBounds] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hydrogens] operator[>] Other[0] operator[&&] identifier[position] operator[==] identifier[Right] operator[SEP] identifier[referenceBounds] operator[=] identifier[hydrogen] operator[SEP] identifier[getBounds] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[hydrogens] operator[>] Other[1] operator[&&] identifier[position] operator[==] identifier[Above] operator[SEP] identifier[referenceBounds] operator[=] identifier[hydrogen] operator[SEP] identifier[getBounds] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[charge] operator[SEP] identifier[translate] operator[SEP] operator[SEP] identifier[referenceBounds] operator[SEP] identifier[getMaxX] operator[SEP] operator[SEP] operator[+] identifier[padding] operator[SEP] operator[-] identifier[chargeBounds] operator[SEP] identifier[getMinX] operator[SEP] operator[SEP] , operator[SEP] identifier[referenceBounds] operator[SEP] identifier[getMinY] operator[SEP] operator[SEP] operator[-] operator[SEP] identifier[chargeBounds] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] operator[-] identifier[chargeBounds] operator[SEP] identifier[getMinY] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getDoi() {
if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_doi == null)
jcasType.jcas.throwFeatMissing("doi", "de.julielab.jules.types.Header");
return jcasType.ll_cas.ll_getStringValue(addr, ((Header_Type)jcasType).casFeatCode_doi);} | class class_name[name] begin[{]
method[getDoi, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[Header_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Header_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["doi"], literal["de.julielab.jules.types.Header"]]]
else begin[{]
None
end[}]
return[call[jcasType.ll_cas.ll_getStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Header_Type, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getDoi] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Header_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Header_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_doi] 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] Keyword[return] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Header_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_doi] operator[SEP] operator[SEP]
}
|
public void serializeInsert(QueryMetadata metadata, RelationalPath<?> entity,
List<SQLInsertBatch> batches, SQLSerializer context) {
context.serializeForInsert(metadata, entity, batches);
if (!metadata.getFlags().isEmpty()) {
context.serialize(Position.END, metadata.getFlags());
}
} | class class_name[name] begin[{]
method[serializeInsert, return_type[void], modifier[public], parameter[metadata, entity, batches, context]] begin[{]
call[context.serializeForInsert, parameter[member[.metadata], member[.entity], member[.batches]]]
if[call[metadata.getFlags, parameter[]]] begin[{]
call[context.serialize, parameter[member[Position.END], call[metadata.getFlags, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[serializeInsert] operator[SEP] identifier[QueryMetadata] identifier[metadata] , identifier[RelationalPath] operator[<] operator[?] operator[>] identifier[entity] , identifier[List] operator[<] identifier[SQLInsertBatch] operator[>] identifier[batches] , identifier[SQLSerializer] identifier[context] operator[SEP] {
identifier[context] operator[SEP] identifier[serializeForInsert] operator[SEP] identifier[metadata] , identifier[entity] , identifier[batches] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[metadata] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[serialize] operator[SEP] identifier[Position] operator[SEP] identifier[END] , identifier[metadata] operator[SEP] identifier[getFlags] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void setIndices(CharBuffer indices)
{
if (indices != null)
{
if (mIndices == null)
{
setIndexBuffer(new GVRIndexBuffer(getGVRContext(), 2, indices.capacity() / 2));
}
mIndices.setShortVec(indices);
}
else
{
NativeMesh.setIndexBuffer(getNative(), 0L);
}
} | class class_name[name] begin[{]
method[setIndices, return_type[void], modifier[public], parameter[indices]] begin[{]
if[binary_operation[member[.indices], !=, literal[null]]] begin[{]
if[binary_operation[member[.mIndices], ==, literal[null]]] begin[{]
call[.setIndexBuffer, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getGVRContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), BinaryOperation(operandl=MethodInvocation(arguments=[], member=capacity, postfix_operators=[], prefix_operators=[], qualifier=indices, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GVRIndexBuffer, sub_type=None))]]
else begin[{]
None
end[}]
call[mIndices.setShortVec, parameter[member[.indices]]]
else begin[{]
call[NativeMesh.setIndexBuffer, parameter[call[.getNative, parameter[]], literal[0L]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setIndices] operator[SEP] identifier[CharBuffer] identifier[indices] operator[SEP] {
Keyword[if] operator[SEP] identifier[indices] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[mIndices] operator[==] Other[null] operator[SEP] {
identifier[setIndexBuffer] operator[SEP] Keyword[new] identifier[GVRIndexBuffer] operator[SEP] identifier[getGVRContext] operator[SEP] operator[SEP] , Other[2] , identifier[indices] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mIndices] operator[SEP] identifier[setShortVec] operator[SEP] identifier[indices] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[NativeMesh] operator[SEP] identifier[setIndexBuffer] operator[SEP] identifier[getNative] operator[SEP] operator[SEP] , Other[0L] operator[SEP] operator[SEP]
}
}
|
public static Map<String, IDLProxyObject> create(File file, boolean debug, File path, List<CodeDependent> cds,
Set<String> compiledClass) throws IOException {
return create(file, debug, path, cds, compiledClass, true);
} | class class_name[name] begin[{]
method[create, return_type[type[Map]], modifier[public static], parameter[file, debug, path, cds, compiledClass]] begin[{]
return[call[.create, parameter[member[.file], member[.debug], member[.path], member[.cds], member[.compiledClass], literal[true]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[IDLProxyObject] operator[>] identifier[create] operator[SEP] identifier[File] identifier[file] , Keyword[boolean] identifier[debug] , identifier[File] identifier[path] , identifier[List] operator[<] identifier[CodeDependent] operator[>] identifier[cds] , identifier[Set] operator[<] identifier[String] operator[>] identifier[compiledClass] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[create] operator[SEP] identifier[file] , identifier[debug] , identifier[path] , identifier[cds] , identifier[compiledClass] , literal[boolean] operator[SEP] operator[SEP]
}
|
public NfsRemoveResponse remove() throws IOException {
NfsRemoveResponse response = getNfs().wrapped_sendRemove(makeRemoveRequest());
setFileHandle(null);
return response;
} | class class_name[name] begin[{]
method[remove, return_type[type[NfsRemoveResponse]], modifier[public], parameter[]] begin[{]
local_variable[type[NfsRemoveResponse], response]
call[.setFileHandle, parameter[literal[null]]]
return[member[.response]]
end[}]
END[}] | Keyword[public] identifier[NfsRemoveResponse] identifier[remove] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[NfsRemoveResponse] identifier[response] operator[=] identifier[getNfs] operator[SEP] operator[SEP] operator[SEP] identifier[wrapped_sendRemove] operator[SEP] identifier[makeRemoveRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setFileHandle] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
@Beta
public static boolean shutdownAndAwaitTermination(
ExecutorService service, long timeout, TimeUnit unit) {
checkNotNull(unit);
// Disable new tasks from being submitted
service.shutdown();
try {
long halfTimeoutNanos = TimeUnit.NANOSECONDS.convert(timeout, unit) / 2;
// Wait for half the duration of the timeout for existing tasks to terminate
if (!service.awaitTermination(halfTimeoutNanos, TimeUnit.NANOSECONDS)) {
// Cancel currently executing tasks
service.shutdownNow();
// Wait the other half of the timeout for tasks to respond to being cancelled
service.awaitTermination(halfTimeoutNanos, TimeUnit.NANOSECONDS);
}
} catch (InterruptedException ie) {
// Preserve interrupt status
Thread.currentThread().interrupt();
// (Re-)Cancel if current thread also interrupted
service.shutdownNow();
}
return service.isTerminated();
} | class class_name[name] begin[{]
method[shutdownAndAwaitTermination, return_type[type[boolean]], modifier[public static], parameter[service, timeout, unit]] begin[{]
call[.checkNotNull, parameter[member[.unit]]]
call[service.shutdown, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit.NANOSECONDS, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), name=halfTimeoutNanos)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=halfTimeoutNanos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NANOSECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=awaitTermination, postfix_operators=[], prefix_operators=['!'], qualifier=service, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=shutdownNow, postfix_operators=[], prefix_operators=[], qualifier=service, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=halfTimeoutNanos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NANOSECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=awaitTermination, postfix_operators=[], prefix_operators=[], qualifier=service, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=shutdownNow, postfix_operators=[], prefix_operators=[], qualifier=service, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ie, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
return[call[service.isTerminated, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Beta] Keyword[public] Keyword[static] Keyword[boolean] identifier[shutdownAndAwaitTermination] operator[SEP] identifier[ExecutorService] identifier[service] , Keyword[long] identifier[timeout] , identifier[TimeUnit] identifier[unit] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[unit] operator[SEP] operator[SEP] identifier[service] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[long] identifier[halfTimeoutNanos] operator[=] identifier[TimeUnit] operator[SEP] identifier[NANOSECONDS] operator[SEP] identifier[convert] operator[SEP] identifier[timeout] , identifier[unit] operator[SEP] operator[/] Other[2] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[service] operator[SEP] identifier[awaitTermination] operator[SEP] identifier[halfTimeoutNanos] , identifier[TimeUnit] operator[SEP] identifier[NANOSECONDS] operator[SEP] operator[SEP] {
identifier[service] operator[SEP] identifier[shutdownNow] operator[SEP] operator[SEP] operator[SEP] identifier[service] operator[SEP] identifier[awaitTermination] operator[SEP] identifier[halfTimeoutNanos] , identifier[TimeUnit] operator[SEP] identifier[NANOSECONDS] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[ie] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP] identifier[service] operator[SEP] identifier[shutdownNow] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[service] operator[SEP] identifier[isTerminated] operator[SEP] operator[SEP] operator[SEP]
}
|
public void configure(Map<String, ?> configs, boolean isKey) {
Preconditions.checkArgument(isKey==false, "LiAvroDeserializer only works for value fields");
_datumReader = new GenericDatumReader<>();
Properties props = new Properties();
for (Map.Entry<String, ?> entry: configs.entrySet())
{
String value = String.valueOf(entry.getValue());
props.setProperty(entry.getKey(), value);
}
_schemaRegistry = KafkaSchemaRegistryFactory.getSchemaRegistry(props);
} | class class_name[name] begin[{]
method[configure, return_type[void], modifier[public], parameter[configs, isKey]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[member[.isKey], ==, literal[false]], literal["LiAvroDeserializer only works for value fields"]]]
assign[member[._datumReader], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=GenericDatumReader, sub_type=None))]
local_variable[type[Properties], props]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=configs, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=?, type=None)], dimensions=None, name=Entry, sub_type=None)))), label=None)
assign[member[._schemaRegistry], call[KafkaSchemaRegistryFactory.getSchemaRegistry, parameter[member[.props]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[configure] operator[SEP] identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[configs] , Keyword[boolean] identifier[isKey] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[isKey] operator[==] literal[boolean] , literal[String] operator[SEP] operator[SEP] identifier[_datumReader] operator[=] Keyword[new] identifier[GenericDatumReader] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Properties] identifier[props] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , operator[?] operator[>] identifier[entry] operator[:] identifier[configs] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[setProperty] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
}
identifier[_schemaRegistry] operator[=] identifier[KafkaSchemaRegistryFactory] operator[SEP] identifier[getSchemaRegistry] operator[SEP] identifier[props] operator[SEP] operator[SEP]
}
|
public void drawImage (final PDInlineImage inlineImage, final float x, final float y) throws IOException
{
drawImage (inlineImage, x, y, inlineImage.getWidth (), inlineImage.getHeight ());
} | class class_name[name] begin[{]
method[drawImage, return_type[void], modifier[public], parameter[inlineImage, x, y]] begin[{]
call[.drawImage, parameter[member[.inlineImage], member[.x], member[.y], call[inlineImage.getWidth, parameter[]], call[inlineImage.getHeight, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[drawImage] operator[SEP] Keyword[final] identifier[PDInlineImage] identifier[inlineImage] , Keyword[final] Keyword[float] identifier[x] , Keyword[final] Keyword[float] identifier[y] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[drawImage] operator[SEP] identifier[inlineImage] , identifier[x] , identifier[y] , identifier[inlineImage] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[inlineImage] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int skipCQLId(String toParse, int idx) {
if (idx >= toParse.length()) throw new IllegalArgumentException();
char c = toParse.charAt(idx);
if (isCqlIdentifierChar(c)) {
while (idx < toParse.length() && isCqlIdentifierChar(toParse.charAt(idx))) idx++;
return idx;
}
if (c != '"') throw new IllegalArgumentException();
while (++idx < toParse.length()) {
c = toParse.charAt(idx);
if (c != '"') continue;
if (idx + 1 < toParse.length() && toParse.charAt(idx + 1) == '\"')
++idx; // this is an escaped double quote, skip it
else return idx + 1;
}
throw new IllegalArgumentException();
} | class class_name[name] begin[{]
method[skipCQLId, return_type[type[int]], modifier[public static], parameter[toParse, idx]] begin[{]
if[binary_operation[member[.idx], >=, call[toParse.length, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[char], c]
if[call[.isCqlIdentifierChar, parameter[member[.c]]]] begin[{]
while[binary_operation[binary_operation[member[.idx], <, call[toParse.length, parameter[]]], &&, call[.isCqlIdentifierChar, parameter[call[toParse.charAt, parameter[member[.idx]]]]]]] begin[{]
member[.idx]
end[}]
return[member[.idx]]
else begin[{]
None
end[}]
if[binary_operation[member[.c], !=, literal['"']]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
while[binary_operation[member[.idx], <, call[toParse.length, parameter[]]]] begin[{]
assign[member[.c], call[toParse.charAt, parameter[member[.idx]]]]
if[binary_operation[member[.c], !=, literal['"']]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.idx], +, literal[1]], <, call[toParse.length, parameter[]]], &&, binary_operation[call[toParse.charAt, parameter[binary_operation[member[.idx], +, literal[1]]]], ==, literal['\"']]]] begin[{]
member[.idx]
else begin[{]
return[binary_operation[member[.idx], +, literal[1]]]
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[skipCQLId] operator[SEP] identifier[String] identifier[toParse] , Keyword[int] identifier[idx] operator[SEP] {
Keyword[if] operator[SEP] identifier[idx] operator[>=] identifier[toParse] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[char] identifier[c] operator[=] identifier[toParse] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isCqlIdentifierChar] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[idx] operator[<] identifier[toParse] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] identifier[isCqlIdentifierChar] operator[SEP] identifier[toParse] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[SEP] operator[SEP] operator[SEP] identifier[idx] operator[++] operator[SEP] Keyword[return] identifier[idx] operator[SEP]
}
Keyword[if] operator[SEP] identifier[c] operator[!=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[++] identifier[idx] operator[<] identifier[toParse] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[c] operator[=] identifier[toParse] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[!=] literal[String] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[+] Other[1] operator[<] identifier[toParse] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] identifier[toParse] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] operator[++] identifier[idx] operator[SEP] Keyword[else] Keyword[return] identifier[idx] operator[+] Other[1] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP]
}
|
private PushApplication loadPushApplicationWhenAuthorized(HttpServletRequest request) {
// extract the pushApplicationID and its secret from the HTTP Basic header:
String[] credentials = HttpBasicHelper.extractUsernameAndPasswordFromBasicHeader(request);
String pushApplicationID = credentials[0];
String secret = credentials[1];
final PushApplication pushApplication = pushApplicationService.findByPushApplicationID(pushApplicationID);
if (pushApplication != null && pushApplication.getMasterSecret().equals(secret)) {
return pushApplication;
}
// unauthorized...
return null;
} | class class_name[name] begin[{]
method[loadPushApplicationWhenAuthorized, return_type[type[PushApplication]], modifier[private], parameter[request]] begin[{]
local_variable[type[String], credentials]
local_variable[type[String], pushApplicationID]
local_variable[type[String], secret]
local_variable[type[PushApplication], pushApplication]
if[binary_operation[binary_operation[member[.pushApplication], !=, literal[null]], &&, call[pushApplication.getMasterSecret, parameter[]]]] begin[{]
return[member[.pushApplication]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[PushApplication] identifier[loadPushApplicationWhenAuthorized] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[credentials] operator[=] identifier[HttpBasicHelper] operator[SEP] identifier[extractUsernameAndPasswordFromBasicHeader] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[String] identifier[pushApplicationID] operator[=] identifier[credentials] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[secret] operator[=] identifier[credentials] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[final] identifier[PushApplication] identifier[pushApplication] operator[=] identifier[pushApplicationService] operator[SEP] identifier[findByPushApplicationID] operator[SEP] identifier[pushApplicationID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pushApplication] operator[!=] Other[null] operator[&&] identifier[pushApplication] operator[SEP] identifier[getMasterSecret] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[secret] operator[SEP] operator[SEP] {
Keyword[return] identifier[pushApplication] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public GetPolicyResult getPolicy(GetPolicyRequest request) {
request = beforeClientExecution(request);
return executeGetPolicy(request);
} | class class_name[name] begin[{]
method[getPolicy, return_type[type[GetPolicyResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetPolicy, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[GetPolicyResult] identifier[getPolicy] operator[SEP] identifier[GetPolicyRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetPolicy] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public void stopWriteCacheFlushTimer(int pagesFlushed) {
// lazy initialization to prevent memory consumption
if (writCacheCountersHolder == null)
writCacheCountersHolder = new WritCacheCountersHolder();
final long endTs = nanoTimer.getNano();
final long timeDiff = (endTs - timeStamps.pop());
writCacheCountersHolder.flushOperationsCount++;
writCacheCountersHolder.amountOfPagesFlushed += pagesFlushed;
writCacheCountersHolder.flushOperationsTime += timeDiff;
makeSnapshotIfNeeded(endTs);
} | class class_name[name] begin[{]
method[stopWriteCacheFlushTimer, return_type[void], modifier[public], parameter[pagesFlushed]] begin[{]
if[binary_operation[member[.writCacheCountersHolder], ==, literal[null]]] begin[{]
assign[member[.writCacheCountersHolder], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WritCacheCountersHolder, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[long], endTs]
local_variable[type[long], timeDiff]
member[writCacheCountersHolder.flushOperationsCount]
assign[member[writCacheCountersHolder.amountOfPagesFlushed], member[.pagesFlushed]]
assign[member[writCacheCountersHolder.flushOperationsTime], member[.timeDiff]]
call[.makeSnapshotIfNeeded, parameter[member[.endTs]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[stopWriteCacheFlushTimer] operator[SEP] Keyword[int] identifier[pagesFlushed] operator[SEP] {
Keyword[if] operator[SEP] identifier[writCacheCountersHolder] operator[==] Other[null] operator[SEP] identifier[writCacheCountersHolder] operator[=] Keyword[new] identifier[WritCacheCountersHolder] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[endTs] operator[=] identifier[nanoTimer] operator[SEP] identifier[getNano] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[timeDiff] operator[=] operator[SEP] identifier[endTs] operator[-] identifier[timeStamps] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writCacheCountersHolder] operator[SEP] identifier[flushOperationsCount] operator[++] operator[SEP] identifier[writCacheCountersHolder] operator[SEP] identifier[amountOfPagesFlushed] operator[+=] identifier[pagesFlushed] operator[SEP] identifier[writCacheCountersHolder] operator[SEP] identifier[flushOperationsTime] operator[+=] identifier[timeDiff] operator[SEP] identifier[makeSnapshotIfNeeded] operator[SEP] identifier[endTs] operator[SEP] operator[SEP]
}
|
public static List<String> zip(String... inputs) {
if (inputs.length == 0) {
return Collections.emptyList();
}
OptionalInt min = Arrays.stream(inputs).mapToInt(str -> str == null ? 0 : str.length()).min();
if (!min.isPresent()) {
return Collections.emptyList();
}
return IntStream.range(0, min.getAsInt())
.mapToObj(elementIndex -> Arrays.stream(inputs)
.map(input -> String.valueOf(input.charAt(elementIndex)))
.collect(joining()))
.collect(toList());
} | class class_name[name] begin[{]
method[zip, return_type[type[List]], modifier[public static], parameter[inputs]] begin[{]
if[binary_operation[member[inputs.length], ==, literal[0]]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[OptionalInt], min]
if[call[min.isPresent, parameter[]]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
return[call[IntStream.range, parameter[literal[0], call[min.getAsInt, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[zip] operator[SEP] identifier[String] operator[...] identifier[inputs] operator[SEP] {
Keyword[if] operator[SEP] identifier[inputs] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
identifier[OptionalInt] identifier[min] operator[=] identifier[Arrays] operator[SEP] identifier[stream] operator[SEP] identifier[inputs] operator[SEP] operator[SEP] identifier[mapToInt] operator[SEP] identifier[str] operator[->] identifier[str] operator[==] Other[null] operator[?] Other[0] operator[:] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[min] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[min] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[IntStream] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[min] operator[SEP] identifier[getAsInt] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mapToObj] operator[SEP] identifier[elementIndex] operator[->] identifier[Arrays] operator[SEP] identifier[stream] operator[SEP] identifier[inputs] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[input] operator[->] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[input] operator[SEP] identifier[charAt] operator[SEP] identifier[elementIndex] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[joining] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void visitLhsNodes(
AmbiguatedFunctionSummary sideEffectInfo,
Scope scope,
Node enclosingFunction,
List<Node> lhsNodes,
Predicate<Node> hasLocalRhs) {
for (Node lhs : lhsNodes) {
if (NodeUtil.isGet(lhs)) {
if (lhs.getFirstChild().isThis()) {
sideEffectInfo.setMutatesThis();
} else {
Node objectNode = lhs.getFirstChild();
if (objectNode.isName()) {
Var var = scope.getVar(objectNode.getString());
if (isVarDeclaredInSameContainerScope(var, scope)) {
// Maybe a local object modification. We won't know for sure until
// we exit the scope and can validate the value of the local.
taintedVarsByFunction.put(enclosingFunction, var);
} else {
sideEffectInfo.setMutatesGlobalState();
}
} else {
// Don't track multi level locals: local.prop.prop2++;
sideEffectInfo.setMutatesGlobalState();
}
}
} else {
checkState(lhs.isName(), lhs);
Var var = scope.getVar(lhs.getString());
if (isVarDeclaredInSameContainerScope(var, scope)) {
if (!hasLocalRhs.test(lhs)) {
// Assigned value is not guaranteed to be a local value,
// so if we see any property assignments on this variable,
// they could be tainting a non-local value.
blacklistedVarsByFunction.put(enclosingFunction, var);
}
} else {
sideEffectInfo.setMutatesGlobalState();
}
}
}
} | class class_name[name] begin[{]
method[visitLhsNodes, return_type[void], modifier[private], parameter[sideEffectInfo, scope, enclosingFunction, lhsNodes, hasLocalRhs]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=lhs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isGet, postfix_operators=[], prefix_operators=[], qualifier=NodeUtil, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=isName, postfix_operators=[], prefix_operators=[], qualifier=lhs, selectors=[], type_arguments=None), MemberReference(member=lhs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getString, postfix_operators=[], prefix_operators=[], qualifier=lhs, selectors=[], type_arguments=None)], member=getVar, postfix_operators=[], prefix_operators=[], qualifier=scope, selectors=[], type_arguments=None), name=var)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Var, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isVarDeclaredInSameContainerScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=setMutatesGlobalState, postfix_operators=[], prefix_operators=[], qualifier=sideEffectInfo, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=lhs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=test, postfix_operators=[], prefix_operators=['!'], qualifier=hasLocalRhs, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=enclosingFunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=blacklistedVarsByFunction, selectors=[], type_arguments=None), label=None)]))]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getFirstChild, postfix_operators=[], prefix_operators=[], qualifier=lhs, selectors=[MethodInvocation(arguments=[], member=isThis, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFirstChild, postfix_operators=[], prefix_operators=[], qualifier=lhs, selectors=[], type_arguments=None), name=objectNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isName, postfix_operators=[], prefix_operators=[], qualifier=objectNode, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=setMutatesGlobalState, postfix_operators=[], prefix_operators=[], qualifier=sideEffectInfo, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getString, postfix_operators=[], prefix_operators=[], qualifier=objectNode, selectors=[], type_arguments=None)], member=getVar, postfix_operators=[], prefix_operators=[], qualifier=scope, selectors=[], type_arguments=None), name=var)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Var, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isVarDeclaredInSameContainerScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=setMutatesGlobalState, postfix_operators=[], prefix_operators=[], qualifier=sideEffectInfo, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=enclosingFunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=taintedVarsByFunction, selectors=[], type_arguments=None), label=None)]))]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=setMutatesThis, postfix_operators=[], prefix_operators=[], qualifier=sideEffectInfo, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=lhsNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=lhs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[visitLhsNodes] operator[SEP] identifier[AmbiguatedFunctionSummary] identifier[sideEffectInfo] , identifier[Scope] identifier[scope] , identifier[Node] identifier[enclosingFunction] , identifier[List] operator[<] identifier[Node] operator[>] identifier[lhsNodes] , identifier[Predicate] operator[<] identifier[Node] operator[>] identifier[hasLocalRhs] operator[SEP] {
Keyword[for] operator[SEP] identifier[Node] identifier[lhs] operator[:] identifier[lhsNodes] operator[SEP] {
Keyword[if] operator[SEP] identifier[NodeUtil] operator[SEP] identifier[isGet] operator[SEP] identifier[lhs] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[lhs] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] identifier[isThis] operator[SEP] operator[SEP] operator[SEP] {
identifier[sideEffectInfo] operator[SEP] identifier[setMutatesThis] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Node] identifier[objectNode] operator[=] identifier[lhs] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[objectNode] operator[SEP] identifier[isName] operator[SEP] operator[SEP] operator[SEP] {
identifier[Var] identifier[var] operator[=] identifier[scope] operator[SEP] identifier[getVar] operator[SEP] identifier[objectNode] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isVarDeclaredInSameContainerScope] operator[SEP] identifier[var] , identifier[scope] operator[SEP] operator[SEP] {
identifier[taintedVarsByFunction] operator[SEP] identifier[put] operator[SEP] identifier[enclosingFunction] , identifier[var] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sideEffectInfo] operator[SEP] identifier[setMutatesGlobalState] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[sideEffectInfo] operator[SEP] identifier[setMutatesGlobalState] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[checkState] operator[SEP] identifier[lhs] operator[SEP] identifier[isName] operator[SEP] operator[SEP] , identifier[lhs] operator[SEP] operator[SEP] identifier[Var] identifier[var] operator[=] identifier[scope] operator[SEP] identifier[getVar] operator[SEP] identifier[lhs] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isVarDeclaredInSameContainerScope] operator[SEP] identifier[var] , identifier[scope] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[hasLocalRhs] operator[SEP] identifier[test] operator[SEP] identifier[lhs] operator[SEP] operator[SEP] {
identifier[blacklistedVarsByFunction] operator[SEP] identifier[put] operator[SEP] identifier[enclosingFunction] , identifier[var] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[sideEffectInfo] operator[SEP] identifier[setMutatesGlobalState] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public final void addExtension(final String extension) {
if (filters == null) {
filters = new HashMap<>(1);
}
filters.put(extension.toLowerCase(Locale.getDefault()), this);
fullDescription = null;
} | class class_name[name] begin[{]
method[addExtension, return_type[void], modifier[final public], parameter[extension]] begin[{]
if[binary_operation[member[.filters], ==, literal[null]]] begin[{]
assign[member[.filters], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None))]
else begin[{]
None
end[}]
call[filters.put, parameter[call[extension.toLowerCase, parameter[call[Locale.getDefault, parameter[]]]], THIS[]]]
assign[member[.fullDescription], literal[null]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[addExtension] operator[SEP] Keyword[final] identifier[String] identifier[extension] operator[SEP] {
Keyword[if] operator[SEP] identifier[filters] operator[==] Other[null] operator[SEP] {
identifier[filters] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
identifier[filters] operator[SEP] identifier[put] operator[SEP] identifier[extension] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] operator[SEP] identifier[fullDescription] operator[=] Other[null] operator[SEP]
}
|
public static void shareViaOther(Activity context, Entity entity, ShareAddListener listener) {
proxy.shareViaOther(context, entity, listener);
} | class class_name[name] begin[{]
method[shareViaOther, return_type[void], modifier[public static], parameter[context, entity, listener]] begin[{]
call[proxy.shareViaOther, parameter[member[.context], member[.entity], member[.listener]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[shareViaOther] operator[SEP] identifier[Activity] identifier[context] , identifier[Entity] identifier[entity] , identifier[ShareAddListener] identifier[listener] operator[SEP] {
identifier[proxy] operator[SEP] identifier[shareViaOther] operator[SEP] identifier[context] , identifier[entity] , identifier[listener] operator[SEP] operator[SEP]
}
|
public Option xAxis(Axis... values) {
if (values == null || values.length == 0) {
return this;
}
if (this.xAxis().size() == 2) {
throw new RuntimeException("xAxisๅทฒ็ปๅญๅจ2ไธช๏ผๆ ๆณ็ปง็ปญๆทปๅ !");
}
if (this.xAxis().size() + values.length > 2) {
throw new RuntimeException("ๆทปๅ ็xAxis่ถ
ๅบไบๆๅคงๅ
่ฎธ็่ๅด:2!");
}
this.xAxis().addAll(Arrays.asList(values));
return this;
} | class class_name[name] begin[{]
method[xAxis, return_type[type[Option]], modifier[public], parameter[values]] begin[{]
if[binary_operation[binary_operation[member[.values], ==, literal[null]], ||, binary_operation[member[values.length], ==, literal[0]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.xAxis, parameter[]]call[None.size, parameter[]]], ==, literal[2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="xAxisๅทฒ็ปๅญๅจ2ไธช๏ผๆ ๆณ็ปง็ปญๆทปๅ !")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[THIS[call[None.xAxis, parameter[]]call[None.size, parameter[]]], +, member[values.length]], >, literal[2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ๆทปๅ ็xAxis่ถ
ๅบไบๆๅคงๅ
่ฎธ็่ๅด:2!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
THIS[call[None.xAxis, parameter[]]call[None.addAll, parameter[call[Arrays.asList, parameter[member[.values]]]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Option] identifier[xAxis] operator[SEP] identifier[Axis] operator[...] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[values] operator[==] Other[null] operator[||] identifier[values] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[xAxis] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[xAxis] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[values] operator[SEP] identifier[length] operator[>] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[xAxis] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Optional<Client> findClient(final String name) {
CommonHelper.assertNotBlank("name", name);
init();
final String lowerTrimmedName = name.toLowerCase().trim();
final Client client = _clients.get(lowerTrimmedName);
if (client != null) {
return Optional.of(client);
}
LOGGER.debug("No client found for name: {}", name);
return Optional.empty();
} | class class_name[name] begin[{]
method[findClient, return_type[type[Optional]], modifier[public], parameter[name]] begin[{]
call[CommonHelper.assertNotBlank, parameter[literal["name"], member[.name]]]
call[.init, parameter[]]
local_variable[type[String], lowerTrimmedName]
local_variable[type[Client], client]
if[binary_operation[member[.client], !=, literal[null]]] begin[{]
return[call[Optional.of, parameter[member[.client]]]]
else begin[{]
None
end[}]
call[LOGGER.debug, parameter[literal["No client found for name: {}"], member[.name]]]
return[call[Optional.empty, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[Optional] operator[<] identifier[Client] operator[>] identifier[findClient] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
identifier[CommonHelper] operator[SEP] identifier[assertNotBlank] operator[SEP] literal[String] , identifier[name] operator[SEP] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[lowerTrimmedName] operator[=] identifier[name] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Client] identifier[client] operator[=] identifier[_clients] operator[SEP] identifier[get] operator[SEP] identifier[lowerTrimmedName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[client] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean newPluginImage(String name, String pluginId,
String filename) {
boolean success = true;
ImageDescriptor id =
AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, filename);
if (id == null) {
id = ImageDescriptor.getMissingImageDescriptor();
// id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
success = false;
}
descMap.put(name, id);
imageMap.put(name, id.createImage(true));
return success;
} | class class_name[name] begin[{]
method[newPluginImage, return_type[type[boolean]], modifier[private], parameter[name, pluginId, filename]] begin[{]
local_variable[type[boolean], success]
local_variable[type[ImageDescriptor], id]
if[binary_operation[member[.id], ==, literal[null]]] begin[{]
assign[member[.id], call[ImageDescriptor.getMissingImageDescriptor, parameter[]]]
assign[member[.success], literal[false]]
else begin[{]
None
end[}]
call[descMap.put, parameter[member[.name], member[.id]]]
call[imageMap.put, parameter[member[.name], call[id.createImage, parameter[literal[true]]]]]
return[member[.success]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[newPluginImage] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[pluginId] , identifier[String] identifier[filename] operator[SEP] {
Keyword[boolean] identifier[success] operator[=] literal[boolean] operator[SEP] identifier[ImageDescriptor] identifier[id] operator[=] identifier[AbstractUIPlugin] operator[SEP] identifier[imageDescriptorFromPlugin] operator[SEP] identifier[pluginId] , identifier[filename] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[id] operator[==] Other[null] operator[SEP] {
identifier[id] operator[=] identifier[ImageDescriptor] operator[SEP] identifier[getMissingImageDescriptor] operator[SEP] operator[SEP] operator[SEP] identifier[success] operator[=] literal[boolean] operator[SEP]
}
identifier[descMap] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[id] operator[SEP] operator[SEP] identifier[imageMap] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[id] operator[SEP] identifier[createImage] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[success] operator[SEP]
}
|
@Override
public void addEdge(Edge e) {
addDirectionalEdge(e);
if (e.isBidirectional())
addDirectionalEdge(new Edge(e.getToNodeId(), e.getFromNodeId(), e.getWeight()));
} | class class_name[name] begin[{]
method[addEdge, return_type[void], modifier[public], parameter[e]] begin[{]
call[.addDirectionalEdge, parameter[member[.e]]]
if[call[e.isBidirectional, parameter[]]] begin[{]
call[.addDirectionalEdge, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getToNodeId, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFromNodeId, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getWeight, 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=Edge, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addEdge] operator[SEP] identifier[Edge] identifier[e] operator[SEP] {
identifier[addDirectionalEdge] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[isBidirectional] operator[SEP] operator[SEP] operator[SEP] identifier[addDirectionalEdge] operator[SEP] Keyword[new] identifier[Edge] operator[SEP] identifier[e] operator[SEP] identifier[getToNodeId] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getFromNodeId] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private int rangeLimit(int size, int min, int max) {
if (size < min) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: " + size + " too small");
}
return min;
} else if (size > max) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: " + size + " too large");
}
return max;
}
return size;
} | class class_name[name] begin[{]
method[rangeLimit, return_type[type[int]], modifier[private], parameter[size, min, max]] begin[{]
if[binary_operation[member[.size], <, member[.min]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[literal["Config: "], +, member[.size]], +, literal[" too small"]]]]
else begin[{]
None
end[}]
return[member[.min]]
else begin[{]
if[binary_operation[member[.size], >, member[.max]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[literal["Config: "], +, member[.size]], +, literal[" too large"]]]]
else begin[{]
None
end[}]
return[member[.max]]
else begin[{]
None
end[}]
end[}]
return[member[.size]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[rangeLimit] operator[SEP] Keyword[int] identifier[size] , Keyword[int] identifier[min] , Keyword[int] identifier[max] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[<] identifier[min] 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[+] identifier[size] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[min] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[>] identifier[max] 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[+] identifier[size] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[max] operator[SEP]
}
Keyword[return] identifier[size] operator[SEP]
}
|
public static void handleError(final HttpServletHelper helper, final Throwable throwable) throws
ServletException,
IOException {
HttpServletRequest httpServletRequest = helper.getBackingRequest();
HttpServletResponse httpServletResponse = helper.getBackingResponse();
// Allow for multi part requests
Map<String, String[]> parameters = getRequestParameters(httpServletRequest);
// Set error code for AJAX, Content or data requests
boolean dataRequest = parameters.get(WServlet.DATA_LIST_PARAM_NAME) != null;
Object target = parameters.get(WServlet.AJAX_TRIGGER_PARAM_NAME);
if (target == null) {
target = parameters.get(WServlet.TARGET_ID_PARAM_NAME);
}
if (target != null || dataRequest) {
httpServletResponse.sendError(500, "Internal Error");
return;
}
// Decide whether we should use the ErrorPageFactory.
boolean handleErrorWithFatalErrorPageFactory = ConfigurationProperties.getHandleErrorWithFatalErrorPageFactory();
// use the new technique and delegate to the ErrorPageFactory.
if (handleErrorWithFatalErrorPageFactory) {
helper.handleError(throwable);
helper.dispose();
} else { // use the old technique and just display a raw message.
// First, decide whether we are in friendly mode or not.
boolean friendly = ConfigurationProperties.getDeveloperErrorHandling();
String message = InternalMessages.DEFAULT_SYSTEM_ERROR;
// If we are unfriendly, terminate the session
if (!friendly) {
HttpSession session = httpServletRequest.getSession(true);
session.invalidate();
message = InternalMessages.DEFAULT_SYSTEM_ERROR_SEVERE;
}
// Display an error to the user.
UIContext uic = helper.getUIContext();
Locale locale = uic == null ? null : uic.getLocale();
message = I18nUtilities.format(locale, message);
httpServletResponse.getWriter().println(message);
}
} | class class_name[name] begin[{]
method[handleError, return_type[void], modifier[public static], parameter[helper, throwable]] begin[{]
local_variable[type[HttpServletRequest], httpServletRequest]
local_variable[type[HttpServletResponse], httpServletResponse]
local_variable[type[Map], parameters]
local_variable[type[boolean], dataRequest]
local_variable[type[Object], target]
if[binary_operation[member[.target], ==, literal[null]]] begin[{]
assign[member[.target], call[parameters.get, parameter[member[WServlet.TARGET_ID_PARAM_NAME]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.target], !=, literal[null]], ||, member[.dataRequest]]] begin[{]
call[httpServletResponse.sendError, parameter[literal[500], literal["Internal Error"]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[boolean], handleErrorWithFatalErrorPageFactory]
if[member[.handleErrorWithFatalErrorPageFactory]] begin[{]
call[helper.handleError, parameter[member[.throwable]]]
call[helper.dispose, parameter[]]
else begin[{]
local_variable[type[boolean], friendly]
local_variable[type[String], message]
if[member[.friendly]] begin[{]
local_variable[type[HttpSession], session]
call[session.invalidate, parameter[]]
assign[member[.message], member[InternalMessages.DEFAULT_SYSTEM_ERROR_SEVERE]]
else begin[{]
None
end[}]
local_variable[type[UIContext], uic]
local_variable[type[Locale], locale]
assign[member[.message], call[I18nUtilities.format, parameter[member[.locale], member[.message]]]]
call[httpServletResponse.getWriter, parameter[]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[handleError] operator[SEP] Keyword[final] identifier[HttpServletHelper] identifier[helper] , Keyword[final] identifier[Throwable] identifier[throwable] operator[SEP] Keyword[throws] identifier[ServletException] , identifier[IOException] {
identifier[HttpServletRequest] identifier[httpServletRequest] operator[=] identifier[helper] operator[SEP] identifier[getBackingRequest] operator[SEP] operator[SEP] operator[SEP] identifier[HttpServletResponse] identifier[httpServletResponse] operator[=] identifier[helper] operator[SEP] identifier[getBackingResponse] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[parameters] operator[=] identifier[getRequestParameters] operator[SEP] identifier[httpServletRequest] operator[SEP] operator[SEP] Keyword[boolean] identifier[dataRequest] operator[=] identifier[parameters] operator[SEP] identifier[get] operator[SEP] identifier[WServlet] operator[SEP] identifier[DATA_LIST_PARAM_NAME] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[Object] identifier[target] operator[=] identifier[parameters] operator[SEP] identifier[get] operator[SEP] identifier[WServlet] operator[SEP] identifier[AJAX_TRIGGER_PARAM_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[target] operator[==] Other[null] operator[SEP] {
identifier[target] operator[=] identifier[parameters] operator[SEP] identifier[get] operator[SEP] identifier[WServlet] operator[SEP] identifier[TARGET_ID_PARAM_NAME] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[target] operator[!=] Other[null] operator[||] identifier[dataRequest] operator[SEP] {
identifier[httpServletResponse] operator[SEP] identifier[sendError] operator[SEP] Other[500] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[boolean] identifier[handleErrorWithFatalErrorPageFactory] operator[=] identifier[ConfigurationProperties] operator[SEP] identifier[getHandleErrorWithFatalErrorPageFactory] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handleErrorWithFatalErrorPageFactory] operator[SEP] {
identifier[helper] operator[SEP] identifier[handleError] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] identifier[helper] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[boolean] identifier[friendly] operator[=] identifier[ConfigurationProperties] operator[SEP] identifier[getDeveloperErrorHandling] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[message] operator[=] identifier[InternalMessages] operator[SEP] identifier[DEFAULT_SYSTEM_ERROR] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[friendly] operator[SEP] {
identifier[HttpSession] identifier[session] operator[=] identifier[httpServletRequest] operator[SEP] identifier[getSession] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[invalidate] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[=] identifier[InternalMessages] operator[SEP] identifier[DEFAULT_SYSTEM_ERROR_SEVERE] operator[SEP]
}
identifier[UIContext] identifier[uic] operator[=] identifier[helper] operator[SEP] identifier[getUIContext] operator[SEP] operator[SEP] operator[SEP] identifier[Locale] identifier[locale] operator[=] identifier[uic] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[uic] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[=] identifier[I18nUtilities] operator[SEP] identifier[format] operator[SEP] identifier[locale] , identifier[message] operator[SEP] operator[SEP] identifier[httpServletResponse] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
|
private void doPdsSummary(Formatter f, MCollection dcm, boolean eachFile) throws IOException {
Counters countersAll = new Counters();
countersAll.add("template");
countersAll.add("timeUnit");
countersAll.add("timeOffset");
countersAll.add("timeIntervalSize");
countersAll.add("levelType");
countersAll.add("genProcessType");
countersAll.add("genProcessId");
countersAll.add("levelScale");
countersAll.add("nExtraCoords");
for (MFile mfile : dcm.getFilesSorted()) {
f.format("---%s%n", mfile.getPath());
doPdsSummary(f, mfile, countersAll);
if (eachFile) {
countersAll.show(f);
countersAll.reset();
}
}
f.format("PdsSummary - all files%n");
if (!eachFile)
countersAll.show(f);
} | class class_name[name] begin[{]
method[doPdsSummary, return_type[void], modifier[private], parameter[f, dcm, eachFile]] begin[{]
local_variable[type[Counters], countersAll]
call[countersAll.add, parameter[literal["template"]]]
call[countersAll.add, parameter[literal["timeUnit"]]]
call[countersAll.add, parameter[literal["timeOffset"]]]
call[countersAll.add, parameter[literal["timeIntervalSize"]]]
call[countersAll.add, parameter[literal["levelType"]]]
call[countersAll.add, parameter[literal["genProcessType"]]]
call[countersAll.add, parameter[literal["genProcessId"]]]
call[countersAll.add, parameter[literal["levelScale"]]]
call[countersAll.add, parameter[literal["nExtraCoords"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="---%s%n"), MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=mfile, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mfile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=countersAll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doPdsSummary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=eachFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=show, postfix_operators=[], prefix_operators=[], qualifier=countersAll, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=countersAll, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFilesSorted, postfix_operators=[], prefix_operators=[], qualifier=dcm, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mfile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MFile, sub_type=None))), label=None)
call[f.format, parameter[literal["PdsSummary - all files%n"]]]
if[member[.eachFile]] begin[{]
call[countersAll.show, parameter[member[.f]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[doPdsSummary] operator[SEP] identifier[Formatter] identifier[f] , identifier[MCollection] identifier[dcm] , Keyword[boolean] identifier[eachFile] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Counters] identifier[countersAll] operator[=] Keyword[new] identifier[Counters] operator[SEP] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MFile] identifier[mfile] operator[:] identifier[dcm] operator[SEP] identifier[getFilesSorted] operator[SEP] operator[SEP] operator[SEP] {
identifier[f] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[mfile] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[doPdsSummary] operator[SEP] identifier[f] , identifier[mfile] , identifier[countersAll] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eachFile] operator[SEP] {
identifier[countersAll] operator[SEP] identifier[show] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[countersAll] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[f] operator[SEP] identifier[format] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[eachFile] operator[SEP] identifier[countersAll] operator[SEP] identifier[show] operator[SEP] identifier[f] operator[SEP] operator[SEP]
}
|
public static Class<?> doFormName(String className) throws ClassNotFoundException {
if ("boolean".equals(className))
return boolean.class;
if ("byte".equals(className))
return byte.class;
if ("char".equals(className))
return char.class;
if ("short".equals(className))
return short.class;
if ("int".equals(className))
return int.class;
if ("long".equals(className))
return long.class;
if ("float".equals(className))
return float.class;
if ("double".equals(className))
return double.class;
if ("boolean[]".equals(className))
return boolean[].class;
if ("byte[]".equals(className))
return byte[].class;
if ("char[]".equals(className))
return char[].class;
if ("short[]".equals(className))
return short[].class;
if ("int[]".equals(className))
return int[].class;
if ("long[]".equals(className))
return long[].class;
if ("float[]".equals(className))
return float[].class;
if ("double[]".equals(className))
return double[].class;
try {
return arrayForName(className);
} catch (ClassNotFoundException e) {
if (className.indexOf('.') == -1) { // ๅฐ่ฏjava.langๅ
try {
return arrayForName("java.lang." + className);
} catch (ClassNotFoundException e2) {
// ๅฟฝ็ฅๅฐ่ฏๅผๅธธ, ๆๅบๅๅงๅผๅธธ
}
}
throw e;
}
} | class class_name[name] begin[{]
method[doFormName, return_type[type[Class]], modifier[public static], parameter[className]] begin[{]
if[literal["boolean"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=boolean))]
else begin[{]
None
end[}]
if[literal["byte"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=byte))]
else begin[{]
None
end[}]
if[literal["char"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=char))]
else begin[{]
None
end[}]
if[literal["short"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=short))]
else begin[{]
None
end[}]
if[literal["int"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=int))]
else begin[{]
None
end[}]
if[literal["long"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=long))]
else begin[{]
None
end[}]
if[literal["float"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=float))]
else begin[{]
None
end[}]
if[literal["double"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=double))]
else begin[{]
None
end[}]
if[literal["boolean[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=boolean))]
else begin[{]
None
end[}]
if[literal["byte[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=byte))]
else begin[{]
None
end[}]
if[literal["char[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=char))]
else begin[{]
None
end[}]
if[literal["short[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=short))]
else begin[{]
None
end[}]
if[literal["int[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=int))]
else begin[{]
None
end[}]
if[literal["long[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=long))]
else begin[{]
None
end[}]
if[literal["float[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=float))]
else begin[{]
None
end[}]
if[literal["double[]"]] begin[{]
return[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[None], name=double))]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arrayForName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.lang."), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=arrayForName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e2, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)])), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Class] operator[<] operator[?] operator[>] identifier[doFormName] operator[SEP] identifier[String] identifier[className] operator[SEP] Keyword[throws] identifier[ClassNotFoundException] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[boolean] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[byte] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[char] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[short] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[int] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[long] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[float] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[double] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[char] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[short] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[int] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[long] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[float] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[double] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] Keyword[try] {
Keyword[return] identifier[arrayForName] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[arrayForName] operator[SEP] literal[String] operator[+] identifier[className] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e2] operator[SEP] {
}
}
Keyword[throw] identifier[e] operator[SEP]
}
}
|
HashSet getQueuePointGuessSet()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getQueuePointGuessSet");
HashSet theQueuePoints = null;
synchronized (_queuePointsGuessSet)
{
theQueuePoints = (HashSet) _queuePointsGuessSet.clone();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getQueuePointGuessSet", theQueuePoints);
return theQueuePoints;
} | class class_name[name] begin[{]
method[getQueuePointGuessSet, return_type[type[HashSet]], modifier[default], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getQueuePointGuessSet"]]]
else begin[{]
None
end[}]
local_variable[type[HashSet], theQueuePoints]
SYNCHRONIZED[member[._queuePointsGuessSet]] BEGIN[{]
assign[member[.theQueuePoints], Cast(expression=MethodInvocation(arguments=[], member=clone, postfix_operators=[], prefix_operators=[], qualifier=_queuePointsGuessSet, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=HashSet, sub_type=None))]
END[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["getQueuePointGuessSet"], member[.theQueuePoints]]]
else begin[{]
None
end[}]
return[member[.theQueuePoints]]
end[}]
END[}] | identifier[HashSet] identifier[getQueuePointGuessSet] 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[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[HashSet] identifier[theQueuePoints] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] identifier[_queuePointsGuessSet] operator[SEP] {
identifier[theQueuePoints] operator[=] operator[SEP] identifier[HashSet] operator[SEP] identifier[_queuePointsGuessSet] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[theQueuePoints] operator[SEP] operator[SEP] Keyword[return] identifier[theQueuePoints] operator[SEP]
}
|
private void sendLayoutMessage(final String msg) {
if (sqw != null) {
String packet = msg;
String hdr = getPacketHeader(new Date().getTime());
if(facilityPrinting || hdr.length() > 0) {
StringBuffer buf = new StringBuffer(hdr);
if(facilityPrinting) {
buf.append(facilityStr);
}
buf.append(msg);
packet = buf.toString();
}
sqw.setLevel(6);
sqw.write(packet);
}
} | class class_name[name] begin[{]
method[sendLayoutMessage, return_type[void], modifier[private], parameter[msg]] begin[{]
if[binary_operation[member[.sqw], !=, literal[null]]] begin[{]
local_variable[type[String], packet]
local_variable[type[String], hdr]
if[binary_operation[member[.facilityPrinting], ||, binary_operation[call[hdr.length, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[StringBuffer], buf]
if[member[.facilityPrinting]] begin[{]
call[buf.append, parameter[member[.facilityStr]]]
else begin[{]
None
end[}]
call[buf.append, parameter[member[.msg]]]
assign[member[.packet], call[buf.toString, parameter[]]]
else begin[{]
None
end[}]
call[sqw.setLevel, parameter[literal[6]]]
call[sqw.write, parameter[member[.packet]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[sendLayoutMessage] operator[SEP] Keyword[final] identifier[String] identifier[msg] operator[SEP] {
Keyword[if] operator[SEP] identifier[sqw] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[packet] operator[=] identifier[msg] operator[SEP] identifier[String] identifier[hdr] operator[=] identifier[getPacketHeader] operator[SEP] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[facilityPrinting] operator[||] identifier[hdr] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[StringBuffer] identifier[buf] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[hdr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[facilityPrinting] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[facilityStr] operator[SEP] operator[SEP]
}
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[msg] operator[SEP] operator[SEP] identifier[packet] operator[=] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[sqw] operator[SEP] identifier[setLevel] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[sqw] operator[SEP] identifier[write] operator[SEP] identifier[packet] operator[SEP] operator[SEP]
}
}
|
public static Style createLocal(String location) {
String name = location.replaceFirst("bootstrap-", "");
name = name.replaceFirst(".min", "");
name = name.replaceFirst(".css", "");
return new AutoValue_Style(name, false, location);
} | class class_name[name] begin[{]
method[createLocal, return_type[type[Style]], modifier[public static], parameter[location]] begin[{]
local_variable[type[String], name]
assign[member[.name], call[name.replaceFirst, parameter[literal[".min"], literal[""]]]]
assign[member[.name], call[name.replaceFirst, parameter[literal[".css"], literal[""]]]]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=location, 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=AutoValue_Style, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Style] identifier[createLocal] operator[SEP] identifier[String] identifier[location] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[location] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[name] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[name] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AutoValue_Style] operator[SEP] identifier[name] , literal[boolean] , identifier[location] operator[SEP] operator[SEP]
}
|
public static void activateLoggers(String loggerList) {
// Create an empty set. This will contain the list of all of the loggers
// to activate. (Note that NONE may be a logger; in this case, all
// logging will be deactivated.)
EnumSet<LoggingType> flags = EnumSet.noneOf(LoggingType.class);
// Split on commas and remove white space.
for (String name : loggerList.split("\\s*,\\s*")) {
try {
flags.add(LoggingType.valueOf(name.trim().toUpperCase()));
} catch (IllegalArgumentException consumed) {
}
}
// Loop over the flags, enabling each one.
for (LoggingType type : flags) {
type.activate();
}
} | class class_name[name] begin[{]
method[activateLoggers, return_type[void], modifier[public static], parameter[loggerList]] begin[{]
local_variable[type[EnumSet], flags]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[MethodInvocation(arguments=[], member=toUpperCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=LoggingType, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=flags, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=consumed, types=['IllegalArgumentException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\s*,\\s*")], member=split, postfix_operators=[], prefix_operators=[], qualifier=loggerList, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=activate, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=flags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LoggingType, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[activateLoggers] operator[SEP] identifier[String] identifier[loggerList] operator[SEP] {
identifier[EnumSet] operator[<] identifier[LoggingType] operator[>] identifier[flags] operator[=] identifier[EnumSet] operator[SEP] identifier[noneOf] operator[SEP] identifier[LoggingType] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[loggerList] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[flags] operator[SEP] identifier[add] operator[SEP] identifier[LoggingType] operator[SEP] identifier[valueOf] operator[SEP] identifier[name] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[consumed] operator[SEP] {
}
}
Keyword[for] operator[SEP] identifier[LoggingType] identifier[type] operator[:] identifier[flags] operator[SEP] {
identifier[type] operator[SEP] identifier[activate] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public EEnum getIfcCooledBeamTypeEnum() {
if (ifcCooledBeamTypeEnumEEnum == null) {
ifcCooledBeamTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(801);
}
return ifcCooledBeamTypeEnumEEnum;
} | class class_name[name] begin[{]
method[getIfcCooledBeamTypeEnum, return_type[type[EEnum]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcCooledBeamTypeEnumEEnum], ==, literal[null]]] begin[{]
assign[member[.ifcCooledBeamTypeEnumEEnum], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, 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=801)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EEnum, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcCooledBeamTypeEnumEEnum]]
end[}]
END[}] | Keyword[public] identifier[EEnum] identifier[getIfcCooledBeamTypeEnum] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcCooledBeamTypeEnumEEnum] operator[==] Other[null] operator[SEP] {
identifier[ifcCooledBeamTypeEnumEEnum] operator[=] operator[SEP] identifier[EEnum] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[801] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcCooledBeamTypeEnumEEnum] operator[SEP]
}
|
public V put(K key, V value) {
V prev_val=get(key);
try {
MethodCall call=new MethodCall(PUT, key, value);
disp.callRemoteMethods(null, call, call_options);
}
catch(Exception e) {
throw new RuntimeException("put(" + key + ", " + value + ") failed", e);
}
return prev_val;
} | class class_name[name] begin[{]
method[put, return_type[type[V]], modifier[public], parameter[key, value]] begin[{]
local_variable[type[V], prev_val]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=PUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, 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=MethodCall, sub_type=None)), name=call)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodCall, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=call, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=call_options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callRemoteMethods, postfix_operators=[], prefix_operators=[], qualifier=disp, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="put("), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", "), operator=+), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") failed"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.prev_val]]
end[}]
END[}] | Keyword[public] identifier[V] identifier[put] operator[SEP] identifier[K] identifier[key] , identifier[V] identifier[value] operator[SEP] {
identifier[V] identifier[prev_val] operator[=] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[try] {
identifier[MethodCall] identifier[call] operator[=] Keyword[new] identifier[MethodCall] operator[SEP] identifier[PUT] , identifier[key] , identifier[value] operator[SEP] operator[SEP] identifier[disp] operator[SEP] identifier[callRemoteMethods] operator[SEP] Other[null] , identifier[call] , identifier[call_options] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[value] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[prev_val] operator[SEP]
}
|
public void discharge(BitmapStorage container) {
this.brlw.literalWordOffset = this.literalWordStartPosition - this.iterator.literalWords();
discharge(this.brlw, this.iterator, container);
} | class class_name[name] begin[{]
method[discharge, return_type[void], modifier[public], parameter[container]] begin[{]
assign[THIS[member[None.brlw]member[None.literalWordOffset]], binary_operation[THIS[member[None.literalWordStartPosition]], -, THIS[member[None.iterator]call[None.literalWords, parameter[]]]]]
call[.discharge, parameter[THIS[member[None.brlw]], THIS[member[None.iterator]], member[.container]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[discharge] operator[SEP] identifier[BitmapStorage] identifier[container] operator[SEP] {
Keyword[this] operator[SEP] identifier[brlw] operator[SEP] identifier[literalWordOffset] operator[=] Keyword[this] operator[SEP] identifier[literalWordStartPosition] operator[-] Keyword[this] operator[SEP] identifier[iterator] operator[SEP] identifier[literalWords] operator[SEP] operator[SEP] operator[SEP] identifier[discharge] operator[SEP] Keyword[this] operator[SEP] identifier[brlw] , Keyword[this] operator[SEP] identifier[iterator] , identifier[container] operator[SEP] operator[SEP]
}
|
@Override
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
final int focusableCount = views.size();
final int descendantFocusability = getDescendantFocusability();
if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS) {
for (int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
child.addFocusables(views, direction, focusableMode);
}
}
}
}
// we add ourselves (if focusable) in all cases except for when we are
// FOCUS_AFTER_DESCENDANTS and there are some descendants focusable. this is
// to avoid the focus search finding layouts when a more precise search
// among the focusable children would be more interesting.
if (
descendantFocusability != FOCUS_AFTER_DESCENDANTS ||
// No focusable descendants
(focusableCount == views.size())) {
// Note that we can't call the superclass here, because it will
// add all views in. So we need to do the same thing View does.
if (!isFocusable()) {
return;
}
if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE &&
isInTouchMode() && !isFocusableInTouchMode()) {
return;
}
if (views != null) {
views.add(this);
}
}
} | class class_name[name] begin[{]
method[addFocusables, return_type[void], modifier[public], parameter[views, direction, focusableMode]] begin[{]
local_variable[type[int], focusableCount]
local_variable[type[int], descendantFocusability]
if[binary_operation[member[.descendantFocusability], !=, member[.FOCUS_BLOCK_DESCENDANTS]]] 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=getChildAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=child)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getVisibility, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[], type_arguments=None), operandr=MemberReference(member=VISIBLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=infoForChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=ii)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ItemInfo, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=ii, selectors=[]), operandr=MemberReference(member=mCurItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=views, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=direction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=focusableMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addFocusables, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getChildCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.descendantFocusability], !=, member[.FOCUS_AFTER_DESCENDANTS]], ||, binary_operation[member[.focusableCount], ==, call[views.size, parameter[]]]]] begin[{]
if[call[.isFocusable, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.focusableMode], &, member[.FOCUSABLES_TOUCH_MODE]], ==, member[.FOCUSABLES_TOUCH_MODE]], &&, call[.isInTouchMode, parameter[]]], &&, call[.isFocusableInTouchMode, parameter[]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.views], !=, literal[null]]] begin[{]
call[views.add, parameter[THIS[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addFocusables] operator[SEP] identifier[ArrayList] operator[<] identifier[View] operator[>] identifier[views] , Keyword[int] identifier[direction] , Keyword[int] identifier[focusableMode] operator[SEP] {
Keyword[final] Keyword[int] identifier[focusableCount] operator[=] identifier[views] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[descendantFocusability] operator[=] identifier[getDescendantFocusability] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[descendantFocusability] operator[!=] identifier[FOCUS_BLOCK_DESCENDANTS] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[getChildCount] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[View] identifier[child] operator[=] identifier[getChildAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[child] operator[SEP] identifier[getVisibility] operator[SEP] operator[SEP] operator[==] identifier[VISIBLE] operator[SEP] {
identifier[ItemInfo] identifier[ii] operator[=] identifier[infoForChild] operator[SEP] identifier[child] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ii] operator[!=] Other[null] operator[&&] identifier[ii] operator[SEP] identifier[position] operator[==] identifier[mCurItem] operator[SEP] {
identifier[child] operator[SEP] identifier[addFocusables] operator[SEP] identifier[views] , identifier[direction] , identifier[focusableMode] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[descendantFocusability] operator[!=] identifier[FOCUS_AFTER_DESCENDANTS] operator[||] operator[SEP] identifier[focusableCount] operator[==] identifier[views] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isFocusable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[focusableMode] operator[&] identifier[FOCUSABLES_TOUCH_MODE] operator[SEP] operator[==] identifier[FOCUSABLES_TOUCH_MODE] operator[&&] identifier[isInTouchMode] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[isFocusableInTouchMode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[views] operator[!=] Other[null] operator[SEP] {
identifier[views] operator[SEP] identifier[add] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
}
}
|
public void setFunctionClass(String value, Identification id, Attributes attrs) {
functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs);
} | class class_name[name] begin[{]
method[setFunctionClass, return_type[void], modifier[public], parameter[value, id, attrs]] begin[{]
assign[member[.functionCD], call[ClassDefinitionImpl.toClassDefinition, parameter[member[.value], member[.id], member[.attrs]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setFunctionClass] operator[SEP] identifier[String] identifier[value] , identifier[Identification] identifier[id] , identifier[Attributes] identifier[attrs] operator[SEP] {
identifier[functionCD] operator[=] identifier[ClassDefinitionImpl] operator[SEP] identifier[toClassDefinition] operator[SEP] identifier[value] , identifier[id] , identifier[attrs] operator[SEP] operator[SEP]
}
|
public void buildWith(final DescriptionBuilder builder) {
//override the annotated description of this plugin
builder.title("Example Remote Script Node Step");
builder.description("Demonstrates a remote script node step");
/**
* calling DescriptionBuilder.property() will replace an existing property of
* the same name.
*/
builder.property(
/**
* In this case builder.property("money") returns the existing property we
* have already defined via annotation, allowing us to modify it with the {@link PropertyBuilder}
*
*/
builder.property("money")
/**
* change the property's description
*/
.description("How much money? (1..5)")
/**
* set a custom validator for the property
*/
.validator(new PropertyValidator() {
public boolean isValid(String s) throws ValidationException {
try {
final int i = Integer.parseInt(s);
if (i <= 0 || i >= 6) {
//throw ValidationException to indicate a problem, with a reason
throw new ValidationException("Must be between 1 and 5");
}
} catch (NumberFormatException e) {
throw new ValidationException("Not a valid integer");
}
return true;
}
})
);
/**
* Here we create a wholly new property not bound to an existing instance field. The runtime
* value for this property will be included in the input configuration map when the plugin method is called.
*/
builder.property(
PropertyBuilder.builder()
.string("fakey")
.title("Fake")
.description("Extra value")
);
} | class class_name[name] begin[{]
method[buildWith, return_type[void], modifier[public], parameter[builder]] begin[{]
call[builder.title, parameter[literal["Example Remote Script Node Step"]]]
call[builder.description, parameter[literal["Demonstrates a remote script node step"]]]
call[builder.property, parameter[call[builder.property, parameter[literal["money"]]]]]
call[builder.property, parameter[call[PropertyBuilder.builder, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[buildWith] operator[SEP] Keyword[final] identifier[DescriptionBuilder] identifier[builder] operator[SEP] {
identifier[builder] operator[SEP] identifier[title] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[description] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[property] operator[SEP] identifier[builder] operator[SEP] identifier[property] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[description] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[validator] operator[SEP] Keyword[new] identifier[PropertyValidator] operator[SEP] operator[SEP] {
Keyword[public] Keyword[boolean] identifier[isValid] operator[SEP] identifier[String] identifier[s] operator[SEP] Keyword[throws] identifier[ValidationException] {
Keyword[try] {
Keyword[final] Keyword[int] identifier[i] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[s] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<=] Other[0] operator[||] identifier[i] operator[>=] Other[6] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ValidationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ValidationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
} operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[property] operator[SEP] identifier[PropertyBuilder] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[string] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[title] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[description] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public void addConnector(Connector connector) {
connectors.put(connector.getClass().getCanonicalName(), new ConnectorEntry(connector));
} | class class_name[name] begin[{]
method[addConnector, return_type[void], modifier[public], parameter[connector]] begin[{]
call[connectors.put, parameter[call[connector.getClass, parameter[]], ClassCreator(arguments=[MemberReference(member=connector, 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=ConnectorEntry, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addConnector] operator[SEP] identifier[Connector] identifier[connector] operator[SEP] {
identifier[connectors] operator[SEP] identifier[put] operator[SEP] identifier[connector] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] , Keyword[new] identifier[ConnectorEntry] operator[SEP] identifier[connector] operator[SEP] operator[SEP] operator[SEP]
}
|
public int lookupIndex(short value) {
for (int i=0; i<elements.length; i++) {
if (elements[i] == value) {
return i;
}
}
return -1;
} | class class_name[name] begin[{]
method[lookupIndex, return_type[type[int]], modifier[public], parameter[value]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=elements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=elements, 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[literal[1]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[lookupIndex] operator[SEP] Keyword[short] identifier[value] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[elements] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[elements] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[value] operator[SEP] {
Keyword[return] identifier[i] operator[SEP]
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public void setBillingSchedule(com.google.api.ads.admanager.axis.v201808.BillingSchedule billingSchedule) {
this.billingSchedule = billingSchedule;
} | class class_name[name] begin[{]
method[setBillingSchedule, return_type[void], modifier[public], parameter[billingSchedule]] begin[{]
assign[THIS[member[None.billingSchedule]], member[.billingSchedule]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setBillingSchedule] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201808] operator[SEP] identifier[BillingSchedule] identifier[billingSchedule] operator[SEP] {
Keyword[this] operator[SEP] identifier[billingSchedule] operator[=] identifier[billingSchedule] operator[SEP]
}
|
private static char[] getCharsFromStringBuilder(StringBuilder sbuf) {
final int length = sbuf.length();
char[] array2 = new char[length];
sbuf.getChars(0, length, array2, 0);
return array2;
} | class class_name[name] begin[{]
method[getCharsFromStringBuilder, return_type[type[char]], modifier[private static], parameter[sbuf]] begin[{]
local_variable[type[int], length]
local_variable[type[char], array2]
call[sbuf.getChars, parameter[literal[0], member[.length], member[.array2], literal[0]]]
return[member[.array2]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[char] operator[SEP] operator[SEP] identifier[getCharsFromStringBuilder] operator[SEP] identifier[StringBuilder] identifier[sbuf] operator[SEP] {
Keyword[final] Keyword[int] identifier[length] operator[=] identifier[sbuf] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[array2] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[sbuf] operator[SEP] identifier[getChars] operator[SEP] Other[0] , identifier[length] , identifier[array2] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[array2] operator[SEP]
}
|
@Override
public BaseType extendGenericType()
{
BaseType []oldParams = getParameters();
BaseType []newParams = new BaseType[oldParams.length];
boolean isExtend = false;
for (int i = 0; i < newParams.length; i++) {
BaseType param = oldParams[i];
if (param instanceof ClassType
|| param instanceof ParamType) {
BaseType []upperBounds = new BaseType[] { param };
BaseType []lowerBounds = new BaseType[] { };//ObjectType.OBJECT_TYPE };
BaseType extParam = new WildcardTypeImpl(lowerBounds, upperBounds);
newParams[i] = extParam;
isExtend = true;
}
else {
newParams[i] = param;
}
}
if (isExtend) {
ParamType extendsType = new ParamType(_type, newParams, _paramMap);
return extendsType;
}
else {
return this;
}
} | class class_name[name] begin[{]
method[extendGenericType, return_type[type[BaseType]], modifier[public], parameter[]] begin[{]
local_variable[type[BaseType], oldParams]
local_variable[type[BaseType], newParams]
local_variable[type[boolean], isExtend]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=oldParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ClassType, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ParamType, sub_type=None), operator=instanceof), operator=||), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=param, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BaseType, sub_type=None)), name=upperBounds)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=BaseType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BaseType, sub_type=None)), name=lowerBounds)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=BaseType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=lowerBounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=upperBounds, 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=WildcardTypeImpl, sub_type=None)), name=extParam)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseType, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=extParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isExtend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), 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=newParams, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[member[.isExtend]] begin[{]
local_variable[type[ParamType], extendsType]
return[member[.extendsType]]
else begin[{]
return[THIS[]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[BaseType] identifier[extendGenericType] operator[SEP] operator[SEP] {
identifier[BaseType] operator[SEP] operator[SEP] identifier[oldParams] operator[=] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[BaseType] operator[SEP] operator[SEP] identifier[newParams] operator[=] Keyword[new] identifier[BaseType] operator[SEP] identifier[oldParams] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[boolean] identifier[isExtend] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[newParams] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[BaseType] identifier[param] operator[=] identifier[oldParams] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[param] Keyword[instanceof] identifier[ClassType] operator[||] identifier[param] Keyword[instanceof] identifier[ParamType] operator[SEP] {
identifier[BaseType] operator[SEP] operator[SEP] identifier[upperBounds] operator[=] Keyword[new] identifier[BaseType] operator[SEP] operator[SEP] {
identifier[param]
} operator[SEP] identifier[BaseType] operator[SEP] operator[SEP] identifier[lowerBounds] operator[=] Keyword[new] identifier[BaseType] operator[SEP] operator[SEP] {
} operator[SEP] identifier[BaseType] identifier[extParam] operator[=] Keyword[new] identifier[WildcardTypeImpl] operator[SEP] identifier[lowerBounds] , identifier[upperBounds] operator[SEP] operator[SEP] identifier[newParams] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[extParam] operator[SEP] identifier[isExtend] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[newParams] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[param] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[isExtend] operator[SEP] {
identifier[ParamType] identifier[extendsType] operator[=] Keyword[new] identifier[ParamType] operator[SEP] identifier[_type] , identifier[newParams] , identifier[_paramMap] operator[SEP] operator[SEP] Keyword[return] identifier[extendsType] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[this] operator[SEP]
}
}
|
public static VoltTable unionTables(Collection<VoltTable> operands) {
VoltTable result = null;
// Locate the first non-null table to get the schema
for (VoltTable vt : operands) {
if (vt != null) {
result = new VoltTable(vt.getTableSchema());
result.setStatusCode(vt.getStatusCode());
break;
}
}
if (result != null) {
result.addTables(operands);
result.resetRowPosition();
}
return result;
} | class class_name[name] begin[{]
method[unionTables, return_type[type[VoltTable]], modifier[public static], parameter[operands]] begin[{]
local_variable[type[VoltTable], result]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=vt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTableSchema, postfix_operators=[], prefix_operators=[], qualifier=vt, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VoltTable, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=vt, selectors=[], type_arguments=None)], member=setStatusCode, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=operands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VoltTable, sub_type=None))), label=None)
if[binary_operation[member[.result], !=, literal[null]]] begin[{]
call[result.addTables, parameter[member[.operands]]]
call[result.resetRowPosition, parameter[]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[VoltTable] identifier[unionTables] operator[SEP] identifier[Collection] operator[<] identifier[VoltTable] operator[>] identifier[operands] operator[SEP] {
identifier[VoltTable] identifier[result] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[VoltTable] identifier[vt] operator[:] identifier[operands] operator[SEP] {
Keyword[if] operator[SEP] identifier[vt] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[VoltTable] operator[SEP] identifier[vt] operator[SEP] identifier[getTableSchema] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setStatusCode] operator[SEP] identifier[vt] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[addTables] operator[SEP] identifier[operands] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[resetRowPosition] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public StringArray getSecondIds() {
if (Cooccurrence_Type.featOkTst && ((Cooccurrence_Type)jcasType).casFeat_secondIds == null)
jcasType.jcas.throwFeatMissing("secondIds", "ch.epfl.bbp.uima.types.Cooccurrence");
return (StringArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Cooccurrence_Type)jcasType).casFeatCode_secondIds)));} | class class_name[name] begin[{]
method[getSecondIds, return_type[type[StringArray]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[Cooccurrence_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Cooccurrence_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["secondIds"], literal["ch.epfl.bbp.uima.types.Cooccurrence"]]]
else begin[{]
None
end[}]
return[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=addr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Cooccurrence_Type, sub_type=None))], member=ll_getRefValue, postfix_operators=[], prefix_operators=[], qualifier=jcasType.ll_cas, selectors=[], type_arguments=None)], member=ll_getFSForRef, postfix_operators=[], prefix_operators=[], qualifier=jcasType.ll_cas, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=StringArray, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[StringArray] identifier[getSecondIds] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Cooccurrence_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Cooccurrence_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_secondIds] 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] Keyword[return] operator[SEP] identifier[StringArray] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getFSForRef] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getRefValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Cooccurrence_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_secondIds] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public TranslationMap doImport() {
try {
for (String locale : LOCALES) {
TranslationHashMap trMap = new TranslationHashMap(getLocale(locale));
trMap.doImport(TranslationMap.class.getResourceAsStream(locale + ".txt"));
add(trMap);
}
postImportHook();
return this;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} | class class_name[name] begin[{]
method[doImport, return_type[type[TranslationMap]], modifier[public], parameter[]] begin[{]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TranslationHashMap, sub_type=None)), name=trMap)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TranslationHashMap, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".txt"), operator=+)], member=getResourceAsStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=TranslationMap, sub_type=None))], member=doImport, postfix_operators=[], prefix_operators=[], qualifier=trMap, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=trMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=LOCALES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=locale)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=postImportHook, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[TranslationMap] identifier[doImport] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[for] operator[SEP] identifier[String] identifier[locale] operator[:] identifier[LOCALES] operator[SEP] {
identifier[TranslationHashMap] identifier[trMap] operator[=] Keyword[new] identifier[TranslationHashMap] operator[SEP] identifier[getLocale] operator[SEP] identifier[locale] operator[SEP] operator[SEP] operator[SEP] identifier[trMap] operator[SEP] identifier[doImport] operator[SEP] identifier[TranslationMap] operator[SEP] Keyword[class] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[locale] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[trMap] operator[SEP] operator[SEP]
}
identifier[postImportHook] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
|
public final void setSubscriptionMessageType(SubscriptionMessageType value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "setSubscriptionMessageType to " + value);
/* Get the int value of the SubscriptionMessageType and set that into the subtype */
setSubtype(value.toInt());
} | class class_name[name] begin[{]
method[setSubscriptionMessageType, return_type[void], modifier[final public], parameter[value]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[SibTr.debug, parameter[THIS[], member[.tc], binary_operation[literal["setSubscriptionMessageType to "], +, member[.value]]]]
else begin[{]
None
end[}]
call[.setSubtype, parameter[call[value.toInt, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[setSubscriptionMessageType] operator[SEP] identifier[SubscriptionMessageType] identifier[value] 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[SibTr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] identifier[value] operator[SEP] operator[SEP] identifier[setSubtype] operator[SEP] identifier[value] operator[SEP] identifier[toInt] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getLocalizedMessage(CmsMessageContainer container, ServletRequest request) {
CmsObject cms = CmsFlexController.getCmsObject(request);
return getLocalizedMessage(container, cms);
} | class class_name[name] begin[{]
method[getLocalizedMessage, return_type[type[String]], modifier[public static], parameter[container, request]] begin[{]
local_variable[type[CmsObject], cms]
return[call[.getLocalizedMessage, parameter[member[.container], member[.cms]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getLocalizedMessage] operator[SEP] identifier[CmsMessageContainer] identifier[container] , identifier[ServletRequest] identifier[request] operator[SEP] {
identifier[CmsObject] identifier[cms] operator[=] identifier[CmsFlexController] operator[SEP] identifier[getCmsObject] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[getLocalizedMessage] operator[SEP] identifier[container] , identifier[cms] operator[SEP] operator[SEP]
}
|
@Nullable static ExecutableElement findLargestPublicConstructor(TypeElement typeElement) {
List<ExecutableElement> constructors =
FluentIterable.from(ElementFilter.constructorsIn(typeElement.getEnclosedElements()))
.filter(FILTER_NON_PUBLIC)
.toList();
if (constructors.size() == 0) {
return null;
}
return PARAMETER_COUNT_ORDER.max(constructors);
} | class class_name[name] begin[{]
method[findLargestPublicConstructor, return_type[type[ExecutableElement]], modifier[static], parameter[typeElement]] begin[{]
local_variable[type[List], constructors]
if[binary_operation[call[constructors.size, parameter[]], ==, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[PARAMETER_COUNT_ORDER.max, parameter[member[.constructors]]]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[static] identifier[ExecutableElement] identifier[findLargestPublicConstructor] operator[SEP] identifier[TypeElement] identifier[typeElement] operator[SEP] {
identifier[List] operator[<] identifier[ExecutableElement] operator[>] identifier[constructors] operator[=] identifier[FluentIterable] operator[SEP] identifier[from] operator[SEP] identifier[ElementFilter] operator[SEP] identifier[constructorsIn] operator[SEP] identifier[typeElement] operator[SEP] identifier[getEnclosedElements] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[FILTER_NON_PUBLIC] operator[SEP] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[constructors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[PARAMETER_COUNT_ORDER] operator[SEP] identifier[max] operator[SEP] identifier[constructors] operator[SEP] operator[SEP]
}
|
public synchronized void setBigDecimal(String parameterName,
BigDecimal x) throws SQLException {
setBigDecimal(findParameterIndex(parameterName), x);
} | class class_name[name] begin[{]
method[setBigDecimal, return_type[void], modifier[synchronized public], parameter[parameterName, x]] begin[{]
call[.setBigDecimal, parameter[call[.findParameterIndex, parameter[member[.parameterName]]], member[.x]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[setBigDecimal] operator[SEP] identifier[String] identifier[parameterName] , identifier[BigDecimal] identifier[x] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[setBigDecimal] operator[SEP] identifier[findParameterIndex] operator[SEP] identifier[parameterName] operator[SEP] , identifier[x] operator[SEP] operator[SEP]
}
|
public static String getQualifiedStreamSegmentName(String scope, String streamName, long segmentId) {
int segmentNumber = getSegmentNumber(segmentId);
int epoch = getEpoch(segmentId);
StringBuffer sb = getScopedStreamNameInternal(scope, streamName);
sb.append('/');
sb.append(segmentNumber);
sb.append(EPOCH_DELIMITER);
sb.append(epoch);
return sb.toString();
} | class class_name[name] begin[{]
method[getQualifiedStreamSegmentName, return_type[type[String]], modifier[public static], parameter[scope, streamName, segmentId]] begin[{]
local_variable[type[int], segmentNumber]
local_variable[type[int], epoch]
local_variable[type[StringBuffer], sb]
call[sb.append, parameter[literal['/']]]
call[sb.append, parameter[member[.segmentNumber]]]
call[sb.append, parameter[member[.EPOCH_DELIMITER]]]
call[sb.append, parameter[member[.epoch]]]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getQualifiedStreamSegmentName] operator[SEP] identifier[String] identifier[scope] , identifier[String] identifier[streamName] , Keyword[long] identifier[segmentId] operator[SEP] {
Keyword[int] identifier[segmentNumber] operator[=] identifier[getSegmentNumber] operator[SEP] identifier[segmentId] operator[SEP] operator[SEP] Keyword[int] identifier[epoch] operator[=] identifier[getEpoch] operator[SEP] identifier[segmentId] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[sb] operator[=] identifier[getScopedStreamNameInternal] operator[SEP] identifier[scope] , identifier[streamName] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[segmentNumber] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[EPOCH_DELIMITER] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[epoch] operator[SEP] operator[SEP] Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void executeImpl(CommandLine cmd) {
try {
List<PropertyDefinition> defintions =
new PropertyDefinitionListBuilder().addMillDb()
.build();
PropertyVerifier verifier = new PropertyVerifier(defintions);
verifier.verify(System.getProperties());
ApplicationContext context =
new AnnotationConfigApplicationContext("org.duracloud.mill.db",
"org.duracloud.mill.manifest.builder");
log.info("context initialized");
boolean dryRun = Boolean.valueOf(cmd.hasOption("d"));
boolean clean = Boolean.valueOf(cmd.hasOption("C"));
String host = cmd.getOptionValue("host");
String port = cmd.getOptionValue("port", "443");
String username = cmd.getOptionValue("u");
String password = cmd.getOptionValue("p");
List<String> spaceList = new LinkedList<>();
if (cmd.hasOption("s")) {
String spaces = cmd.getOptionValue("s", "");
if (!StringUtils.isEmpty(spaces)) {
spaceList = Arrays.asList(spaces.split("[,]"));
}
}
List<String> storeList = new LinkedList<>();
if (cmd.hasOption("t")) {
String stores = cmd.getOptionValue("t", "");
if (!StringUtils.isEmpty(stores)) {
storeList = Arrays.asList(stores.split("[,]"));
}
}
int threads = 0;
if (cmd.hasOption("T")) {
threads = Integer.parseInt(cmd.getOptionValue("T", "10"));
}
String account = host.split("[.]")[0];
ContentStoreManager storeManager = new ContentStoreManagerImpl(host, port);
storeManager.login(new Credential(username, password));
Map<String, ContentStore> contentStoreMap = storeManager.getContentStores();
List<ContentStore> contentStores = new LinkedList<>();
for (String storeId : contentStoreMap.keySet()) {
if (storeList.isEmpty() || storeList.contains(storeId)) {
ContentStore contentStore = contentStoreMap.get(storeId);
contentStores.add(contentStore);
}
}
ManifestBuilder builder = (ManifestBuilder) context.getBean(ManifestBuilder.class);
builder.init(account, contentStores, spaceList, clean, dryRun, threads);
builder.execute();
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
log.info("exiting...");
}
} | class class_name[name] begin[{]
method[executeImpl, return_type[void], modifier[protected], parameter[cmd]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=addMillDb, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PropertyDefinitionListBuilder, sub_type=None)), name=defintions)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=PropertyDefinition, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=defintions, 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=PropertyVerifier, sub_type=None)), name=verifier)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyVerifier, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProperties, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None)], member=verify, postfix_operators=[], prefix_operators=[], qualifier=verifier, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.duracloud.mill.db"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.duracloud.mill.manifest.builder")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AnnotationConfigApplicationContext, sub_type=None)), name=context)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ApplicationContext, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="context initialized")], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="d")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), name=dryRun)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="C")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), name=clean)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="host")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=host)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="port"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="443")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=port)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="u")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=username)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="p")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=password)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedList, sub_type=None)), name=spaceList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="s")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="s"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=spaces)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=spaces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=spaceList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[,]")], member=split, postfix_operators=[], prefix_operators=[], qualifier=spaces, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)), label=None)]))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedList, sub_type=None)), name=storeList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="t")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="t"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), name=stores)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=stores, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=storeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[,]")], member=split, postfix_operators=[], prefix_operators=[], qualifier=stores, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)), label=None)]))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=threads)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="T")], member=hasOption, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=threads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="T"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="10")], member=getOptionValue, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[.]")], member=split, postfix_operators=[], prefix_operators=[], qualifier=host, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None), name=account)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, 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=ContentStoreManagerImpl, sub_type=None)), name=storeManager)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContentStoreManager, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Credential, sub_type=None))], member=login, postfix_operators=[], prefix_operators=[], qualifier=storeManager, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getContentStores, postfix_operators=[], prefix_operators=[], qualifier=storeManager, selectors=[], type_arguments=None), name=contentStoreMap)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ContentStore, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedList, sub_type=None)), name=contentStores)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ContentStore, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=storeList, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=storeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=storeList, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=storeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=contentStoreMap, selectors=[], type_arguments=None), name=contentStore)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContentStore, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=contentStores, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=contentStoreMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=storeId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ManifestBuilder, sub_type=None))], member=getBean, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ManifestBuilder, sub_type=None)), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ManifestBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=account, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentStores, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=spaceList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dryRun, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=threads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=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="exiting...")], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[executeImpl] operator[SEP] identifier[CommandLine] identifier[cmd] operator[SEP] {
Keyword[try] {
identifier[List] operator[<] identifier[PropertyDefinition] operator[>] identifier[defintions] operator[=] Keyword[new] identifier[PropertyDefinitionListBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[addMillDb] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[PropertyVerifier] identifier[verifier] operator[=] Keyword[new] identifier[PropertyVerifier] operator[SEP] identifier[defintions] operator[SEP] operator[SEP] identifier[verifier] operator[SEP] identifier[verify] operator[SEP] identifier[System] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ApplicationContext] identifier[context] operator[=] Keyword[new] identifier[AnnotationConfigApplicationContext] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[dryRun] operator[=] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[clean] operator[=] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[host] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[port] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[username] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[password] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[spaceList] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[spaces] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[spaces] operator[SEP] operator[SEP] {
identifier[spaceList] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[spaces] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[String] operator[>] identifier[storeList] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[stores] operator[=] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[stores] operator[SEP] operator[SEP] {
identifier[storeList] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[stores] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[int] identifier[threads] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[cmd] operator[SEP] identifier[hasOption] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[threads] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[cmd] operator[SEP] identifier[getOptionValue] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[account] operator[=] identifier[host] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[ContentStoreManager] identifier[storeManager] operator[=] Keyword[new] identifier[ContentStoreManagerImpl] operator[SEP] identifier[host] , identifier[port] operator[SEP] operator[SEP] identifier[storeManager] operator[SEP] identifier[login] operator[SEP] Keyword[new] identifier[Credential] operator[SEP] identifier[username] , identifier[password] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[ContentStore] operator[>] identifier[contentStoreMap] operator[=] identifier[storeManager] operator[SEP] identifier[getContentStores] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ContentStore] operator[>] identifier[contentStores] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[storeId] operator[:] identifier[contentStoreMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[storeList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[storeList] operator[SEP] identifier[contains] operator[SEP] identifier[storeId] operator[SEP] operator[SEP] {
identifier[ContentStore] identifier[contentStore] operator[=] identifier[contentStoreMap] operator[SEP] identifier[get] operator[SEP] identifier[storeId] operator[SEP] operator[SEP] identifier[contentStores] operator[SEP] identifier[add] operator[SEP] identifier[contentStore] operator[SEP] operator[SEP]
}
}
identifier[ManifestBuilder] identifier[builder] operator[=] operator[SEP] identifier[ManifestBuilder] operator[SEP] identifier[context] operator[SEP] identifier[getBean] operator[SEP] identifier[ManifestBuilder] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[init] operator[SEP] identifier[account] , identifier[contentStores] , identifier[spaceList] , identifier[clean] , identifier[dryRun] , identifier[threads] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
protected void configure() {
Properties properties = readDefaultConfig();
Properties appProperties = new Props();
List<String> appConf = Lists.newArrayListWithExpectedSize(configFiles.length);
for (String conf : configFiles) {
//่ฏปๅๅบ็จ็จๅบ้
็ฝฎ
URL appCfgUrl = readAppConfig(appProperties, conf);
appConf.add(toExternalForm(appCfgUrl));
}
//่ทๅๅบ็จ็จๅบๆจกๅผ
try {
mode = Mode.valueOf(appProperties.getProperty("app.mode").toUpperCase());
} catch (Exception e) {
mode = Mode.PRODUCT;
}
//่ฎพ็ฝฎๅบ็จ็จๅบๅ็งฐ
setApplicationName(StringUtils.defaultString(appProperties.getProperty("app.name"), DEFAULT_APP_NAME));
applicationVersion = appProperties.getProperty("app.version");
if (StringUtils.isBlank(applicationVersion)) {
applicationVersion = new UnknownVersion();
}
//้
็ฝฎๆฅๅฟๅจ
configureLogger(appProperties);
if (!isInitialized())
Ameba.printInfo();
logger.info(Messages.get("info.init"));
logger.info(Messages.get("info.app.conf", appConf));
//่ฏปๅๆจกๅผ้
็ฝฎ
readModeConfig(properties, mode);
//่ฏปๅๆจกๅ้
็ฝฎ
readModuleConfig(properties, getMode().isDev());
properties.putAll(appProperties);
srcProperties.putAll((Map) properties);
setEnvironmentConfig(srcProperties);
addOnSetup(srcProperties);
//่ฝฌๆขjersey้
็ฝฎ้กน
convertJerseyConfig(srcProperties);
//ๅฐไธดๆถ้
็ฝฎๅฏน่ฑกๆพๅ
ฅๅบ็จ็จๅบ้
็ฝฎ
addProperties(srcProperties);
srcProperties = Collections.unmodifiableMap(srcProperties);
registerBinder();
configureExclude(srcProperties);
//้
็ฝฎ่ตๆบ
configureResource();
//้
็ฝฎ็นๆง
configureFeature(srcProperties);
//้
็ฝฎๆๅกๅจ็ธๅ
ณ
configureServer();
//ๆธ
็ฉบไธดๆถ่ฏปๅ็้
็ฝฎ
properties.clear();
scanClasses();
addOnDone();
addons = Collections.unmodifiableSet(addons);
excludes = Collections.unmodifiableSet(excludes);
logger.info(Messages.get("info.feature.load"));
} | class class_name[name] begin[{]
method[configure, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[Properties], properties]
local_variable[type[Properties], appProperties]
local_variable[type[List], appConf]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=appProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readAppConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=appCfgUrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=appCfgUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toExternalForm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=appConf, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=configFiles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=conf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="app.mode")], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=appProperties, selectors=[MethodInvocation(arguments=[], member=toUpperCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Mode, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=PRODUCT, postfix_operators=[], prefix_operators=[], qualifier=Mode, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
call[.setApplicationName, parameter[call[StringUtils.defaultString, parameter[call[appProperties.getProperty, parameter[literal["app.name"]]], member[.DEFAULT_APP_NAME]]]]]
assign[member[.applicationVersion], call[appProperties.getProperty, parameter[literal["app.version"]]]]
if[call[StringUtils.isBlank, parameter[member[.applicationVersion]]]] begin[{]
assign[member[.applicationVersion], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnknownVersion, sub_type=None))]
else begin[{]
None
end[}]
call[.configureLogger, parameter[member[.appProperties]]]
if[call[.isInitialized, parameter[]]] begin[{]
call[Ameba.printInfo, parameter[]]
else begin[{]
None
end[}]
call[logger.info, parameter[call[Messages.get, parameter[literal["info.init"]]]]]
call[logger.info, parameter[call[Messages.get, parameter[literal["info.app.conf"], member[.appConf]]]]]
call[.readModeConfig, parameter[member[.properties], member[.mode]]]
call[.readModuleConfig, parameter[member[.properties], call[.getMode, parameter[]]]]
call[properties.putAll, parameter[member[.appProperties]]]
call[srcProperties.putAll, parameter[Cast(expression=MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=None))]]
call[.setEnvironmentConfig, parameter[member[.srcProperties]]]
call[.addOnSetup, parameter[member[.srcProperties]]]
call[.convertJerseyConfig, parameter[member[.srcProperties]]]
call[.addProperties, parameter[member[.srcProperties]]]
assign[member[.srcProperties], call[Collections.unmodifiableMap, parameter[member[.srcProperties]]]]
call[.registerBinder, parameter[]]
call[.configureExclude, parameter[member[.srcProperties]]]
call[.configureResource, parameter[]]
call[.configureFeature, parameter[member[.srcProperties]]]
call[.configureServer, parameter[]]
call[properties.clear, parameter[]]
call[.scanClasses, parameter[]]
call[.addOnDone, parameter[]]
assign[member[.addons], call[Collections.unmodifiableSet, parameter[member[.addons]]]]
assign[member[.excludes], call[Collections.unmodifiableSet, parameter[member[.excludes]]]]
call[logger.info, parameter[call[Messages.get, parameter[literal["info.feature.load"]]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[void] identifier[configure] operator[SEP] operator[SEP] {
identifier[Properties] identifier[properties] operator[=] identifier[readDefaultConfig] operator[SEP] operator[SEP] operator[SEP] identifier[Properties] identifier[appProperties] operator[=] Keyword[new] identifier[Props] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[appConf] operator[=] identifier[Lists] operator[SEP] identifier[newArrayListWithExpectedSize] operator[SEP] identifier[configFiles] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[conf] operator[:] identifier[configFiles] operator[SEP] {
identifier[URL] identifier[appCfgUrl] operator[=] identifier[readAppConfig] operator[SEP] identifier[appProperties] , identifier[conf] operator[SEP] operator[SEP] identifier[appConf] operator[SEP] identifier[add] operator[SEP] identifier[toExternalForm] operator[SEP] identifier[appCfgUrl] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[mode] operator[=] identifier[Mode] operator[SEP] identifier[valueOf] operator[SEP] identifier[appProperties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[mode] operator[=] identifier[Mode] operator[SEP] identifier[PRODUCT] operator[SEP]
}
identifier[setApplicationName] operator[SEP] identifier[StringUtils] operator[SEP] identifier[defaultString] operator[SEP] identifier[appProperties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] , identifier[DEFAULT_APP_NAME] operator[SEP] operator[SEP] operator[SEP] identifier[applicationVersion] operator[=] identifier[appProperties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[applicationVersion] operator[SEP] operator[SEP] {
identifier[applicationVersion] operator[=] Keyword[new] identifier[UnknownVersion] operator[SEP] operator[SEP] operator[SEP]
}
identifier[configureLogger] operator[SEP] identifier[appProperties] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isInitialized] operator[SEP] operator[SEP] operator[SEP] identifier[Ameba] operator[SEP] identifier[printInfo] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] literal[String] , identifier[appConf] operator[SEP] operator[SEP] operator[SEP] identifier[readModeConfig] operator[SEP] identifier[properties] , identifier[mode] operator[SEP] operator[SEP] identifier[readModuleConfig] operator[SEP] identifier[properties] , identifier[getMode] operator[SEP] operator[SEP] operator[SEP] identifier[isDev] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[putAll] operator[SEP] identifier[appProperties] operator[SEP] operator[SEP] identifier[srcProperties] operator[SEP] identifier[putAll] operator[SEP] operator[SEP] identifier[Map] operator[SEP] identifier[properties] operator[SEP] operator[SEP] identifier[setEnvironmentConfig] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[addOnSetup] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[convertJerseyConfig] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[addProperties] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[srcProperties] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[registerBinder] operator[SEP] operator[SEP] operator[SEP] identifier[configureExclude] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[configureResource] operator[SEP] operator[SEP] operator[SEP] identifier[configureFeature] operator[SEP] identifier[srcProperties] operator[SEP] operator[SEP] identifier[configureServer] operator[SEP] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[scanClasses] operator[SEP] operator[SEP] operator[SEP] identifier[addOnDone] operator[SEP] operator[SEP] operator[SEP] identifier[addons] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[addons] operator[SEP] operator[SEP] identifier[excludes] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[excludes] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public AppVersion getCurrentAppVersion() {
return new AppVersion(getSequenceNumber()).setReleaseName(getReleaseName()).setTimestamp(getTimestamp())
.setNumClasses(getProjectStats().getNumClasses()).setCodeSize(getProjectStats().getCodeSize());
} | class class_name[name] begin[{]
method[getCurrentAppVersion, return_type[type[AppVersion]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSequenceNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getReleaseName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setReleaseName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTimestamp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setTimestamp, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProjectStats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getNumClasses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setNumClasses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProjectStats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCodeSize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setCodeSize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=AppVersion, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[AppVersion] identifier[getCurrentAppVersion] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[AppVersion] operator[SEP] identifier[getSequenceNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setReleaseName] operator[SEP] identifier[getReleaseName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setTimestamp] operator[SEP] identifier[getTimestamp] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setNumClasses] operator[SEP] identifier[getProjectStats] operator[SEP] operator[SEP] operator[SEP] identifier[getNumClasses] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setCodeSize] operator[SEP] identifier[getProjectStats] operator[SEP] operator[SEP] operator[SEP] identifier[getCodeSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void controlEventHandler(final ControlEventHandler controlEventHandler) {
env.setControlEventHandler(new ControlEventHandler() {
@Override
public void onEvent(ChannelFlowController flowController, ByteBuf event) {
if (DcpSnapshotMarkerRequest.is(event)) {
// Keep snapshot information in the session state, but also forward event to user
short partition = DcpSnapshotMarkerRequest.partition(event);
PartitionState ps = sessionState().get(partition);
ps.setSnapshotStartSeqno(DcpSnapshotMarkerRequest.startSeqno(event));
ps.setSnapshotEndSeqno(DcpSnapshotMarkerRequest.endSeqno(event));
sessionState().set(partition, ps);
} else if (DcpFailoverLogResponse.is(event)) {
// Do not forward failover log responses for now since their info is kept
// in the session state transparently
handleFailoverLogResponse(event);
event.release();
return;
} else if (RollbackMessage.is(event)) {
// even if forwarded to the user, warn in case the user is not
// aware of rollback messages.
LOGGER.warn(
"Received rollback for vbucket {} to seqno {}",
RollbackMessage.vbucket(event),
RollbackMessage.seqno(event)
);
}
// Forward event to user.
controlEventHandler.onEvent(flowController, event);
}
});
} | class class_name[name] begin[{]
method[controlEventHandler, return_type[void], modifier[public], parameter[controlEventHandler]] begin[{]
call[env.setControlEventHandler, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=is, postfix_operators=[], prefix_operators=[], qualifier=DcpSnapshotMarkerRequest, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=is, postfix_operators=[], prefix_operators=[], qualifier=DcpFailoverLogResponse, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=is, postfix_operators=[], prefix_operators=[], qualifier=RollbackMessage, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received rollback for vbucket {} to seqno {}"), MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=vbucket, postfix_operators=[], prefix_operators=[], qualifier=RollbackMessage, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=seqno, postfix_operators=[], prefix_operators=[], qualifier=RollbackMessage, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleFailoverLogResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=partition, postfix_operators=[], prefix_operators=[], qualifier=DcpSnapshotMarkerRequest, selectors=[], type_arguments=None), name=partition)], modifiers=set(), type=BasicType(dimensions=[], name=short)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=sessionState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=partition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=ps)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PartitionState, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startSeqno, postfix_operators=[], prefix_operators=[], qualifier=DcpSnapshotMarkerRequest, selectors=[], type_arguments=None)], member=setSnapshotStartSeqno, postfix_operators=[], prefix_operators=[], qualifier=ps, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=endSeqno, postfix_operators=[], prefix_operators=[], qualifier=DcpSnapshotMarkerRequest, selectors=[], type_arguments=None)], member=setSnapshotEndSeqno, postfix_operators=[], prefix_operators=[], qualifier=ps, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=sessionState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=partition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=flowController, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onEvent, postfix_operators=[], prefix_operators=[], qualifier=controlEventHandler, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onEvent, parameters=[FormalParameter(annotations=[], modifiers=set(), name=flowController, type=ReferenceType(arguments=None, dimensions=[], name=ChannelFlowController, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=ByteBuf, 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=ControlEventHandler, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[controlEventHandler] operator[SEP] Keyword[final] identifier[ControlEventHandler] identifier[controlEventHandler] operator[SEP] {
identifier[env] operator[SEP] identifier[setControlEventHandler] operator[SEP] Keyword[new] identifier[ControlEventHandler] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onEvent] operator[SEP] identifier[ChannelFlowController] identifier[flowController] , identifier[ByteBuf] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[DcpSnapshotMarkerRequest] operator[SEP] identifier[is] operator[SEP] identifier[event] operator[SEP] operator[SEP] {
Keyword[short] identifier[partition] operator[=] identifier[DcpSnapshotMarkerRequest] operator[SEP] identifier[partition] operator[SEP] identifier[event] operator[SEP] operator[SEP] identifier[PartitionState] identifier[ps] operator[=] identifier[sessionState] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[partition] operator[SEP] operator[SEP] identifier[ps] operator[SEP] identifier[setSnapshotStartSeqno] operator[SEP] identifier[DcpSnapshotMarkerRequest] operator[SEP] identifier[startSeqno] operator[SEP] identifier[event] operator[SEP] operator[SEP] operator[SEP] identifier[ps] operator[SEP] identifier[setSnapshotEndSeqno] operator[SEP] identifier[DcpSnapshotMarkerRequest] operator[SEP] identifier[endSeqno] operator[SEP] identifier[event] operator[SEP] operator[SEP] operator[SEP] identifier[sessionState] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[partition] , identifier[ps] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[DcpFailoverLogResponse] operator[SEP] identifier[is] operator[SEP] identifier[event] operator[SEP] operator[SEP] {
identifier[handleFailoverLogResponse] operator[SEP] identifier[event] operator[SEP] operator[SEP] identifier[event] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[RollbackMessage] operator[SEP] identifier[is] operator[SEP] identifier[event] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[RollbackMessage] operator[SEP] identifier[vbucket] operator[SEP] identifier[event] operator[SEP] , identifier[RollbackMessage] operator[SEP] identifier[seqno] operator[SEP] identifier[event] operator[SEP] operator[SEP] operator[SEP]
}
identifier[controlEventHandler] operator[SEP] identifier[onEvent] operator[SEP] identifier[flowController] , identifier[event] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"rawtypes"})
public static Map getMapValue(Config stormConf, String key)
{
Map configMap = (Map) stormConf.get(key);
return configMap;
} | class class_name[name] begin[{]
method[getMapValue, return_type[type[Map]], modifier[public static], parameter[stormConf, key]] begin[{]
local_variable[type[Map], configMap]
return[member[.configMap]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String]
} operator[SEP] Keyword[public] Keyword[static] identifier[Map] identifier[getMapValue] operator[SEP] identifier[Config] identifier[stormConf] , identifier[String] identifier[key] operator[SEP] {
identifier[Map] identifier[configMap] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[stormConf] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[configMap] operator[SEP]
}
|
@Override
public String getLabel(KamNode kamNode) {
String label = labelCache.get(kamNode.getLabel());
if (label == null) {
label = kamNode.getLabel();
try {
List<BelTerm> terms = kAMStore.getSupportingTerms(kamNode);
if (!terms.isEmpty()) {
BelTerm bt = terms.get(0);
Term t = BELParser.parseTerm(bt.getLabel());
label = t.toBELShortForm();
}
} catch (Exception e) {
// TODO exception
}
labelCache.put(kamNode.getLabel(), label);
}
return label;
} | class class_name[name] begin[{]
method[getLabel, return_type[type[String]], modifier[public], parameter[kamNode]] begin[{]
local_variable[type[String], label]
if[binary_operation[member[.label], ==, literal[null]]] begin[{]
assign[member[.label], call[kamNode.getLabel, parameter[]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=kamNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSupportingTerms, postfix_operators=[], prefix_operators=[], qualifier=kAMStore, selectors=[], type_arguments=None), name=terms)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BelTerm, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=terms, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=terms, selectors=[], type_arguments=None), name=bt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BelTerm, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLabel, postfix_operators=[], prefix_operators=[], qualifier=bt, selectors=[], type_arguments=None)], member=parseTerm, postfix_operators=[], prefix_operators=[], qualifier=BELParser, selectors=[], type_arguments=None), name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toBELShortForm, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
call[labelCache.put, parameter[call[kamNode.getLabel, parameter[]], member[.label]]]
else begin[{]
None
end[}]
return[member[.label]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getLabel] operator[SEP] identifier[KamNode] identifier[kamNode] operator[SEP] {
identifier[String] identifier[label] operator[=] identifier[labelCache] operator[SEP] identifier[get] operator[SEP] identifier[kamNode] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[label] operator[==] Other[null] operator[SEP] {
identifier[label] operator[=] identifier[kamNode] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[List] operator[<] identifier[BelTerm] operator[>] identifier[terms] operator[=] identifier[kAMStore] operator[SEP] identifier[getSupportingTerms] operator[SEP] identifier[kamNode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[terms] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[BelTerm] identifier[bt] operator[=] identifier[terms] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Term] identifier[t] operator[=] identifier[BELParser] operator[SEP] identifier[parseTerm] operator[SEP] identifier[bt] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[=] identifier[t] operator[SEP] identifier[toBELShortForm] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
identifier[labelCache] operator[SEP] identifier[put] operator[SEP] identifier[kamNode] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] , identifier[label] operator[SEP] operator[SEP]
}
Keyword[return] identifier[label] operator[SEP]
}
|
protected void onGetImageError(String cacheKey, JusError error) {
// Notify the requesters that something failed via a null result.
// Remove this request from the list of in-flight requests.
BatchedImageRequest request = inFlightRequests.remove(cacheKey);
if (request != null) {
// Set the error for this request
request.setError(error);
// Send the batched response
batchResponse(cacheKey, request);
}
} | class class_name[name] begin[{]
method[onGetImageError, return_type[void], modifier[protected], parameter[cacheKey, error]] begin[{]
local_variable[type[BatchedImageRequest], request]
if[binary_operation[member[.request], !=, literal[null]]] begin[{]
call[request.setError, parameter[member[.error]]]
call[.batchResponse, parameter[member[.cacheKey], member[.request]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[onGetImageError] operator[SEP] identifier[String] identifier[cacheKey] , identifier[JusError] identifier[error] operator[SEP] {
identifier[BatchedImageRequest] identifier[request] operator[=] identifier[inFlightRequests] operator[SEP] identifier[remove] operator[SEP] identifier[cacheKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[setError] operator[SEP] identifier[error] operator[SEP] operator[SEP] identifier[batchResponse] operator[SEP] identifier[cacheKey] , identifier[request] operator[SEP] operator[SEP]
}
}
|
protected Query detachQueryNonTxInvocation(EntityManager underlyingEntityManager, Query underLyingQuery) {
if (!this.isExtendedPersistenceContext() && !this.isInTx()) {
return new QueryNonTxInvocationDetacher(underlyingEntityManager, underLyingQuery);
}
return underLyingQuery;
} | class class_name[name] begin[{]
method[detachQueryNonTxInvocation, return_type[type[Query]], modifier[protected], parameter[underlyingEntityManager, underLyingQuery]] begin[{]
if[binary_operation[THIS[call[None.isExtendedPersistenceContext, parameter[]]], &&, THIS[call[None.isInTx, parameter[]]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=underlyingEntityManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=underLyingQuery, 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=QueryNonTxInvocationDetacher, sub_type=None))]
else begin[{]
None
end[}]
return[member[.underLyingQuery]]
end[}]
END[}] | Keyword[protected] identifier[Query] identifier[detachQueryNonTxInvocation] operator[SEP] identifier[EntityManager] identifier[underlyingEntityManager] , identifier[Query] identifier[underLyingQuery] operator[SEP] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isExtendedPersistenceContext] operator[SEP] operator[SEP] operator[&&] operator[!] Keyword[this] operator[SEP] identifier[isInTx] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[QueryNonTxInvocationDetacher] operator[SEP] identifier[underlyingEntityManager] , identifier[underLyingQuery] operator[SEP] operator[SEP]
}
Keyword[return] identifier[underLyingQuery] operator[SEP]
}
|
public int getSize() {
InnerList iList = ref.get();
return iList != null ? iList.getList().size() : 0;
} | class class_name[name] begin[{]
method[getSize, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[InnerList], iList]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=iList, 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=0), if_true=MethodInvocation(arguments=[], member=getList, postfix_operators=[], prefix_operators=[], qualifier=iList, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getSize] operator[SEP] operator[SEP] {
identifier[InnerList] identifier[iList] operator[=] identifier[ref] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[iList] operator[!=] Other[null] operator[?] identifier[iList] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[:] Other[0] operator[SEP]
}
|
@Override
public Edge addEdge(final String label, Vertex inVertex) {
if (inVertex instanceof PartitionVertex)
// WRAPPED: GET THE BASE VERTEX
inVertex = ((PartitionVertex) inVertex).getBaseVertex();
return addEdge(label, (OrientVertex) inVertex, null, null, (Object[]) null);
} | class class_name[name] begin[{]
method[addEdge, return_type[type[Edge]], modifier[public], parameter[label, inVertex]] begin[{]
if[binary_operation[member[.inVertex], instanceof, type[PartitionVertex]]] begin[{]
assign[member[.inVertex], Cast(expression=MemberReference(member=inVertex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PartitionVertex, sub_type=None))]
else begin[{]
None
end[}]
return[call[.addEdge, parameter[member[.label], Cast(expression=MemberReference(member=inVertex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=OrientVertex, sub_type=None)), literal[null], literal[null], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Edge] identifier[addEdge] operator[SEP] Keyword[final] identifier[String] identifier[label] , identifier[Vertex] identifier[inVertex] operator[SEP] {
Keyword[if] operator[SEP] identifier[inVertex] Keyword[instanceof] identifier[PartitionVertex] operator[SEP] identifier[inVertex] operator[=] operator[SEP] operator[SEP] identifier[PartitionVertex] operator[SEP] identifier[inVertex] operator[SEP] operator[SEP] identifier[getBaseVertex] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[addEdge] operator[SEP] identifier[label] , operator[SEP] identifier[OrientVertex] operator[SEP] identifier[inVertex] , Other[null] , Other[null] , operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public Optional<ResourceSection> maybeLoadResourceSection()
throws IOException {
return (Optional<ResourceSection>) maybeLoadSpecialSection(DataDirectoryKey.RESOURCE_TABLE);
} | class class_name[name] begin[{]
method[maybeLoadResourceSection, return_type[type[Optional]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=RESOURCE_TABLE, postfix_operators=[], prefix_operators=[], qualifier=DataDirectoryKey, selectors=[])], member=maybeLoadSpecialSection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ResourceSection, sub_type=None))], dimensions=[], name=Optional, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Optional] operator[<] identifier[ResourceSection] operator[>] identifier[maybeLoadResourceSection] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] operator[SEP] identifier[Optional] operator[<] identifier[ResourceSection] operator[>] operator[SEP] identifier[maybeLoadSpecialSection] operator[SEP] identifier[DataDirectoryKey] operator[SEP] identifier[RESOURCE_TABLE] operator[SEP] operator[SEP]
}
|
private void closeSelectors()
{
if (readSelector != null)
{
try
{
readSelector.close();
}
catch (IOException e)
{
LOGGER.debug("Error while closing read selector", e);
}
}
if (writeSelector != null)
{
try
{
writeSelector.close();
}
catch (IOException e)
{
LOGGER.debug("Error while closing write selector", e);
}
}
} | class class_name[name] begin[{]
method[closeSelectors, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.readSelector], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=readSelector, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while closing read selector"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[member[.writeSelector], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=writeSelector, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while closing write selector"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[closeSelectors] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[readSelector] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[readSelector] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[writeSelector] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[writeSelector] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public GlobalTableDescription withReplicationGroup(ReplicaDescription... replicationGroup) {
if (this.replicationGroup == null) {
setReplicationGroup(new java.util.ArrayList<ReplicaDescription>(replicationGroup.length));
}
for (ReplicaDescription ele : replicationGroup) {
this.replicationGroup.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withReplicationGroup, return_type[type[GlobalTableDescription]], modifier[public], parameter[replicationGroup]] begin[{]
if[binary_operation[THIS[member[None.replicationGroup]], ==, literal[null]]] begin[{]
call[.setReplicationGroup, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=replicationGroup, 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=ReplicaDescription, 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=replicationGroup, 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=replicationGroup, 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=ReplicaDescription, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[GlobalTableDescription] identifier[withReplicationGroup] operator[SEP] identifier[ReplicaDescription] operator[...] identifier[replicationGroup] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[replicationGroup] operator[==] Other[null] operator[SEP] {
identifier[setReplicationGroup] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[ReplicaDescription] operator[>] operator[SEP] identifier[replicationGroup] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ReplicaDescription] identifier[ele] operator[:] identifier[replicationGroup] operator[SEP] {
Keyword[this] operator[SEP] identifier[replicationGroup] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void store(final OutputStream out, final String comments, final String encoding) throws IOException {
lock.readLock().lock();
try {
properties.store(new OutputStreamWriter(out, Charset.forName(encoding)), comments);
} finally {
lock.readLock().unlock();
}
} | class class_name[name] begin[{]
method[store, return_type[void], modifier[public], parameter[out, comments, encoding]] begin[{]
call[lock.readLock, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Charset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OutputStreamWriter, sub_type=None)), MemberReference(member=comments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=store, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=readLock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[store] operator[SEP] Keyword[final] identifier[OutputStream] identifier[out] , Keyword[final] identifier[String] identifier[comments] , Keyword[final] identifier[String] identifier[encoding] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[lock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[properties] operator[SEP] identifier[store] operator[SEP] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[out] , identifier[Charset] operator[SEP] identifier[forName] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] , identifier[comments] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public int[] getValues() {
int[] result = new int[size()];
for (int i = 0; i < result.length; i++) {
result[i] = getValue(i);
}
return result;
} | class class_name[name] begin[{]
method[getValues, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=result, 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[.result]]
end[}]
END[}] | Keyword[public] Keyword[int] operator[SEP] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[result] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[getValue] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public final GeographyPointValue getGeographyPointValue(int columnIndex) {
validateColumnType(columnIndex, VoltType.GEOGRAPHY_POINT);
GeographyPointValue pt = GeographyPointValue.unflattenFromBuffer(m_buffer, getOffset(columnIndex));
m_wasNull = (pt == null);
return pt;
} | class class_name[name] begin[{]
method[getGeographyPointValue, return_type[type[GeographyPointValue]], modifier[final public], parameter[columnIndex]] begin[{]
call[.validateColumnType, parameter[member[.columnIndex], member[VoltType.GEOGRAPHY_POINT]]]
local_variable[type[GeographyPointValue], pt]
assign[member[.m_wasNull], binary_operation[member[.pt], ==, literal[null]]]
return[member[.pt]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[GeographyPointValue] identifier[getGeographyPointValue] operator[SEP] Keyword[int] identifier[columnIndex] operator[SEP] {
identifier[validateColumnType] operator[SEP] identifier[columnIndex] , identifier[VoltType] operator[SEP] identifier[GEOGRAPHY_POINT] operator[SEP] operator[SEP] identifier[GeographyPointValue] identifier[pt] operator[=] identifier[GeographyPointValue] operator[SEP] identifier[unflattenFromBuffer] operator[SEP] identifier[m_buffer] , identifier[getOffset] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] operator[SEP] identifier[m_wasNull] operator[=] operator[SEP] identifier[pt] operator[==] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[pt] operator[SEP]
}
|
public void purge() {
long time = System.currentTimeMillis();
if (time - latestWriteTime > expireMillis) {
// Everything in the map is expired, clear all at once
map.clear();
} else {
// Iterate and remove until the first non-expired token
Iterator<Value> values = map.values().iterator();
while (values.hasNext()) {
if (time >= values.next().expire) {
values.remove();
} else {
break;
}
}
}
} | class class_name[name] begin[{]
method[purge, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[long], time]
if[binary_operation[binary_operation[member[.time], -, member[.latestWriteTime]], >, member[.expireMillis]]] begin[{]
call[map.clear, parameter[]]
else begin[{]
local_variable[type[Iterator], values]
while[call[values.hasNext, parameter[]]] begin[{]
if[binary_operation[member[.time], >=, call[values.next, parameter[]]]] begin[{]
call[values.remove, parameter[]]
else begin[{]
BreakStatement(goto=None, label=None)
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[purge] operator[SEP] operator[SEP] {
Keyword[long] identifier[time] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[time] operator[-] identifier[latestWriteTime] operator[>] identifier[expireMillis] operator[SEP] {
identifier[map] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Iterator] operator[<] identifier[Value] operator[>] identifier[values] operator[=] identifier[map] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[values] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[time] operator[>=] identifier[values] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[expire] operator[SEP] {
identifier[values] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[break] operator[SEP]
}
}
}
}
|
private void guaranteeRegistered(TrafficSource trafficSource,
TargetGroup targetGroup,
Collection<TargetDescription> targets,
Collection<BaragonAgentMetadata> baragonAgents,
Collection<LoadBalancer> loadBalancers) {
/*
- Check that load balancers, baragon agents, target groups are on same VPC
- Check that load balancers, targets are on same subnet (== AZ)
- Check that all baragon agents are associated with a target on target group
- Check that load balancers has listeners, rules to make talk to target group
*/
if (configuration.isPresent() && configuration.get().isCheckForCorrectVpc()) {
guaranteeSameVPC(targetGroup, baragonAgents, loadBalancers);
}
guaranteeAzEnabled(baragonAgents, loadBalancers);
guaranteeHasAllTargets(trafficSource, targetGroup, targets, baragonAgents);
//guaranteeListenersPresent(targetGroup, loadBalancers);
} | class class_name[name] begin[{]
method[guaranteeRegistered, return_type[void], modifier[private], parameter[trafficSource, targetGroup, targets, baragonAgents, loadBalancers]] begin[{]
if[binary_operation[call[configuration.isPresent, parameter[]], &&, call[configuration.get, parameter[]]]] begin[{]
call[.guaranteeSameVPC, parameter[member[.targetGroup], member[.baragonAgents], member[.loadBalancers]]]
else begin[{]
None
end[}]
call[.guaranteeAzEnabled, parameter[member[.baragonAgents], member[.loadBalancers]]]
call[.guaranteeHasAllTargets, parameter[member[.trafficSource], member[.targetGroup], member[.targets], member[.baragonAgents]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[guaranteeRegistered] operator[SEP] identifier[TrafficSource] identifier[trafficSource] , identifier[TargetGroup] identifier[targetGroup] , identifier[Collection] operator[<] identifier[TargetDescription] operator[>] identifier[targets] , identifier[Collection] operator[<] identifier[BaragonAgentMetadata] operator[>] identifier[baragonAgents] , identifier[Collection] operator[<] identifier[LoadBalancer] operator[>] identifier[loadBalancers] operator[SEP] {
Keyword[if] operator[SEP] identifier[configuration] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[&&] identifier[configuration] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[isCheckForCorrectVpc] operator[SEP] operator[SEP] operator[SEP] {
identifier[guaranteeSameVPC] operator[SEP] identifier[targetGroup] , identifier[baragonAgents] , identifier[loadBalancers] operator[SEP] operator[SEP]
}
identifier[guaranteeAzEnabled] operator[SEP] identifier[baragonAgents] , identifier[loadBalancers] operator[SEP] operator[SEP] identifier[guaranteeHasAllTargets] operator[SEP] identifier[trafficSource] , identifier[targetGroup] , identifier[targets] , identifier[baragonAgents] operator[SEP] operator[SEP]
}
|
protected boolean isProducerTypeCheck() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "isProducerTypeCheck");
boolean checking = true;
// We can carry out checking if there is no FRP, or the FRP has 0 size.
StringArrayWrapper frp = (StringArrayWrapper) properties.get(FORWARD_ROUTING_PATH);
if (frp != null) {
List totalPath = frp.getMsgForwardRoutingPath();
if ((totalPath != null) && (totalPath.size() > 0))
checking = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "isProducerTypeCheck", checking);
return checking;
} | class class_name[name] begin[{]
method[isProducerTypeCheck, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["isProducerTypeCheck"]]]
else begin[{]
None
end[}]
local_variable[type[boolean], checking]
local_variable[type[StringArrayWrapper], frp]
if[binary_operation[member[.frp], !=, literal[null]]] begin[{]
local_variable[type[List], totalPath]
if[binary_operation[binary_operation[member[.totalPath], !=, literal[null]], &&, binary_operation[call[totalPath.size, parameter[]], >, literal[0]]]] begin[{]
assign[member[.checking], literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["isProducerTypeCheck"], member[.checking]]]
else begin[{]
None
end[}]
return[member[.checking]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isProducerTypeCheck] 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[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[checking] operator[=] literal[boolean] operator[SEP] identifier[StringArrayWrapper] identifier[frp] operator[=] operator[SEP] identifier[StringArrayWrapper] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] identifier[FORWARD_ROUTING_PATH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[frp] operator[!=] Other[null] operator[SEP] {
identifier[List] identifier[totalPath] operator[=] identifier[frp] operator[SEP] identifier[getMsgForwardRoutingPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[totalPath] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[totalPath] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] identifier[checking] operator[=] literal[boolean] 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[checking] operator[SEP] operator[SEP] Keyword[return] identifier[checking] operator[SEP]
}
|
@Override
public final void stop() throws CoreException {
try {
LOGGER.log(STOP_APPLICATION, this.getClass().getSimpleName());
preStop();
super.stop();
// Hide the stage is this method wasn't call by user
if (stage().isShowing()) {
stage().hide();
}
// Now nothing is visible by users, Let's kill and release all JRebirth folks
// without loosing or corrupting something
// Be Careful done into the JAT
// Should create a progress bar to control the closure process
// Flag used to have 2 different waiting times
boolean firstTime = true;
do {
// Try to stop the JRebirth Thread
JRebirthThread.getThread().close();
// Wait parameterized delay before retrying to close if the thread is still alive
Thread.sleep(firstTime ? CoreParameters.CLOSE_RETRY_DELAY_FIRST.get() : CoreParameters.CLOSE_RETRY_DELAY_OTHER.get());
if (firstTime) {
firstTime = false;
}
} while (JRebirthThread.getThread().isAlive());
postStop();
LOGGER.log(STOPPED_SUCCESSFULLY, this.getClass().getSimpleName());
} catch (final Exception e) { // NOSONAR Catch all exception during stopping phase
LOGGER.error(STOP_ERROR, e, this.getClass().getSimpleName(), e);
throw new CoreException(e);
}
} | class class_name[name] begin[{]
method[stop, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STOP_APPLICATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[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=log, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=preStop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=SuperMethodInvocation(arguments=[], member=stop, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=stage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=isShowing, 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=stage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=hide, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=firstTime)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), DoStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getThread, postfix_operators=[], prefix_operators=[], qualifier=JRebirthThread, selectors=[MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[TernaryExpression(condition=MemberReference(member=firstTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=CoreParameters.CLOSE_RETRY_DELAY_OTHER, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=CoreParameters.CLOSE_RETRY_DELAY_FIRST, selectors=[], type_arguments=None))], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=firstTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=firstTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]))]), condition=MethodInvocation(arguments=[], member=getThread, postfix_operators=[], prefix_operators=[], qualifier=JRebirthThread, selectors=[MethodInvocation(arguments=[], member=isAlive, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=postStop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STOPPED_SUCCESSFULLY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[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=log, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STOP_ERROR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[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)]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=CoreException, 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[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[stop] operator[SEP] operator[SEP] Keyword[throws] identifier[CoreException] {
Keyword[try] {
identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[STOP_APPLICATION] , Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[preStop] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stage] operator[SEP] operator[SEP] operator[SEP] identifier[isShowing] operator[SEP] operator[SEP] operator[SEP] {
identifier[stage] operator[SEP] operator[SEP] operator[SEP] identifier[hide] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[firstTime] operator[=] literal[boolean] operator[SEP] Keyword[do] {
identifier[JRebirthThread] operator[SEP] identifier[getThread] operator[SEP] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] identifier[firstTime] operator[?] identifier[CoreParameters] operator[SEP] identifier[CLOSE_RETRY_DELAY_FIRST] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[:] identifier[CoreParameters] operator[SEP] identifier[CLOSE_RETRY_DELAY_OTHER] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstTime] operator[SEP] {
identifier[firstTime] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[JRebirthThread] operator[SEP] identifier[getThread] operator[SEP] operator[SEP] operator[SEP] identifier[isAlive] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[postStop] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[STOPPED_SUCCESSFULLY] , Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[STOP_ERROR] , identifier[e] , Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CoreException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public GrpcChannel build() throws AlluxioStatusException {
ManagedChannel underlyingChannel =
GrpcManagedChannelPool.INSTANCE().acquireManagedChannel(mChannelKey,
mConfiguration.getMs(PropertyKey.NETWORK_CONNECTION_HEALTH_CHECK_TIMEOUT_MS),
mConfiguration.getMs(PropertyKey.MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT));
try {
Channel clientChannel = underlyingChannel;
if (mAuthenticateChannel) {
// Create channel authenticator based on provided content.
ChannelAuthenticator channelAuthenticator;
if (mUseSubject) {
channelAuthenticator = new ChannelAuthenticator(mParentSubject, mConfiguration);
} else {
channelAuthenticator =
new ChannelAuthenticator(mUserName, mPassword, mImpersonationUser,
mConfiguration.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class),
mConfiguration.getMs(PropertyKey.MASTER_GRPC_CHANNEL_AUTH_TIMEOUT));
}
// Get an authenticated wrapper channel over given managed channel.
clientChannel = channelAuthenticator.authenticate(mServerAddress, underlyingChannel);
}
// Create the channel after authentication with the target.
return new GrpcChannel(mChannelKey, clientChannel,
mConfiguration.getMs(PropertyKey.MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT));
} catch (Exception exc) {
// Release the managed channel to the pool before throwing.
GrpcManagedChannelPool.INSTANCE().releaseManagedChannel(mChannelKey,
mConfiguration.getMs(PropertyKey.MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT));
throw exc;
}
} | class class_name[name] begin[{]
method[build, return_type[type[GrpcChannel]], modifier[public], parameter[]] begin[{]
local_variable[type[ManagedChannel], underlyingChannel]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=underlyingChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=clientChannel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None)), IfStatement(condition=MemberReference(member=mAuthenticateChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=channelAuthenticator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelAuthenticator, sub_type=None)), IfStatement(condition=MemberReference(member=mUseSubject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=channelAuthenticator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=mUserName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mImpersonationUser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=SECURITY_AUTHENTICATION_TYPE, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AuthType, sub_type=None))], member=getEnum, postfix_operators=[], prefix_operators=[], qualifier=mConfiguration, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=MASTER_GRPC_CHANNEL_AUTH_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getMs, postfix_operators=[], prefix_operators=[], qualifier=mConfiguration, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelAuthenticator, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=channelAuthenticator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=mParentSubject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mConfiguration, 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=ChannelAuthenticator, sub_type=None))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=clientChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mServerAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=underlyingChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=authenticate, postfix_operators=[], prefix_operators=[], qualifier=channelAuthenticator, selectors=[], type_arguments=None)), label=None)])), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=mChannelKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clientChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getMs, postfix_operators=[], prefix_operators=[], qualifier=mConfiguration, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GrpcChannel, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=GrpcManagedChannelPool, selectors=[MethodInvocation(arguments=[MemberReference(member=mChannelKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=PropertyKey, selectors=[])], member=getMs, postfix_operators=[], prefix_operators=[], qualifier=mConfiguration, selectors=[], type_arguments=None)], member=releaseManagedChannel, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=exc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exc, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[GrpcChannel] identifier[build] operator[SEP] operator[SEP] Keyword[throws] identifier[AlluxioStatusException] {
identifier[ManagedChannel] identifier[underlyingChannel] operator[=] identifier[GrpcManagedChannelPool] operator[SEP] identifier[INSTANCE] operator[SEP] operator[SEP] operator[SEP] identifier[acquireManagedChannel] operator[SEP] identifier[mChannelKey] , identifier[mConfiguration] operator[SEP] identifier[getMs] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[NETWORK_CONNECTION_HEALTH_CHECK_TIMEOUT_MS] operator[SEP] , identifier[mConfiguration] operator[SEP] identifier[getMs] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Channel] identifier[clientChannel] operator[=] identifier[underlyingChannel] operator[SEP] Keyword[if] operator[SEP] identifier[mAuthenticateChannel] operator[SEP] {
identifier[ChannelAuthenticator] identifier[channelAuthenticator] operator[SEP] Keyword[if] operator[SEP] identifier[mUseSubject] operator[SEP] {
identifier[channelAuthenticator] operator[=] Keyword[new] identifier[ChannelAuthenticator] operator[SEP] identifier[mParentSubject] , identifier[mConfiguration] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[channelAuthenticator] operator[=] Keyword[new] identifier[ChannelAuthenticator] operator[SEP] identifier[mUserName] , identifier[mPassword] , identifier[mImpersonationUser] , identifier[mConfiguration] operator[SEP] identifier[getEnum] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[SECURITY_AUTHENTICATION_TYPE] , identifier[AuthType] operator[SEP] Keyword[class] operator[SEP] , identifier[mConfiguration] operator[SEP] identifier[getMs] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[MASTER_GRPC_CHANNEL_AUTH_TIMEOUT] operator[SEP] operator[SEP] operator[SEP]
}
identifier[clientChannel] operator[=] identifier[channelAuthenticator] operator[SEP] identifier[authenticate] operator[SEP] identifier[mServerAddress] , identifier[underlyingChannel] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[GrpcChannel] operator[SEP] identifier[mChannelKey] , identifier[clientChannel] , identifier[mConfiguration] operator[SEP] identifier[getMs] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[exc] operator[SEP] {
identifier[GrpcManagedChannelPool] operator[SEP] identifier[INSTANCE] operator[SEP] operator[SEP] operator[SEP] identifier[releaseManagedChannel] operator[SEP] identifier[mChannelKey] , identifier[mConfiguration] operator[SEP] identifier[getMs] operator[SEP] identifier[PropertyKey] operator[SEP] identifier[MASTER_GRPC_CHANNEL_SHUTDOWN_TIMEOUT] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] identifier[exc] operator[SEP]
}
}
|
private <T> RestHttpClientResponse<T> invokeApi(String path, String method,
QueryParams queryParams, HeaderParams headerParams,
Object body, Map<String, Object> formParams,
TypeRef returnType
) throws ServiceException {
Invocation.Builder invocationBuilder;
Entity<?> formEntity = null;
Entity<String> bodyEntity = null;
//STEP 1/3: PREPARE DATA TO SEND
try {
if (body != null && formParams != null) {
throw new IllegalArgumentException("Only formParams OR body can be used, not both at once!");
}
if (method.equals("GET") && (body != null || formParams != null)) {
throw new IllegalArgumentException("Can't use GET with body nor form!");
}
if (body != null) {
bodyEntity = serialize(body, CONTENT_TYPE);
}
Client client = getClient();
WebTarget target = client.target(this.basePath).path(path);
target = addQueryParams(queryParams, target);
invocationBuilder = target.request().accept(ACCEPT);
invocationBuilder = setHeaders(headerParams, invocationBuilder);
if (CONTENT_TYPE.startsWith("multipart/form-data")) {
MultiPart multipart = new MultiPart();
for (Entry<String, Object> param : formParams.entrySet()) {
if (param.getValue() instanceof File) {
File file = (File) param.getValue();
FormDataMultiPart mp = new FormDataMultiPart();
mp.bodyPart(new FormDataBodyPart(param.getKey(), file.getName()));
multipart.bodyPart(mp, MediaType.MULTIPART_FORM_DATA_TYPE);
multipart.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE));
} else {
FormDataMultiPart mp = new FormDataMultiPart();
mp.bodyPart(new FormDataBodyPart(param.getKey(), parameterToString(param.getValue())));
multipart.bodyPart(mp, MediaType.MULTIPART_FORM_DATA_TYPE);
}
}
formEntity = Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA_TYPE);
} else if (CONTENT_TYPE.startsWith("application/x-www-form-urlencoded")) {
Form form = new Form();
for (Entry<String, Object> param : formParams.entrySet()) {
form.param(param.getKey(), parameterToString(param.getValue()));
}
formEntity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE);
} else if (formParams != null) {
throw new IllegalArgumentException("Form params can't be used for this content type!");
}
} catch (Exception e) {
if (e instanceof ServiceException) {
throw e;
}
throw new BadRequestServiceException(
new RestFaultInfo("BadRequest", Blame.CLIENT,
e.getMessage(), ""+ErrorCodes.Client.BAD_REQUEST.getCode(),
null,
Retry.no(), Retry.no(),
Response.Status.BAD_REQUEST.getStatusCode(),
Response.Status.BAD_REQUEST.getReasonPhrase()
), e
);
}
//STEP 2/3: SEND THE REQUEST
Response response;
switch (method) {
case "GET":
response = invocationBuilder.get();
break;
case "POST":
if (formEntity != null) {
response = invocationBuilder.post(formEntity);
} else if (body == null) {
response = invocationBuilder.post(null);
} else {
response = invocationBuilder.post(bodyEntity);
}
break;
case "PUT":
if (formEntity != null) {
response = invocationBuilder.put(formEntity);
} else if (body == null) {
response = invocationBuilder.put(null);
} else {
response = invocationBuilder.put(bodyEntity);
}
break;
case "DELETE":
response = invocationBuilder.delete();
break;
default:
String msg = "Unknown method type >>>" + method+"<<<!";
// throw new WebApplicationException(msg, 500);
throw new BadRequestServiceException(
new RestFaultInfo("BadRequest", Blame.CLIENT,
msg, null,
null,
Retry.no(), Retry.no(),
Response.Status.BAD_REQUEST.getStatusCode(),
Response.Status.BAD_REQUEST.getReasonPhrase()
)
);
}
//STEP 3/3: READ/PARSE THE RESPONSE
boolean envelope = false;
if (response.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) {
//not sure who needs this...
return new RestHttpClientResponse<>(response, Optional.<T>absent());
} else if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
if (returnType == null)
return new RestHttpClientResponse<>(response, Optional.<T>absent());
else {
T deserialized = deserializeResult(response, jsonEnvelopeResultAttributeName, returnType);
return new RestHttpClientResponse<>(response, Optional.fromNullable(deserialized));
}
} else {
TypeRef<RestFaultInfo> errorTypeRef = new TypeRef<RestFaultInfo>(){};
RestFaultInfo faultInfo = deserializeResult(response, jsonEnvelopeErrorAttributeName, errorTypeRef);
switch (faultInfo.getFaultCause()) {
case "BadRequest":
throw new BadRequestServiceException(faultInfo);
case "AccessDenied":
throw new AccessDeniedServiceException(faultInfo);
case "InternalServerError":
throw new InternalServerErrorServiceException(faultInfo);
case "ServiceTemporarilyUnavailable":
throw new ServiceTemporarilyUnavailableServiceException(faultInfo);
case "BadResponse":
throw new BadResponseServiceException(faultInfo);
default:
Blame.assertSize(4);
switch (faultInfo.getBlame()) {
case CLIENT:
throw new ClientServiceException(faultInfo);
case SERVER:
throw new ServerServiceException(faultInfo);
case NETWORK:
throw new NetworkServiceException(faultInfo);
case UNKNOWN:
default:
throw new ServiceException(faultInfo);
}
}
}
} | class class_name[name] begin[{]
method[invokeApi, return_type[type[RestHttpClientResponse]], modifier[private], parameter[path, method, queryParams, headerParams, body, formParams, returnType]] begin[{]
local_variable[type[Invocation], invocationBuilder]
local_variable[type[Entity], formEntity]
local_variable[type[Entity], bodyEntity]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=formParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Only formParams OR body can be used, not both at once!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="GET")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=formParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't use GET with body nor form!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bodyEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CONTENT_TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=client)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Client, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=basePath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=target, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=path, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=target)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WebTarget, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=queryParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addQueryParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=invocationBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=request, postfix_operators=[], prefix_operators=[], qualifier=target, selectors=[MethodInvocation(arguments=[MemberReference(member=ACCEPT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=invocationBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=headerParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=invocationBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="multipart/form-data")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=CONTENT_TYPE, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/x-www-form-urlencoded")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=CONTENT_TYPE, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=formParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Form params can't be used for this content type!")], 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, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Form, sub_type=None)), name=form)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Form, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=parameterToString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=param, postfix_operators=[], prefix_operators=[], qualifier=form, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=formParams, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=formEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=form, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=APPLICATION_FORM_URLENCODED_TYPE, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[])], member=entity, postfix_operators=[], prefix_operators=[], qualifier=Entity, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MultiPart, sub_type=None)), name=multipart)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MultiPart, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FormDataMultiPart, sub_type=None)), name=mp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FormDataMultiPart, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=parameterToString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FormDataBodyPart, sub_type=None))], member=bodyPart, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MULTIPART_FORM_DATA_TYPE, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[])], member=bodyPart, postfix_operators=[], prefix_operators=[], qualifier=multipart, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FormDataMultiPart, sub_type=None)), name=mp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FormDataMultiPart, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FormDataBodyPart, sub_type=None))], member=bodyPart, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MULTIPART_FORM_DATA_TYPE, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[])], member=bodyPart, postfix_operators=[], prefix_operators=[], qualifier=multipart, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=APPLICATION_OCTET_STREAM_TYPE, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileDataBodyPart, sub_type=None))], member=bodyPart, postfix_operators=[], prefix_operators=[], qualifier=multipart, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=formParams, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=formEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=multipart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MULTIPART_FORM_DATA_TYPE, postfix_operators=[], prefix_operators=[], qualifier=MediaType, selectors=[])], member=entity, postfix_operators=[], prefix_operators=[], qualifier=Entity, selectors=[], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ServiceException, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ThrowStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BadRequest"), MemberReference(member=CLIENT, postfix_operators=[], prefix_operators=[], qualifier=Blame, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), operandr=MethodInvocation(arguments=[], member=getCode, postfix_operators=[], prefix_operators=[], qualifier=ErrorCodes.Client.BAD_REQUEST, selectors=[], type_arguments=None), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=no, postfix_operators=[], prefix_operators=[], qualifier=Retry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=no, postfix_operators=[], prefix_operators=[], qualifier=Retry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=Response.Status.BAD_REQUEST, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getReasonPhrase, postfix_operators=[], prefix_operators=[], qualifier=Response.Status.BAD_REQUEST, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RestFaultInfo, sub_type=None)), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadRequestServiceException, 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[Response], response]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="GET")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="POST")], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=formEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=bodyEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=post, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=post, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=formEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=post, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PUT")], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=formEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=bodyEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=put, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=formEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DELETE")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=delete, postfix_operators=[], prefix_operators=[], qualifier=invocationBuilder, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown method type >>>"), operandr=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<<<!"), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BadRequest"), MemberReference(member=CLIENT, postfix_operators=[], prefix_operators=[], qualifier=Blame, selectors=[]), MemberReference(member=msg, 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), MethodInvocation(arguments=[], member=no, postfix_operators=[], prefix_operators=[], qualifier=Retry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=no, postfix_operators=[], prefix_operators=[], qualifier=Retry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=Response.Status.BAD_REQUEST, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getReasonPhrase, postfix_operators=[], prefix_operators=[], qualifier=Response.Status.BAD_REQUEST, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RestFaultInfo, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadRequestServiceException, sub_type=None)), label=None)])], expression=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
local_variable[type[boolean], envelope]
if[binary_operation[call[response.getStatus, parameter[]], ==, call[Response.Status.NO_CONTENT.getStatusCode, parameter[]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=Optional, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=RestHttpClientResponse, sub_type=None))]
else begin[{]
if[call[response.getStatusInfo, parameter[]]] begin[{]
if[binary_operation[member[.returnType], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=Optional, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=RestHttpClientResponse, sub_type=None))]
else begin[{]
local_variable[type[T], deserialized]
return[ClassCreator(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=deserialized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromNullable, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=RestHttpClientResponse, sub_type=None))]
end[}]
else begin[{]
local_variable[type[TypeRef], errorTypeRef]
local_variable[type[RestFaultInfo], faultInfo]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BadRequest")], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=BadRequestServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AccessDenied")], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=AccessDeniedServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="InternalServerError")], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=InternalServerErrorServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ServiceTemporarilyUnavailable")], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=ServiceTemporarilyUnavailableServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BadResponse")], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=BadResponseServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=assertSize, postfix_operators=[], prefix_operators=[], qualifier=Blame, selectors=[], type_arguments=None), label=None), SwitchStatement(cases=[SwitchStatementCase(case=['CLIENT'], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=ClientServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=['SERVER'], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=ServerServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=['NETWORK'], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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=NetworkServiceException, sub_type=None)), label=None)]), SwitchStatementCase(case=['UNKNOWN'], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=faultInfo, 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)])], expression=MethodInvocation(arguments=[], member=getBlame, postfix_operators=[], prefix_operators=[], qualifier=faultInfo, selectors=[], type_arguments=None), label=None)])], expression=MethodInvocation(arguments=[], member=getFaultCause, postfix_operators=[], prefix_operators=[], qualifier=faultInfo, selectors=[], type_arguments=None), label=None)
end[}]
end[}]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[RestHttpClientResponse] operator[<] identifier[T] operator[>] identifier[invokeApi] operator[SEP] identifier[String] identifier[path] , identifier[String] identifier[method] , identifier[QueryParams] identifier[queryParams] , identifier[HeaderParams] identifier[headerParams] , identifier[Object] identifier[body] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[formParams] , identifier[TypeRef] identifier[returnType] operator[SEP] Keyword[throws] identifier[ServiceException] {
identifier[Invocation] operator[SEP] identifier[Builder] identifier[invocationBuilder] operator[SEP] identifier[Entity] operator[<] operator[?] operator[>] identifier[formEntity] operator[=] Other[null] operator[SEP] identifier[Entity] operator[<] identifier[String] operator[>] identifier[bodyEntity] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[body] operator[!=] Other[null] operator[&&] identifier[formParams] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[body] operator[!=] Other[null] operator[||] identifier[formParams] operator[!=] Other[null] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[body] operator[!=] Other[null] operator[SEP] {
identifier[bodyEntity] operator[=] identifier[serialize] operator[SEP] identifier[body] , identifier[CONTENT_TYPE] operator[SEP] operator[SEP]
}
identifier[Client] identifier[client] operator[=] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[WebTarget] identifier[target] operator[=] identifier[client] operator[SEP] identifier[target] operator[SEP] Keyword[this] operator[SEP] identifier[basePath] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[target] operator[=] identifier[addQueryParams] operator[SEP] identifier[queryParams] , identifier[target] operator[SEP] operator[SEP] identifier[invocationBuilder] operator[=] identifier[target] operator[SEP] identifier[request] operator[SEP] operator[SEP] operator[SEP] identifier[accept] operator[SEP] identifier[ACCEPT] operator[SEP] operator[SEP] identifier[invocationBuilder] operator[=] identifier[setHeaders] operator[SEP] identifier[headerParams] , identifier[invocationBuilder] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CONTENT_TYPE] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[MultiPart] identifier[multipart] operator[=] Keyword[new] identifier[MultiPart] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[param] operator[:] identifier[formParams] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] Keyword[instanceof] identifier[File] operator[SEP] {
identifier[File] identifier[file] operator[=] operator[SEP] identifier[File] operator[SEP] identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[FormDataMultiPart] identifier[mp] operator[=] Keyword[new] identifier[FormDataMultiPart] operator[SEP] operator[SEP] operator[SEP] identifier[mp] operator[SEP] identifier[bodyPart] operator[SEP] Keyword[new] identifier[FormDataBodyPart] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[multipart] operator[SEP] identifier[bodyPart] operator[SEP] identifier[mp] , identifier[MediaType] operator[SEP] identifier[MULTIPART_FORM_DATA_TYPE] operator[SEP] operator[SEP] identifier[multipart] operator[SEP] identifier[bodyPart] operator[SEP] Keyword[new] identifier[FileDataBodyPart] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[file] , identifier[MediaType] operator[SEP] identifier[APPLICATION_OCTET_STREAM_TYPE] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[FormDataMultiPart] identifier[mp] operator[=] Keyword[new] identifier[FormDataMultiPart] operator[SEP] operator[SEP] operator[SEP] identifier[mp] operator[SEP] identifier[bodyPart] operator[SEP] Keyword[new] identifier[FormDataBodyPart] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[parameterToString] operator[SEP] identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[multipart] operator[SEP] identifier[bodyPart] operator[SEP] identifier[mp] , identifier[MediaType] operator[SEP] identifier[MULTIPART_FORM_DATA_TYPE] operator[SEP] operator[SEP]
}
}
identifier[formEntity] operator[=] identifier[Entity] operator[SEP] identifier[entity] operator[SEP] identifier[multipart] , identifier[MediaType] operator[SEP] identifier[MULTIPART_FORM_DATA_TYPE] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[CONTENT_TYPE] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Form] identifier[form] operator[=] Keyword[new] identifier[Form] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[param] operator[:] identifier[formParams] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[form] operator[SEP] identifier[param] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[parameterToString] operator[SEP] identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[formEntity] operator[=] identifier[Entity] operator[SEP] identifier[entity] operator[SEP] identifier[form] , identifier[MediaType] operator[SEP] identifier[APPLICATION_FORM_URLENCODED_TYPE] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[formParams] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[ServiceException] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[BadRequestServiceException] operator[SEP] Keyword[new] identifier[RestFaultInfo] operator[SEP] literal[String] , identifier[Blame] operator[SEP] identifier[CLIENT] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[ErrorCodes] operator[SEP] identifier[Client] operator[SEP] identifier[BAD_REQUEST] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] , Other[null] , identifier[Retry] operator[SEP] identifier[no] operator[SEP] operator[SEP] , identifier[Retry] operator[SEP] identifier[no] operator[SEP] operator[SEP] , identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] , identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] operator[SEP] identifier[getReasonPhrase] operator[SEP] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
identifier[Response] identifier[response] operator[SEP] Keyword[switch] operator[SEP] identifier[method] operator[SEP] {
Keyword[case] literal[String] operator[:] identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[formEntity] operator[!=] Other[null] operator[SEP] {
identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[post] operator[SEP] identifier[formEntity] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[body] operator[==] Other[null] operator[SEP] {
identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[post] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[post] operator[SEP] identifier[bodyEntity] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[formEntity] operator[!=] Other[null] operator[SEP] {
identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[put] operator[SEP] identifier[formEntity] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[body] operator[==] Other[null] operator[SEP] {
identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[put] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[put] operator[SEP] identifier[bodyEntity] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[response] operator[=] identifier[invocationBuilder] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[method] operator[+] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[BadRequestServiceException] operator[SEP] Keyword[new] identifier[RestFaultInfo] operator[SEP] literal[String] , identifier[Blame] operator[SEP] identifier[CLIENT] , identifier[msg] , Other[null] , Other[null] , identifier[Retry] operator[SEP] identifier[no] operator[SEP] operator[SEP] , identifier[Retry] operator[SEP] identifier[no] operator[SEP] operator[SEP] , identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] , identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] operator[SEP] identifier[getReasonPhrase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[envelope] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[==] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[NO_CONTENT] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[RestHttpClientResponse] operator[<] operator[>] operator[SEP] identifier[response] , identifier[Optional] operator[SEP] operator[<] identifier[T] operator[>] identifier[absent] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatusInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getFamily] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[Family] operator[SEP] identifier[SUCCESSFUL] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[returnType] operator[==] Other[null] operator[SEP] Keyword[return] Keyword[new] identifier[RestHttpClientResponse] operator[<] operator[>] operator[SEP] identifier[response] , identifier[Optional] operator[SEP] operator[<] identifier[T] operator[>] identifier[absent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] {
identifier[T] identifier[deserialized] operator[=] identifier[deserializeResult] operator[SEP] identifier[response] , identifier[jsonEnvelopeResultAttributeName] , identifier[returnType] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[RestHttpClientResponse] operator[<] operator[>] operator[SEP] identifier[response] , identifier[Optional] operator[SEP] identifier[fromNullable] operator[SEP] identifier[deserialized] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[TypeRef] operator[<] identifier[RestFaultInfo] operator[>] identifier[errorTypeRef] operator[=] Keyword[new] identifier[TypeRef] operator[<] identifier[RestFaultInfo] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[RestFaultInfo] identifier[faultInfo] operator[=] identifier[deserializeResult] operator[SEP] identifier[response] , identifier[jsonEnvelopeErrorAttributeName] , identifier[errorTypeRef] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[faultInfo] operator[SEP] identifier[getFaultCause] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[throw] Keyword[new] identifier[BadRequestServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[throw] Keyword[new] identifier[AccessDeniedServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[throw] Keyword[new] identifier[InternalServerErrorServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[throw] Keyword[new] identifier[ServiceTemporarilyUnavailableServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[throw] Keyword[new] identifier[BadResponseServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[default] operator[:] identifier[Blame] operator[SEP] identifier[assertSize] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[faultInfo] operator[SEP] identifier[getBlame] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[CLIENT] operator[:] Keyword[throw] Keyword[new] identifier[ClientServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] identifier[SERVER] operator[:] Keyword[throw] Keyword[new] identifier[ServerServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] identifier[NETWORK] operator[:] Keyword[throw] Keyword[new] identifier[NetworkServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP] Keyword[case] identifier[UNKNOWN] operator[:] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[faultInfo] operator[SEP] operator[SEP]
}
}
}
}
|
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <T2> Flowable<T2> dematerialize() {
@SuppressWarnings("unchecked")
Flowable<Notification<T2>> m = (Flowable<Notification<T2>>)this;
return RxJavaPlugins.onAssembly(new FlowableDematerialize<T2>(m));
} | class class_name[name] begin[{]
method[dematerialize, return_type[type[Flowable]], modifier[final public], parameter[]] begin[{]
local_variable[type[Flowable], m]
return[call[RxJavaPlugins.onAssembly, parameter[ClassCreator(arguments=[MemberReference(member=m, 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=T2, sub_type=None))], dimensions=None, name=FlowableDematerialize, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] operator[<] identifier[T2] operator[>] identifier[Flowable] operator[<] identifier[T2] operator[>] identifier[dematerialize] operator[SEP] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Flowable] operator[<] identifier[Notification] operator[<] identifier[T2] operator[>] operator[>] identifier[m] operator[=] operator[SEP] identifier[Flowable] operator[<] identifier[Notification] operator[<] identifier[T2] operator[>] operator[>] operator[SEP] Keyword[this] operator[SEP] Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] Keyword[new] identifier[FlowableDematerialize] operator[<] identifier[T2] operator[>] operator[SEP] identifier[m] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<WordInfo> discover(BufferedReader reader, int size) throws IOException
{
String doc;
Map<String, WordInfo> word_cands = new TreeMap<String, WordInfo>();
int totalLength = 0;
Pattern delimiter = Pattern.compile("[\\s\\d,.<>/?:;'\"\\[\\]{}()\\|~!@#$%^&*\\-_=+๏ผใใใใ๏ผ๏ผ๏ผโโโโ๏ฝ๏ฝใใ๏ผ๏ผโฆ๏ฟฅ๏ผโโ๏ผ]+");
while ((doc = reader.readLine()) != null)
{
doc = delimiter.matcher(doc).replaceAll("\0");
int docLength = doc.length();
for (int i = 0; i < docLength; ++i)
{
int end = Math.min(i + 1 + max_word_len, docLength + 1);
for (int j = i + 1; j < end; ++j)
{
String word = doc.substring(i, j);
if (word.indexOf('\0') >= 0)
continue; // ๅซๆๅ้็ฌฆ็ไธ่ฎคไธบๆฏ่ฏ่ฏญ
WordInfo info = word_cands.get(word);
if (info == null)
{
info = new WordInfo(word);
word_cands.put(word, info);
}
info.update(i == 0 ? '\0' : doc.charAt(i - 1), j < docLength ? doc.charAt(j) : '\0');
}
}
totalLength += docLength;
}
for (WordInfo info : word_cands.values())
{
info.computeProbabilityEntropy(totalLength);
}
for (WordInfo info : word_cands.values())
{
info.computeAggregation(word_cands);
}
// ่ฟๆปค
List<WordInfo> wordInfoList = new LinkedList<WordInfo>(word_cands.values());
ListIterator<WordInfo> listIterator = wordInfoList.listIterator();
while (listIterator.hasNext())
{
WordInfo info = listIterator.next();
if (info.text.trim().length() < 2 || info.p < min_freq || info.entropy < min_entropy || info.aggregation < min_aggregation
|| (filter && LexiconUtility.getFrequency(info.text) > 0)
)
{
listIterator.remove();
}
}
// ๆ็
ง้ข็ๆๅบ
MaxHeap<WordInfo> topN = new MaxHeap<WordInfo>(size, new Comparator<WordInfo>()
{
public int compare(WordInfo o1, WordInfo o2)
{
return Float.compare(o1.p, o2.p);
}
});
topN.addAll(wordInfoList);
return topN.toList();
} | class class_name[name] begin[{]
method[discover, return_type[type[List]], modifier[public], parameter[reader, size]] begin[{]
local_variable[type[String], doc]
local_variable[type[Map], word_cands]
local_variable[type[int], totalLength]
local_variable[type[Pattern], delimiter]
while[binary_operation[assign[member[.doc], call[reader.readLine, parameter[]]], !=, literal[null]]] begin[{]
assign[member[.doc], call[delimiter.matcher, parameter[member[.doc]]]]
local_variable[type[int], docLength]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MemberReference(member=max_word_len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), BinaryOperation(operandl=MemberReference(member=docLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=end)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), name=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\0')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=word, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=word_cands, selectors=[], type_arguments=None), name=info)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WordInfo, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=word, 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=WordInfo, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=word_cands, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\0')), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=docLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\0'), if_true=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None))], member=update, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=docLength, 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)
assign[member[.totalLength], member[.docLength]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=totalLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=computeProbabilityEntropy, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=word_cands, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=info)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WordInfo, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=word_cands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=computeAggregation, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=word_cands, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=info)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WordInfo, sub_type=None))), label=None)
local_variable[type[List], wordInfoList]
local_variable[type[ListIterator], listIterator]
while[call[listIterator.hasNext, parameter[]]] begin[{]
local_variable[type[WordInfo], info]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[call[info.text.trim, parameter[]], <, literal[2]], ||, binary_operation[member[info.p], <, member[.min_freq]]], ||, binary_operation[member[info.entropy], <, member[.min_entropy]]], ||, binary_operation[member[info.aggregation], <, member[.min_aggregation]]], ||, binary_operation[member[.filter], &&, binary_operation[call[LexiconUtility.getFrequency, parameter[member[info.text]]], >, literal[0]]]]] begin[{]
call[listIterator.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
local_variable[type[MaxHeap], topN]
call[topN.addAll, parameter[member[.wordInfoList]]]
return[call[topN.toList, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[WordInfo] operator[>] identifier[discover] operator[SEP] identifier[BufferedReader] identifier[reader] , Keyword[int] identifier[size] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[doc] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[WordInfo] operator[>] identifier[word_cands] operator[=] Keyword[new] identifier[TreeMap] operator[<] identifier[String] , identifier[WordInfo] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[totalLength] operator[=] Other[0] operator[SEP] identifier[Pattern] identifier[delimiter] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[doc] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[doc] operator[=] identifier[delimiter] operator[SEP] identifier[matcher] operator[SEP] identifier[doc] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[docLength] operator[=] identifier[doc] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[docLength] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[int] identifier[end] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[i] operator[+] Other[1] operator[+] identifier[max_word_len] , identifier[docLength] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[i] operator[+] Other[1] operator[SEP] identifier[j] operator[<] identifier[end] operator[SEP] operator[++] identifier[j] operator[SEP] {
identifier[String] identifier[word] operator[=] identifier[doc] operator[SEP] identifier[substring] operator[SEP] identifier[i] , identifier[j] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[word] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>=] Other[0] operator[SEP] Keyword[continue] operator[SEP] identifier[WordInfo] identifier[info] operator[=] identifier[word_cands] operator[SEP] identifier[get] operator[SEP] identifier[word] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[info] operator[==] Other[null] operator[SEP] {
identifier[info] operator[=] Keyword[new] identifier[WordInfo] operator[SEP] identifier[word] operator[SEP] operator[SEP] identifier[word_cands] operator[SEP] identifier[put] operator[SEP] identifier[word] , identifier[info] operator[SEP] operator[SEP]
}
identifier[info] operator[SEP] identifier[update] operator[SEP] identifier[i] operator[==] Other[0] operator[?] literal[String] operator[:] identifier[doc] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] , identifier[j] operator[<] identifier[docLength] operator[?] identifier[doc] operator[SEP] identifier[charAt] operator[SEP] identifier[j] operator[SEP] operator[:] literal[String] operator[SEP] operator[SEP]
}
}
identifier[totalLength] operator[+=] identifier[docLength] operator[SEP]
}
Keyword[for] operator[SEP] identifier[WordInfo] identifier[info] operator[:] identifier[word_cands] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[info] operator[SEP] identifier[computeProbabilityEntropy] operator[SEP] identifier[totalLength] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[WordInfo] identifier[info] operator[:] identifier[word_cands] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[info] operator[SEP] identifier[computeAggregation] operator[SEP] identifier[word_cands] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[WordInfo] operator[>] identifier[wordInfoList] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[WordInfo] operator[>] operator[SEP] identifier[word_cands] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ListIterator] operator[<] identifier[WordInfo] operator[>] identifier[listIterator] operator[=] identifier[wordInfoList] operator[SEP] identifier[listIterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[listIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[WordInfo] identifier[info] operator[=] identifier[listIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[info] operator[SEP] identifier[text] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] Other[2] operator[||] identifier[info] operator[SEP] identifier[p] operator[<] identifier[min_freq] operator[||] identifier[info] operator[SEP] identifier[entropy] operator[<] identifier[min_entropy] operator[||] identifier[info] operator[SEP] identifier[aggregation] operator[<] identifier[min_aggregation] operator[||] operator[SEP] identifier[filter] operator[&&] identifier[LexiconUtility] operator[SEP] identifier[getFrequency] operator[SEP] identifier[info] operator[SEP] identifier[text] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
identifier[listIterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[MaxHeap] operator[<] identifier[WordInfo] operator[>] identifier[topN] operator[=] Keyword[new] identifier[MaxHeap] operator[<] identifier[WordInfo] operator[>] operator[SEP] identifier[size] , Keyword[new] identifier[Comparator] operator[<] identifier[WordInfo] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[WordInfo] identifier[o1] , identifier[WordInfo] identifier[o2] operator[SEP] {
Keyword[return] identifier[Float] operator[SEP] identifier[compare] operator[SEP] identifier[o1] operator[SEP] identifier[p] , identifier[o2] operator[SEP] identifier[p] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[topN] operator[SEP] identifier[addAll] operator[SEP] identifier[wordInfoList] operator[SEP] operator[SEP] Keyword[return] identifier[topN] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP]
}
|
public void extendedPut(String remoteFileName,
long offset,
DataSource source,
MarkerListener mListener)
throws IOException,
ServerException,
ClientException{
// servers support GridFTP?
checkGridFTPSupport();
// all parameters set correctly (or still unset)?
checkTransferParamsPut();
localServer.retrieve(source);
controlChannel.write(new Command("ESTO",
"A " + offset + " " +
remoteFileName));
transferRunSingleThread(localServer.getControlChannel(),
mListener);
} | class class_name[name] begin[{]
method[extendedPut, return_type[void], modifier[public], parameter[remoteFileName, offset, source, mListener]] begin[{]
call[.checkGridFTPSupport, parameter[]]
call[.checkTransferParamsPut, parameter[]]
call[localServer.retrieve, parameter[member[.source]]]
call[controlChannel.write, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ESTO"), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A "), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=remoteFileName, 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=Command, sub_type=None))]]
call[.transferRunSingleThread, parameter[call[localServer.getControlChannel, parameter[]], member[.mListener]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[extendedPut] operator[SEP] identifier[String] identifier[remoteFileName] , Keyword[long] identifier[offset] , identifier[DataSource] identifier[source] , identifier[MarkerListener] identifier[mListener] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ServerException] , identifier[ClientException] {
identifier[checkGridFTPSupport] operator[SEP] operator[SEP] operator[SEP] identifier[checkTransferParamsPut] operator[SEP] operator[SEP] operator[SEP] identifier[localServer] operator[SEP] identifier[retrieve] operator[SEP] identifier[source] operator[SEP] operator[SEP] identifier[controlChannel] operator[SEP] identifier[write] operator[SEP] Keyword[new] identifier[Command] operator[SEP] literal[String] , literal[String] operator[+] identifier[offset] operator[+] literal[String] operator[+] identifier[remoteFileName] operator[SEP] operator[SEP] operator[SEP] identifier[transferRunSingleThread] operator[SEP] identifier[localServer] operator[SEP] identifier[getControlChannel] operator[SEP] operator[SEP] , identifier[mListener] operator[SEP] operator[SEP]
}
|
public void addDependencyMore( final CharSequence name, final CharSequence version) {
addDependency( name, version, GREATER | EQUAL);
} | class class_name[name] begin[{]
method[addDependencyMore, return_type[void], modifier[public], parameter[name, version]] begin[{]
call[.addDependency, parameter[member[.name], member[.version], binary_operation[member[.GREATER], |, member[.EQUAL]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addDependencyMore] operator[SEP] Keyword[final] identifier[CharSequence] identifier[name] , Keyword[final] identifier[CharSequence] identifier[version] operator[SEP] {
identifier[addDependency] operator[SEP] identifier[name] , identifier[version] , identifier[GREATER] operator[|] identifier[EQUAL] operator[SEP] operator[SEP]
}
|
private void readConfiguration( Map<String, String> parameters ) {
String mountPath = parameters.get(MOUNT_PATH_CONFIG);
this.mountPath = mountPath != null ? mountPath : DEFAULT_MOUNT_PATH;
this.jcrConfig = RepositoryConfig.load(parameters);
} | class class_name[name] begin[{]
method[readConfiguration, return_type[void], modifier[private], parameter[parameters]] begin[{]
local_variable[type[String], mountPath]
assign[THIS[member[None.mountPath]], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=mountPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=DEFAULT_MOUNT_PATH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=mountPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
assign[THIS[member[None.jcrConfig]], call[RepositoryConfig.load, parameter[member[.parameters]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[readConfiguration] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameters] operator[SEP] {
identifier[String] identifier[mountPath] operator[=] identifier[parameters] operator[SEP] identifier[get] operator[SEP] identifier[MOUNT_PATH_CONFIG] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[mountPath] operator[=] identifier[mountPath] operator[!=] Other[null] operator[?] identifier[mountPath] operator[:] identifier[DEFAULT_MOUNT_PATH] operator[SEP] Keyword[this] operator[SEP] identifier[jcrConfig] operator[=] identifier[RepositoryConfig] operator[SEP] identifier[load] operator[SEP] identifier[parameters] operator[SEP] operator[SEP]
}
|
public ServiceFuture<FeatureResultInner> registerAsync(String resourceProviderNamespace, String featureName, final ServiceCallback<FeatureResultInner> serviceCallback) {
return ServiceFuture.fromResponse(registerWithServiceResponseAsync(resourceProviderNamespace, featureName), serviceCallback);
} | class class_name[name] begin[{]
method[registerAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceProviderNamespace, featureName, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.registerWithServiceResponseAsync, parameter[member[.resourceProviderNamespace], member[.featureName]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[FeatureResultInner] operator[>] identifier[registerAsync] operator[SEP] identifier[String] identifier[resourceProviderNamespace] , identifier[String] identifier[featureName] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[FeatureResultInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[registerWithServiceResponseAsync] operator[SEP] identifier[resourceProviderNamespace] , identifier[featureName] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public HttpMessage getHttpMessage() throws HttpMalformedHeaderException, DatabaseException {
if (httpMessage != null) {
return httpMessage;
}
// fetch complete message
RecordHistory history = staticTableHistory.read(historyId);
if (history == null) {
throw new HttpMalformedHeaderException("No history reference for id " + historyId + " type=" + historyType);
}
// ZAP: Init HttpMessage HistoryReference field
history.getHttpMessage().setHistoryRef(this);
return history.getHttpMessage();
} | class class_name[name] begin[{]
method[getHttpMessage, return_type[type[HttpMessage]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.httpMessage], !=, literal[null]]] begin[{]
return[member[.httpMessage]]
else begin[{]
None
end[}]
local_variable[type[RecordHistory], history]
if[binary_operation[member[.history], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No history reference for id "), operandr=MemberReference(member=historyId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" type="), operator=+), operandr=MemberReference(member=historyType, 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=HttpMalformedHeaderException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[history.getHttpMessage, parameter[]]
return[call[history.getHttpMessage, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[HttpMessage] identifier[getHttpMessage] operator[SEP] operator[SEP] Keyword[throws] identifier[HttpMalformedHeaderException] , identifier[DatabaseException] {
Keyword[if] operator[SEP] identifier[httpMessage] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[httpMessage] operator[SEP]
}
identifier[RecordHistory] identifier[history] operator[=] identifier[staticTableHistory] operator[SEP] identifier[read] operator[SEP] identifier[historyId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[history] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[HttpMalformedHeaderException] operator[SEP] literal[String] operator[+] identifier[historyId] operator[+] literal[String] operator[+] identifier[historyType] operator[SEP] operator[SEP]
}
identifier[history] operator[SEP] identifier[getHttpMessage] operator[SEP] operator[SEP] operator[SEP] identifier[setHistoryRef] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] identifier[history] operator[SEP] identifier[getHttpMessage] operator[SEP] operator[SEP] operator[SEP]
}
|
public static CallOptions withAnnotation(CallOptions callOptions, Object annotation) {
Collection<Object> existingAnnotations = callOptions.getOption(CRONET_ANNOTATIONS_KEY);
ArrayList<Object> newAnnotations;
if (existingAnnotations == null) {
newAnnotations = new ArrayList<>();
} else {
newAnnotations = new ArrayList<>(existingAnnotations);
}
newAnnotations.add(annotation);
return callOptions.withOption(
CronetCallOptions.CRONET_ANNOTATIONS_KEY, Collections.unmodifiableList(newAnnotations));
} | class class_name[name] begin[{]
method[withAnnotation, return_type[type[CallOptions]], modifier[public static], parameter[callOptions, annotation]] begin[{]
local_variable[type[Collection], existingAnnotations]
local_variable[type[ArrayList], newAnnotations]
if[binary_operation[member[.existingAnnotations], ==, literal[null]]] begin[{]
assign[member[.newAnnotations], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
assign[member[.newAnnotations], ClassCreator(arguments=[MemberReference(member=existingAnnotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
call[newAnnotations.add, parameter[member[.annotation]]]
return[call[callOptions.withOption, parameter[member[CronetCallOptions.CRONET_ANNOTATIONS_KEY], call[Collections.unmodifiableList, parameter[member[.newAnnotations]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CallOptions] identifier[withAnnotation] operator[SEP] identifier[CallOptions] identifier[callOptions] , identifier[Object] identifier[annotation] operator[SEP] {
identifier[Collection] operator[<] identifier[Object] operator[>] identifier[existingAnnotations] operator[=] identifier[callOptions] operator[SEP] identifier[getOption] operator[SEP] identifier[CRONET_ANNOTATIONS_KEY] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[Object] operator[>] identifier[newAnnotations] operator[SEP] Keyword[if] operator[SEP] identifier[existingAnnotations] operator[==] Other[null] operator[SEP] {
identifier[newAnnotations] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[newAnnotations] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[existingAnnotations] operator[SEP] operator[SEP]
}
identifier[newAnnotations] operator[SEP] identifier[add] operator[SEP] identifier[annotation] operator[SEP] operator[SEP] Keyword[return] identifier[callOptions] operator[SEP] identifier[withOption] operator[SEP] identifier[CronetCallOptions] operator[SEP] identifier[CRONET_ANNOTATIONS_KEY] , identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[newAnnotations] operator[SEP] operator[SEP] operator[SEP]
}
|
public synchronized long delay() {
while (true) {
long curTimeMs = System.currentTimeMillis();
long millisSinceLastSecond = curTimeMs % 1000;
long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond;
checkNextSecond(nowInMsRoundedAtSec);
int delayMs = getDelay(millisSinceLastSecond);
if (stopping) {
delayMs = delayMs > 0 ? 10 : 0;
notify(); // NOSONAR Don't notifyAll as cost is too big in terms of performances
}
if (delayMs < 1) {
notify(); // NOSONAR Don't notifyAll as cost is too big in terms of performances
break;
}
cntDelayed++;
try {
wait(delayMs);
} catch (InterruptedException ex) {
log.debug("Waiting thread was interrupted", ex);
Thread.currentThread().interrupt();
}
cntDelayed--;
}
cntSent++;
return 0;
} | class class_name[name] begin[{]
method[delay, return_type[type[long]], modifier[synchronized public], parameter[]] begin[{]
while[literal[true]] begin[{]
local_variable[type[long], curTimeMs]
local_variable[type[long], millisSinceLastSecond]
local_variable[type[long], nowInMsRoundedAtSec]
call[.checkNextSecond, parameter[member[.nowInMsRoundedAtSec]]]
local_variable[type[int], delayMs]
if[member[.stopping]] begin[{]
assign[member[.delayMs], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=delayMs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10))]
call[.notify, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.delayMs], <, literal[1]]] begin[{]
call[.notify, parameter[]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
member[.cntDelayed]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=delayMs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wait, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Waiting thread was interrupted"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
member[.cntDelayed]
end[}]
member[.cntSent]
return[literal[0]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[long] identifier[delay] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[long] identifier[curTimeMs] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[millisSinceLastSecond] operator[=] identifier[curTimeMs] operator[%] Other[1000] operator[SEP] Keyword[long] identifier[nowInMsRoundedAtSec] operator[=] identifier[curTimeMs] operator[-] identifier[millisSinceLastSecond] operator[SEP] identifier[checkNextSecond] operator[SEP] identifier[nowInMsRoundedAtSec] operator[SEP] operator[SEP] Keyword[int] identifier[delayMs] operator[=] identifier[getDelay] operator[SEP] identifier[millisSinceLastSecond] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stopping] operator[SEP] {
identifier[delayMs] operator[=] identifier[delayMs] operator[>] Other[0] operator[?] Other[10] operator[:] Other[0] operator[SEP] identifier[notify] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[delayMs] operator[<] Other[1] operator[SEP] {
identifier[notify] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
identifier[cntDelayed] operator[++] operator[SEP] Keyword[try] {
identifier[wait] operator[SEP] identifier[delayMs] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[ex] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
identifier[cntDelayed] operator[--] operator[SEP]
}
identifier[cntSent] operator[++] operator[SEP] Keyword[return] Other[0] operator[SEP]
}
|
protected TypedParams<FilterParams> parseFiltersParameters(final QueryParamsParserContext context) {
String filterKey = RestrictedQueryParamsMembers.filter.name();
Map<String, Set<String>> filters = filterQueryParamsByKey(context, filterKey);
Map<String, Map<String, Set<String>>> temporaryFiltersMap = new LinkedHashMap<>();
for (Map.Entry<String, Set<String>> entry : filters.entrySet()) {
List<String> propertyList = buildPropertyListFromEntry(entry, filterKey);
String resourceType = propertyList.get(0);
String propertyPath = StringUtils.join(".", propertyList.subList(1, propertyList.size()));
if (temporaryFiltersMap.containsKey(resourceType)) {
Map<String, Set<String>> resourceParams = temporaryFiltersMap.get(resourceType);
resourceParams.put(propertyPath, Collections.unmodifiableSet(entry.getValue()));
} else {
Map<String, Set<String>> resourceParams = new LinkedHashMap<>();
temporaryFiltersMap.put(resourceType, resourceParams);
resourceParams.put(propertyPath, entry.getValue());
}
}
Map<String, FilterParams> decodedFiltersMap = new LinkedHashMap<>();
for (Map.Entry<String, Map<String, Set<String>>> resourceTypesMap : temporaryFiltersMap.entrySet()) {
Map<String, Set<String>> filtersMap = Collections.unmodifiableMap(resourceTypesMap.getValue());
decodedFiltersMap.put(resourceTypesMap.getKey(), new FilterParams(filtersMap));
}
return new TypedParams<>(Collections.unmodifiableMap(decodedFiltersMap));
} | class class_name[name] begin[{]
method[parseFiltersParameters, return_type[type[TypedParams]], modifier[protected], parameter[context]] begin[{]
local_variable[type[String], filterKey]
local_variable[type[Map], filters]
local_variable[type[Map], temporaryFiltersMap]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filterKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildPropertyListFromEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=propertyList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=propertyList, selectors=[], type_arguments=None), name=resourceType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=propertyList, selectors=[], type_arguments=None)], member=subList, postfix_operators=[], prefix_operators=[], qualifier=propertyList, selectors=[], type_arguments=None)], member=join, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), name=propertyPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=resourceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=temporaryFiltersMap, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None)), name=resourceParams)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resourceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resourceParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=temporaryFiltersMap, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=propertyPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=resourceParams, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=resourceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=temporaryFiltersMap, selectors=[], type_arguments=None), name=resourceParams)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=propertyPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=unmodifiableSet, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=resourceParams, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=filters, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
local_variable[type[Map], decodedFiltersMap]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=resourceTypesMap, selectors=[], type_arguments=None)], member=unmodifiableMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None), name=filtersMap)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=resourceTypesMap, selectors=[], type_arguments=None), ClassCreator(arguments=[MemberReference(member=filtersMap, 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=FilterParams, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=decodedFiltersMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=temporaryFiltersMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=resourceTypesMap)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[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=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None))], dimensions=[], name=Map, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=decodedFiltersMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=TypedParams, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[TypedParams] operator[<] identifier[FilterParams] operator[>] identifier[parseFiltersParameters] operator[SEP] Keyword[final] identifier[QueryParamsParserContext] identifier[context] operator[SEP] {
identifier[String] identifier[filterKey] operator[=] identifier[RestrictedQueryParamsMembers] operator[SEP] identifier[filter] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] identifier[filters] operator[=] identifier[filterQueryParamsByKey] operator[SEP] identifier[context] , identifier[filterKey] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] operator[>] identifier[temporaryFiltersMap] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] identifier[entry] operator[:] identifier[filters] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[propertyList] operator[=] identifier[buildPropertyListFromEntry] operator[SEP] identifier[entry] , identifier[filterKey] operator[SEP] operator[SEP] identifier[String] identifier[resourceType] operator[=] identifier[propertyList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[propertyPath] operator[=] identifier[StringUtils] operator[SEP] identifier[join] operator[SEP] literal[String] , identifier[propertyList] operator[SEP] identifier[subList] operator[SEP] Other[1] , identifier[propertyList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[temporaryFiltersMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[resourceType] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] identifier[resourceParams] operator[=] identifier[temporaryFiltersMap] operator[SEP] identifier[get] operator[SEP] identifier[resourceType] operator[SEP] operator[SEP] identifier[resourceParams] operator[SEP] identifier[put] operator[SEP] identifier[propertyPath] , identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] identifier[resourceParams] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[temporaryFiltersMap] operator[SEP] identifier[put] operator[SEP] identifier[resourceType] , identifier[resourceParams] operator[SEP] operator[SEP] identifier[resourceParams] operator[SEP] identifier[put] operator[SEP] identifier[propertyPath] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[Map] operator[<] identifier[String] , identifier[FilterParams] operator[>] identifier[decodedFiltersMap] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] operator[>] identifier[resourceTypesMap] operator[:] identifier[temporaryFiltersMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[String] operator[>] operator[>] identifier[filtersMap] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[resourceTypesMap] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[decodedFiltersMap] operator[SEP] identifier[put] operator[SEP] identifier[resourceTypesMap] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , Keyword[new] identifier[FilterParams] operator[SEP] identifier[filtersMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[TypedParams] operator[<] operator[>] operator[SEP] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[decodedFiltersMap] operator[SEP] operator[SEP] operator[SEP]
}
|
protected List<Object> onCounterColumn(EntityMetadata m, boolean isRelation, List<String> relations,
List<KeySlice> ks) {
List<Object> entities;
if (m.getType().isSuperColumnFamilyMetadata()) {
if (log.isInfoEnabled()) {
log.info("On counter column for super column family of entity {}.", m.getEntityClazz());
}
// TODO:: change it. remove column or super column helper
Map<byte[], List<CounterSuperColumn>> results = new HashMap<byte[], List<CounterSuperColumn>>();
List<CounterSuperColumn> counterColumns = null;
for (KeySlice slice : ks) {
counterColumns = new ArrayList<CounterSuperColumn>(slice.getColumnsSize());
for (ColumnOrSuperColumn column : slice.columns) {
counterColumns.add(column.counter_super_column);
}
results.put(slice.getKey(), counterColumns);
}
entities = new ArrayList<Object>(results.size());
for (byte[] key : results.keySet()) {
Object e = null;
Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key);
List<CounterSuperColumn> counterSuperColumns = results.get(key);
ThriftRow tr = new ThriftRow(id, m.getTableName(), new ArrayList<Column>(0),
new ArrayList<SuperColumn>(0), new ArrayList<CounterColumn>(0), counterSuperColumns);
e = getDataHandler().populateEntity(tr, m, KunderaCoreUtils.getEntity(e), relations, isRelation);
entities.add(e);
}
} else {
if (log.isInfoEnabled()) {
log.info("On counter column for column family of entity {}", m.getEntityClazz());
}
Map<byte[], List<CounterColumn>> results = new HashMap<byte[], List<CounterColumn>>();
List<CounterColumn> counterColumns = null;
for (KeySlice slice : ks) {
counterColumns = new ArrayList<CounterColumn>(slice.getColumnsSize());
for (ColumnOrSuperColumn column : slice.columns) {
counterColumns.add(column.counter_column);
}
results.put(slice.getKey(), counterColumns);
}
entities = new ArrayList<Object>(results.size());
for (byte[] key : results.keySet()) {
Object e = null;
Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key);
List<CounterColumn> columns = results.get(key);
ThriftRow tr = new ThriftRow(id, m.getTableName(), new ArrayList<Column>(0),
new ArrayList<SuperColumn>(0), columns, new ArrayList<CounterSuperColumn>(0));
e = getDataHandler().populateEntity(tr, m, KunderaCoreUtils.getEntity(e), relations, isRelation);
if (e != null) {
entities.add(e);
}
}
}
return entities;
} | class class_name[name] begin[{]
method[onCounterColumn, return_type[type[List]], modifier[protected], parameter[m, isRelation, relations, ks]] begin[{]
local_variable[type[List], entities]
if[call[m.getType, parameter[]]] begin[{]
if[call[log.isInfoEnabled, parameter[]]] begin[{]
call[log.info, parameter[literal["On counter column for super column family of entity {}."], call[m.getEntityClazz, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[Map], results]
local_variable[type[List], counterColumns]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=counterColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getColumnsSize, postfix_operators=[], prefix_operators=[], qualifier=slice, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CounterSuperColumn, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=counter_super_column, postfix_operators=[], prefix_operators=[], qualifier=column, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=counterColumns, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=slice, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=column)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnOrSuperColumn, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=slice, selectors=[], type_arguments=None), MemberReference(member=counterColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=ks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=slice)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KeySlice, sub_type=None))), label=None)
assign[member[.entities], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdAttribute, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[MethodInvocation(arguments=[], member=getJavaType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=PropertyAccessorHelper, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), name=counterSuperColumns)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CounterSuperColumn, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], 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=Column, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], 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=SuperColumn, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], 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=CounterColumn, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), MemberReference(member=counterSuperColumns, 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=ThriftRow, sub_type=None)), name=tr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ThriftRow, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDataHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=tr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEntity, postfix_operators=[], prefix_operators=[], qualifier=KunderaCoreUtils, selectors=[], type_arguments=None), MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=populateEntity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=entities, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=BasicType(dimensions=[None], name=byte))), label=None)
else begin[{]
if[call[log.isInfoEnabled, parameter[]]] begin[{]
call[log.info, parameter[literal["On counter column for column family of entity {}"], call[m.getEntityClazz, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[Map], results]
local_variable[type[List], counterColumns]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=counterColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getColumnsSize, postfix_operators=[], prefix_operators=[], qualifier=slice, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CounterColumn, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=counter_column, postfix_operators=[], prefix_operators=[], qualifier=column, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=counterColumns, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=slice, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=column)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnOrSuperColumn, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=slice, selectors=[], type_arguments=None), MemberReference(member=counterColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=ks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=slice)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KeySlice, sub_type=None))), label=None)
assign[member[.entities], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdAttribute, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[MethodInvocation(arguments=[], member=getJavaType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=PropertyAccessorHelper, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), name=columns)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CounterColumn, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], 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=Column, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], 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=SuperColumn, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], 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=CounterSuperColumn, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ThriftRow, sub_type=None)), name=tr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ThriftRow, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDataHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=tr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEntity, postfix_operators=[], prefix_operators=[], qualifier=KunderaCoreUtils, selectors=[], type_arguments=None), MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=populateEntity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=e, 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=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=entities, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=BasicType(dimensions=[None], name=byte))), label=None)
end[}]
return[member[.entities]]
end[}]
END[}] | Keyword[protected] identifier[List] operator[<] identifier[Object] operator[>] identifier[onCounterColumn] operator[SEP] identifier[EntityMetadata] identifier[m] , Keyword[boolean] identifier[isRelation] , identifier[List] operator[<] identifier[String] operator[>] identifier[relations] , identifier[List] operator[<] identifier[KeySlice] operator[>] identifier[ks] operator[SEP] {
identifier[List] operator[<] identifier[Object] operator[>] identifier[entities] operator[SEP] Keyword[if] operator[SEP] identifier[m] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[isSuperColumnFamilyMetadata] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[m] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] Keyword[byte] operator[SEP] operator[SEP] , identifier[List] operator[<] identifier[CounterSuperColumn] operator[>] operator[>] identifier[results] operator[=] Keyword[new] identifier[HashMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] , identifier[List] operator[<] identifier[CounterSuperColumn] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CounterSuperColumn] operator[>] identifier[counterColumns] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[KeySlice] identifier[slice] operator[:] identifier[ks] operator[SEP] {
identifier[counterColumns] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[CounterSuperColumn] operator[>] operator[SEP] identifier[slice] operator[SEP] identifier[getColumnsSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ColumnOrSuperColumn] identifier[column] operator[:] identifier[slice] operator[SEP] identifier[columns] operator[SEP] {
identifier[counterColumns] operator[SEP] identifier[add] operator[SEP] identifier[column] operator[SEP] identifier[counter_super_column] operator[SEP] operator[SEP]
}
identifier[results] operator[SEP] identifier[put] operator[SEP] identifier[slice] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[counterColumns] operator[SEP] operator[SEP]
}
identifier[entities] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Object] operator[>] operator[SEP] identifier[results] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key] operator[:] identifier[results] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[e] operator[=] Other[null] operator[SEP] identifier[Object] identifier[id] operator[=] identifier[PropertyAccessorHelper] operator[SEP] identifier[getObject] operator[SEP] identifier[m] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[getJavaType] operator[SEP] operator[SEP] , identifier[key] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CounterSuperColumn] operator[>] identifier[counterSuperColumns] operator[=] identifier[results] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[ThriftRow] identifier[tr] operator[=] Keyword[new] identifier[ThriftRow] operator[SEP] identifier[id] , identifier[m] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , Keyword[new] identifier[ArrayList] operator[<] identifier[Column] operator[>] operator[SEP] Other[0] operator[SEP] , Keyword[new] identifier[ArrayList] operator[<] identifier[SuperColumn] operator[>] operator[SEP] Other[0] operator[SEP] , Keyword[new] identifier[ArrayList] operator[<] identifier[CounterColumn] operator[>] operator[SEP] Other[0] operator[SEP] , identifier[counterSuperColumns] operator[SEP] operator[SEP] identifier[e] operator[=] identifier[getDataHandler] operator[SEP] operator[SEP] operator[SEP] identifier[populateEntity] operator[SEP] identifier[tr] , identifier[m] , identifier[KunderaCoreUtils] operator[SEP] identifier[getEntity] operator[SEP] identifier[e] operator[SEP] , identifier[relations] , identifier[isRelation] operator[SEP] operator[SEP] identifier[entities] operator[SEP] identifier[add] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[m] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] Keyword[byte] operator[SEP] operator[SEP] , identifier[List] operator[<] identifier[CounterColumn] operator[>] operator[>] identifier[results] operator[=] Keyword[new] identifier[HashMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] , identifier[List] operator[<] identifier[CounterColumn] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CounterColumn] operator[>] identifier[counterColumns] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[KeySlice] identifier[slice] operator[:] identifier[ks] operator[SEP] {
identifier[counterColumns] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[CounterColumn] operator[>] operator[SEP] identifier[slice] operator[SEP] identifier[getColumnsSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ColumnOrSuperColumn] identifier[column] operator[:] identifier[slice] operator[SEP] identifier[columns] operator[SEP] {
identifier[counterColumns] operator[SEP] identifier[add] operator[SEP] identifier[column] operator[SEP] identifier[counter_column] operator[SEP] operator[SEP]
}
identifier[results] operator[SEP] identifier[put] operator[SEP] identifier[slice] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[counterColumns] operator[SEP] operator[SEP]
}
identifier[entities] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Object] operator[>] operator[SEP] identifier[results] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key] operator[:] identifier[results] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[e] operator[=] Other[null] operator[SEP] identifier[Object] identifier[id] operator[=] identifier[PropertyAccessorHelper] operator[SEP] identifier[getObject] operator[SEP] identifier[m] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[getJavaType] operator[SEP] operator[SEP] , identifier[key] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CounterColumn] operator[>] identifier[columns] operator[=] identifier[results] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[ThriftRow] identifier[tr] operator[=] Keyword[new] identifier[ThriftRow] operator[SEP] identifier[id] , identifier[m] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , Keyword[new] identifier[ArrayList] operator[<] identifier[Column] operator[>] operator[SEP] Other[0] operator[SEP] , Keyword[new] identifier[ArrayList] operator[<] identifier[SuperColumn] operator[>] operator[SEP] Other[0] operator[SEP] , identifier[columns] , Keyword[new] identifier[ArrayList] operator[<] identifier[CounterSuperColumn] operator[>] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[=] identifier[getDataHandler] operator[SEP] operator[SEP] operator[SEP] identifier[populateEntity] operator[SEP] identifier[tr] , identifier[m] , identifier[KunderaCoreUtils] operator[SEP] identifier[getEntity] operator[SEP] identifier[e] operator[SEP] , identifier[relations] , identifier[isRelation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] {
identifier[entities] operator[SEP] identifier[add] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[entities] operator[SEP]
}
|
public void setValues(com.google.api.ads.admanager.axis.v201902.String_ValueMapEntry[] values) {
this.values = values;
} | class class_name[name] begin[{]
method[setValues, return_type[void], modifier[public], parameter[values]] begin[{]
assign[THIS[member[None.values]], member[.values]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setValues] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201902] operator[SEP] identifier[String_ValueMapEntry] operator[SEP] operator[SEP] identifier[values] operator[SEP] {
Keyword[this] operator[SEP] identifier[values] operator[=] identifier[values] operator[SEP]
}
|
@Override
public Taxinvoice getDetailInfo(String CorpNum, MgtKeyType KeyType,
String MgtKey) throws PopbillException {
if (KeyType == null)
throw new PopbillException(-99999999, "๊ด๋ฆฌ๋ฒํธํํ๊ฐ ์
๋ ฅ๋์ง ์์์ต๋๋ค.");
if (MgtKey == null || MgtKey.isEmpty())
throw new PopbillException(-99999999, "๊ด๋ฆฌ๋ฒํธ๊ฐ ์
๋ ฅ๋์ง ์์์ต๋๋ค.");
return httpget("/Taxinvoice/" + KeyType.name() + "/" + MgtKey
+ "?Detail", CorpNum, null, Taxinvoice.class);
} | class class_name[name] begin[{]
method[getDetailInfo, return_type[type[Taxinvoice]], modifier[public], parameter[CorpNum, KeyType, MgtKey]] begin[{]
if[binary_operation[member[.KeyType], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=99999999), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="๊ด๋ฆฌ๋ฒํธํํ๊ฐ ์
๋ ฅ๋์ง ์์์ต๋๋ค.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PopbillException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.MgtKey], ==, literal[null]], ||, call[MgtKey.isEmpty, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=99999999), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="๊ด๋ฆฌ๋ฒํธ๊ฐ ์
๋ ฅ๋์ง ์์์ต๋๋ค.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PopbillException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.httpget, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["/Taxinvoice/"], +, call[KeyType.name, parameter[]]], +, literal["/"]], +, member[.MgtKey]], +, literal["?Detail"]], member[.CorpNum], literal[null], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Taxinvoice, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Taxinvoice] identifier[getDetailInfo] operator[SEP] identifier[String] identifier[CorpNum] , identifier[MgtKeyType] identifier[KeyType] , identifier[String] identifier[MgtKey] operator[SEP] Keyword[throws] identifier[PopbillException] {
Keyword[if] operator[SEP] identifier[KeyType] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[PopbillException] operator[SEP] operator[-] Other[99999999] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[MgtKey] operator[==] Other[null] operator[||] identifier[MgtKey] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[PopbillException] operator[SEP] operator[-] Other[99999999] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[httpget] operator[SEP] literal[String] operator[+] identifier[KeyType] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[MgtKey] operator[+] literal[String] , identifier[CorpNum] , Other[null] , identifier[Taxinvoice] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
protected Map<String, String> parseDictionary(final JSONObject jsonDictionaryObject) {
final Map<String, String> dictionaryAsMap = new HashMap<>();
if (jsonDictionaryObject != null) {
for (final String key : JSONObject.getNames(jsonDictionaryObject)) {
dictionaryAsMap.put(key, extractFieldValue(jsonDictionaryObject, key, String.class));
}
}
return dictionaryAsMap;
} | class class_name[name] begin[{]
method[parseDictionary, return_type[type[Map]], modifier[protected], parameter[jsonDictionaryObject]] begin[{]
local_variable[type[Map], dictionaryAsMap]
if[binary_operation[member[.jsonDictionaryObject], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=jsonDictionaryObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=extractFieldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=dictionaryAsMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=jsonDictionaryObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNames, postfix_operators=[], prefix_operators=[], qualifier=JSONObject, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.dictionaryAsMap]]
end[}]
END[}] | Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parseDictionary] operator[SEP] Keyword[final] identifier[JSONObject] identifier[jsonDictionaryObject] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[dictionaryAsMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonDictionaryObject] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[:] identifier[JSONObject] operator[SEP] identifier[getNames] operator[SEP] identifier[jsonDictionaryObject] operator[SEP] operator[SEP] {
identifier[dictionaryAsMap] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[extractFieldValue] operator[SEP] identifier[jsonDictionaryObject] , identifier[key] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[dictionaryAsMap] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.