Пример #1
0
        public static NodeSignal BuildWith(FieldSignalName SignalName,
                                           FieldDataType DataType, FieldBool Forced,
                                           FieldConstant ForcedValue)
        {
            //build fields
            Dictionary <FieldIdentifier, FieldBase> mutableFields =
                new Dictionary <FieldIdentifier, FieldBase>();

            mutableFields.Add(new FieldIdentifier(m_SignalIdName), new FieldGuid());
            mutableFields.Add(new FieldIdentifier(m_SignalNameName), SignalName);
            mutableFields.Add(new FieldIdentifier(m_ForcedName), Forced);
            mutableFields.Add(new FieldIdentifier(m_ForcedValueName), ForcedValue);
            mutableFields.Add(new FieldIdentifier(m_CommentName), new FieldString());
            //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code);

            //build children
            KeyedNodeCollection <NodeBase> mutableChildren =
                new KeyedNodeCollection <NodeBase>();

            mutableChildren.Add(NodeValue.BuildWith(DataType));
            //Add Children here: mutableChildren.Add(SomeChild);

            //build node
            NodeSignal Builder = new NodeSignal(
                new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection <NodeBase>(mutableChildren));

            return(Builder);
        }
Пример #2
0
        public static NodeValue BuildWith(FieldDataType DataType)
        {
            //build fields
            Dictionary <FieldIdentifier, FieldBase> mutableFields =
                new Dictionary <FieldIdentifier, FieldBase>();

            mutableFields.Add(new FieldIdentifier(m_DataTypeName), DataType);
            //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code);

            //build children
            KeyedNodeCollection <NodeBase> mutableChildren =
                new KeyedNodeCollection <NodeBase>();
            //Add Children here: mutableChildren.Add(SomeChild);

            //build node
            NodeValue Builder = new NodeValue(
                new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection <NodeBase>(mutableChildren));

            return(Builder);
        }
Пример #3
0
 public NodeValue GetValue(NodeRuntimeApplication runtimeApplication)
 {
     if (runtimeApplication == null)
     {
         throw new ArgumentNullException();
     }
     if (SignalId != null)
     {
         var signal = runtimeApplication.FindSignal(SignalId);
         if (signal != null)
         {
             return(signal.Storage);
         }
         else
         {
             return(null);
         }
     }
     else if (Literal != null)
     {
         NodeValue retVal = null;
         lock (m_LiteralNodeValue_Lock)
         {
             if (m_LiteralNodeValue == null)
             {
                 m_LiteralNodeValue       = NodeValue.BuildWith(new FieldDataType(Literal.DataType));
                 m_LiteralNodeValue.Value = Literal.Value;
             }
             retVal = m_LiteralNodeValue;
         }
         return(retVal);
     }
     else
     {
         return(null);
     }
 }
Пример #4
0
        public static NodeValue BuildWith(FieldDataType DataType)
        {
            //build fields
            Dictionary<FieldIdentifier, FieldBase> mutableFields =
                new Dictionary<FieldIdentifier, FieldBase>();
            mutableFields.Add(new FieldIdentifier(m_DataTypeName), DataType);
            //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code);

            //build children
            KeyedNodeCollection<NodeBase> mutableChildren =
                new KeyedNodeCollection<NodeBase>();
            //Add Children here: mutableChildren.Add(SomeChild);

            //build node
            NodeValue Builder = new NodeValue(
                new ReadOnlyDictionary<FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection<NodeBase>(mutableChildren));

            return Builder;
        }
Пример #5
0
 public NodeValue GetValue(NodeRuntimeApplication runtimeApplication)
 {
     if (runtimeApplication == null)
     {
         throw new ArgumentNullException();
     }
     if (SignalId != null)
     {
         var signal = runtimeApplication.FindSignal(SignalId);
         if (signal != null)
         {
             return signal.Storage;
         }
         else
         {
             return null;
         }
     }
     else if (Literal != null)
     {
         NodeValue retVal = null;
         lock (m_LiteralNodeValue_Lock)
         {
             if (m_LiteralNodeValue == null)
             {
                 m_LiteralNodeValue = NodeValue.BuildWith(new FieldDataType(Literal.DataType));
                 m_LiteralNodeValue.Value = Literal.Value;
             }
             retVal = m_LiteralNodeValue;
         }
         return retVal;
     }
     else
     {
         return null;
     }
 }