Changeset 740 for trunk/CrypPlugins/Gate


Ignore:
Timestamp:
Oct 17, 2009, 10:34:26 PM (12 years ago)
Author:
Matthäus Wander
Message:

CrypWin:

  • changed string Beta 01 -> 02
  • TextBoxHidden now loads its value when loading a project file
  • see #98 for an open issue

BigInteger/BigNumber:

  • added sanity checks for == operator and Equals()
  • setting input properties to null in PreExecution (addresses #90)

Tokenizer:

  • added \t as word delimiter (fixes problem with Enigma-Challenge_II)

Enigma:

  • added null reference sanity check

WordPatterns:

  • improved PostBuild events

ExamplePluginCT2:

  • added example plugin which serves as plugin template
  • the template is located in Documentation/Template/
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/Gate/Gate.cs

    r658 r740  
    2727using System.Threading;
    2828using System.Diagnostics;
     29using System.Runtime.Remoting.Contexts;
    2930
    3031namespace Gate
     
    3233    [Author("Matthäus Wander", "wander@cryptool.org", "Universität Duisburg-Essen, Fachgebiet Verteilte Systeme", "http://www.vs.uni-due.de")]
    3334    [PluginInfo(false, "Gate", "Control operator", "", "Gate/gate_closed_32.png", "Gate/gate_open_32.png")]
     35    [Synchronization]
    3436    public class Gate : IThroughput
    3537    {
     
    4042        private bool control = false;
    4143
    42         private bool locked = false;
     44        private bool freshInput = false;
     45        private bool freshControl = false;
     46
     47        private Object inputMonitor = new Object();
     48        private Object controlMonitor = new Object();
    4349
    4450        [PropertyInfo(Direction.InputData, "Input", "Input object of any type", null, true, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
     
    5258            {
    5359                input = value;
     60                freshInput = true;
    5461                OnPropertyChanged("InputObject");
    5562            }
     
    6673            {
    6774                oldControl = control;
    68                 locked = false;
    69 
    7075                control = value;
     76                freshControl = true;
    7177                OnPropertyChanged("Control");
    7278            }
     
    114120        public void PreExecution()
    115121        {
     122            input = null;
     123            output = null;
     124            oldControl = false;
     125            control = false;
    116126        }
    117127
     
    121131            {
    122132                output = input;
    123                 locked = true;
     133                freshControl = false;
     134                freshInput = false;
    124135                ProgressChanged(1, 1);
    125136                OnPropertyChanged("OutputObject");
     
    145156                    return false;
    146157                case Trigger.TrueValue:
    147                     return !locked && control;
     158                    return freshInput && freshControl && control;
    148159                case Trigger.FalseValue:
    149                     return !locked && !control;
     160                    return freshInput && freshControl && !control;
    150161                case Trigger.AnyEdge:
    151                     return !locked && control != oldControl;
     162                    return freshInput && freshControl && control != oldControl;
    152163                case Trigger.PositiveEdge:
    153                     return !locked && !oldControl && control;
     164                    return freshInput && freshControl && !oldControl && control;
    154165                case Trigger.NegativeEdge:
    155                     return !locked && oldControl && !control;
     166                    return freshInput && freshControl && oldControl && !control;
    156167                default:
    157168                    return false;
Note: See TracChangeset for help on using the changeset viewer.