public DependencyPropertyValueRule(DependencyPropertySelector selector,
                                    ObjectDeclaration declaration)
 {
     Selector    = selector;
     _hashCode   = selector.GetHashCode() & declaration.GetHashCode();
     Declaration = declaration;
 }
コード例 #2
0
ファイル: FRMObjectViewer.cs プロジェクト: emir452/DeltaUML
 private void SetUpDGV()
 {
     if (objectDeclarations.Count == 0)
     {
         ObjectDeclaration od = new ObjectDeclaration();
         od.objectName = "Object1";
         od.className  = "Class1";
         objectDeclarations.Add(od);
     }
     dgv.DataSource = objectDeclarations;
 }
コード例 #3
0
        public IStyleRule?GetRule(IMarkupNode markupNode,
                                  Type targetType)
        {
            if (markupNode.TryGetAttributeValue(nameof(DependencyPropertySelector.Property),
                                                out var propertyName))
            {
                if (DependencyProperty.TryGetDependecyProperty(targetType, propertyName, out var depProp))
                {
                    var selector = new DependencyPropertySelector(depProp);

                    var propVal = BuildPropertyValue(depProp, markupNode);

                    var objDeclaration = new ObjectDeclaration(propVal);

                    return(new DependencyPropertyValueRule(selector, objDeclaration));
                }
            }

            throw new NotImplementedException();
        }
コード例 #4
0
            public List <object> GetLocalListOfObjects()
            {
                List <object> res = new List <object>();

                foreach (E declaration in this)
                {
                    if (declaration is EnumerationType)
                    {
                        EnumerationType type = declaration as EnumerationType;
                        res.Add(type);


                        //TODO: support overloading
                        foreach (EnumerationLiteral literal in type.Literals)
                        {
                            res.Add(literal);
                        }
                    }
                    else if (declaration is RecordType)
                    {
                        RecordType type = declaration as RecordType;
                        res.Add(type);
                        foreach (VHDL.type.RecordType.ElementDeclaration el in type.Elements)
                        {
                            foreach (string name in el.Identifiers)
                            {
                                res.Add(name);
                            }
                        }
                    }
                    else if (declaration is PhysicalType)
                    {
                        PhysicalType type = declaration as PhysicalType;
                        res.Add(type);
                        res.Add(new PhysicalLiteral(null, type.PrimaryUnit, declaration as PhysicalType));

                        foreach (PhysicalType.Unit unit in type.Units)
                        {
                            res.Add(unit.Identifier);
                        }
                    }
                    else if (declaration is NamedEntity)
                    {
                        INamedEntity identElement = (NamedEntity)declaration;
                        res.Add(declaration);
                    }
                    else if (declaration is SignalDeclaration)
                    {
                        SignalDeclaration objDecl = declaration as SignalDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            res.Add(o);
                        }
                    }
                    else if (declaration is ConstantDeclaration)
                    {
                        ConstantDeclaration objDecl = declaration as ConstantDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            res.Add(o);
                        }
                    }
                    else if (declaration is VariableDeclaration)
                    {
                        VariableDeclaration objDecl = declaration as VariableDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            res.Add(o);
                        }
                    }
                    else if (declaration is FileDeclaration)
                    {
                        FileDeclaration objDecl = declaration as FileDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            res.Add(o);
                        }
                    }
                    else if (declaration is Alias)
                    {
                        res.Add(declaration);
                    }
                    else if (declaration is Subtype)
                    {
                        res.Add(declaration);
                    }
                    else if (declaration is UseClause)
                    {
                        UseClause use = declaration as UseClause;
                        res.AddRange(use.Scope.GetLocalListOfObjects());
                    }
                    else if (declaration.GetType().BaseType == typeof(ObjectDeclaration <>))
                    {
                        ObjectDeclaration <VhdlObject> objDecl = declaration as ObjectDeclaration <VhdlObject>;
                        foreach (VhdlObject o in objDecl.Objects)
                        {
                            res.Add(o);
                        }
                    }
                }
                return(res);
            }
コード例 #5
0
            public object Resolve(string identifier)
            {
                foreach (E declaration in this)
                {
                    if (declaration is EnumerationType)
                    {
                        EnumerationType type = declaration as EnumerationType;
                        if (identifier.EqualsIdentifier(type.Identifier))
                        {
                            return(type);
                        }

                        //TODO: support overloading
                        foreach (EnumerationLiteral literal in type.Literals)
                        {
                            if (identifier.EqualsIdentifier(literal.ToString()))
                            {
                                return(literal);
                            }
                        }
                    }
                    else if (declaration is RecordType)
                    {
                        RecordType type = declaration as RecordType;
                        if (identifier.EqualsIdentifier(type.Identifier))
                        {
                            return(type);
                        }
                        foreach (VHDL.type.RecordType.ElementDeclaration el in type.Elements)
                        {
                            foreach (string name in el.Identifiers)
                            {
                                if (identifier.EqualsIdentifier(name))
                                {
                                    return(new Variable(name, el.Type));
                                }
                            }
                        }
                    }
                    else if (declaration is PhysicalType)
                    {
                        PhysicalType type = declaration as PhysicalType;
                        if (identifier.EqualsIdentifier(type.Identifier))
                        {
                            return(type);
                        }

                        //TODO: don't use strings for the physical literals
                        if (identifier.EqualsIdentifier(type.PrimaryUnit))
                        {
                            return(new PhysicalLiteral(null, type.PrimaryUnit, declaration as PhysicalType));
                        }

                        foreach (PhysicalType.Unit unit in type.Units)
                        {
                            if (identifier.EqualsIdentifier(unit.Identifier))
                            {
                                return(new PhysicalLiteral(null, unit.Identifier, declaration as PhysicalType));
                            }
                        }
                    }
                    else if (declaration is NamedEntity)
                    {
                        INamedEntity identElement = (NamedEntity)declaration;
                        if (identifier.EqualsIdentifier(identElement.Identifier))
                        {
                            return(declaration);
                        }
                    }
                    else if (declaration is SignalDeclaration)
                    {
                        SignalDeclaration objDecl = declaration as SignalDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            if (o.Identifier.EqualsIdentifier(identifier))
                            {
                                return(o);
                            }
                        }
                    }
                    else if (declaration is ConstantDeclaration)
                    {
                        ConstantDeclaration objDecl = declaration as ConstantDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            if (o.Identifier.EqualsIdentifier(identifier))
                            {
                                return(o);
                            }
                        }
                    }
                    else if (declaration is VariableDeclaration)
                    {
                        VariableDeclaration objDecl = declaration as VariableDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            if (o.Identifier.EqualsIdentifier(identifier))
                            {
                                return(o);
                            }
                        }
                    }
                    else if (declaration is FileDeclaration)
                    {
                        FileDeclaration objDecl = declaration as FileDeclaration;
                        foreach (var o in objDecl.Objects)
                        {
                            if (o.Identifier.EqualsIdentifier(identifier))
                            {
                                return(o);
                            }
                        }
                    }
                    else if (declaration is Alias)
                    {
                        Alias objDecl = declaration as Alias;
                        if (objDecl.Designator.EqualsIdentifier(identifier))
                        {
                            return(objDecl.Aliased);//new Variable(objDecl.Aliased, objDecl.SubtypeIndication);
                        }
                    }
                    else if (declaration is Subtype)
                    {
                        Subtype objDecl = declaration as Subtype;
                        if (objDecl.Identifier.EqualsIdentifier(identifier))
                        {
                            return(objDecl);
                        }
                    }
                    else if (declaration is UseClause)
                    {
                        UseClause use = declaration as UseClause;
                        object    res = use.Scope.resolve(identifier);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                    else if (declaration.GetType().BaseType == typeof(ObjectDeclaration <>))
                    {
                        ObjectDeclaration <VhdlObject> objDecl = declaration as ObjectDeclaration <VhdlObject>;
                        foreach (VhdlObject o in objDecl.Objects)
                        {
                            if (o.Identifier.EqualsIdentifier(identifier))
                            {
                                return(o);
                            }
                        }
                    }
                }

                return(null);
            }