예제 #1
0
        public TinkerGrapĥ(string directory, FileType fileType)
        {
            if (string.IsNullOrWhiteSpace(directory))
            {
                throw new ArgumentNullException(nameof(directory));
            }

            VertexKeyIndex = new TinkerKeyIndex(typeof(TinkerVertex), this);
            EdgeKeyIndex   = new TinkerKeyIndex(typeof(TinkerEdge), this);

            _directory = directory;
            _fileType  = fileType;

            if (!Directory.Exists(_directory))
            {
                Directory.CreateDirectory(_directory);
            }
            else
            {
                var tinkerStorage = TinkerStorageFactory.GetInstance().GetTinkerStorage(fileType);
                var graph         = tinkerStorage.Load(directory);

                InnerVertices  = graph.InnerVertices;
                Edges          = graph.Edges;
                CurrentId      = graph.CurrentId;
                Indices        = graph.Indices;
                VertexKeyIndex = graph.VertexKeyIndex;
                EdgeKeyIndex   = graph.EdgeKeyIndex;
            }
        }
예제 #2
0
 public TinkerGrapĥ()
 {
     VertexKeyIndex = new TinkerKeyIndex(typeof(TinkerVertex), this);
     EdgeKeyIndex   = new TinkerKeyIndex(typeof(TinkerEdge), this);
     _directory     = null;
     _fileType      = FileType.DotNet;
 }
예제 #3
0
 public void Clear()
 {
     InnerVertices.Clear();
     Edges.Clear();
     Indices.Clear();
     CurrentId      = 0;
     VertexKeyIndex = new TinkerKeyIndex(typeof(TinkerVertex), this);
     EdgeKeyIndex   = new TinkerKeyIndex(typeof(TinkerEdge), this);
 }