## tree_object_class.api
## (C) 1999, Albert-Ludwigs-Universität Freiburg
## Author: bu
# Compiled by:
#
src/lib/tk/src/toolkit/sources.sublib# **************************************************************************
# Unified Object Interface
# **************************************************************************
# The entity Folder_Info contains just the information that
# makes abstractly the "skeleton" or just the "node" of
# a folder, but not its content. This Node_Info must comprise:
# - an ordering
# - an (implicit) name
# - rename and reset-name facilities
# - additional info's that may be attached directly to subcomponents
# of a folder (i.e. positions, layout, ...)
api Folder_Info {
Node_Info;
Subnode_Info;
string_of_name_node: Node_Info -> print::Format -> String;
ord_node: (Node_Info, Node_Info) -> Order;
rename_node: String -> Node_Info -> Void;
reset_name_node: Node_Info -> Void;
};
# SPECIFICATION :
# - ord_node is a linear ordering
# - (rename_node s ni;
# string_of_name_node ni f) = "nice s"
# - (rename_node s ni;
# reset_name_node ni;
# string_of_name_node ni f) =
# (reset_name_node ni;
# string_of_name_node ni f)
# The entity Tree_Part_Class is just a subclass of
# Part_Class. It is enriched by Folder_Info, SUBNODE_INFO and functions,
# that exploit (or enforce) the tree-like package of Tree_Part_Class-
# elements - i.e. terms of type Part.
# Additionally, they provide the concept path on folders and
# path-related operations.
api Tree_Part_Class {
include api Part_Class; # Part_Class is from
src/lib/tk/src/toolkit/object_class.api include api Folder_Info; # Folder_Info is from
src/lib/tk/src/toolkit/tree_object_class.api package basic: Part_Class; # Part_Class is from
src/lib/tk/src/toolkit/object_class.api get_content: Part_Ilk -> (basic::Part_Ilk, Subnode_Info);
get_folder: Part_Ilk -> (Node_Info, List( Part_Ilk ));
is_folder: Part_Ilk -> Bool;
content: (basic::Part_Ilk, Subnode_Info) -> Part_Ilk;
folder: (Node_Info, List( Part_Ilk )) -> Part_Ilk;
is_folder_type: Part_Type -> Bool;
get_content_type: Part_Type -> basic::Part_Type;
content_type: basic::Part_Type -> Part_Type;
};
# SPECIFICATION :
# - getContent (Content m) = m
# - getFolder (Folder m) = m
# - Content (getContent o) = o
# - Folder (getFolder o) = o
# - tree_objects are generated over Content and Folder
# - isFolder (Folder m) = TRUE, isFolder (Content m) = FALSE
# - getContentType (ContentType ot) = ot
# - ContentType (getContentType ot) = ot
api Ptree_Part_Class {
include api Tree_Part_Class; # Tree_Part_Class is from
src/lib/tk/src/toolkit/tree_object_class.api # necessary for SML97 - compliance: synonyms no longer allowed . . .
Path;
path_rep: Path -> (List( Node_Info ), Null_Or( basic::Part_Ilk ));
path_abs: (List( Node_Info ), Null_Or( basic::Part_Ilk )) -> Path;
# path and name are identical in Ptree_Part_Class. Unfortunately,
# this can't be said explicitly in SML. Therefore, we establish an
# isomorphism.
ord_path: (Path, Path) -> Order;
is_prefix: (Path, Path) -> Bool;
join_path: (Path, Path) -> Path;
name2path: Name -> Path;
path2name: Path -> Name;
# The foll. opns may fail if paths do not exist or are not unique
# NOTE: this implies that Node_Info and obj must be unique if
# these operations are expected to work properly
get_path: Part_Ilk -> Part_Ilk -> List( Path );
# get_path a b produces path
# of sub-object b in object a
exception INCONSIST_PATH;
select_from_path: List( Part_Ilk ) -> Path -> Part_Ilk;
remove_at_path: List( Part_Ilk ) -> Path -> List( Part_Ilk );
# removes_at_path a produces object
# from a with subobject at p removed
update_at_path: List( Part_Ilk ) -> Path -> Part_Ilk -> List( Part_Ilk );
};
# SPECIFICATION :
# - to be done
# select_from_path, remove_at_path and update_at_path use inherently
# the uniqueness of paths and may deliver arbitrary result if it
# is not assured. May raise INCONSIST_PATH if path not accessible.
# It is allowed to replace objects byb olders and vice versa -
# the application has to assure uniqueness !!!