diff Implab/Automaton/DFATable.cs @ 251:7c7e9ad6fe4a v3

Prerelease version of RunnableComponent Added draft messaging interfaces Added more more helpers to Xml/SerializationHelpers
author cin
date Sun, 11 Feb 2018 00:49:51 +0300
parents fa6cbf4d8841
children
line wrap: on
line diff
--- a/Implab/Automaton/DFATable.cs	Thu Feb 01 02:43:35 2018 +0300
+++ b/Implab/Automaton/DFATable.cs	Sun Feb 11 00:49:51 2018 +0300
@@ -20,7 +20,7 @@
         #region IDFADefinition implementation
 
         public bool IsFinalState(int s) {
-            Safe.ArgumentInRange(s, 0, m_stateCount, "s");
+            Safe.ArgumentInRange(s >= 0 && s < m_stateCount, nameof(s));
 
             return m_finalStates.Contains(s);
         }
@@ -46,7 +46,7 @@
         #endregion
 
         public void SetInitialState(int s) {
-            Safe.ArgumentAssert(s >= 0, "s");
+            Safe.ArgumentInRange(s >= 0, nameof(s));
             m_stateCount = Math.Max(m_stateCount, s + 1);
             m_initialState = s;
         }
@@ -57,9 +57,9 @@
         }
 
         public void Add(AutomatonTransition item) {
-            Safe.ArgumentAssert(item.s1 >= 0, "item");
-            Safe.ArgumentAssert(item.s2 >= 0, "item");
-            Safe.ArgumentAssert(item.edge >= 0, "item");
+            Safe.ArgumentAssert(item.s1 >= 0, nameof(item));
+            Safe.ArgumentAssert(item.s2 >= 0, nameof(item));
+            Safe.ArgumentAssert(item.edge >= 0, nameof(item));
 
             m_stateCount = Math.Max(m_stateCount, Math.Max(item.s1, item.s2) + 1);
             m_symbolCount = Math.Max(m_symbolCount, item.edge + 1);