コード例 #1
0
 public InstructionGroupDummy(IEditorItem parent, NodeInstructionGroup instructionGroup)
     : base(parent)
 {
     if (instructionGroup == null)
     {
         throw new ArgumentNullException();
     }
     m_instructionGroup = instructionGroup;
 }
コード例 #2
0
 internal InstructionGroupLD(IEditorItem parent, NodeInstructionGroup instructionGroup)
     : base(parent)
 {
     if (instructionGroup == null)
     {
         // a new group
         InstructionGroup = emptyNode();
     }
     else
     {
         if (instructionGroup.Language != Extensions.Workbench.Documents.PageEditor_.InstructionGroupItems.LD)
         {
             throw new InvalidOperationException("instructionGroup");
         }
         InstructionGroup = instructionGroup;
     }
 }
コード例 #3
0
        public static NodeInstructionGroup BuildWith(FieldIdentifier Language)
        {
            //build fields
            Dictionary <FieldIdentifier, FieldBase> mutableFields =
                new Dictionary <FieldIdentifier, FieldBase>();

            mutableFields.Add(new FieldIdentifier(m_LanguageName), Language);
            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(NodeInstructionGroupTry.BuildWith());
            //Add Children here: mutableChildren.Add(SomeChild);

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

            return(Builder);
        }
コード例 #4
0
ファイル: Engine.cs プロジェクト: EdWeller/SoapboxSnap
        private void ScanInstructionGroup(NodeRuntimeApplication rta, NodeInstructionGroup instructionGroup)
        {
            string language = instructionGroup.Language.ToString();
            IGroupExecutor executor = null;
            if (m_groupExecutors.ContainsKey(language))
            {
                executor = m_groupExecutors[language];
            }
            else
            {
                // this only instantiates new language modules if we're actually using that language
                foreach (var executorSearch in groupExecutorsImported)
                {
                    if (executorSearch.Metadata.Language == language)
                    {
                        executor = executorSearch.Value;
                        m_groupExecutors.Add(language, executor);
                        break;
                    }
                }
            }

            if (executor != null)
            {
                executor.ScanInstructionGroup(rta, instructionGroup);
            }
            else
            {
                // FIXME - should report the error - we can't execute it
            }
        }
コード例 #5
0
ファイル: GroupExecutor.cs プロジェクト: EdWeller/SoapboxSnap
 public void ScanInstructionGroup(NodeRuntimeApplication rta, NodeInstructionGroup instructionGroup)
 {
     var contextIterator = new InstructionGroupExecutorContextLD(true); // rung condition at the beginning of a rung is always true
     // A rung only ever has one series instruction as a child, so the foreach is kind of overkill, but should work
     foreach (var instruction in instructionGroup.NodeInstructionChildren)
     {
         contextIterator = ScanInstruction(rta, instruction, contextIterator);
     }
 }
コード例 #6
0
 /// <summary>
 /// Factory function for creating LD Editors
 /// </summary>
 /// <param name="parent">Usually the PageEditor.PageEditorItem, but could be null</param>
 /// <param name="instructionGroup">The wrapped model class.  Null = create a new one</param>
 /// <returns></returns>
 public override IInstructionGroupItem Create(IEditorItem parent, NodeInstructionGroup instructionGroup)
 {
     return new InstructionGroupLD(parent, instructionGroup);
 }
コード例 #7
0
        public static NodeInstructionGroup BuildWith(FieldIdentifier Language)
        {
            //build fields
            Dictionary<FieldIdentifier, FieldBase> mutableFields =
                new Dictionary<FieldIdentifier, FieldBase>();
            mutableFields.Add(new FieldIdentifier(m_LanguageName), Language);
            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(NodeInstructionGroupTry.BuildWith());
            //Add Children here: mutableChildren.Add(SomeChild);

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

            return Builder;
        }
コード例 #8
0
 public virtual IInstructionGroupItem Create(IEditorItem parent, NodeInstructionGroup instructionGroup)
 {
     return null;
 }