public override bool IsSameSpace(ValueSpace space) { if (space is BinarySpace) { BinarySpace bspace = (BinarySpace)space; if (bspace._paramTable.Count != _paramTable.Count) { return(false); } IEnumerator param = _paramTable.GetEnumerator(); while (param.MoveNext()) { DictionaryEntry entry = (DictionaryEntry)param.Current; if (!bspace._paramTable.ContainsKey(entry.Key) || bspace._paramTable[entry.Key] != entry.Value) { return(false); } } return(true); } return(false); }
public override bool IsSameSpace(ValueSpace space) { if (space is ListSelectionSpace) { ListSelectionSpace lspace = (ListSelectionSpace)space; if (lspace.ListName != this.ListName) { return(false); } if (lspace.Formula != null && this.Formula != null) { // FIXME: JWN: This code is incorrect. The dependency // formulas should be compared to see if they are the // same. Since comparing the formulas is a little tricky, // I'm going to leave this out. Hopefully this doesn't // create a bug. return(true); } else if (lspace.Formula == null && this.Formula == null) { return(true); } else { return(false); } // return true; } return(false); }
public override bool IsSameSpace(ValueSpace space) { if (space is FloatingPtSpace) { FloatingPtSpace fs = (FloatingPtSpace)space; if (fs.IsRanged() && this.IsRanged()) { if (!fs.GetMinimum().IsSameValue(this.GetMinimum())) { return(false); } if (!fs.GetMaximum().IsSameValue(this.GetMaximum())) { return(false); } } else { return(false); } return(true); } return(false); }
public override bool IsSameSpace(ValueSpace space) { if (space is StringSpace) { StringSpace sspace = (StringSpace)space; if (sspace._minCharacters != null && _minCharacters != null) { if (!sspace._minCharacters.IsSameValue(_minCharacters)) { return(false); } } else if (sspace._minCharacters != _minCharacters) { // return false if both aren't null return(false); } if (sspace._maxCharacters != null && _maxCharacters != null) { if (!sspace._maxCharacters.IsSameValue(_maxCharacters)) { return(false); } } else if (sspace._maxCharacters != _maxCharacters) { // return false if both aren't null return(false); } if (sspace._aveCharacters != null && _aveCharacters != null) { if (!sspace._aveCharacters.IsSameValue(_aveCharacters)) { return(false); } } else if (sspace._aveCharacters != _aveCharacters) { // return false if both aren't null return(false); } return(true); } return(false); }
public override bool IsSameSpace(ValueSpace space) { if (space is FixedPtSpace) { FixedPtSpace fs = (FixedPtSpace)space; if (fs.GetPointPosition() != this.GetPointPosition()) { return(false); } if (fs.IsRanged() && this.IsRanged()) { if (fs.IsIncremented() && this.IsIncremented()) { if (!fs.GetIncrement().IsSameValue(this.GetIncrement())) { return(false); } } else { return(false); } if (!fs.GetMinimum().IsSameValue(this.GetMinimum())) { return(false); } if (!fs.GetMaximum().IsSameValue(this.GetMaximum())) { return(false); } } else { return(false); } return(true); } return(false); }
public override bool IsSameSpace(ValueSpace space) { if (space is IntegerSpace) { IntegerSpace ispace = (IntegerSpace)space; if (ispace.IsRanged() && this.IsRanged()) { if (ispace.IsIncremented() && this.IsIncremented()) { if (!ispace.GetIncrement().IsSameValue(this.GetIncrement())) { return(false); } } else { return(false); } if (!ispace.GetMinimum().IsSameValue(this.GetMinimum())) { return(false); } if (!ispace.GetMaximum().IsSameValue(this.GetMaximum())) { return(false); } } else { return(false); } return(true); } return(false); }
public override bool IsSameSpace(ValueSpace space) { return(space is EnumeratedSpace && ((EnumeratedSpace)space).GetItemCount() == this._itemcount); }
public PUCValue(object value, ValueSpace space) { _valueSpace = space; this.Value = value; }
/* * Constructors */ /// <summary> /// Create a new PUCValue with an undefined value in the given space /// </summary> /// <param name="space">The space in which values of this PUCValue must exist</param> public PUCValue(ValueSpace space) { _valueSpace = space; }
/// <summary> /// Compares this ValueSpace to another in order to determine if /// the two spaces are identical. /// </summary> /// <param name="space">the space to compare to</param> /// <returns>whether the spaces are identical</returns> public abstract bool IsSameSpace(ValueSpace space);
public override bool IsSameSpace(ValueSpace space) { return(space is BooleanSpace); }
/* * Constructor */ public TimeDurationSmartCIO(GroupNode specSnippet) : base(new Panel(), specSnippet) { if (_specSnippet.IsObject()) { // single state translations /* * There are three possible translations if there is only one state. * If the state is read-only, then the time will be displayed in a label. * The state will be displayed as a TimeSlider if the state is editable, * numeric and bounded. Otherwise it will be displayed as a TimeEditor. */ ApplianceState state = (ApplianceState)_objects[SINGLE_STATE]; PUC.Types.ValueSpace space = state.Type.ValueSpace; if (space is PUC.Types.IntegerSpace) { _getString = new GetStringMethod(this.GetStringFromInt); } else if (space is PUC.Types.StringSpace) { _getString = new GetStringMethod(this.GetStringFromString); } else if (space is PUC.Types.FixedPtSpace || space is PUC.Types.FloatingPtSpace) { _getString = new GetStringMethod(this.GetStringFromFloat); } if (state.ReadOnly) { _timeControl = new Label(); if (space is PUC.Types.IntegerSpace) { _setTime = new SetControlTime(this.SetLabel); } else if (space is PUC.Types.StringSpace) { _setTime = new SetControlTime(this.SetLabel); } else { _setTime = new SetControlTime(this.SetLabel); } } else { if (space is PUC.Types.IntegerSpace) { IntegerSpace intspc = (IntegerSpace)space; if (intspc.IsRanged()) { _timeControl = new TimeSlider(); _setTime = new SetControlTime(this.SetSliderFromInt); ((TimeSlider)_timeControl).TimeChanged += new EventHandler(this.IntSliderTimeChanged); _sentValues = new Hashtable(); } else { _format = new TimeFormat[4]; _format[(int)TimeUnits.Hours] = new TimeFormat(true); _format[(int)TimeUnits.Minutes] = new TimeFormat(true); _format[(int)TimeUnits.Seconds] = new TimeFormat(true); _format[(int)TimeUnits.Fraction] = new TimeFormat(false); _timeControl = new TimeEditor(_format); _setTime = new SetControlTime(this.SetEditorFromInt); ((TimeEditor)_timeControl).TimeChanged += new EventHandler(this.IntTimeEditorChanged); } } else if (space is PUC.Types.FixedPtSpace) { FixedPtSpace fxdspc = (FixedPtSpace)space; if (fxdspc.IsRanged()) { _timeControl = new TimeSlider(); _setTime = new SetControlTime(this.SetSliderFromFixed); ((TimeSlider)_timeControl).TimeChanged += new EventHandler(this.FloatSliderTimeChanged); _sentValues = new Hashtable(); } else { _format = new TimeFormat[4]; _format[(int)TimeUnits.Hours] = new TimeFormat(true); _format[(int)TimeUnits.Minutes] = new TimeFormat(true); _format[(int)TimeUnits.Seconds] = new TimeFormat(true); _format[(int)TimeUnits.Fraction] = new TimeFormat(true); _format[(int)TimeUnits.Fraction].Maximum = ((int)Math.Pow(10, fxdspc.GetPointPosition())) - 1; _timeControl = new TimeEditor(_format); _setTime = new SetControlTime(this.SetEditorFromFloat); ((TimeEditor)_timeControl).TimeChanged += new EventHandler(this.FloatTimeEditorChanged); } } else if (space is PUC.Types.FloatingPtSpace) { FloatingPtSpace fltspc = (FloatingPtSpace)space; if (fltspc.IsRanged()) { _timeControl = new TimeSlider(); _setTime = new SetControlTime(this.SetSliderFromFloat); ((TimeSlider)_timeControl).TimeChanged += new EventHandler(this.FloatSliderTimeChanged); _sentValues = new Hashtable(); } else { _format = new TimeFormat[4]; _format[(int)TimeUnits.Hours] = new TimeFormat(true); _format[(int)TimeUnits.Minutes] = new TimeFormat(true); _format[(int)TimeUnits.Seconds] = new TimeFormat(true); _format[(int)TimeUnits.Fraction] = new TimeFormat(true); _format[(int)TimeUnits.Fraction].Maximum = 999; _timeControl = new TimeEditor(_format); _setTime = new SetControlTime(this.SetEditorFromFloat); ((TimeEditor)_timeControl).TimeChanged += new EventHandler(this.FloatTimeEditorChanged); } } else if (space is PUC.Types.StringSpace) { _format = new TimeFormat[4]; _format[(int)TimeUnits.Hours] = new TimeFormat(true); _format[(int)TimeUnits.Minutes] = new TimeFormat(true); _format[(int)TimeUnits.Seconds] = new TimeFormat(true); _format[(int)TimeUnits.Fraction] = new TimeFormat(true); _timeControl = new TimeEditor(); _setTime = new SetControlTime(this.SetEditorFromString); ((TimeEditor)_timeControl).TimeChanged += new EventHandler(this.StringTimeEditorChanged); } } if (_timeControl != null) { doNotRenderObject(state); state.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(this.ValueChanged); state.TypeChangedEvent += new PUC.ApplianceState.TypeChangedHandler(this.TypeChanged); state.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); } } else { // multiple state translation /* * There are two possible translations if there are multiple * states. If any states are read-only, then the time will be displayed * in a label. Otherwise the time will displayed for editing in the * PocketPCControls.TimeEditor control. */ ApplianceState hourState = (ApplianceState)_objects[HOURS_LABEL]; ApplianceState minState = (ApplianceState)_objects[MINUTES_LABEL]; ApplianceState secState = (ApplianceState)_objects[SECONDS_LABEL]; ApplianceState fracState = (ApplianceState)_objects[FRACTION_LABEL]; _getString = new GetStringMethod(this.GetStringFromMultiple); if ((hourState != null && hourState.ReadOnly) || (minState != null && minState.ReadOnly) || (secState != null && secState.ReadOnly) || (fracState != null && fracState.ReadOnly)) { _timeControl = new Label(); _setTime = new SetControlTime(this.SetLabel); } else { ApplianceState[] states = new ApplianceState[4]; _format = new TimeFormat[4]; IntegerSpace space; states[(int)TimeUnits.Hours] = hourState; states[(int)TimeUnits.Minutes] = minState; states[(int)TimeUnits.Seconds] = secState; states[(int)TimeUnits.Fraction] = fracState; for (int i = (int)TimeUnits.Hours; i <= (int)TimeUnits.Fraction; i++) { if (states[i] == null) { _format[i] = new TimeFormat(false); } else { _format[i] = new TimeFormat(true); doNotRenderObject(states[i]); space = (IntegerSpace)states[i].Type.ValueSpace; if (space.IsRanged()) { _format[i].Maximum = space.GetMaximum().GetIntValue(); _format[i].Minimum = space.GetMinimum().GetIntValue(); } else { _format[i].Maximum = Int32.MaxValue; _format[i].Minimum = 0; } if (space.IsIncremented()) { _format[i].Increment = space.GetIncrement().GetIntValue(); } } } _timeControl = new TimeEditor(_format); _setTime = new SetControlTime(this.SetEditorFromMultiple); ((TimeEditor)_timeControl).TimeChanged += new EventHandler(this.MultipleTimeEditorChanged); } if (_timeControl != null) { if (hourState != null) { hourState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(this.ValueChanged); hourState.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); } if (minState != null) { minState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(this.ValueChanged); minState.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); } if (secState != null) { secState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(this.ValueChanged); secState.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); } if (fracState != null) { fracState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(this.ValueChanged); fracState.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); } } } if (_timeControl != null) { GetControl().Controls.Add(_timeControl); _timeControl.Location = new System.Drawing.Point(0, 0); _timeControl.Size = GetControl().Size; _control.Resize += new EventHandler(this.Resized); } }