Static and Dynamic Participant Definitions
==========================================

We have two kinds of participant definitions: static and dynamic.
Static participants are specified in a structure-shy way
independent of a distinguished traversal method.
Dynamic participants are specified relative to a distinguished traversal
method.
Static (dynamic) participants are specified by a traversal strategy which
is called a static (dynamic) participant strategy.
A component may have both a static and a dynamic participant strategy.

The intuition behind static participant strategies 
is to program with "elastic" data members. A component with a static
participant strategy refers to "elastic" data members whose
details are specified by the static participant strategy and
the class graph. 
The data members point to objects either farther down or farther up
the class graph.

From an aspect-oriented programming  point of view,
elastic data members are expression-level join points in the program.
Information from the strategy graph and the class graph determines
the detailed meaning of the elastic data member.
These join points are different than the method-level join points usually
used with strategies: The traversal methods are join points
which are sandwiched by information from the visitors.

Each strategy graph node is mapped by a bijection to a class-valued variable.
Therefore, each strategy graph node is denoted by a class-valued
variable. The same name means the same node. There is a map
N which maps class-valued variables to classes. Map N
is in general not a bijection; it may map different class-valued variables
to the same class.

In the following we use terminology from the 
traversal theory papers 
\cite{lieber-palsberg-xiao94,gener-comp-j:jens-boaz-karl,strategies-tr:LP97}: 
the concept of a path in class graphs and strategy graphs
and the concept of a pathset determined by a strategy graph
and a class graph, called PathSet[G](S) in \cite{lieber-palsberg-xiao94}.

We assume a strategy graph SG with nodes X and Y, Y a successor of X.
X has participant name x (of N(X)) and Y participant name y (of N(Y)).

1. static participants:

They are used in APPCs to define participants statically.
The participants are defined by labeling strategy nodes
with variable names. For the participants to be well defined
in a given class, certain preconditions must hold.

The rules below tell us under which circumstances we can
use in a given class the participant names introduced in a
strategy.

up(X,Y) means that in N(X) we can use y.
----------------------------------------------------------
Precondition: the class graph path from N(X) to N(Y) is unique,
i.e., PathSet[G](SG) reduced to the paths from N(X) to N(Y)
consists of only one path.

down(X,Y) means that in N(Y) we can use x.
----------------------------------------------------------
Precondition: There is no class graph path from N(X) to N(Y) going through 
N(X) in between,
i.e., PathSet[G](SG) does not contain a path from N(X) via N(X) to N(Y).
(This means that each N(Y)-object is in a unique N(X)-object.)

The following examples use a unified class graph and strategy graph
syntax. Syntax at end.

Examples:
strategy graph 
c:C B.
  B A.

For the following class graph
down(C,A) does not hold.
C [C] B A.
B A.
A.

For the following class graph
down(C,A) holds:
C B.
B A.
A .

For the following class graph
down(C,A) does not hold.
C B.
B A.
A [C].

We assume a strategy graph SG with nodes X and Y.

cross(X,Y) means that in N(Y) we can use x.
----------------------------------------------------------
Precondition: From A = Source(SG) 
both X and Y can be reached and 
up(A,X) and down(A,Y).


Extension:
=======================

We extend up to also deal with collections.

up*(X,Y) means that in N(X) we can use y, where y is declared 
to be of type collection.
----------------------------------------------------------
Precondition: there are several class graph paths from N(X) to N(Y),
i.e., PathSet[G](SG) reduced to the paths from N(X) to N(Y)
consists of more than one path.

A path which contains an edge with cardinality greater than 1
counts as several paths.


2. dynamic participants: 

They are computed during a distinguished traversal.
The last visited object of some class A can be used
later during the traversal.

Proposed syntax:


Strategy = LabeledGraph.

LabeledGraph = List(Adjacency).
Adjacency = [VertexLabel] <source> Vertex List(Neighbor) ".".
Neighbor : SubClass | LabeledVertex | OptLabeledVertex.
SubClass = "|" Vertex.

LabeledVertex = [EdgeLabel] Vertex.
OptLabeledVertex = "[" LabeledVertex "]".
EdgeLabel = "<" LabelName ">".
VertexLabel = ":" VariableName.
  // in strategy graphs: for participants 

// Terminal Buffer Rule
ComponentName = Ident.
Vertex = Ident.
VariableName = Ident.
LabelName = Ident.

// parameterized
List(S) ~ {S}.

// Ident=DemIdent.

Main = .
//
:a A B C D.
:b B.
:c C.
:d D E F.
:e E.
:f F.

X U |V [X].
:u U.
V.

