Esempio n. 1
0
 public void Reload(NodePort port)
 {
     fieldName      = port.fieldName;
     direction      = port.direction;
     capacity       = port.capacity;
     typeConstraint = port.typeConstraint;
     DataType       = port.DataType;
 }
Esempio n. 2
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;
 }
 public override bool GetPortCapacity(PortModel portModel, out PortCapacity capacity)
 {
     if (portModel.PortType == PortType.Execution)
     {
         capacity = PortCapacity.Multi;
     }
     else
     {
         Assert.AreEqual(portModel.PortType, PortType.Data);
         capacity = portModel.Direction == Direction.Input
             ? PortCapacity.Single
             : PortCapacity.Multi;
     }
     return(true);
 }
Esempio n. 5
0
        public NodePort(FieldInfo fieldInfo, string name, PortDirection direction)
        {
            fieldName = name;

            if (AttributeCache.TryGetFieldAttribute(fieldInfo.DeclaringType, fieldInfo.Name, out PortAttribute attribute))
            {
                capacity       = attribute.Capacity;
                typeConstraint = attribute.TypeConstraint;
            }
            this.direction = direction;

            if (attribute != null && attribute.CustomPortConnectionType != null)
            {
                DataType = attribute.CustomPortConnectionType;
            }
            else
            {
                DataType = fieldInfo.FieldType;
            }
        }
Esempio n. 6
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));
        }
 /// <summary>
 /// Gets the port capacity of a port. This is called portModel?.GetDefaultCapacity() by NodeModel.GetPortCapacity(portModel)
 /// </summary>
 /// <param name="portModel"></param>
 /// <param name="capacity"></param>
 /// <returns></returns>
 public virtual bool GetPortCapacity(PortModel portModel, out PortCapacity capacity)
 {
     capacity = default;
     return(false);
 }
Esempio n. 8
0
 private static Capacity ConvertCapacity(PortCapacity value) => value == PortCapacity.Single ? Capacity.Single : Capacity.Multi;
Esempio n. 9
0
 public SleipnirPortView(Orientation orientation, PortDirection direction, PortCapacity capacity, Type type, IEdgeConnectorListener listener) : base(orientation, ConvertDirection(direction), ConvertCapacity(capacity), type)
 {
     m_EdgeConnector = new EdgeConnector <Edge>(listener);
     this.AddManipulator(m_EdgeConnector);
 }