Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Jira
serverONAP Jira
serverId425b2b0a-557c-3c0c-b515-579789cceedb
keyCPS-875

State Machine

State Machines are a model used in computing to define the current state of the system, and the possible next state which it may transition to.

...

Code Block
languagejava
titleState Machine Transition
linenumberstrue
public enum CmHandleState {

    Advised {
        @Override
        public CmHandleState nextState() {
            return Locked;
        }

        @Override
        public String cmHandleState() {
            return "ADVISED";
        }
    },
    Locked {
        @Override
        public CmHandleState nextState() {
            return Ready;
        }

        @Override
        public String cmHandleState() {
            return "LOCKED";
        }
    },
    Ready {
        @Override
        public CmHandleState nextState() {
            return this;
        }

        @Override
        public String cmHandleState() {
            return "LOCKEDREADY";
        }
    };

    public abstract CmHandleState nextState();
    public abstract String cmHandleState();

...