Beispiel #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));
        }
Beispiel #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 = actionNode.Operator;
                var operatorLabel   = actionNode.Label;

                var newState = (IState)appliedOperator.Apply(State);

                foreach (var atom in newState.GetPredicates())
                {
                    if (sLayer.State.HasPredicate(atom))
                    {
                        // this atom is not a result of the operator application -> ignore
                        continue;
                    }

                    StoreLabel(atom, operatorLabel);
                    State.AddPredicate(atom);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Constructs the state layer from other state layer.
 /// </summary>
 /// <param name="other">Other state layer.</param>
 public StateLayer(StateLayer other)
 {
     State  = (IState)other.State.Clone();
     Labels = new StateLabels(other.Labels);
 }