Ejemplo n.º 1
0
 public Dependency(string dependantId, string dependsOnId, DependencyDirection direction, bool enforce)
 {
     DependantId = dependantId;
     DependsOnId = dependsOnId;
     Direction   = direction;
     Enforce     = enforce;
 }
Ejemplo n.º 2
0
        public List <DatabaseObject> GetDependencies(int databaseObjectId, DependencyDirection direction, DependencyLevel level, DatabaseObjectType?objectsType)
        {
            EnforceDatabaseObjectId(databaseObjectId);
            DatabaseObject databaseObject = Keys[databaseObjectId];

            return(GetDependencies(databaseObject, direction, level, objectsType));
        }
Ejemplo n.º 3
0
        public List <T> GetDependencies(int symbolId, DependencyDirection direction, DependencyLevel level)
        {
            if (symbolId < 0 || symbolId >= SymbolTable.Count)
            {
                throw new ArgumentException(nameof(symbolId));
            }
            Digraph           g = direction == DependencyDirection.Downstream ? Digraph : Digraph.Reverse();
            IEnumerable <int> symbolIndexes;

            if (level == DependencyLevel.DirectOnly)
            {
                // That's easy
                symbolIndexes = g.GetAdjList(symbolId);
            }
            else
            {
                // Run BFS to find out
                var bfs = new DigraphBfs(g, symbolId);
                symbolIndexes = bfs.Preorder;
            }

            List <T> symbols = symbolIndexes
                               .Select(i => Keys[i])
                               .ToList();

            return(symbols);
        }
Ejemplo n.º 4
0
 public Dependency(string dependantId, string dependsOnId, DependencyDirection direction, bool enforce)
 {
     DependantId = dependantId;
     DependsOnId = dependsOnId;
     Direction = direction;
     Enforce = enforce;
 }
Ejemplo n.º 5
0
 public List <T> GetDependencies(T symbol, DependencyDirection direction, DependencyLevel level)
 {
     if (!SymbolTable.ContainsKey(symbol))
     {
         throw new ArgumentException(nameof(symbol));
     }
     return(GetDependencies(SymbolTable[symbol], direction, level));
 }
Ejemplo n.º 6
0
        public List <DatabaseObject> GetDependencies(DatabaseObject databaseObject, DependencyDirection direction, DependencyLevel level, DatabaseObjectType?objectsType = null)
        {
            if (!SymbolTable.ContainsKey(databaseObject))
            {
                throw new ArgumentException(nameof(databaseObject));
            }

            var items = GetDependencies(SymbolTable[databaseObject], direction, level);

            return(objectsType == null ? items : items.Where(w => w.ObjectType == objectsType).ToList());
        }
Ejemplo n.º 7
0
        private Texture2D GetArrowByDirection(DependencyDirection direction)
        {
            switch (direction)
            {
            case DependencyDirection.Up:
                return(_mainWindow.ArrowUp);

            case DependencyDirection.Down:
                return(_mainWindow.ArrowDown);

            case DependencyDirection.Left:
                return(_mainWindow.ArrowLeft);

            case DependencyDirection.Right:
                return(_mainWindow.ArrowRight);
            }

            return(null);
        }
Ejemplo n.º 8
0
        private void DrawCurveReferences(Rect start, Rect end, NodeVisual visual, DependencyDirection direction)
        {
            var xOffset = start.position.x > end.position.x ? 10 : -10;

            var startPos = new Vector3(
                start.x + start.width * 0.5f,
                start.y + start.height,
                0
                );
            var endPos = new Vector3(
                end.x + end.width * 0.5f + xOffset,
                end.y,
                0
                );

            var startTan = startPos + Vector3.up * 25;
            var endTan   = endPos + Vector3.down * 75;


            for (var i = 1; i < 4; i++)
            {
                var shadow = new Color32(visual.LineShadowColor.r, visual.LineShadowColor.g, visual.LineShadowColor.b, (byte)Mathf.Clamp(i * 30f, 0, 255));
                Handles.DrawBezier(startPos, endPos, startTan, endTan, shadow, null, i * 2);
            }

            Handles.DrawBezier(startPos, endPos, startTan, endTan, visual.LineColor, null, 3);

            var arrowSize     = 14;
            var arrowPosition = startPos + new Vector3(-arrowSize / 2, -2);

            if (direction == DependencyDirection.Down)
            {
                arrowPosition = endPos + new Vector3(-arrowSize / 2, -12);
            }

            DrawArrow(arrowPosition, arrowSize, GetArrowByDirection(direction), visual);
        }
Ejemplo n.º 9
0
        public IList <ViewModels.DatabaseObject> Get(int objectId, DependencyDirection direction, DependencyLevel level, DatabaseObjectType?objectsType = null)
        {
            var items = _graph.GetDependencies(objectId, direction, level, objectsType);

            return(Mapper.Map <List <ViewModels.DatabaseObject> >(items));
        }
Ejemplo n.º 10
0
        public IList <ViewModels.Module> Get(int moduleId, DependencyDirection direction, DependencyLevel level)
        {
            var items = _graph.GetDependencies(moduleId, direction, level);

            return(Mapper.Map <List <ViewModels.Module> >(items));
        }