% PARTOF texte:da/tex/a_home.tex
\begin{xple}
\begin{tabbing}
\hspace*{0.7cm}\=\hspace{0.5cm}\=\hspace{0.5cm}\=\hspace{0.5cm}\=\hspace{0.5cm}\=
\hspace{0.5cm}\=\hspace{0.5cm}\=\hspace{0.5cm}\=\hspace{0.5cm}\=\hspace{0.5cm}
\=\hspace{0.5cm}\=\kill
interface TBCContent                                                                             \\
import iter newDate                                                                                   \\
export                                                                                           \\
\>error :Exception reason :String end                                                            \\
\>(* --- content specification object: *)                                                        \\
\>Let Rec Spec $<$:Ok = Tuple                                                                      \\
\>\>case int, real, date, string                                                                                  \\
\>\>case rcd, variant with                                                                            \\
\>\>\>elements() :iter.T(NamedContentSpec)                                                       \\
\>\>case singleChoice, multipleChoice, sequence with                                                                           \\
\>\>\>spec() :Spec                                                                               \\
\>end                                                                                            \\
\>and NamedContentSpec $<$:Ok = Tuple                                                             \\
\>\>name :String                                                                                 \\
\>\>spec() :Spec                                                                                 \\
\>end                                                                                            \\
\>(* --- content object: *)                                                                      \\
\>Let Rec T $<$:Ok = Tuple                                                                         \\
\>\>spec() :Spec                                                                                 \\
\>\>case int with                                                                                \\
\>\>\>(* by default, the current state is 0 *)                                                   \\
\>\>\>set(:Int) :Ok                                                                              \\
\>\>\>get() :Int                                                                                 \\
\>\>case real with                                                                               \\
\>\>\>(* by default, the current state is 0.0 *)                                                 \\
\>\>\>set(:Real) :Ok                                                                             \\
\>\>\>get() :Real                                                                                \\
\>\>case date with                                                                               \\
\>\>\>(* by default, the current state is today *)                                               \\
\>\>\>set(:newDate.T) :Ok                                                                        \\
\>\>\>get() :newDate.T                                                                           \\
\>\>case string with                                                                             \\
\>\>\>(* by default, the current state is "" *)                                                  \\
\>\>\>set(:String) :Ok                                                                           \\
\>\>\>get() :String                                                                              \\
\>\>case rcd with                                                                                \\
\>\>\>ref(name :String) :T                                                                       \\
\>\>\>(* get a content object of this record via its name.                                       \\
\>\>\>\> Raise error iff the refered object isn't found. *)                                      \\
\>\>case variant with                                                                            \\
\>\>\>(* by default, the first specified variant is selected *)                                  \\
\>\>\>select(:String) :Ok                                                                        \\
\>\>\>(* select a variant-element via its name *)                                                \\
\>\>\>selected() :String                                                                         \\
\>\>\>(* get the name of the currently selected variant. *)                                      \\
\>\>\>ref() :T                                                                                   \\
\>\>\>(* get a content object of the current record variant. *)                                  \\
\>\>case singleChoice with                                                                       \\
\>\>\>(* by default, the first possible choice is selected *)                                    \\
\>\>\>get() :T                                                                                   \\
\>\>\>(* get the current selected choice *)                                                      \\
\>\>\>choose(c :T) :Ok                                                                           \\
\>\>\>(* select a new 'current selected' choice *)                                               \\
\>\>\>select(p(c :T) :Bool) :Ok                                                                  \\
\>\>\>(* select a new 'current selected' choice. Iterate over                                    \\
\>\>\>\> each valid choice and choose the last one for which p() returns                         \\
\>\>\>\> true. *)                                                                                \\
\>\>\>setChoices(:iter.T(T)) :Ok                                    \\
\>\>\>(* set new valid choices and reset the current selection to default *)                     \\
\>\>\>getChoices() :iter.T(T)                                                                    \\
\>\>\>(* get the set of possible valid choices *)                                                \\
\>\>case multipleChoice with                                                                     \\
\>\>\>(* by default, no choice is selected *)                                                    \\
\>\>\>get() :iter.T(T)                                                                           \\
\>\>\>(* get the set of currently selected choices *)                                            \\
\>\>\>choose(c :T) :Ok                                                                           \\
\>\>\>(* add a new choice to the set of current selected choices *)                              \\
\>\>\>discard(c :T) :Ok                                                                          \\
\>\>\>(* discard a choice from the set of current selected choices *)                            \\
\>\>\>select(p(c :T) :Bool) :Ok                                                                  \\
\>\>\>(* select a new set of 'current selected' choices. Iterate over                            \\
\>\>\>\> all valid choices and choose each of them for which p() returns                         \\
\>\>\>\> true. *)                                                                                \\
\>\>\>setChoices(:iter.T(T)) :Ok                                    \\
\>\>\>(* set new valid choices and reset the current selection to default *)                     \\
\>\>\>getChoices() :iter.T(T)                                                                    \\
\>\>\>(* get the set of possible valid choices *)                                                \\
\>\>case sequence with                                                                           \\
\>\>\>set(:Sequence) :Ok                                                                         \\
\>\>\>(* set reference to bulk data interface object *)                                          \\
\>\>\>get() :Sequence                                                                            \\
\>\>\>(* get current reference to bulk data interface object *)                                  \\
\>end                                                                                            \\
\>and Sequence $<$:Ok = Tuple                                                                      \\
\>\>elements(A $<$:Ok \ map(:T) :A) :iter.T(A)                                                      \\
\>\>fromIter(A $<$:Ok \ itr :iter.T(A) \ map(:A \ :T) :Ok) :Ok                                        \\
\>end                                                                                            \\
\>(* --- general: *)                                                                             \\
\>setDebug(f :Bool) :Ok                                                                          \\
\>(* --- specification constructors: *)                                                          \\
\>intSpec() :Spec                                                                                \\
\>realSpec() :Spec                                                                               \\
\>stringSpec() :Spec                                                                             \\
\>dateSpec() :Spec                                                                               \\
\>(* create an atomic specification of its type. *)                                              \\
\>rcdSpec(elements :Array(NamedContentSpec)) :Spec                                               \\
\>(* create a record specification given an iteration of named content.                          \\
\>\> Each named content has an unique name and its content specification. *)                     \\
\>variantSpec(elements :Array(NamedContentSpec)) :Spec                                           \\
\>(* create a variant record specification given an iteration of variants.                       \\
\>\> Each variant has an unique name and an iteration of its aggregated                          \\
\>\> componenets, its 'elements' *)                                                              \\
\>singleChoiceSpec(spec :Spec) :Spec                                                             \\
\>(* create a single choice specification whose choices are                                      \\
\>\> specified by 'c' *)                                                                         \\
\>multipleChoiceSpec(spec :Spec) :Spec                                                           \\
\>(* create a mulitple choice specification whose choices are                                    \\
\>\> specified by 'c' *)                                                                         \\
\>sequenceSpec(spec :Spec) :Spec                                                                 \\
\>(* create a sequence specification whose elements are specified by 'c' *)                      \\
\>(* --- content object constructors: *)                                                         \\
\>create(spec :Spec) :T                                                                          \\
\>(* create a content object conforming to the specification object 's'. All                     \\
\>\> content objects with a state are initialized to their documented                            \\
\>\> default state. *)                                                                           \\
\>copy(:T) :T                                                                                    \\
\>(* create a new content object with the same specification and state                           \\
\>\> as the given content object. The objects have a seperate state                              \\
\>\> afterwards. *)                                                                              \\
end;   \\
\end{tabbing}
\end{xple}

