Beispiel #1
0
        public bool ConformsToComposite(Classifier other)
        {
            TupleType otherType = other as TupleType;

            if (otherType == null)
            {
                return(false);
            }

            foreach (var otherVar in otherType)
            {
                Property thisVar;
                if (TupleParts.TryGetValue(otherVar.Name, out thisVar) == false)
                {
                    return(false);
                }

                if (thisVar.Type.ConformsTo(otherVar.Type) == false)
                {
                    return(false);// other neobsahuje propertu nebo neodpovida typ
                }
            }
            return(true);
        }
Beispiel #2
0
 public CollectionType(TypesTable.TypesTable tt, Classifier elemetnType, Classifier superClassifier)
     : this(tt, CollectionKind.Collection, elemetnType, superClassifier)
 {
 }
Beispiel #3
0
        public Classifier CommonSuperType <T>(Func <TypesTable.TypesTable, Classifier, T> creator, Classifier other) where T : CollectionType
        {
            if (other is T)
            {
                Classifier commonElementType = this.ElementType.CommonSuperType(((T)other).ElementType);

                if (commonElementType != null)
                {
                    CollectionType commenType = creator(TypeTable, commonElementType);
                    TypeTable.RegisterType(commenType);
                    return(commenType);
                }
            }
            return(null);
        }
Beispiel #4
0
 public SetType(TypesTable.TypesTable tt, Classifier elemetnType, Classifier superClassifier)
     : base(tt, CollectionKind.Set, elemetnType, superClassifier)
 {
 }
Beispiel #5
0
 public Parameter([Localizable(false)] string name, Classifier type)
 {
     _Name = name;
     _Type = type;
 }
Beispiel #6
0
 public bool ConformsToSimple(Classifier other)
 {
     return(TypeTable.ConformsTo(this, other, true));
 }
Beispiel #7
0
 public override bool ConformsToRegister(Classifier other)
 {
     return(true);
 }
Beispiel #8
0
 public override bool ConformsToRegister(Classifier other)
 {
     return(other == TypeTable.Library.Any);
 }
Beispiel #9
0
 public virtual Classifier CommonSuperType(Classifier other)
 {
     return(TypeTable.CommonSuperType(this, other));
 }
Beispiel #10
0
        /* public override int GetHashCode() {
         *   return QualifiedName.GetHashCode();
         * }
         *
         * public override bool Equals(object obj) {
         *   if (obj is Classifier != true) {
         *       return false;
         *   }
         *   return QualifiedName == ((Classifier)obj).QualifiedName;
         * }*/

        public virtual bool ConformsTo(Classifier other)
        {
            return(TypeTable.ConformsTo(this, other));
        }
Beispiel #11
0
 public DataType(TypesTable.TypesTable tt, Namespace ns, string name, Classifier superClassifier)
     : base(tt, ns, name, superClassifier)
 {
 }
Beispiel #12
0
 internal PropertyCollection(Classifier owner)
 {
     this.owner = owner;
 }
Beispiel #13
0
 internal OperationList(Classifier owner, string operationName)
 {
     this.owner       = owner;
     NameOfOperations = operationName;
 }
Beispiel #14
0
 internal OperationCollection(Classifier owner)
 {
     this.owner = owner;
 }
Beispiel #15
0
 protected CollectionType(TypesTable.TypesTable tt, CollectionKind collectionKind, Classifier elemetnType, Classifier superClassifier)
     : base(tt, new Namespace("isolatedNS"), GetName(collectionKind, elemetnType), superClassifier)
 {
     this.CollectionKind = collectionKind;
     this.ElementType    = elemetnType;
 }
Beispiel #16
0
 private static string GetName(CollectionKind kind, Classifier elemetnType)
 {
     return(String.Format("{0}({1})", kind.ToString(), elemetnType.QualifiedName));
 }
Beispiel #17
0
 public Classifier(TypesTable.TypesTable tt, Namespace ns, string name, Classifier superClassifier)
     : this(tt, ns, name)
 {
     this.SuperClassifier = superClassifier;
 }
Beispiel #18
0
 public override bool ConformsTo(Classifier other)
 {
     return(ConformsToRegister(other));
 }
Beispiel #19
0
 public override bool ConformsToRegister(Classifier other)
 {
     return(other.GetType() != typeof(InvalidType));
 }
Beispiel #20
0
 public bool ConformsToComposite(Classifier other)
 {
     return(true);
 }
Beispiel #21
0
 public override Classifier CommonSuperType(Classifier other)
 {
     return(other);
 }
Beispiel #22
0
 public VariableDeclaration(string name, Classifier propertyType, OclExpression value)
 {
     this.Name         = name;
     this.PropertyType = propertyType;
     this.Value        = value;
 }
Beispiel #23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sourceType"></param>
 /// <param name="_bodyType"></param>
 /// <param name="tt"></param>
 /// <returns></returns>
 public Classifier BodyType(CollectionType sourceType, Classifier _bodyType, TypesTable.TypesTable tt)
 {
     return(bodyType(sourceType, _bodyType, tt));
 }