예제 #1
0
        /// <summary>
        /// This method helps in the cloning process by allowing each
        /// class in the hierarchy to clone their own member variables.
        /// The class being cloned will create a new instance of itself,
        /// and then call the cloneHelper in its super-class to get any
        /// member variables of its super classes to be copied.
        /// </summary>
        /// <param name="g">the instance of the cloned object</param>
        protected void cloneHelper(ObjectGroupNode g)
        {
            base.cloneHelper(g);

            // deep copy the object
            g._object = (ApplianceObject)_object.Clone();
        }
예제 #2
0
        public void CreateExtraStates(Appliance appliance, VariableTable varTable)
        {
            _unionState      = new ApplianceState(appliance, UNION_STATE, _readonly);
            _unionState.Type = new PUCType(new StringSpace());
            GroupNode newG = new ObjectGroupNode(_unionState);

            newG.Parent = this;
            this.Children.Add(newG);
            varTable.RegisterObject(_unionState.FullName, _unionState);
        }
예제 #3
0
        /*
         * Member Methods
         */

        public override object Clone()
        {
            // instantiate cloned object
            ObjectGroupNode obj = new ObjectGroupNode();

            // call the cloneHelper
            cloneHelper(obj);

            // return object
            return(obj);
        }
예제 #4
0
        public void CreateExtraStates(VariableTable varTable, IBranchDataWindow window)
        {
            // Add Length State
            _listLengthState = new ApplianceState(_appliance, LIST_LENGTH_STATE, true);

            PUC.Types.IntegerSpace intSpace;
            if (_itemCount != null)
            {
                intSpace = new PUC.Types.IntegerSpace(_itemCount, _itemCount);
                if (_itemCount is IConstraint)
                {
                    new TypeConstraintListener(_listLengthState, (IConstraint)_itemCount);
                }
            }
            else if (_minimum == null && _maximum == null)
            {
                intSpace = new PUC.Types.IntegerSpace(new IntNumber(0), new IntNumber(Int32.MaxValue));
            }
            else if (_minimum != null && _maximum != null)
            {
                intSpace = new PUC.Types.IntegerSpace(_minimum, _maximum);

                if (_minimum is IConstraint)
                {
                    new TypeConstraintListener(_listLengthState, (IConstraint)_minimum);
                }
                if (_maximum is IConstraint)
                {
                    new TypeConstraintListener(_listLengthState, (IConstraint)_maximum);
                }
            }
            else if (_minimum != null)
            {
                intSpace = new IntegerSpace(_minimum, new IntNumber(Int32.MaxValue));

                if (_minimum is IConstraint)
                {
                    new TypeConstraintListener(_listLengthState, (IConstraint)_minimum);
                }
            }
            else
            {
                intSpace = new IntegerSpace(new IntNumber(0), _maximum);

                if (_maximum is IConstraint)
                {
                    new TypeConstraintListener(_listLengthState, (IConstraint)_maximum);
                }
            }

            _listLengthState.Type = new PUCType(intSpace);

            GroupNode newG = new ObjectGroupNode(_listLengthState);

            newG.Parent = this;
            this.Children.Add(newG);
            varTable.RegisterObject(_listLengthState.MakeFullName(this.FullPath), _listLengthState);
            window.AddChildWindow(_listLengthState);
            newG.Parent = null;             // remove from group so it doesn't get in the way later
            this.Children.Remove(newG);

            // Add Selection States
            _listSelectionState      = new ApplianceState(_appliance, LIST_SELECTION_STATE, _selectionReadOnly);
            _listSelectionState.Type = new PUCType(new IntegerSpace(new IntNumber(0), new NumberConstraint(_listSelectionState, _listLengthState)));

            if (_selectionType == SelectionType.One)
            {
                // one selection
                newG        = new ObjectGroupNode(_listSelectionState);
                newG.Parent = this;
                this.Children.Add(newG);
                _listSelectionState.FullName = _listSelectionState.MakeFullName(this.FullPath);
                _listSelectionState.SetNetworkHandler();
                window.AddChildWindow(_listSelectionState);
                newG.Parent = null;                 // remove from group so it doesn't get in the way later
                this.Children.Remove(newG);
            }
            else
            {
                // multiple selections
                BranchGroupNode selGroup = new BranchGroupNode();

                _listSelectionLengthState      = new ApplianceState(_appliance, LIST_LENGTH_STATE, false);
                _listSelectionLengthState.Type = new PUCType(new IntegerSpace(new IntNumber(0), new NumberConstraint(_listSelectionState, _listLengthState)));

                this.Children.Add(selGroup);
                selGroup.Name = LIST_SELECTION_STATE;
                newG          = new ObjectGroupNode(_listSelectionLengthState);
                newG.Parent   = selGroup;
                selGroup.Children.Add(newG);
                newG        = new ObjectGroupNode(_listSelectionState);
                newG.Parent = selGroup;
                selGroup.Children.Add(newG);

                varTable.RegisterObject(_listSelectionLengthState.MakeFullName(selGroup.FullPath), _listSelectionLengthState);
                _listSelectionState.FullName = _listSelectionState.MakeFullName(selGroup.FullPath);
                window.AddChildWindow(_listSelectionLengthState);
                window.AddChildWindow(_listSelectionState);

                this.Children.Remove(selGroup);
            }

            varTable.RegisterObject(_listSelectionState.FullName, _listSelectionState);
        }