/// <summary> /// Retuns a new simple state where the control mode has been replaced with the new one /// </summary> public SimpleState ReplaceControlMode(Term newControlMode) { SimpleState newState = new SimpleState(newControlMode, this.locationValues, this.domainMap, this.modelName, this.locationNames); return(newState); // this is due a weird error occurring sometimes // that fetches a state with different contents // from the cache and returns it. // This is a quick fix and the issue needs to be investigated further. //return cache.Get(newState); }
/// <summary> /// Creates a state. /// </summary> /// <param name="controlMode">The control state of the machine</param> /// <param name="fieldValues">The values of each data field. This array is captured; the method /// assumes that the array passed as an argument will never be modified.</param> /// <param name="domainMap">A mapping of domain names to integers that represent the next available id.</param> /// <param name="modelName">name of the model</param> /// <param name="locationNames">names of locations</param> /// <returns>A state with the given control mode, field values and domain map.</returns> public static SimpleState CreateState(Term controlMode, Term[] fieldValues, Map <Symbol, int> domainMap, string modelName, ValueArray <string> locationNames ) { SimpleState newState = new SimpleState(controlMode, fieldValues, domainMap, modelName, locationNames); return(cache.Get(newState)); }