Ejemplo n.º 1
0
 public DigitalDataPoint(DigitalDataPoint copyMe)
 {
     // parameter is a struct, so this is a copy operation
     this.parameter       = copyMe.parameter;
     this.digitalPulse    = copyMe.digitalPulse;
     this.DigitalContinue = copyMe.digitalContinue;
 }
Ejemplo n.º 2
0
        public void setPulse(Pulse pulse)
        {
            if (this.pulse == pulse)
                return; // if already set corrently, return immediately

            if (pulse != null)
            {
                this.pulse = pulse;

                this.startDelayTime.setParameterData(pulse.startDelay);
                this.endDelayTime.setParameterData(pulse.endDelay);
                this.pulseDuration.setParameterData(pulse.pulseDuration);

                this.startDelayEnabled.Checked = pulse.startDelayEnabled;
                this.endDelayEnabled.Checked = pulse.endDelayEnabled;

                this.startDelayed.Checked = pulse.startDelayed;
                this.endDelayed.Checked = pulse.endDelayed;

                this.pulseValue.Checked = pulse.PulseValue;

                this.pulseNameTextBox.Text = pulse.PulseName;
                this.pulseDescriptionTextBox.Text = pulse.PulseDescription;

                this.startCondition.SelectedItem = pulse.startCondition;
                this.endCondition.SelectedItem = pulse.endCondition;

                this.getValueFromVariableCheckBox.Checked = pulse.ValueFromVariable;

            }

            updateElements();
        }
 public DigitalDataPoint(DigitalDataPoint copyMe)
 {
     // parameter is a struct, so this is a copy operation
     this.parameter = copyMe.parameter;
     this.digitalPulse = copyMe.digitalPulse;
     this.DigitalContinue = copyMe.digitalContinue;
 }
Ejemplo n.º 4
0
 public Pulse(Pulse copyMe)
 {
     this.endCondition = copyMe.endCondition;
     this.endDelay = new DimensionedParameter(copyMe.endDelay);
     this.endDelayed = copyMe.endDelayed;
     this.endDelayEnabled = copyMe.endDelayEnabled;
     this.pulseDescription = copyMe.pulseDescription;
     this.pulseDuration = new DimensionedParameter(copyMe.pulseDuration);
     this.pulseName = "Copy of " + copyMe.pulseName;
     this.pulseValue = copyMe.pulseValue;
     this.startCondition = copyMe.startCondition;
     this.startDelay = new DimensionedParameter(copyMe.startDelay);
     this.startDelayed = copyMe.startDelayed;
     this.startDelayEnabled = copyMe.startDelayEnabled;
 }
Ejemplo n.º 5
0
 public Pulse(Pulse copyMe)
 {
     this.endCondition      = copyMe.endCondition;
     this.endDelay          = new DimensionedParameter(copyMe.endDelay);
     this.endDelayed        = copyMe.endDelayed;
     this.endDelayEnabled   = copyMe.endDelayEnabled;
     this.pulseDescription  = copyMe.pulseDescription;
     this.pulseDuration     = new DimensionedParameter(copyMe.pulseDuration);
     this.pulseName         = "Copy of " + copyMe.pulseName;
     this.pulseValue        = copyMe.pulseValue;
     this.startCondition    = copyMe.startCondition;
     this.startDelay        = new DimensionedParameter(copyMe.startDelay);
     this.startDelayed      = copyMe.startDelayed;
     this.startDelayEnabled = copyMe.startDelayEnabled;
     this.autoName          = copyMe.autoName;
 }
        private static bool ComparePulses(string preString, Pulse a, Pulse b, List <SequenceDifference> ans)
        {
            bool diffs = false;

            diffs |= CompareGenericStructsAsStrings <Pulse.PulseTimingCondition>(preString + "end condition ", a.endCondition, b.endCondition, ans);
            diffs |= CompareParameters(preString + "end delay ", a.endDelay, b.endDelay, ans);
            diffs |= CompareBools(preString + "end delayed/advanced ", a.endDelayed, b.endDelayed, ans);
            diffs |= CompareBools(preString + "end delay enabled/disabled ", a.endDelayEnabled, b.endDelayEnabled, ans);

            diffs |= CompareStrings(preString + "pulse name ", a.PulseName, b.PulseName, ans);
            diffs |= CompareBools(preString + "pulse value ", a.PulseValue, b.PulseValue, ans);

            diffs |= CompareGenericStructsAsStrings <Pulse.PulseTimingCondition>(preString + "start condition ", a.startCondition, b.startCondition, ans);
            diffs |= CompareParameters(preString + "start delay ", a.startDelay, b.startDelay, ans);
            diffs |= CompareBools(preString + "start delayed/advanced ", a.startDelayed, b.startDelayed, ans);
            diffs |= CompareBools(preString + "start delay enabled/disabled ", a.startDelayEnabled, b.startDelayEnabled, ans);

            diffs |= CompareBools(preString + "value from variable/manual ", a.ValueFromVariable, b.ValueFromVariable, ans);
            if (a.ValueVariable != null && b.ValueVariable != null)
            {
                diffs |= CompareStrings(preString + "name of value variable ", a.ValueVariable.VariableName, b.ValueVariable.VariableName, ans);
            }
            return(diffs);
        }
        /// <summary>
        /// Replaces all occurences of pulse replaceMe with withMe, and then removes replaceMe
        /// from Pulses list.
        /// </summary>
        /// <param name="replaceMe"></param>
        /// <param name="withMe"></param>
        public void replacePulse(Pulse replaceMe, Pulse withMe)
        {
            foreach (TimeStep step in TimeSteps)
            {
                foreach (DigitalDataPoint dp in step.DigitalData.Values)
                {
                    if (dp.usesPulse())
                    {
                        if (dp.DigitalPulse == replaceMe)
                        {
                            dp.DigitalPulse = withMe;
                        }
                    }
                }
            }

            if (DigitalPulses.Contains(replaceMe))
            {
                DigitalPulses.Remove(replaceMe);
            }
        }
Ejemplo n.º 8
0
 private PulseEditor createAndRegisterPulseEditor(Pulse pulse)
 {
     PulseEditor pe = new PulseEditor(pulse);
     pulseEditors.Add(pe);
     pe.pulseDeleted += new EventHandler(pe_pulseDeleted);
     return pe;
 }
Ejemplo n.º 9
0
 public PulseEditor(Pulse pulse)
     : this()
 {
     setPulse(pulse);
 }
Ejemplo n.º 10
0
 private void duplicateButton_Click(object sender, EventArgs e)
 {
     Pulse newPulse = new Pulse(pulse);
     int currentIndex = Storage.sequenceData.DigitalPulses.IndexOf(pulse);
     Storage.sequenceData.DigitalPulses.Insert(currentIndex + 1, newPulse);
     WordGenerator.mainClientForm.instance.RefreshSequenceDataToUI(Storage.sequenceData);
 }
Ejemplo n.º 11
0
        public static bool Equivalent(Pulse a, Pulse b)
        {
            if (a.endCondition != b.endCondition)
                return false;
            if (!DimensionedParameter.Equivalent(a.endDelay, b.endDelay))
                return false;
            if (a.endDelayed != b.endDelayed)
                return false;
            if (a.endDelayEnabled != b.endDelayEnabled)
                return false;
            if (a.PulseDescription != b.PulseDescription)
                return false;
            if (!DimensionedParameter.Equivalent(a.pulseDuration, b.pulseDuration))
                return false;
            if (a.PulseName != b.PulseName)
                return false;
            if (a.PulseValue != b.PulseValue)
                return false;
            if (a.startCondition != b.startCondition)
                return false;
            if (!DimensionedParameter.Equivalent(a.startDelay ,b.startDelay))
                return false;
            if (a.startDelayed != b.startDelayed)
                return false;
            if (a.startDelayEnabled != b.startDelayEnabled)
                return false;
            if (a.ValueFromVariable != b.ValueFromVariable)
                return false;
            if (a.ValueVariable != b.ValueVariable)
                return false;

            return true;
        }
Ejemplo n.º 12
0
        public static bool Equivalent(Pulse a, Pulse b)
        {
            if (a.endCondition != b.endCondition)
            {
                return(false);
            }
            if (!DimensionedParameter.Equivalent(a.endDelay, b.endDelay))
            {
                return(false);
            }
            if (a.endDelayed != b.endDelayed)
            {
                return(false);
            }
            if (a.endDelayEnabled != b.endDelayEnabled)
            {
                return(false);
            }
            if (a.PulseDescription != b.PulseDescription)
            {
                return(false);
            }
            if (!DimensionedParameter.Equivalent(a.pulseDuration, b.pulseDuration))
            {
                return(false);
            }
            if (a.PulseName != b.PulseName)
            {
                return(false);
            }
            if (a.PulseValue != b.PulseValue)
            {
                return(false);
            }
            if (a.startCondition != b.startCondition)
            {
                return(false);
            }
            if (!DimensionedParameter.Equivalent(a.startDelay, b.startDelay))
            {
                return(false);
            }
            if (a.startDelayed != b.startDelayed)
            {
                return(false);
            }
            if (a.startDelayEnabled != b.startDelayEnabled)
            {
                return(false);
            }
            if (a.ValueFromVariable != b.ValueFromVariable)
            {
                return(false);
            }
            if (a.ValueVariable != b.ValueVariable)
            {
                return(false);
            }

            return(true);
        }