lib/StateTransitionExpression.js
/**
 * @param expression the expression to be constructed
 * @constructor
 */
@param expression the expression to be constructed
@constructor
@param expression the expression to be constructed @constructor
function StateTransitionExpression(expression) {
    if (!expression) throw new Error("ERROR: StateTransitionExpression cannot be null or empty");
    if (expression.indexOf(expressionToken) == -1) throw new Error("ERROR: StateTransitionExpression misses -> character. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE");
    if (expression.indexOf(operationToken) == -1) throw new Error("ERROR: StateTransitionExpression misses : character. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE");
    var stringExpression = expression;
    expression = expression.replace(operationToken, expressionToken);
    expression = expression.split(expressionToken);
    this._operation = expression[0].replace(/ /g, '');
    this._initialState = expression[1].replace(/ /g, '');
    this._finalState = expression[2].replace(/ /g, '');
    this._name = stringExpression;
    if (this._initialState.length == 0 && this._finalState.length == 0) throw new Error("ERROR: StateTransitionExpression misses INITIAL_STATE and FINAL_STATE. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE");
    if (this._initialState.length == 0) throw new Error("ERROR: StateTransitionExpression misses INITIAL_STATE. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE");
    if (this._finalState.length == 0) throw new Error("ERROR: StateTransitionExpression misses FINAL_STATE. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE");
    if (this._operation.length == 0) throw new Error("ERROR: StateTransitionExpression misses OPERATION_NAME. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE");
}
function StateTransitionExpression ( expression ) { if ( ! expression ) throw new Error ( "ERROR: StateTransitionExpression cannot be null or empty" ) ; if ( expression . indexOf ( expressionToken ) == - 1 ) throw new Error ( "ERROR: StateTransitionExpression misses -> character. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE" ) ; if ( expression . indexOf ( operationToken ) == - 1 ) throw new Error ( "ERROR: StateTransitionExpression misses : character. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE" ) ; var stringExpression = expression ; expression = expression . replace ( operationToken , expressionToken ) ; expression = expression . split ( expressionToken ) ; this . _operation = expression [ 0 ] . replace ( / / g , '' ) ; this . _initialState = expression [ 1 ] . replace ( / / g , '' ) ; this . _finalState = expression [ 2 ] . replace ( / / g , '' ) ; this . _name = stringExpression ; if ( this . _initialState . length == 0 && this . _finalState . length == 0 ) throw new Error ( "ERROR: StateTransitionExpression misses INITIAL_STATE and FINAL_STATE. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE" ) ; if ( this . _initialState . length == 0 ) throw new Error ( "ERROR: StateTransitionExpression misses INITIAL_STATE. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE" ) ; if ( this . _finalState . length == 0 ) throw new Error ( "ERROR: StateTransitionExpression misses FINAL_STATE. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE" ) ; if ( this . _operation . length == 0 ) throw new Error ( "ERROR: StateTransitionExpression misses OPERATION_NAME. Expected structure: OPERATION_NAME:INITIAL_STATE->FINAL_STATE" ) ; }
@param expression the expression to be constructed
 @constructor
@param expression the expression to be constructed @constructor