Exemple #1
0
        /// <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);
            }

            StateLayer other = obj as StateLayer;

            if (other == null)
            {
                return(false);
            }

            return(State.Equals(other.State) && Labels.Equals(other.Labels));
        }
Exemple #2
0
        /// <summary>
        /// Constructs the state layer from the preceding state layer and action layer.
        /// </summary>
        /// <param name="sLayer">State layer.</param>
        /// <param name="aLayer">Action layer.</param>
        public StateLayer(StateLayer sLayer, ActionLayer aLayer) : this(sLayer)
        {
            foreach (var actionNode in aLayer)
            {
                var appliedOperator = (Operator)actionNode.Operator;
                var operatorLabel   = actionNode.Label;

                foreach (var effect in appliedOperator.Effects)
                {
                    if (effect.IsApplicable(sLayer.State))
                    {
                        var assignment = effect.GetAssignment();
                        StoreLabel(assignment, operatorLabel);
                    }
                }

                State = (RelaxedState)appliedOperator.Apply(State);
            }
        }
Exemple #3
0
 /// <summary>
 /// Constructs the state layer from other state layer.
 /// </summary>
 /// <param name="other">Other state layer.</param>
 public StateLayer(StateLayer other)
 {
     State  = (RelaxedState)other.State.Clone();
     Labels = new StateLabels(other.Labels);
 }