next up previous contents
Next: 3.6 Ellipses Up: 3. Yet Another Object Notation Previous: 3.4 Inheritance Relation

  
3.5 Packages

Packages are a syntactical mechanism to group classes. They are convenient to separate the own work from code libraries provided by others.


  
Figure 21: Package icon
\begin{figure}
\center
\begin{tabular}[c]{c}
\begin{picture}
(102, 102)(0, 0)
...
...ame}}
\put(0, 0){\framebox (90, 90){}}
\end{picture} \end{tabular}
\end{figure}

In YAON, the same icon as in UML ([RAT97a, P. 7ff]) is used to depict a package (Fig. 21). A package is a large rectangle with a small rectangle on top. The name is placed in the small rectangle. If no contents of the package is shown, the name may be placed in the large rectangle (not shown here).

  
Figure 22: Hierarchical packages
\begin{figure}
\center
\begin{tabular}[c]{c}
\begin{picture}
(202, 202)(0, 0)
...
... \\ \hline
\\ \hline
\end{tabular}}
}
\end{picture} \end{tabular}
\end{figure}


  
Figure 23: Import relationship
\begin{figure}
\center
\begin{picture}
(70, 5)(0, 0)
\put(10, 3){\line(1,0){4...
...0){4}}
\put(65, 3){\line(1,0){4}}
\put(70, 0){$>$ }
\end{picture}
\end{figure}

Packages can contain classes and other packages as depicted in figure 22. In order to access a package, the import relationship is defined between packages. This relation is depicted with a broken arrow as in figure 23.


  
Figure 24: Import example
\begin{figure}
\begin{picture}
(300, 400)(0, 0)
\put(100, 391){\framebox (70...
...)(0,5){14}{\line(0, 1){4}}
\put(206, 190){$\wedge$ }
\end{picture}
\end{figure}

A package can import a whole (sub)package or only a class of a package. The different possibilities are depicted in figure 24. The package pack_c imports the class Class from the package Big_pack. The package pack_e imports the whole package Big_pack with all its subpackages. The package pack_d imports only the package subpack_a from the package Big_Pack. Public classes are always available by their fully qualified names. In example 24, the class Class is imported by the package pack_c and therefore it is not necessary to use the fully qualified name inside of the package pack_c. However it must be fully qualified from the pack_d and pack_e if they must refer to it.