示例#1
0
 public Builder(RegressiveState original = default(RegressiveState))
 {
     if (original.ranges == null)                    // Check for default instance
     {
         this.ranges = new Dictionary <SymbolId, ValueRange>();
     }
     else
     {
         this.ranges = new Dictionary <SymbolId, ValueRange>(original.ranges);
     }
 }
示例#2
0
        public RegressiveState Populate(Goal goal, RegressiveState initialState = default(RegressiveState))
        {
            var builder = initialState.BuildUpon();

            foreach (var precondition in goal.Preconditions)
            {
                // IntersectRange() has the effect of merging preconditions on the same symbol
                builder.IntersectRange(precondition.SymbolId, precondition.AsValueRange);
            }
            return(builder.Build());
        }
示例#3
0
 public static RegressiveNode MakeRegular(
     RegressiveState currentConstraints,
     WorldState initialState,
     INodeExpander <RegressiveNode> nodeExpander
     )
 {
     return(new RegressiveNode(
                currentConstraints,
                //default(WorldState),
                initialState,
                PreconditionUtils.EnsureNotNull(nodeExpander, "nodeExpander"),
                false
                ));
 }
示例#4
0
        private RegressiveNode(
            RegressiveState currentConstraints,
            WorldState initialState,
            INodeExpander <RegressiveNode> nodeExpander,
            bool isTarget
            )
        {
            DebugUtils.Assert(
                isTarget || nodeExpander != null,
                "Unless isTarget is true, nodeExpander must not be null"
                );

            this.currentConstraints = currentConstraints;
            this.initialState       = initialState;
            this.nodeExpander       = nodeExpander;
            this.IsTarget           = isTarget;
        }