Пример #1
0
 public INamedGraph CreateNamedGraph(IGraphModel graphModel, string graphName, params String[] parameters)
 {
     String assemblyName = Assembly.GetAssembly(graphModel.GetType()).Location;
     int capacity = 0;
     if(parameters != null)
         foreach(String parameter in parameters)
             if(parameter.StartsWith("capacity="))
                 capacity = int.Parse(parameter.Substring("capacity=".Length));
     return new LGSPNamedGraph(this, graphModel, graphName, assemblyName, capacity);
 }
Пример #2
0
        public INamedGraph CreateNamedGraph(IGraphModel graphModel, string graphName, params String[] parameters)
        {
            String assemblyName = Assembly.GetAssembly(graphModel.GetType()).Location;
            int    capacity     = 0;

            if (parameters != null)
            {
                foreach (String parameter in parameters)
                {
                    if (parameter.StartsWith("capacity="))
                    {
                        capacity = int.Parse(parameter.Substring("capacity=".Length));
                    }
                }
            }
            return(new LGSPNamedGraph(this, graphModel, graphName, assemblyName, capacity));
        }
Пример #3
0
        /// <summary>
        /// Initializes the graph with the given model.
        /// </summary>
        /// <param name="grmodel">The model for this graph.</param>
        protected void InitializeGraph(IGraphModel grmodel)
        {
            model = grmodel;
            if(statistics.graphModel == null)
                statistics.graphModel = grmodel;

            modelAssemblyName = Assembly.GetAssembly(grmodel.GetType()).Location;

            InitializeGraph();

            grmodel.CreateAndBindIndexSet(this);
        }
Пример #4
0
        /// <summary>
        /// Returns type object for type name string
        /// </summary>
        /// <param name="typeName">Name of the type we want some type object for</param>
        /// <param name="model">Graph model to be search for enum,node,edge types / enum,node/edge type names</param>
        /// <returns>The type object corresponding to the given string, null if type was not found</returns>
        public static Type GetType(String typeName, IGraphModel model)
        {
            if (typeName == null)
            {
                return(null);
            }

            switch (typeName)
            {
            case "boolean": return(typeof(bool));

            case "byte": return(typeof(sbyte));

            case "short": return(typeof(short));

            case "int": return(typeof(int));

            case "long": return(typeof(long));

            case "float": return(typeof(float));

            case "double": return(typeof(double));

            case "string": return(typeof(string));

            case "object": return(typeof(object));

            case "graph": return(typeof(IGraph));
            }

            if (model == null)
            {
                return(null);
            }

            // No standard type, so check enums
            foreach (EnumAttributeType enumAttrType in model.EnumAttributeTypes)
            {
                if (enumAttrType.PackagePrefixedName == typeName)
                {
                    return(enumAttrType.EnumType);
                }
            }

            Assembly assembly = Assembly.GetAssembly(model.GetType());

            // check node and edge types
            foreach (NodeType nodeType in model.NodeModel.Types)
            {
                if (nodeType.PackagePrefixedName == typeName)
                {
                    Type type = Type.GetType(nodeType.NodeInterfaceName); // available in libGr (INode)?
                    if (type != null)
                    {
                        return(type);
                    }
                    type = Type.GetType(nodeType.NodeInterfaceName + "," + assembly.FullName); // no -> search model assembly
                    return(type);
                }
            }
            foreach (EdgeType edgeType in model.EdgeModel.Types)
            {
                if (edgeType.PackagePrefixedName == typeName)
                {
                    Type type = Type.GetType(edgeType.EdgeInterfaceName); // available in libGr (IEdge)?
                    if (type != null)
                    {
                        return(type);
                    }
                    type = Type.GetType(edgeType.EdgeInterfaceName + "," + assembly.FullName); // no -> search model assembly
                    return(type);
                }
            }

            return(null);
        }
Пример #5
0
        // ------------------------------------------------------------------------------------------------

        public static Type GetType(GrGenType type, IGraphModel model)
        {
            if (type is NodeType)
            {
                NodeType nodeType = (NodeType)type;
                if (Type.GetType(nodeType.NodeInterfaceName) != null) // available in libGr (INode)?
                {
                    return(Type.GetType(nodeType.NodeInterfaceName));
                }
                else
                {
                    return(Type.GetType(nodeType.NodeInterfaceName + "," + Assembly.GetAssembly(model.GetType()).FullName)); // no -> search model assembly
                }
            }
            else if (type is EdgeType)
            {
                EdgeType edgeType = (EdgeType)type;
                if (Type.GetType(edgeType.EdgeInterfaceName) != null) // available in libGr (INode)?
                {
                    return(Type.GetType(edgeType.EdgeInterfaceName));
                }
                else
                {
                    return(Type.GetType(edgeType.EdgeInterfaceName + "," + Assembly.GetAssembly(model.GetType()).FullName)); // no -> search model assembly
                }
            }
            else
            {
                VarType varType = (VarType)type;
                return(varType.Type);
            }
        }
Пример #6
0
 public IGraph CreateGraph(IGraphModel graphModel, string graphName, params String[] parameters)
 {
     String assemblyName = Assembly.GetAssembly(graphModel.GetType()).Location;
     return new LGSPGraph(this, graphModel, graphName, assemblyName);
 }
Пример #7
0
        public IGraph CreateGraph(IGraphModel graphModel, string graphName, params String[] parameters)
        {
            String assemblyName = Assembly.GetAssembly(graphModel.GetType()).Location;

            return(new LGSPGraph(this, graphModel, graphName, assemblyName));
        }