Atitit. java expression fsm expression word segmentation fsm engine, atitit. javafsm

Source: Internet
Author: User
Tags fsm

Atitit. java expression fsm expression word segmentation fsm engine, atitit. javafsm

 

 

Atitit. java expression fsm expression word segmentation fsm Engine

 

C: \ 0workspace \ AtiPlatf_cms \ src \ com \ attilax \ fsm \ JavaExpFsm. java

 

 

String Code= "New(com.attilax.util.conn?cedync=.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: old wow's paw (full name: Attilax Akbar Al Rapanui Attila Akba Arla Panui) Chinese name: AI long, EMAIL: 1466519819@qq.com

Reprinted 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. newqueue List ();

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.conn?cedync=.set_resfile(uc_js.txt). joinNout ()

* Http: // localhost/wrmiServlet? Code=new(com.attilax.util.conn?cedync=.set_resfile(uc_js.txt). joinNout ()

* @ Param args

*/

Public static void main (String [] args ){

String code = "new(com.attilax.util.conn?cedync=.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;

}

 

}

 

 

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.