Atitit.java expression FSM expressions participle FSM engine
C:\0workspace\AtiPlatf_cms\src\com\attilax\fsm\JavaExpFsm.java
string code   =   "new (Com.attilax.util.connReduceDync). Set_resfile (Uc_js.txt). Joinnout ()"
. Trim ();
$code = New (Com.attilax.user.AgentService). Login (admin,admin)
[
"New",
"(",
"Com.attilax.user.AgentService",
")",
".",
"Login",
"(",
"Admin",
"Admin",
")"
]
Author :: ★ (Attilax) >>> nickname : Span style= "font-family: the song Body;" > old wow Paw   ( attilax akbar al rapanui Attilax   Baroque   Alpha   Rapa Nui   )   Kanji name: Ayron, Email:[email protected]
reprint Please indicate source: http://www.cnblogs.com/attilax/
Package COM.ATTILAX.FSM;
Import java.util.List;
Import com.google.common.collect.Lists;
public class JAVAEXPFSM {
List<string> tokens = lists.newlinkedlist ();
String Curtoken = "";
// String splitors = "(), \" ";
String curstat = "ini";
Private String Code;
Public char[] Code_char_arr;
Public JAVAEXPFSM (String code) {
This.code = code;
}
/**
* Http://localhost/new (Com.attilax.util.connReduceDync). Set_resfile (Uc_js.txt). Joinnout ()
* Http://localhost/wrmiServlet?code=new (Com.attilax.util.connReduceDync). Set_resfile (Uc_js.txt). Joinnout ()
* @param args
*/
public static void Main (string[] args) {
String code = "New (Com.attilax.util.connReduceDync). Set_resfile (Uc_js.txt). Joinnout ()"
. Trim ();
Code= "New (Com.attilax.agent.AgentRechargeService). Getsubmemtotalsrecyclebyagentid (\" promoter: $pid $,fld2:v2\ ")" ;
List li = new JAVAEXPFSM (code). Gettokens ();
for (Object Object:li) {
System.out.println (object);
}
System.out.println (LI);
}
Public List Gettokens () {
Code_char_arr = Code.tochararray ();
for (char C:code_char_arr) {
Get Next Char,,then Change stat
Jude Cur char and cur stat ... Then if or not chage stat
if (c = = ' (' &&!this.curstat.equals ("Strstart")) {//&& cur Stta=ini
This.curstat = "Brkstart";
Tokens.add (This.curtoken);
Tokens.add ("(");
This.curtoken = "";
Continue
}
// if (c = = '. ' && this.curStat.equals ("Brkstart")) {
//
// Curtoken = Curtoken + string.valueof (c);
// continue;
//
// //This.curStat.equals ("Brkend"))
//
// }
//
if (c = = ') ' &&!this.curstat.equals ("Strstart")) {//&& cur stat =brk start
This.curstat = "Brkend";
if (This.curToken.length () >0)
Tokens.add (This.curtoken);
Tokens.add (")");
This.curtoken = "";
Continue
}
if (c = = '. ' && this.curStat.equals ("Brkend")) {
Tokens.add (".");
Curtoken = "";
Continue
}
if (c== ' \ "' && this.curStat.equals (" Brkstart "))
{
This.curstat = "Strstart";
// Tokens.add (c);
This.curtoken = "";
Continue
}
if (c== ' \ "' && this.curStat.equals (" Strstart "))
{
This.curstat = "Strend";
Tokens.add (This.curtoken);
This.curtoken = "";
Continue
}
if (c== ', ' && this.curStat.equals ("Brkstart"))
{
This.curstat = "Strend";
Tokens.add (This.curtoken);
This.curtoken = "";
Continue
}
// if (this.curStat.equals ("INI"))
Curtoken = Curtoken + string.valueof (c);
}
return tokens;
}
}
Atitit.java expression FSM Expressions participle FSM engine