Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1437

Clarity: DFA Rules - eliminate anonymous classes and functions

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: deferred
    • Component/s: Back End, clean ups
    • Labels:
      None

      Description

      This is a lisp sort of thing to do as written, but there really is no reason these can't be ordinary objects with two methods, test and act. The code would be clearer and easier to debug. Particularly if the classes have names like

      final class StartState(states: => ArrayBuffer[State], val stateNum: Int) extends State(states) {
         type R = Registers // put into State base class, protected
       
         object Got_EC_goto_ESCState extends Rule {
             def test(r: R) = { ... }
             def act(r: R) = { ... }
           }
       
        object Got_EEC_goto_ESCESCState extends Rule {
             def test(r: R) = { ... }
             def act(r: R) = { ... }
           }
      ...
        override val rules = ArrayBuffer(
           Got_EC_goto_ESCState, 
           Got_EEC_goto_EECState,
          ...
        )
      ...
      }

      In the above, the nesting makes it clear each "Rule" which is a state-machine transition, originates at a particular state.

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Tasks