• No results found

Predened Classes

In document Tool specification with GTSL (Page 112-114)

Selection

5.9 Tool Schema

5.9.1 Predened Classes

Properties that are common to any tool schema and that should, therefore, be implemented in the predened schema are:

nodes of the abstract syntax graph are persistent,

nodes either represent a place holder or an expanded increment, nodes may be optional,

nodes may be leaf nodes or inner nodes of the abstract syntax tree, nodes may have outgoing multi-valued aggregation edges,

nodes may represent erroneous increments, nodes may represent a scoping block,

nodes belong to a subgraph that represents a document,

nodes may have reference edges to nodes contained in other documents and these edges

are used for conguration management,

edges must be traversable in both directions 3, documents have an external unique name,

documents are the unit of ownership,

documents are the unit of version management and documents have a time stamp of their last modication.

These properties are implemented in classes contained in the predened schema as depicted in Figure 5.7. It includes two disjoint class hierarchies. The subclasses of Incrementare called

increment classes. They are used to dene common properties of node types. The subclasses of Attributeare referred to as non-syntactic classes. They dene properties of types for node

attributes. Attribute Increment Symbol Table Version Vector Version VectorTable Error TerminalIncrement List Document Usable Increment Using Increment Optional Increment Increment List Terminal Increment Document Version Document Pool Syntax Error Date Document Table Duplicate SymbolTable NonterminalIncrement List Nonterminal Increment

Figure 5.7: Classes Contained in the Predened Schema

ClassIncrementis the generalisation of arbitrary node types. Therefore, each class implement-

ing a node type should be a subclass of Increment. It has an instance variable father that

implements an edge to the father node with respect to the abstract syntax. For each node, it implements the reverse edge to the syntactic edge that leads to the node. This instance variable is initialised during object creation. It is updated whenever the node is moved to some other position in the abstract syntax graph. Moreover, class Incrementmaintains a set

of error descriptors that represent the semantic errors the increment is involved in. The in- crement is considered to be erroneous if this set is not empty. The class exports an operation that can be used for checking whether the node represents an erroneous increment. Moreover, it exports an operation that returns a set of strings as textual representations of the error set. A further instance variable of class Incrementis used to indicate whether the increment

is already expanded or still a place holder. Objects of class Documentimplement root nodes of

syntax trees that span up subgraphs of the project-wide abstract syntax graph representing documents. ClassDocumenthas an instance variable of typestringin order to store the owner

of the document and an instance variable of class Date to store the time stamp of the last

document modication. Class OptionalIncrementspecialises Incrementin that objects of this

class represent nodes that are optional. It denes methods in order to delete or expand an optional increment.

The classes TerminalIncrementand NonterminalIncrementdene the properties of leaf nodes

in the abstract syntax tree and of inner nodes, respectively. Subclasses of TerminalIncrement

are called terminal increment classes and subclasses of NonterminalIncrementare called non-

terminal increment classes. The common properties of nodes that have an outgoing multi- valued aggregation edge are dened by class IncrementList. The classTerminalIncrementList

and the class NonterminalIncrementListare more specialised in that the target of the multi-

valued edge are inner nodes and leaf nodes, respectively. These list classes dene a multi-valued instance variable to implement the multi-valued aggregation edge and then oer methods, for instance to add, insert and delete elements of the list.

Class DocumentVersionrepresents an abstraction for those document types that are version-

able. In our implementation it uses the

O

2 Kernel class Version (c.f. Page 80) for version

management purposes. During creation of an object of classIncrement, which is implementing

a node, the object must be entered into the version unit object of the respective document and, during destruction of an object, the object has to be removed from the respective version unit object. DocumentVersionthen oers a number of methods for version management such as

freezing a document, deriving a new version, merging two versions, establishing a default ver- sion, navigating through the version history graph of the document and so on. UsableIncrement

and UsingIncrementimplement nodes with incoming and outgoing inter-document reference

edges. These classes oer methods for implementation of conguration management, such as selecting a particular version of a used document. For conguration management pur- poses class DocumentVersion internally uses instance variables of classes VersionVector and VersionVectorTable.

An object of class DocumentPoolis declared as a persistent root in each schema in order to

implement persistence of documents. This object is persistent by denition, as an object reachable from a persistent root is persistent. DocumentPool then has an instance variable

of class DocumentTable. Root nodes of documents may then be inserted in this table. As a

consequence, each root node of a subgraph that represents a document is persistent, too. As each node of the subgraph is reachable from the root node of the respective subgraph, all nodes are persistent.

Objects of classSymbolTablearrange for associations between symbols and nodes, i.e. objects

of class Increment. Hence they can be used for implementing scoping rules of the static

semantics of a language. They oer methods to declare a new symbol, to look up whether a given symbol has been dened, to retrieve a node associated with a given symbol and to delete an association. DocumentTableis a more specic symbol table where increments are instances

of class Document. DuplicateSymbolTableis a specic symbol table that can manage duplicate

symbols. It is required if violations of scoping rules are to be temporarily permitted.

In document Tool specification with GTSL (Page 112-114)