Atitit.java expression FSM Expressions participle FSM engine

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.