private ISet <string> GetNamespaceIdentifiersFromComponentOf(PlantUmlComponent component)
        {
            var result = ImmutableHashSet.CreateBuilder <string>();

            foreach (Stereotype stereotype in component.Stereotypes)
            {
                result.Add(stereotype.AsString());
            }
            return(result.ToImmutable());
        }
예제 #2
0
        private IEnumerable <ParsedDependency> ParseDependencies(PlantUmlComponents plantUmlComponents, IEnumerable <string> plantUmlDiagramLines)
        {
            var result = new List <ParsedDependency>();

            foreach (PlantUmlDependencyMatcher matcher in _plantUmlPatterns.MatchDependencies(plantUmlDiagramLines))
            {
                PlantUmlComponent origin = FindComponentMatching(plantUmlComponents, matcher.MatchOrigin);
                PlantUmlComponent target = FindComponentMatching(plantUmlComponents, matcher.MatchTarget);
                result.Add(new ParsedDependency(origin.Identifier, target.Identifier));
            }
            return(result);
        }
        private void Finish(PlantUmlComponent component)
        {
            var dependencies = ImmutableList.CreateBuilder <PlantUmlComponentDependency>();

            if (_originToParsedDependency.ContainsKey(component.Identifier))
            {
                foreach (ParsedDependency dependencyOriginatingFromComponent in _originToParsedDependency[component.Identifier])
                {
                    PlantUmlComponent target = _plantUmlComponents.findComponentWith(dependencyOriginatingFromComponent.Target);
                    dependencies.Add(new PlantUmlComponentDependency(component, target));
                }
            }
            component.Finish(dependencies.ToImmutable());
        }
예제 #4
0
        internal PlantUmlComponent FindComponentWith(string nameOrAlias)
        {
            ComponentName     componentName = new ComponentName(nameOrAlias);
            Alias             alias         = new Alias(nameOrAlias);
            PlantUmlComponent result        = null;

            if (_componentsByAlias.ContainsKey(alias))
            {
                result = _componentsByAlias[alias];
            }
            else if (_componentsByName.ContainsKey(componentName))
            {
                result = _componentsByName[componentName];
            }
            if (result == null)
            {
                throw new IllegalDiagramException(string.Format("There is no Component with name or alias = '{0}'. {1}", nameOrAlias,
                                                                "Components must be specified separately from dependencies."));
            }
            return(result);
        }
 public AssociatedComponent(PlantUmlComponent component)
 {
     _component = component;
 }
 public PlantUmlComponentDependency(PlantUmlComponent component, PlantUmlComponent target)
 {
     Component = component ?? throw new System.ArgumentNullException(nameof(component));
     Target    = target ?? throw new System.ArgumentNullException(nameof(target));
 }