public static string LowerEqualStatic(string leftValue, string rightValue,
                                              string balancedType, string leftType, string rightType, IGraphModel model)
        {
            // byte and short are only used for storing, no computations are done with them
            // enums are handled via int
            if (balancedType == "int")
            {
                return("((int)" + leftValue + " <= " + "(int)" + rightValue + ")");
            }
            else if (balancedType == "long")
            {
                return("((long)" + leftValue + " <= " + "(long)" + rightValue + ")");
            }
            else if (balancedType == "float")
            {
                return("((float)" + leftValue + " <= " + "(float)" + rightValue + ")");
            }
            else if (balancedType == "double")
            {
                return("((double)" + leftValue + " <= " + "(double)" + rightValue + ")");
            }
            else if (balancedType.StartsWith("set<"))
            {
                return("GRGEN_LIBGR.ContainerHelper.LessOrEqualIDictionary((IDictionary)" + leftValue + ", (IDictionary)" + rightValue + ")");
            }
            else if (balancedType.StartsWith("map<"))
            {
                return("GRGEN_LIBGR.ContainerHelper.LessOrEqualIDictionary((IDictionary)" + leftValue + ", (IDictionary)" + rightValue + ")");
            }
            else if (balancedType.StartsWith("array<"))
            {
                return("GRGEN_LIBGR.ContainerHelper.LessOrEqualIList((IList)" + leftValue + ", (IList)" + rightValue + ")");
            }
            else if (balancedType.StartsWith("deque<"))
            {
                return("GRGEN_LIBGR.ContainerHelper.LessOrEqualDeque((Deque)" + leftValue + ", (Deque)" + rightValue + ")");
            }
            else if (TypesHelper.IsExternalObjectTypeIncludingObjectType(balancedType, model))
            {
                return("(graph.Model.IsLower((object)" + leftValue + ", (object)" + rightValue + ")"
                       + " || graph.Model.IsEqual((object)" + leftValue + ", (object)" + rightValue + "))");
            }

            return(null);
        }
        /// <summary>
        /// Returns the types to which the operands must be casted to,
        /// assuming an external type equality or ordering operator.
        /// Returns "" if the type can only be determined at runtime.
        /// Returns "-" in case of a type error and/or if no operator working on external types can be applied.
        /// </summary>
        private static string BalanceExternalObjectType(string left, string right, IGraphModel model)
        {
            if (left == right)
            {
                return(left);
            }

            if (left == "" || right == "")
            {
                return("");
            }

            if (TypesHelper.IsSameOrSubtype(left, right, model) && TypesHelper.IsExternalObjectTypeIncludingObjectType(right, model))
            {
                return(right);
            }

            if (TypesHelper.IsSameOrSubtype(right, left, model) && TypesHelper.IsExternalObjectTypeIncludingObjectType(left, model))
            {
                return(left);
            }

            return("-");
        }
 public static string NotEqualStatic(string leftValue, string rightValue,
                                     string balancedType, string leftType, string rightType, IGraphModel model)
 {
     // byte and short are only used for storing, no computations are done with them
     // enums are handled via int, node and edges are handled via reference equality
     if (balancedType == "int")
     {
         return("((int)" + leftValue + " != " + "(int)" + rightValue + ")");
     }
     else if (balancedType == "long")
     {
         return("((long)" + leftValue + " != " + "(long)" + rightValue + ")");
     }
     else if (balancedType == "float")
     {
         return("((float)" + leftValue + " != " + "(float)" + rightValue + ")");
     }
     else if (balancedType == "double")
     {
         return("((double)" + leftValue + " != " + "(double)" + rightValue + ")");
     }
     else if (balancedType == "boolean")
     {
         return("((bool)" + leftValue + " != " + "(bool)" + rightValue + ")");
     }
     else if (balancedType == "string")
     {
         return("((string)" + leftValue + " != " + "(string)" + rightValue + ")");
     }
     else if (balancedType == "graph")
     {
         return("!GRGEN_LIBGR.GraphHelper.Equal((GRGEN_LIBGR.IGraph)" + leftValue + ", (GRGEN_LIBGR.IGraph)" + rightValue + ")");
     }
     else if (balancedType.StartsWith("set<"))
     {
         return("GRGEN_LIBGR.ContainerHelper.NotEqualIDictionary((IDictionary)" + leftValue + ", (IDictionary)" + rightValue + ")");
     }
     else if (balancedType.StartsWith("map<"))
     {
         return("GRGEN_LIBGR.ContainerHelper.NotEqualIDictionary((IDictionary)" + leftValue + ", (IDictionary)" + rightValue + ")");
     }
     else if (balancedType.StartsWith("array<"))
     {
         return("GRGEN_LIBGR.ContainerHelper.NotEqualIList((IList)" + leftValue + ", (IList)" + rightValue + ")");
     }
     else if (balancedType.StartsWith("deque<"))
     {
         return("GRGEN_LIBGR.ContainerHelper.NotEqualDeque((Deque)" + leftValue + ", (Deque)" + rightValue + ")");
     }
     else if (TypesHelper.IsExternalObjectTypeIncludingObjectType(balancedType, model))
     {
         return("!graph.Model.IsEqual((object)" + leftValue + ", (object)" + rightValue + ")");
     }
     else if (model.ObjectModel.GetType(balancedType) != null)
     {
         return("!GRGEN_LIBGR.ContainerHelper.IsEqual((GRGEN_LIBGR.IObject)" + leftValue + ", (GRGEN_LIBGR.IObject)" + rightValue + ")");
     }
     else if (model.TransientObjectModel.GetType(balancedType) != null)
     {
         return("!GRGEN_LIBGR.ContainerHelper.IsEqual((GRGEN_LIBGR.ITransientObject)" + leftValue + ", (GRGEN_LIBGR.ITransientObject)" + rightValue + ")");
     }
     else
     {
         return("!object.Equals(" + leftValue + ", " + rightValue + ")");
     }
 }