Ejemplo n.º 1
0
        public void Connect()
        {
            if (DefaultLength == -1)
            {
                if (Fields.Count != 0)
                {
                    DefaultLength = Fields.Select(f => f.Range.EndOffset).ToList().Max();
                }
                else
                {
                    DefaultLength = 0;
                }
            }

            if (Switch == null)
            {
                return;
            }

            foreach (var protocol in Switch.Cases.Select(tmp => ProtocolLibrary.GetProtocol(tmp.Protocol)).Where(protocol => protocol != null))
            {
                protocol.AddParent(this);
                Children.Add(protocol);

                protocol.Connect();

                Dependants.Add(protocol);
                Dependants.UnionWith(protocol.Dependants);
            }
        }
Ejemplo n.º 2
0
        public FilterRecord(FieldFilter filter)
        {
            Name        = filter.ID;
            Comparison  = filter.Comparison;
            LookupIndex = MemoryCoordinator.RegisterStaticInteger(filter.Value);
            RuleIndex   = filter.RuleIndex;
            SwitchValue = 0;

            var protocolSwitch = filter.Parent.Parent.Switch;

            if (protocolSwitch == null)
            {
                return;
            }

            //need to check for empty protocols, and give these a switch of 0
            if (protocolSwitch.Cases.Select(c => c.Filter).ToList().Contains(Name))
            {
                SwitchValue = ProtocolLibrary.GetProtocol(protocolSwitch.Cases.Find(switchCase => switchCase.Filter == Name).Protocol).Identifier;
            }
        }
Ejemplo n.º 3
0
        public AndTransaction(AndString input)
        {
            this.Transactions = new List <PredicateReadTransaction>();
            for (int index = 0; index < input.List.Count; index++)
            {
                var  atom   = input.List[index];
                bool invert = false;
                PredicateReadTransaction tmp;
                if (atom.AtomType == PredicateAtomType.Not)
                {
                    atom   = ((NotAtom)atom).Operand;
                    invert = true;
                }

                switch (atom.AtomType)
                {
                case PredicateAtomType.SubPredicate:
                    var pred = ((SubPredicateAtom)atom);
                    tmp = new PredicateReadTransaction(PredInLoc.BoolRuleMemory, pred.Predicate.WriteIndex, invert);
                    break;

                case PredicateAtomType.Protocol:
                    var proto = ProtocolLibrary.GetProtocol(((ProtocolAtom)atom).Protocol);
                    tmp = new PredicateReadTransaction(PredInLoc.BoolRuleMemory, proto.RuleIndex);
                    break;

                case PredicateAtomType.Filter:
                    var filter = ((FilterAtom)atom);
                    var f      = ProtocolLibrary.GetFieldFilter(filter.Protocol, filter.Field, filter.Filter);
                    tmp = new PredicateReadTransaction(PredInLoc.BoolRuleMemory, f.RuleIndex);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                Transactions.Add(tmp);
            }
        }