コード例 #1
0
        public Architecture InstantiateToPort(Port port)
        {
            if (IntegerValueCategory.IsIntegerValueMember(port))
            {
                return(new GenericArchitecture(EntityId.DerivePrefix("Integer"), EntityId, false, port, IntegerValueCategory.IsIntegerValueMember, 0, new Process[] { new IntegerValue.AddProcess(0, port.InputSignalCount - 1, 0) }));
            }

            if (RationalValueCategory.IsRationalValueMember(port))
            {
                return(new GenericArchitecture(EntityId.DerivePrefix("Rational"), EntityId, false, port, RationalValueCategory.IsRationalValueMember, 0, new Process[] { new RationalValue.AddProcess(0, port.InputSignalCount - 1, 0) }));
            }

            if (RealValueCategory.IsRealValueMember(port))
            {
                return(new GenericArchitecture(EntityId.DerivePrefix("Real"), EntityId, false, port, RealValueCategory.IsRealValueMember, 0, new Process[] { new RealValue.AddProcess(0, port.InputSignalCount - 1, 0) }));
            }

            if (ComplexValueCategory.IsComplexValueMember(port))
            {
                return(new GenericArchitecture(EntityId.DerivePrefix("Complex"), EntityId, false, port, RealValueCategory.IsRealValueMember, 0, new Process[] { new GenericStdFunctionProcess <ComplexValue>(delegate() { return ComplexValue.Zero; }, ComplexValue.ConvertFrom, ComplexValue.Add, port.InputSignalCount) }));
            }

            if (IsVector(port))
            {
                return(new GenericArchitecture(EntityId.DerivePrefix("Vector"), EntityId, false, port, IsVector, 0, new Process[] { })); //DUMMY
            }
            throw new MathNet.Symbolics.Backend.Exceptions.ArchitectureNotAvailableException(port);
        }
コード例 #2
0
        public bool SupportsPort(Port port)
        {
            if (port == null || !port.Entity.EqualsById(_entityId))
            {
                return(false);
            }

            if (IntegerValueCategory.IsIntegerValueMember(port))
            {
                return(true);
            }

            if (RationalValueCategory.IsRationalValueMember(port))
            {
                return(true);
            }

            if (RealValueCategory.IsRealValueMember(port))
            {
                return(true);
            }

            if (ComplexValueCategory.IsComplexValueMember(port))
            {
                return(true);
            }

            if (IsVector(port)) //DUMMY
            {
                return(true);
            }

            return(false);
        }