The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
NameSpaceType.cs
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
3 // Project rROTOR
4 // --------------------------------------------------------------------------
5 // File: NameSpaceType.cs
6 // Author: Francisco Ortin - francisco.ortin@gmail.com
7 // Description:
8 // Represents a type obtained when explicitely using namespaces IDs.
9 // Eg: "System.Diagnostics".Debug
10 // Inheritance: TypeExpression.
11 // Implements Composite pattern [Leaf].
12 // --------------------------------------------------------------------------
13 // Create date: 06-04-2007
14 // Modification date: 06-04-2007
16 //Visto
17 using System;
18 using System.Collections.Generic;
19 using System.Text;
20 using Tools;
21 using TypeSystem.Operations;
22 
23 namespace TypeSystem {
27  public class NameSpaceType : TypeExpression {
28 
29  #region Fields
30  private string name;
34  #endregion
35 
36 
37  #region Properties
38  public string Name {
42  get { return name; }
43  set { name = value; }
44  }
45  #endregion
46 
47  #region Constructors
48  public NameSpaceType(string name) {
49  this.name = name;
50  this.fullName = name;
51  }
52 
53  public NameSpaceType(string name,string fullname)
54  {
55  this.name = name;
56  this.fullName = fullname;
57  }
58  #endregion
59 
60  #region Dispatcher
61  public override object AcceptOperation(TypeSystemOperation op, object arg) { return op.Exec(this, arg); }
62  #endregion
63 
64  #region Unify()
65  public override bool Unify(TypeExpression te, SortOfUnification unification, IList<Pair<TypeExpression, TypeExpression>> previouslyUnified) {
73  return false;
74  }
75 
81  public NameSpaceType concat(string subNamespace) {
82  this.name = String.Format("{0}.{1}", this.name, subNamespace);
83  this.fullName = this.name;
84  return this;
85  }
86 
87  #region ToString()
88  public override string ToString() {
89  return this.name;
90  }
91 
92  #endregion
93  #endregion
94 
95  #region IsValueType()
96 
101  public override bool IsValueType()
102  {
103  return false;
104  }
105 
106  #endregion
107 
108  }
109 }
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Abstract class that represents all different types.
NameSpaceType(string name, string fullname)
override bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
WriteType of a namespace
NameSpaceType(string name)
NameSpaceType concat(string subNamespace)
Modifies this namespace to create it as a child namespace
override bool Unify(TypeExpression te, SortOfUnification unification, IList< Pair< TypeExpression, TypeExpression >> previouslyUnified)
This method unifies two type expressions (this and te)
override string ToString()
override object AcceptOperation(TypeSystemOperation op, object arg)
string Name
The qualified name of the namespace