internal List<SymbolID> GetLeafsByRelation(SymbolID rootSymbol, OperatorID relation)
 {
     List<SymbolID> resultedSymbols = new List<SymbolID>();
     List<SymbolID> ReturnedIDs = serverAccess.GetContent(relation, rootSymbol, 1000);
     foreach (SymbolID ints in ReturnedIDs)
     {
         if (ints.Exists)
         {
             //=// ints.Names = serverAccess.GetSymbolNamesByID(ID, 1);
             resultedSymbols.Add(ints);
         }
         else
         {
             resultedSymbols.Add(SymbolID.Null);
         }
     }
     if (resultedSymbols.Count < 1)
     {
         resultedSymbols.Add(SymbolID.Null);
     }
     return resultedSymbols;
 }
        public List<SymbolID> SolveRelation(SymbolID symbol1, OperatorID operatorID,  SymbolID symbol2, int limit = 10)
        {
            // Algebric logics
            // null        == [ 0,  0]   // nothing, ignorance
            // measure     == [ 0,+/-]   // levels, needs, satisfacrion, states
            // event       == [ +,  -]   // decisions, state modifiers
            // object      == [ +,0/+]   // static objects, existence
            // incertitude == [ -,  +]   // cumulator, unoriented, unknown
            // collision   == [ -,  -]   // collision, boundary, buffer, meta
            List<SymbolID> resultNULL = new List<SymbolID>();


            // CASE 0:
            // relation is unknown
            if (operatorID.Location.IR == 0 && operatorID.Location.Var == 0 && operatorID.Multiplicity.Direction == 0 && operatorID.Multiplicity.Level == 0) // SOMETHING ? SOMETHING
            {
                List<SymbolID> result = new List<SymbolID>();
                return result;
            }

            // CASE 1:
            // both operands are nulls
            if (symbol1.Location.A == 0 && symbol1.Location.B == 0 && symbol2.Location.A == 0 && symbol2.Location.B == 0) // [ 0,  0] => [ 0,  0]  // NULL => NULL
            {
                List<SymbolID> result = new List<SymbolID>();
                result.Add(SymbolID.Null);
                return result; // NULL
            }

            // CASE 2:
            // first operand is null
            if ((symbol1.Location.A == 0 && symbol1.Location.B == 0) && (symbol2.Location.A > 0 && symbol2.Location.B >= 0)) // [ 0,  0] => [ +,  +]  // NULL => SOMETHING
            {
                List<SymbolID> result = new List<SymbolID>();
                result.Add(SymbolID.Null);
                return result; // NULL
            }

            // CASE 3:
            // second operand is null
            if ((symbol1.Location.A > 0 && symbol1.Location.B >= 0) && (symbol2.Location.A == 0 && symbol2.Location.B == 0)) // [ +,  +] => [ 0,  0] // SOMETHING => NULL
            {
                List<SymbolID> result = new List<SymbolID>();
                result.Add(SymbolID.Null);
                return result; // NULL
            }

            // CASE 4:
            // both operands are not-nulls
            if ((symbol1.Location.A < 0 && symbol1.Location.B > 0) && (symbol2.Location.A < 0 || symbol2.Location.B > 0)) // [ -,  +] => [ -,  +]  // ? => ?
            {
                List<SymbolID> result = new List<SymbolID>();
                result.Add(SymbolID.Null);
                return result; // NULL
            }

            // CASE 5:
            // unknown preoperand
            if ((symbol1.Location.A < 0 && symbol1.Location.B > 0) && (symbol2.Location.A > 0 || symbol2.Location.B >= 0)) // [ -,  +] => [ +,  +]  // ? => SOMETHING
            {
                //return FindContainer(r, a, b, limit);
            }

            // CASE 6:
            // both unknown postoperand
            if ((symbol1.Location.A > 0 && symbol1.Location.B >= 0) && (symbol2.Location.A < 0 && symbol2.Location.B > 0)) // [ +,  +] => [ -,  +]  // SOMETHING => ?
            {
                //return FindContent(r, a, b, limit);
            }

            // CASE 4:
            // both operands are not-nulls
            if ((symbol1.Location.A > 0 && symbol1.Location.B >= 0) && (symbol2.Location.A > 0 || symbol2.Location.B >= 0)) // [ +,  +] => [ -,  +]  // SOMETHING => SOMETHING
            {
                return IsTransitive(operatorID, symbol1, symbol2, 10);
            }

            return resultNULL;
        }
 private List<SymbolID> IsTransitive(OperatorID operatorId, SymbolID symbolFrom, SymbolID symbolTo, int limit)
 {
     List<SymbolID> resultedSymbols = new List<SymbolID>();
     List<SymbolID> ReturnedIDs = new List<SymbolID>();//=// serverAccess.IsTransitive(new List<Location>(), operatorId.Location, symbolFrom.Location, symbolTo.Location, limit);
     foreach (SymbolID ints in ReturnedIDs)
     {
         if (ints.Exists)
         {
             resultedSymbols.Add(new SymbolID(ints.Location, ints.Multiplicity, ""));
         }
         else
         {
             resultedSymbols.Add(SymbolID.Null);
         }
     }
     if (resultedSymbols.Count < 1)
     {
         resultedSymbols.Add(SymbolID.Null);
     }
     return resultedSymbols;
 }
 private List<SymbolID> SetRelation(SymbolID a, OperatorID r, SymbolID b)
 {
     List<SymbolID> resultedSymbols = new List<SymbolID>();
     List<SymbolID> ReturnedIDs = new List<SymbolID>();//=//  serverAccess.CreateRelation(r, a.Location, b.Location);
     foreach (SymbolID ints in ReturnedIDs)
     {
         resultedSymbols.Add(new SymbolID(ints.Location, ints.Multiplicity, ""));
     }
     return resultedSymbols;
 }
        /// <summary>
        /// check if the relation is transitive
        /// </summary>
        /// <param name="path">path so far</param>
        /// <param name="operatorID">Given operator</param>
        /// <param name="symbolID1">from symbol A</param>
        /// <param name="symbolID2">to symbol B</param>
        /// <param name="limitOfResults">Maximum capacity accepted for the result set</param>
        /// <returns>the symbols succession from A to B</returns>
        public List<SymbolID> IsTransitive(List<SymbolID> path, OperatorID operatorID, SymbolID symbolID1, SymbolID symbolID2, int limitOfResults) 
        {
            System.Diagnostics.StackTrace stackTrace0 = new System.Diagnostics.StackTrace(); LoggingSystem.BranchName = stackTrace0.GetFrame(0).GetMethod().Name;

            List<SymbolID> LocalReturnList = new List<SymbolID>();
            List<SymbolID> returnList = new List<SymbolID>();
            bool solved = false;
            try
            {
                string commandString;
                if (false) // ($t1[0]=='?x')
                {
                    commandString = "SELECT `ID`, `g`, `h` FROM `" + DB + "`.`s" + symbolID1.Location.A.ToString("") + "` WHERE `a` = " + symbolID1.Location.A + " AND `c` LIKE " + operatorID.Location.Var + " AND `e` = " + symbolID2.Location.A + " ";
                }
                else
                {
                    commandString = "SELECT `ID`, `g`, `h` FROM `" + DB + "`.`s" + symbolID1.Location.A.ToString("") + "` WHERE `a` = " + symbolID1.Location.A + " AND `c` = " + operatorID.Location.Var + " AND `e` = " + symbolID2.Location.A + " ";
                }
                if (limitOfResults > 0) { commandString += " Limit " + limitOfResults; }
                MySql.Data.MySqlClient.MySqlCommand mySqlCommand = new MySqlCommand(commandString, mySQLConnection);
                MySqlDataReader myReader = mySqlCommand.ExecuteReader();
                if (MySqlTrace) SQLView.Log(mySqlCommand.CommandText);
                if (myReader.HasRows)
                {
                    solved = true;
                    while (myReader.Read())
                    {
                        if (!string.IsNullOrEmpty(myReader.GetString(0)))
                        {
                            int[] multipplicity = new int[] {0, 0 };
                            int.TryParse(myReader.GetString(1), out multipplicity[0]);
                            int.TryParse(myReader.GetString(2), out multipplicity[1]);
                            //if (multipplicity[0] != 0 || multipplicity[1] != 0)
                            //{
                            //    ReturnList.Add(symbID);
                            //}
                            SymbolID symbID = new SymbolID();
                            symbID.Location.A = symbolID1.Location.A;
                            int.TryParse(myReader.GetString(0), out symbID.Location.A);
                            int.TryParse(myReader.GetString(1), out symbID.Location.B);
                            //int.TryParse(myReader.GetString(2), out symbID[3]);
                            if (symbID.Exists)
                            {
                                returnList.Add(symbID);
                            }
                        }
                    }
                    myReader.Close();
                }
                else
                {
                    myReader.Close();
                    if (true) // ($t1[0]=='?x')
                    {
                        commandString = "SELECT `ID`, `e`, `f`, `g`, `h` FROM `" + DB + "`.`s" + symbolID1.Location.A.ToString("") + "` WHERE `a` = " + symbolID1.Location.A + " AND `c` = " + operatorID.Location.IR + " ";
                    }
                    else
                    {
                        commandString = "SELECT `ID`, `e`, `f`, `g`, `h` FROM `" + DB + "`.`s" + symbolID1.Location.A.ToString("") + "` WHERE `a` = " + symbolID1.Location.A + " AND `c`< 5000 ";
                    }
                    if (limitOfResults > 0) { commandString += " Limit " + limitOfResults; }
                    MySql.Data.MySqlClient.MySqlCommand mySqlCommand2 = new MySqlCommand(commandString, mySQLConnection);
                    MySqlDataReader myReader2 = mySqlCommand2.ExecuteReader();
                    if (MySqlTrace) SQLView.Log(mySqlCommand2.CommandText);
                    List<SymbolID> toTry = new List<SymbolID>();
                    while (myReader2.Read())
                    {
                        if (!string.IsNullOrEmpty(myReader2.GetString(0)))
                        {
                            SymbolID symbID = new SymbolID();
                            int.TryParse(myReader2.GetString(0), out symbID.Location.A);
                            int.TryParse(myReader2.GetString(1), out symbID.Location.B);
                            //int.TryParse(myReader2.GetString(2), out symbID[2]);
                            if (symbID.Exists)
                            {
                                toTry.Add(symbID);
                            }
                        }

                    }
                    myReader2.Close();
                    for (int i = 0; i < toTry.Count; i++)
                    {
                        if (!solved)
                        {
                            foreach (SymbolID symbID in toTry)
                            {
                                if (symbID.Exists)
                                {
                                    SymbolID newSymbolID = symbID;
                                    LocalReturnList = IsTransitive(LocalReturnList, operatorID, newSymbolID, symbolID2, limitOfResults);
                                }
                                if (LocalReturnList.Count > 0)
                                {
                                    //int[] ToAdd = new int[] { a[0], symbID[0] };
                                    //ReturnList.Add(new int[] { symbID[1], symbID[2] });
                                    SymbolID newSymbolID = symbID;
                                    newSymbolID.Location.A = symbolID1.Location.A;
                                    newSymbolID.Location.B = symbID.Location.A;
                                    returnList.Add(newSymbolID);
                                    returnList.AddRange(LocalReturnList);
                                    solved = true;
                                }
                            }
                        }
                    }

                }
            }
            catch (MySqlException retrieveSymbolIndexException)
            {
                Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
            }
            if (MyResultsTrace)
            {
                string ResultLog = "";
                foreach (SymbolID i in returnList)
                {
                    ResultLog += " [" + i.Location.A + ":" + i.Location.B + "]";
                }
                SQLView.LogResult(new string[] { ResultLog });
            }
            #region LOG
            //=== CUSTOM LOGGER===================================================================================
            ElementMethod thisMethod = new ElementMethod();
            int logLevel = -1; if (logingOptions != null) logLevel = logingOptions.levelNumbers;
            if (logLevel >= 3) // code
            {
                System.Diagnostics.StackTrace stackTrace; System.Diagnostics.StackFrame fr; stackTrace = new System.Diagnostics.StackTrace(); fr = stackTrace.GetFrame(0);
                thisMethod.ElementNamespaceName = this.GetType().Namespace;
                thisMethod.ElementClassName = this.GetType().Name;
                string methodName = fr.GetMethod().ToString();
                thisMethod.ElementName = fr.GetMethod().Name;
                thisMethod.ReturnType = methodName.Substring(0, methodName.IndexOf(" "));
            }
            if (logLevel >= 2) // parameters
            {
                // , , int[] , int[] , int[] , int[] , int 
                thisMethod.Parameters.Add(new string[] { "List<int[]> path", path.ToString() });
                thisMethod.Parameters.Add(new string[] { "int[] relationID", operatorID.ToString() });
                thisMethod.Parameters.Add(new string[] { "int[] symbolID1", symbolID1.ToString() });
                thisMethod.Parameters.Add(new string[] { "int[] symbolID2", symbolID2.ToString() });
                thisMethod.Parameters.Add(new string[] { "int limitOfResults", limitOfResults.ToString() });
            }
            if (logLevel >= 1) // results
            {
                string result = string.Empty;
                foreach (SymbolID symbolItem in returnList)
                {
                    result += "{" + symbolItem.ToString() + "}";
                }
                thisMethod.Result = result;
            }
            LoggingSystem.LogMethod = thisMethod;

            //====================================================================================================
            #endregion LOG
            return returnList;
        }
        /// <summary>
        /// Get the proprieties of a symbol restricted to a relation type if provided
        /// </summary>
        /// <param name="operatorID">The relation to restrict the resultset if provided</param>
        /// <param name="multiplicationOrder">the multiplication order requested if provided</param>
        /// <param name="symbolID">The symbolID to expore for properties</param>
        /// <param name="limitOfResults">>Maximum capacity accepted for the result set</param>
        /// <returns>ResultSet: The descriptopn of the given symbol restricted to the relation if provided</returns>
        public List<SymbolID> GetContent(OperatorID operatorID, SymbolID symbolID, int limitOfResults)
        {
            // TODO Use multiplicationOrder parameter

            // Start logging
            System.Diagnostics.StackTrace stackTrace0 = new System.Diagnostics.StackTrace(); LoggingSystem.BranchName = stackTrace0.GetFrame(0).GetMethod().Name;

            // Prepare result set
            List<SymbolID> resultedSymbolIDs = new List<SymbolID>();
            try
            {
                string commandString = string.Empty;
                if (operatorID.hasMultiplicity)
                {
                    commandString = "SELECT `e`, `f` FROM `" + DB + "`.`s" + symbolID.Location.A.ToString() + "` WHERE `a` = " + symbolID.Location.A + " AND `b` = " + symbolID.Location.B + " AND `c` = " + operatorID.Location.IR + " AND `d` = " + operatorID.Location.Var + " ";
                }
                else
                {
                    commandString = "SELECT `e`, `f` FROM `" + DB + "`.`s" + symbolID.Location.A.ToString() + "` WHERE `a` = " + symbolID.Location.A + " AND `b` = " + symbolID.Location.B + " AND `c` = " + operatorID.Location.IR +" AND `d` = " + operatorID.Location.Var + " ";
                //    commandString = "SELECT `e`, `f` FROM `" + DB + "`.`s" + symbolID.Location.A.ToString() + "` WHERE `a` = " + symbolID.Location.A + " AND `b` = " + symbolID.Location.B + " ";
                }
                if (limitOfResults != 0) { commandString += " Limit " + limitOfResults; }
                MySql.Data.MySqlClient.MySqlCommand mySqlCommand = new MySqlCommand(commandString, mySQLConnection);
                if (MySqlTrace) SQLView.Log(mySqlCommand.CommandText);
                MySqlDataReader myReader = mySqlCommand.ExecuteReader();
                while (myReader.Read())
                {
                    if (!string.IsNullOrEmpty(myReader.GetString(0)))
                    {
                        SymbolID newSymbolID = new SymbolID();
                        int.TryParse(myReader.GetString(0), out newSymbolID.Location.A);
                        try
                        {
                            int.TryParse(myReader.GetString(1), out newSymbolID.Location.B);
                        }
                        catch
                        {
                        }
                        //int.TryParse(myReader.GetString(2), out symbID[2]);
                        //int.TryParse(myReader.GetString(3), out symbID[3]);
                        if (newSymbolID.Exists)
                        {
                            resultedSymbolIDs.Add(newSymbolID);
                        }
                    }
                }
                myReader.Close();
            }
            catch (MySqlException retrieveSymbolIndexException)
            {
                Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
            }
            if (MyResultsTrace)
            {
                string ResultLog = "";
                foreach (SymbolID itemSymbolID in resultedSymbolIDs)
                {
                    ResultLog += " [" + itemSymbolID.Location.A + ":" + itemSymbolID.Location.B + "]";
                }
                SQLView.LogResult(new string[] { ResultLog });
            }
            #region LOG
            //=== CUSTOM LOGGER===================================================================================
            ElementMethod thisMethod = new ElementMethod();
            int logLevel = -1; if (logingOptions != null) logLevel = logingOptions.levelNumbers;
            if (logLevel >= 3) // code
            {
                System.Diagnostics.StackTrace stackTrace; System.Diagnostics.StackFrame fr; stackTrace = new System.Diagnostics.StackTrace(); fr = stackTrace.GetFrame(0);
                thisMethod.ElementNamespaceName = this.GetType().Namespace;
                thisMethod.ElementClassName = this.GetType().Name;
                string methodName = fr.GetMethod().ToString();
                thisMethod.ElementName = fr.GetMethod().Name;
                thisMethod.ReturnType = methodName.Substring(0, methodName.IndexOf(" "));
            }
            if (logLevel >= 2) // parameters
            {
                thisMethod.Parameters.Add(new string[] { "int[] relationID", operatorID.ToString() });
                thisMethod.Parameters.Add(new string[] { "int[] symbolID", symbolID.ToString() });
                thisMethod.Parameters.Add(new string[] { "int limitOfResults", limitOfResults.ToString() });
            }
            if (logLevel >= 1) // results
            {
                string result = string.Empty;
                foreach (SymbolID itemSymbolID in resultedSymbolIDs)
                {
                    result += "{" + itemSymbolID.ToString() + "}";
                }
                thisMethod.Result = result;
            }
            LoggingSystem.LogMethod = thisMethod;

            //====================================================================================================
            #endregion LOG
            return resultedSymbolIDs;
        }
        /// <summary>
        /// Get the names of the given operatorIDs
        /// </summary>
        /// <param name="operatorID">OperatorIDs to look for</param>
        /// <param name="limitOfResults">Maximum capacity accepted for the result set</param>
        /// <returns>ResultSet: A List of the given operator`s names</returns>
        public List<string> GetOperatorNamesByID(OperatorID operatorID, int limitOfResults = 10)
        {
            // Start logging
            System.Diagnostics.StackTrace stackTrace0 = new System.Diagnostics.StackTrace(); LoggingSystem.BranchName = stackTrace0.GetFrame(0).GetMethod().Name;

            // Prepare result set
            List<string> resultedOperatorNames = new List<string>();
            try
            {
                string commandString;
                commandString = "SELECT `En` FROM `" + DB + "`.`srel` WHERE `IR` = " + operatorID.Location.IR + " AND `Var` = " + operatorID.Location.Var + " AND `IR2` = " + operatorID.Location.IR2 + " AND `Var2` = " + operatorID.Location.Var2 + " ";
                if (limitOfResults != 0) { commandString += " Limit " + limitOfResults + " "; }
                MySql.Data.MySqlClient.MySqlCommand mySqlCommand = new MySqlCommand(commandString, mySQLConnection);
                if (MySqlTrace) SQLView.Log(mySqlCommand.CommandText);
                MySqlDataReader myReader = mySqlCommand.ExecuteReader();
                while (myReader.Read())
                {
                    if (!string.IsNullOrEmpty(myReader.GetString(0)))
                    {
                        string symbolName;
                        symbolName = myReader.GetString(0).ToString();
                        if (!string.IsNullOrEmpty(symbolName))
                        {
                            resultedOperatorNames.Add(symbolName);
                        }
                    }
                }
                myReader.Close();
            }
            catch (MySqlException retrieveSymbolIndexException)
            {
                Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
            }
            if (MyResultsTrace)
            {
                string ResultLog = "";
                foreach (string i in resultedOperatorNames)
                {
                    ResultLog += "" + i + "";
                }
                SQLView.LogResult(new string[] { ResultLog });
            }
            #region LOG
            //=== CUSTOM LOGGER===================================================================================
            ElementMethod thisMethod = new ElementMethod();
            int logLevel = -1; if (logingOptions != null) logLevel = logingOptions.levelNumbers;
            if (logLevel >= 3) // code
            {
                System.Diagnostics.StackTrace stackTrace; System.Diagnostics.StackFrame fr; stackTrace = new System.Diagnostics.StackTrace(); fr = stackTrace.GetFrame(0);
                thisMethod.ElementNamespaceName = this.GetType().Namespace;
                thisMethod.ElementClassName = this.GetType().Name;
                string methodName = fr.GetMethod().ToString();
                thisMethod.ElementName = fr.GetMethod().Name;
                thisMethod.ReturnType = methodName.Substring(0, methodName.IndexOf(" "));
            }
            if (logLevel >= 2) // parameters
            {
                thisMethod.Parameters.Add(new string[] { "int[] operatorID", operatorID.ToString() });
                thisMethod.Parameters.Add(new string[] { "int limitOfResults", limitOfResults.ToString() });
            }
            if (logLevel >= 1) // results
            {
                string result = string.Empty;
                foreach (string symbolItem in resultedOperatorNames)
                {
                    result += "{" + symbolItem.ToString() + "}";
                }
                thisMethod.Result = result;
            }
            LoggingSystem.LogMethod = thisMethod;

            //====================================================================================================
            #endregion LOG
            return resultedOperatorNames;
        }
        /// <summary>
        /// Create new relation
        /// </summary>
        /// <param name="operatorID">relation type</param>
        /// <param name="symbolID1">preoperand symbol</param>
        /// <param name="symbolID2">postoperand symbol</param>
        /// <returns>ResultSet: The new created relation</returns>
        public List<SymbolID> CreateRelation(OperatorID operatorID, SymbolID symbolID1, SymbolID symbolID2)
        {
            System.Diagnostics.StackTrace stackTrace0 = new System.Diagnostics.StackTrace(); LoggingSystem.BranchName = stackTrace0.GetFrame(0).GetMethod().Name;

            List<SymbolID> relationPositions = new List<SymbolID>();
            SymbolID relationPosition = new SymbolID();
            try
            {
                string commandString = commandString = "INSERT INTO `" + DB + "`.`s" + symbolID2.Location.A.ToString("") + "` (`a`, `b`, `c`, `d`, `e`, `f`) VALUES (" + symbolID2.Location.A + ", " + symbolID2.Location.B + "," + operatorID.Location.IR2 + ", " + operatorID.Location.Var2 + "," + symbolID1.Location.A + ", " + symbolID1.Location.A + ", " + operatorID.Location.IR2 + ", " + operatorID.Location.Var2 + " ) ;";
                //string commandString = commandString = "INSERT INTO `" + DB + "`.`s" + symbolID2[0].ToString() + "` (`a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`) VALUES (" + symbolID2[0] + ", " + symbolID2[1] + "," + relationID[4] + ", " + relationID[5] + "," + symbolID1[0] + ", " + symbolID1[1] + ", " + relationID[2] + ", " + relationID[3] + " ) ;";
                MySql.Data.MySqlClient.MySqlCommand mySqlCommand = new MySqlCommand(commandString, mySQLConnection);
                //if (mySQLConnection.
                mySqlCommand.ExecuteNonQuery();
                if (MySqlTrace) SQLView.Log(mySqlCommand.CommandText);
                commandString = commandString = "INSERT INTO `" + DB + "`.`s" + symbolID1.Location.A.ToString("") + "` (`a`, `b`, `c`, `d`, `e`, `f`) VALUES (" + symbolID1.Location.A + ", " + symbolID1.Location.B + ", " + operatorID.Location.IR + ", " + operatorID.Location.Var + ", " + symbolID2.Location.A + ", " + symbolID2.Location.B + ", " + operatorID.Location.IR2 + ", " + operatorID.Location.Var2 + " ) ;";
                //commandString = commandString = "INSERT INTO `" + DB + "`.`s" + symbolID1[0].ToString() + "` (`a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`) VALUES (" + symbolID1[0] + ", " + symbolID1[1] + ", " + relationID[0] + ", " + relationID[1] + ", " + symbolID2[0] + ", " + symbolID2[1] + ", " + relationID[2] + ", " + relationID[3] + " ) ;";
                mySqlCommand = new MySqlCommand(commandString, mySQLConnection);
                mySqlCommand.ExecuteNonQuery();
                if (MySqlTrace) SQLView.Log(mySqlCommand.CommandText);
                if (mySqlCommand.LastInsertedId > 0)
                {
                    relationPosition.Location.A = symbolID1.Location.A;
                    relationPosition.Location.B = (int)mySqlCommand.LastInsertedId;
                }
            }
            catch (MySqlException retrieveRelationIndexException)
            {
                Console.WriteLine("Error: {0}", retrieveRelationIndexException.ToString());
            }
            if (MyResultsTrace) SQLView.LogResult(relationPosition.ToString());
            relationPositions.Add(relationPosition);
            #region LOG
            //=== CUSTOM LOGGER===================================================================================
            ElementMethod thisMethod = new ElementMethod();
            int logLevel = -1; if (logingOptions != null) logLevel = logingOptions.levelNumbers;
            if (logLevel >= 3) // code
            {
                System.Diagnostics.StackTrace stackTrace; System.Diagnostics.StackFrame fr; stackTrace = new System.Diagnostics.StackTrace(); fr = stackTrace.GetFrame(0);
                thisMethod.ElementNamespaceName = this.GetType().Namespace;
                thisMethod.ElementClassName = this.GetType().Name;
                string methodName = fr.GetMethod().ToString();
                thisMethod.ElementName = fr.GetMethod().Name;
                thisMethod.ReturnType = methodName.Substring(0, methodName.IndexOf(" "));
            }
            if (logLevel >= 2) // parameters
            {
                thisMethod.Parameters.Add(new string[] { "int[] relationID", operatorID.ToString() });
                // thisMethod.Parameters.Add(new string[] { "int[] multiplicityA", ArrayToString(multiplicityA) });
                thisMethod.Parameters.Add(new string[] { "int[] symbolID1", symbolID1.ToString() });
                // thisMethod.Parameters.Add(new string[] { "int[] multiplicityB", ArrayToString(multiplicityB) });
                thisMethod.Parameters.Add(new string[] { "int[] symbolID2", symbolID2.ToString() });
            }
            if (logLevel >= 1) // results
            {
                string result = string.Empty;
                foreach (SymbolID symbolItem in relationPositions)
                {
                    result += "{" + symbolItem.Location.ToString() + "}";
                }
                thisMethod.Result = result;
            }
            LoggingSystem.LogMethod = thisMethod;

            //====================================================================================================
            #endregion LOG
            return relationPositions;
        }
Exemple #9
0
        /*
        internal void UpdateTreeView(EDocument document)
        {
            treeView1.Nodes.Clear();
            Wrap(document.RootTocken);
            foreach (TreeNode rootNode in treeView1.Nodes)
            {
                rootNode.ExpandAll();
            }
            ImageList imageList = new ImageList();
            imageList.Images.Add("class", Image.FromFile("..\\..\\IMG\\class.png"));
            imageList.Images.Add("property", Image.FromFile("..\\..\\IMG\\property.png"));
            imageList.Images.Add("method", Image.FromFile("..\\..\\IMG\\method.png"));
            imageList.Images.Add("increase", Image.FromFile("..\\..\\IMG\\increase.png"));
            imageList.Images.Add("decrease", Image.FromFile("..\\..\\IMG\\decrease.png"));
            imageList.Images.Add("increasedBy", Image.FromFile("..\\..\\IMG\\increasedBy.png"));
            imageList.Images.Add("decreasedBy", Image.FromFile("..\\..\\IMG\\decreasedBy.png"));
            treeView1.ImageList = imageList;
        }
        */
        /*
        List<SToken> words = new List<SToken>();
        */
        /*
        private void Wrap(SToken token)
        {
            while (token != null)
            {
                if (token.TokenType == SElementType.Symbol)
                {
                    TreeNode classNode = null;
                    CodeFile newCodeFile = new CodeFile();
                    ElementNamespace namespaceItem = new ElementNamespace();
                    ElementClass classItem = new ElementClass();

                    bool isNeededCodeFileCreation = true;
                    if (isNeededCodeFileCreation)
                    {
                        classNode = new TreeNode(token.TokenString);
                        classNode.ImageKey = "class";
                        classNode.Tag = token;
                        treeView1.Nodes.Add(classNode);
                    }


                    if (token.TokenProperties != null)
                    {
                        SToken tokenToRead = token;
                        if (token.TokenProperties[0].TokenNodeType == SElementType.FoldOpen)
                        {
                            foreach (SToken localTokenF in token.TokenProperties[0].TokenChilds)
                            {
                                SToken localToken = localTokenF;
                                while (localToken != null)
                                {
                                    Wrap(localToken);
                                    ElementProperty newProperty = new ElementProperty();
                                    TreeNode propertyNode = null;
                                    propertyNode.ImageKey = "property";
                                    switch (localToken.TokenMultiplicity)
                                    {
                                        case SElementMultiplicity.Some:
                                            propertyNode = new TreeNode(localToken.TokenString);
                                            propertyNode.Tag = token;
                                            classNode.Nodes.Add(propertyNode);
                                            break;
                                        case SElementMultiplicity.Explicit:
                                            propertyNode = new TreeNode(localToken.TokenString);
                                            propertyNode.Tag = token;
                                            classNode.Nodes.Add(propertyNode);
                                            break;
                                        default:
                                            propertyNode = new TreeNode(localToken.TokenString);
                                            propertyNode.Tag = token;
                                            classNode.Nodes.Add(propertyNode);
                                            break;
                                    }
                                    //newProperty.PropertyType = localToken.TokenString;
                                    newProperty.ElementClassName = ToUp(localToken.TokenString);
                                    classItem.ElementProperties.Add(newProperty);
                                    if (localToken.TokenAfter != null)
                                    {
                                        localToken = localToken.TokenAfter[0];
                                    }
                                    else
                                    {
                                        localToken = null;
                                    }
                                }
                            }
                        }
                        else
                            foreach (SToken localToken in token.TokenProperties)
                            {
                                //Wrap(localToken);
                                ElementProperty newProperty = new ElementProperty();
                                TreeNode propertyNode = null;
                                switch (localToken.TokenMultiplicity)
                                {
                                    case SElementMultiplicity.Some:
                                        propertyNode = new TreeNode(localToken.TokenString);
                                        propertyNode.Tag = token;
                                        propertyNode.ImageKey = "property";
                                        classNode.Nodes.Add(propertyNode);
                                        break;
                                    case SElementMultiplicity.Explicit:
                                        propertyNode = new TreeNode(localToken.TokenString);
                                        propertyNode.Tag = token;
                                        propertyNode.ImageKey = "property";
                                        classNode.Nodes.Add(propertyNode);
                                        break;
                                    default:
                                        propertyNode = new TreeNode(localToken.TokenString);
                                        propertyNode.Tag = token;
                                        propertyNode.ImageKey = "property";
                                        classNode.Nodes.Add(propertyNode);
                                        break;
                                }
                                //newProperty.PropertyType = localToken.TokenString;
                                newProperty.ElementClassName = ToUp(localToken.TokenString);
                                classItem.ElementProperties.Add(newProperty);
                            }
                    }
                    if (token.TokenActivities != null)
                    {
                        TreeNode actionNode = null;
                        foreach (SToken localToken in token.TokenActivities)
                        {
                            Wrap(localToken);
                            actionNode = new TreeNode(localToken.TokenString);
                            actionNode.Tag = token;
                            actionNode.ImageKey = "method";
                            classNode.Nodes.Add(actionNode);

                        }
                    }
                    if (token.TokenInfluenceA != null)
                    {
                        TreeNode actionNode = null;
                        foreach (SToken localToken in token.TokenInfluenceA)
                        {
                            ///if ()
                            //Wrap(localToken);
                            actionNode = new TreeNode(localToken.TokenString);
                            actionNode.Tag = token;
                            actionNode.ImageKey = "increase";
                            classNode.Nodes.Add(actionNode);

                        }
                    }

                    if (token.TokenInfluenceB != null)
                    {
                        TreeNode actionNode = null;
                        foreach (SToken localToken in token.TokenInfluenceB)
                        {
                            // Wrap(localToken);
                            actionNode = new TreeNode(localToken.TokenString);
                            actionNode.Tag = token;
                            actionNode.ImageKey = "decrease";
                            classNode.Nodes.Add(actionNode);

                        }
                    }

                    if (token.TokenInfluenceC != null)
                    {
                        TreeNode actionNode = null;
                        foreach (SToken localToken in token.TokenInfluenceC)
                        {
                            Wrap(localToken);
                            actionNode = new TreeNode(localToken.TokenString);
                            actionNode.Tag = token;
                            actionNode.ImageKey = "increasedBy";
                            classNode.Nodes.Add(actionNode);

                        }
                    }

                    if (token.TokenInfluenceD != null)
                    {
                        TreeNode actionNode = null;
                        foreach (SToken localToken in token.TokenInfluenceD)
                        {
                            Wrap(localToken);
                            actionNode = new TreeNode(localToken.TokenString);
                            actionNode.Tag = token;
                            actionNode.ImageKey = "decreasedBy";
                            classNode.Nodes.Add(actionNode);

                        }
                    }

                }
                foreach (SToken tokenlist in token.TokenChilds)
                {
                    Wrap(tokenlist);
                }
                if (token.TokenAfter != null)
                {
                    token = token.TokenAfter[0];
                }
                else
                {
                    token = null;
                }
            }
        }
        */

        private void PrepareRelations()
        {
            List<SymbolID> rels = new List<SymbolID>();
            relationCollection.GetAllOperators();
            r2 = relationCollection.operatorCollection[0];
            comboBox1.Items.Add("-All Operations-");
            foreach (OperatorID r in relationCollection.operatorCollection)
            {
                comboBox1.Items.Add(r.Names[0]);

            }
            comboBox1.SelectedIndex = 2;
        }