13.07.2015 Views

A Graph-Based Generic Type System for Object-Oriented Programs

A Graph-Based Generic Type System for Object-Oriented Programs

A Graph-Based Generic Type System for Object-Oriented Programs

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Type</strong> Operations 194.2 Conjunction <strong>Graph</strong>sA class contains all the attributes and methods of its direct superclass as well as the new membersintroduced in the class itself. Inductively along the inheritance hierarchy, the effective memberstructure of a class is a conjunction of all the members of its superclasses. The effective memberstructure is also called the interface of the class.The notion of conjunctions can be extended to a set of arbitrary classes. A conjunction of aset of classes consists of all the effective members of these classes. For the conjunction of a setof classes to be defined, these classes must be consistent that members with the same name indifferent classes must have equivalent types. We often use a conjunction to combine a numberof interfaces to define a structural requirement that is to be implemented by a concrete class,hence the term “conjunction”. The requirement is satisfied only when all of the interfaces areimplemented.Definition 9 (Conjunction <strong>Graph</strong>) Given a list of rooted graphs G, a rooted graph G ′ is aconjunction graph of G, denoted as G ′ ∼ ⋓ G, if1. G ′ . ∈ S ,2. all attributes in G are included in G ′ ,G ∈ G ∧ a ∈ A ∧ ⊲ −→ ∗ a −→ n ∈ G =⇒ ∃ a −→ n ′ ∈ G ′ • G n ∼ G ′ n ′ ,3. G ′ only contains attributes in G,a ≠ σ ∧ a −→ · ∈ G ′ =⇒ a ∈ A ∧ ∃G ∈ G • ⊲ −→ ∗ a −→ · ∈ G,4. all method signatures in G are included in G ′ ,G ∈ G ∧ m ∈ A ∧ ⊲ −→ ∗ σ.m −−→ n ∈ G =⇒ ∃ σ.m −−→ n ′ ∈ G ′ • G n ∼ G ′ n ′ ,5. G ′ only contains method signatures in G, −−→ σ.m · ∈ G ′ =⇒ m ∈ A ∧ ∃G ∈ G • −→ ⊲ ∗ −−→ σ.m · ∈ G.Fig. 3 (left) shows a conjunction graph rooted at r, of two classes C 1 and C 2 . A conjunctiongraph can be considered as a shallow structure of multiple classes.In a type graph Γ, it is often the case that two nodes n and n ′ lead to equivalent nodes n 1 andn ′ 1 through the same attribute navigation path a. We can thus merge n 1 and n ′ 1 to obtain asimpler graph. Formally, let n be a list of nodes of Γ and a a navigation path, provided that∀t 1 , t 2 ∈ {t | n ⊲ −→ ∗ a −→ t ∈ Γ, n ∈ n} • Γ ⊢ t1 ∼ t 2 ,we define co-target(Γ, n, a) ̂= ts, where{⊲{tts = 0 } if ∃n 0 ∈ n • n 0 −→∗−→ a t 0 ∈ Γ,∅ otherwise.Report No. 448, June 2011UNU-IIST, P.O. Box 3058, Macao

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!