/// <summary> /// Checks the equality of objects. /// </summary> /// <param name="obj">Object to be checked.</param> /// <returns>True if the objects are equal, false otherwise.</returns> public override bool Equals(object obj) { if (obj == this) { return(true); } RelativeState other = obj as RelativeState; if (other == null) { return(false); } return(CollectionsEquality.Equals(Values, other.Values)); }
/// <summary> /// Gets the corresponding SAS+ relative state meeting specified conditions. Lazy generated via yield return. /// </summary> /// <param name="conditions">Reference conditions.</param> /// <param name="variables">Variables of the planning problem.</param> /// <returns>Corresponding SAS+ relative state meeting the conditions.</returns> private static IRelativeState GetCorrespondingRelativeState(ISimpleConditions conditions, Variables variables) { int[] initWildCards = new int[variables.Count]; for (int i = 0; i < variables.Count; ++i) { initWildCards[i] = -1; } IRelativeState newRelativeState = new RelativeState(initWildCards); foreach (var constraint in conditions) { newRelativeState.SetValue(constraint); } return(newRelativeState); }