...
Suggestion: rename IPersistentState into IState and make it to be byte[]-convertible, the following interface demonstrate the idea:
Code Block | ||||
---|---|---|---|---|
| ||||
interface IState: IIdentifiable, IDescribable { } interface IByteStateConverter { IStateIIdentifiable ConvertFromByteArray(byte[] array); byte[] ConvertToByteArray(IStateIIdentifiable statestateId); } public interface IManageState { /// <summary> /// Store the linkable component's current State /// </summary> /// <returns>Object that identifies the stored state.</returns> IStateIIdentifiable KeepCurrentState(); /// <summary> /// Restores the state identified by the parameter stateID. If the state identifier identified by /// stateID is not known by the linkable component an exception should be trown. /// </summary> /// <param name="stateID">Object that identifies the state to be restored.</param> void RestoreState(IStateIIdentifiable statestateId); /// <summary> /// Clears a state from the linkable component's memory. If the state identifier identified by /// stateID is not known by the linkable component an exception should be trown. /// </summary> /// <param name="stateID">Object that identifies the state to be cleared.</param> void ClearState(IState state); /// <summary> /// All available states created using KeepCurrentState() /// </summary> IEnumerable<IState> AvailableStates { get; }IIdentifiable stateId); } |
Suggestion for IState and IManageState refactoring in Java version:
...