Beispiel #1
0
 public PortAssigned(NodeIdentifier nodeId, PortDirection port, LinkIdentifier linkId, ConnectionDirection direction)
 {
     NodeId    = nodeId ?? throw new System.ArgumentNullException(nameof(nodeId));
     Port      = port;
     LinkId    = linkId ?? throw new System.ArgumentNullException(nameof(linkId));
     Direction = direction;
 }
Beispiel #2
0
 public PortDescription(NodeEditor owner, string memberName, string displayName, PortDirection portDirection)
 {
     Owner          = owner;
     _memberName    = memberName;
     _displayName   = displayName;
     _portDirection = portDirection;
 }
Beispiel #3
0
 public Port(string name, PortDirection portDirection, PortType portType, float initialValue = 0f)
 {
     Name = name;
     Direction = portDirection;
     Type = portType;
     Value = initialValue;
 }
        public void RemovePort(PortOrientation orientation, PortDirection direction)
        {
            if (orientation == PortOrientation.Horizontal)
            {
                if (direction == PortDirection.Input)
                {
                    m_InputCount--;
                }
                else
                {
                    m_OutputCount--;
                }
            }
            else
            {
                if (direction == PortDirection.Input)
                {
                    m_VerticalInputCount--;
                }
                else
                {
                    m_VerticalOutputCount--;
                }
            }

            DefineNode();
        }
Beispiel #5
0
        /* Initialize port's properties from loaded template */
        public void InitializeFromTemplate(Node parent, PortDirection direction, api.PortTemplate template)
        {
            ParentNode = parent;
            Direction  = direction;

            // Note: This Id should be obtained from backend on save
            Id   = Guid.NewGuid().ToString();
            name = Id;

            Name = template.name;

            // Few steps to set Type
            var type = Utils.DataTypeFromString(template.kind);

            Type            = type;
            iconField.color = Utils.GetDataTypeColor(type);

            if (valueField && null == template.defaultValue)
            {
                valueField.enabled = false;
            }
            else if (valueField)
            {
                valueField.enabled = true;
                Value = template.defaultValue;
            }
        }
Beispiel #6
0
 public NodePort this[PortDirection direction]
 {
     get
     {
         return(_ports[(int)direction]);
     }
 }
Beispiel #7
0
 public LinkNodes(NodeIdentifier source, PortDirection sourcePort, NodeIdentifier sink, PortDirection sinkPort, LinkAttributes attributes)
 {
     Source     = source ?? throw new System.ArgumentNullException(nameof(source));
     SourcePort = sourcePort;
     Sink       = sink ?? throw new System.ArgumentNullException(nameof(sink));
     SinkPort   = sinkPort;
     Attributes = attributes;
 }
Beispiel #8
0
 public void Reload(NodePort port)
 {
     fieldName      = port.fieldName;
     direction      = port.direction;
     capacity       = port.capacity;
     typeConstraint = port.typeConstraint;
     DataType       = port.DataType;
 }
 public NodePort(NodePort _port)
 {
     fieldName         = _port.fieldName;
     direction         = _port.direction;
     multiple          = _port.multiple;
     typeConstraint    = _port.typeConstraint;
     typeQualifiedName = _port.typeQualifiedName;
 }
 public void Reload(NodePort port)
 {
     fieldName         = port.fieldName;
     direction         = port.direction;
     multiple          = port.multiple;
     typeConstraint    = port.typeConstraint;
     typeQualifiedName = port.typeQualifiedName;
 }
Beispiel #11
0
        /// <summary>
        /// Creates a new <see cref="VerticalPortContainerPart"/>.
        /// </summary>
        /// <param name="name">The name of the part to create.</param>
        /// <param name="portDirection">The direction of the ports the container will hold.</param>
        /// <param name="model">The model which the part represents.</param>
        /// <param name="ownerUI">The owner of the part to create.</param>
        /// <param name="parentClassName">The class name of the parent UI.</param>
        /// <returns>A new instance of <see cref="VerticalPortContainerPart"/>.</returns>
        public static VerticalPortContainerPart Create(string name, PortDirection portDirection, IGraphElementModel model, IModelUI ownerUI, string parentClassName)
        {
            if (model is IPortNodeModel)
            {
                return(new VerticalPortContainerPart(name, portDirection, model, ownerUI, parentClassName));
            }

            return(null);
        }
Beispiel #12
0
 public NodePort(NodePort port, NodeData node)
 {
     fieldName      = port.fieldName;
     direction      = port.direction;
     capacity       = port.capacity;
     typeConstraint = port.typeConstraint;
     DataType       = port.DataType;
     this.node      = node;
 }
 public Port(FlowNode node, string fieldName, Type fieldType, PortCapacity capacity, PortDirection direction)
 {
     m_Connections        = new List <Edge>();
     this.node            = node;
     this.fieldName       = fieldName;
     this.capacity        = capacity;
     this.direction       = direction;
     this.m_FieldTypeName = fieldType.FullName;
 }
Beispiel #14
0
 public PortData(string nodeDataId, string fieldName, Type type, Type overrideConnectionType,
                 PortDirection direction)
 {
     _portId = Guid.NewGuid().ToString();
     _overrideConnectionTypeName = overrideConnectionType != null ? overrideConnectionType.FullName : null;
     _nodeDataId = nodeDataId;
     _fieldName  = fieldName;
     _typeName   = type.Name;
     _direction  = direction;
 }
Beispiel #15
0
        public My_Port(Schematix.FSM.Constructor_Core core, PortDirection Direction) :
            base(core)
        {
            Color          = Color.Aqua;
            this.Direction = Direction;
            this.Port_Type = PortType.Registered;

            base.name            = ("Port" + core.Graph.Ports.Count.ToString());
            base.label_name.Text = name;
        }
Beispiel #16
0
        /***************************************************************************/

        public PortElement(
            PortDirection _portKind
            , string _name
            , int _id
            , ILibraryElementType _type
            )
            : base(_id, _type, 0)
        {
            m_port   = new Port(_name);
            PortKind = _portKind;
        }
Beispiel #17
0
    public void Display(PacketType packetType, PortDirection direction)
    {
        switch (packetType)
        {
        case PacketType.Red: RedInputDetector.UpdateDirectionToFace(direction); break;

        case PacketType.Green: GreenInputDetector.UpdateDirectionToFace(direction); break;

        case PacketType.Blue: BlueInputDetector.UpdateDirectionToFace(direction); break;
        }
    }
Beispiel #18
0
        public void CreateNode_Should_Create_Port(string id, Type type, PortDirection direction, PortCapacity capacity)
        {
            var nodeType = new NodeWithPorts();
            var node     = nodeType.CreateNode();

            var port = node.Ports.FirstOrDefault(p => p.Id == id);

            Assert.That(port, Is.Not.Null);
            Assert.That(port.Type, Is.EqualTo(type));
            Assert.That(port.Direction, Is.EqualTo(direction));
            Assert.That(port.Capacity, Is.EqualTo(capacity));
        }
Beispiel #19
0
		// Инверсия направления порта
		public static PortDirection Invert(PortDirection dir)
		{
			switch (dir)
			{
				case PortDirection.In:
					return PortDirection.Out;
				case PortDirection.Out:
					return PortDirection.In;
				default:
					throw new System.Exception("Unknown port direction");
			}
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateEdgeCommand" /> class.
 /// </summary>
 /// <param name="toPortModel">Destination port.</param>
 /// <param name="fromPortModel">Origin port.</param>
 /// <param name="edgeModelsToDelete">List of edges to delete (sometimes the new edge replaces previous connections).</param>
 /// <param name="portAlignment">Which port's node should be aligned to the other port.</param>
 public CreateEdgeCommand(IPortModel toPortModel, IPortModel fromPortModel,
                          IReadOnlyList <IEdgeModel> edgeModelsToDelete = null,
                          PortDirection portAlignment = PortDirection.None)
     : this()
 {
     Assert.IsTrue(toPortModel == null || toPortModel.Direction == PortDirection.Input);
     Assert.IsTrue(fromPortModel == null || fromPortModel.Direction == PortDirection.Output);
     ToPortModel        = toPortModel;
     FromPortModel      = fromPortModel;
     EdgeModelsToDelete = edgeModelsToDelete;
     PortAlignment      = portAlignment;
 }
 public override IPortModel CreatePort(PortDirection direction, PortOrientation orientation, string portName, PortType portType,
                                       TypeHandle dataType, string portId, PortModelOptions options)
 {
     return(new FakePortModel(GraphModel)
     {
         Direction = direction,
         Orientation = orientation,
         Title = portName,
         PortType = portType,
         DataTypeHandle = dataType,
         NodeModel = this
     });
 }
        public IPort SetupPort(INode node, FieldInfo fieldInfo, out PortDirection direction,
                               out PortType type, out string name)
        {
            var portIndex = LastPortIndex + 1;

            name = fieldInfo.Name;

            var port = (IPort)fieldInfo.GetValue(node);

            LastPortIndex += (uint)port.GetDataCount();

            var internalPort = port.GetPort();

            internalPort.Index = portIndex;

            if (port is IInputDataPort inputDataPort)
            {
                direction = PortDirection.Input;
                type      = PortType.Data;
                inputDataPort.SetPort(internalPort);
                port = inputDataPort;
            }
            else if (port is IOutputDataPort outputDataPort)
            {
                direction = PortDirection.Output;
                type      = PortType.Data;
                outputDataPort.SetPort(internalPort);
                port = outputDataPort;
            }
            else if (port is IInputTriggerPort inputTriggerPort)
            {
                direction = PortDirection.Input;
                type      = PortType.Trigger;
                inputTriggerPort.SetPort(internalPort);
                port = inputTriggerPort;
            }
            else if (port is IOutputTriggerPort outputTriggerPort)
            {
                direction = PortDirection.Output;
                type      = PortType.Trigger;
                outputTriggerPort.SetPort(internalPort);
                port = outputTriggerPort;
            }
            else
            {
                throw new NotImplementedException();
            }

            fieldInfo.SetValue(node, port);
            return(port);
        }
Beispiel #23
0
    public void UpdateDirectionToFace(PortDirection direction)
    {
        switch (direction)
        {
        case PortDirection.Right: _desiredDirection = RightDirection; break;

        case PortDirection.Top: _desiredDirection = TopDirection; break;

        case PortDirection.Left: _desiredDirection = LeftDirection; break;

        default:
        case PortDirection.Bottom: _desiredDirection = BottomDirection; break;
        }
    }
Beispiel #24
0
        public static string GetBothName(string fieldName, PortDirection direction)
        {
            switch (direction)
            {
            case PortDirection.Input:
                return(fieldName + " Iutput");

            case PortDirection.Output:
                return(fieldName + " Onput");

            default:
                return(fieldName);
            }
        }
Beispiel #25
0
        /// <summary>
        ///   Instantiates a new <see cref="PortInfo"/> object.
        /// </summary>
        /// <param name="name">Name of the port.</param>
        /// <param name="description">Description of the port.</param>
        /// <param name="direction">Direction of the port.</param>
        /// <param name="type">Type of the port.</param>
        /// <param name="defaultValue">Default value of the port. Can be null or empty.</param>
        /// <exception cref="ArgumentNullException"><paramref name="name"/>, <paramref name="type"/>, or <paramref name="description"/> is a null reference.</exception>
        /// <exception cref="ArgumentException"><paramref name="name"/>, <paramref name="type"/>, or <paramref name="description"/> is an empty string.</exception>
        public PortInfo(string name, string description, PortDirection direction, string type, string defaultValue = null)
            : base(name, direction, type, defaultValue)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }
            if (description.Length == 0)
            {
                throw new ArgumentException("description is an empty string");
            }

            Description = description;
        }
 public override IPortModel CreatePort(PortDirection direction, PortOrientation orientation, string portName, PortType portType, TypeHandle dataType, string portId, PortModelOptions options)
 {
     return(new MathExpressionPortModel
     {
         Direction = direction,
         Orientation = orientation,
         PortType = portType,
         DataTypeHandle = dataType,
         Title = portName ?? "",
         UniqueName = portId,
         Options = options,
         NodeModel = this,
         AssetModel = AssetModel
     });
 }
        public NodePort(FieldInfo _fieldInfo, PortAttribute _portAttribute)
        {
            fieldName      = _fieldInfo.Name;
            multiple       = _portAttribute.IsMulti;
            direction      = _portAttribute.Direction;
            typeConstraint = _portAttribute.TypeConstraint;

            if (Utility_Attribute.TryGetFieldAttribute(_fieldInfo.DeclaringType, _fieldInfo.Name, out PortTypeAttribute typeAttribute))
            {
                typeQualifiedName = typeAttribute.portType.AssemblyQualifiedName;
            }
            else
            {
                typeQualifiedName = _fieldInfo.FieldType.AssemblyQualifiedName;
            }
        }
Beispiel #28
0
        /***************************************************************************/

        public PortElement createPortElement(PortDirection _kind, string _name)
        {
            if (_name.Length == 0)
            {
                throw new ArgumentException(
                          Resoursers.Exceptions.Messages.emptyPortName
                          );
            }

            return
                (new PortElement(
                     _kind
                     , _name
                     , ms_currentID++
                     , ms_portElementTypes[_kind]
                     ));
        }
        public override IPortModel CreatePort(PortDirection direction, PortOrientation orientation, string portName,
                                              PortType portType, TypeHandle dataType, string portId, PortModelOptions options)
        {
            var port = new PortModel
            {
                Direction      = direction,
                Orientation    = orientation,
                PortType       = portType,
                DataTypeHandle = dataType,
                Title          = portName,
                UniqueName     = portId,
                Options        = options,
                NodeModel      = this
            };

            port.SetGraphModel(GraphModel);
            return(port);
        }
Beispiel #30
0
        public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
        {
            string stageID = pContext.StageID.ToString("D");

            m_portDirection = PortDirection.send;
            if (stageID == CategoryTypes.CATID_Decoder || stageID == CategoryTypes.CATID_Validate || stageID == CategoryTypes.CATID_PartyResolver)
            {
                m_portDirection = PortDirection.receive;
            }

            if (!string.IsNullOrEmpty(_mapName))
            {
                MarkableForwardOnlyEventingReadStream stream =
                    new MarkableForwardOnlyEventingReadStream(
                        pInMsg.BodyPart.GetOriginalDataStream());

                string messageType = (string)pInMsg.Context.Read("MessageType", _systemPropertiesNamespace);

                if (messageType == String.Empty)
                {
                    stream.MarkPosition();
                    //Thanks to http://maximelabelle.wordpress.com/2010/07/08/determining-the-type-of-an-xml-message-in-a-custom-pipeline-component/
                    messageType = Microsoft.BizTalk.Streaming.Utils.GetDocType(stream);
                    stream.ResetPosition();
                }


                TransformMetaData _map = FindFirstMapMatch(messageType);

                if (_map == null)
                {
                    System.Diagnostics.Debug.WriteLine("No match for map could be made for message type: " + messageType);
                }
                else
                {
                    pInMsg.BodyPart.Data = TransformMessage(stream, _map, pInMsg);

                    pContext.ResourceTracker.AddResource(stream);
                }
            }


            return(pInMsg);
        }
Beispiel #31
0
        private void SetAvailablePorts()
        {
            signalControl.AvailableIns.Clear();
            signalControl.AvailableOuts.Clear();

            
            foreach (ListViewItem lvi in interfaceListControl.Items)
            {
                var port = lvi.Tag as Port;
                if (port != null)
                {
                    PortDirection direction = port.direction;
                    if (direction == PortDirection.Input || direction == PortDirection.BiDirectional)
                        signalControl.AvailableIns.Add(port);
                    if (direction == PortDirection.Output || direction == PortDirection.BiDirectional)
                        signalControl.AvailableOuts.Add(port);
                }
            }
        }
Beispiel #32
0
		// Составление имени контакта, в соответствии с его направлением
		// и порядком
		public static string BuildName(PortDirection dir,
			int idx = -1)
		{
			switch (dir)
			{
				case Model.PortDirection.In:
					return (idx < 0)
						? "I"
						: "I_" + idx.ToString();

				case Model.PortDirection.Out:
					return (idx < 0)
						? "O"
						: "O_" + idx.ToString();

				default:
					throw new System.Exception("Unknown port direction");
			}
		}
 public void pinMode(ArduinoPort port, PortDirection direction)
 {
 }
Beispiel #34
0
		protected Connection(string name, PortDirection direction)
			: base(name)
		{
			Direction = direction;
		}
Beispiel #35
0
		public Pin(string name, PortDirection direction, ILogic owner)
			: base(name, direction)
		{
			Owner = owner;
		}