Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

The final version for now is:

Code Block
java
java

interface IByteStateConverter
{
	IIdentifiable ConvertFromByteArray(byte[] array);
	byte[] ConvertToByteArray(IIdentifiable stateId);
}

public interface IManageState
	{
		/// <summary>
		/// Store the linkable component's current State
		/// </summary>
		/// <returns>Object that identifies the stored state.</returns>
		ObjectIIdentifiable 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 exceptionInvalidOperationException should be trown.
		/// </summary>
		/// <param name="stateID">Object that identifies the state to be restored.</param>
		void RestoreState(ObjectIIdentifiable stateIDstateId);

		/// <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(ObjectIIdentifiable stateIDstateId);
	}

	interface IPersistentState
	{
		/// <summary>
		/// Transform the state of a component instance into an array of bytes
		/// </summary>
		/// <param name="state">The state to be turned into a byte array</param>
		/// <returns></returns>
		byte[] makePersistent(object state);

		/// <summary>
		/// Read the state of a component instance from an array of bytes
		/// </summary>
		/// <param name="persistentState">Byte array containing the state</param>
		/// <returns></returns>
		object readPersistentState(byte[] persistentState);
	}

Suggestion for IState and IManageState refactoring in Java version:

Code Block
java
java

public interface IByteStateConverter {
	IIdentifiable convertFromByteArray(byte[] array);
	byte[] convertToByteArray(IIdentifiable stateId);
}

public interface IManageState {
	public IIdentifiable keepCurrentState();
	public void restoreState(IState state);
	public void clearState(IState state);
}

Previous versionSuggestion: rename IPersistentState into IState and make it to be byte[]-convertible, the following interface demonstrate the idea:

Code Block
java
java

	interface IState
	{
	/// <summary>
	/// Transform the state instance into an array of bytes
	/// </summary>
	/// <param name="state">The state to be turned into a byte array</param>
	/// <returns></returns>
	byte[] ToByteArray();
	}

	public interface IManageState
	{
		/// <summary>
		/// Store the linkable component's current State
		/// </summary>
		/// <returns>Object that identifies the stored state.</returns>
		IStateObject KeepCurrentState();

		/// <summary>
		/// Creates an instance of the state using array of bytes 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>
		IStatevoid CreateStateFromByteArrayRestoreState(byte[]Object statestateID);

		/// <summary>
		/// RestoresClears thea state identifiedfrom bythe thelinkable parametercomponent's stateIDmemory. 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 restoredcleared.</param>
		void RestoreStateClearState(IStateObject statestateID);
	}

	interface IPersistentState
	{
		/// <summary>
		/// ClearsTransform athe state fromof thea linkable component's memory.instance If the state identifier identified by
		/// stateID is not known by the linkable component an exception should be trown.into an array of bytes
		/// </summary>
		/// <param name="stateIDstate">Object>The state thatto identifiesbe theturned stateinto toa bebyte cleared.<array</param>
		void ClearState(IState/// <returns></returns>
		byte[] makePersistent(object state);
		
		/// <summary>
		/// All available states created using KeepCurrentState() Read the state of a component instance from an array of bytes
		/// </summary>
		/// <param name="persistentState">Byte array containing the state</param>
		IEnumerable<IState> AvailableStates { get; }/// <returns></returns>
		object readPersistentState(byte[] persistentState);
	}