 p a c k a g e   c o s t o . u t i l s . e x p o r t s ; 
 
 
 
 i m p o r t   j a v a . a w t . P o i n t ; 
 
 i m p o r t   j a v a . i o . F i l e ; 
 
 i m p o r t   j a v a . i o . F i l e I n p u t S t r e a m ; 
 
 i m p o r t   j a v a . i o . F i l e W r i t e r ; 
 
 i m p o r t   j a v a . i o . I O E x c e p t i o n ; 
 
 i m p o r t   j a v a . u t i l . D a t e ; 
 
 i m p o r t   j a v a . u t i l . P r o p e r t i e s ; 
 
 
 
 i m p o r t   c o s t o . L o a d e r ; 
 
 i m p o r t   c o s t o . g r a p h . C o m p o n e n t ; 
 
 i m p o r t   c o s t o . g r a p h . C o m p o s i t i o n ; 
 
 i m p o r t   c o s t o . g r a p h . L T S ; 
 
 i m p o r t   c o s t o . g r a p h . S e r v i c e ; 
 
 / /   d u m m y   t e s t   c o m m e n t   :             
 
 
 
 / * * 
 
   *   T h i s   u t i l i t y   e x p o r t s   a   K m e l i a   c o m p o n e n t   t o   a   L a T e X   f i l e   t h a t   b e c o m e s   i t s 
 
   *   d o c u m e n t a t i o n .   I t   c a n   a c c e p t   a s   e n t r y   e i t h e r   a   c o m p o n e n t   ( o r   a   c o m p o s i t e )   o r 
 
   *   a   s e r v i c e .   
 
   *   
 
   *   I n   t h i s   v e r s i o n ,   w e   s h a l l   u s e   o n l y   s t r i n g   o u t p u t   s t r e a m s   w i t h   s t r i n g 
 
   *   f u n c t i o n s . 
 
   *   
 
   *   A n o t h e r   v e r s i o n   w o u l d   a p p l y   t o   a   c r i t e r i o n   o n   f i l e s   r a t h e r   t h a n   c o m p o n e n t s 
 
   *   a n d   u s i n g   a   t e m p l a t e   t e c h n o l o g y .   T h e   m a i n   a d v a n t a g e   s   t o   k e e p   t h e   o r i g i n a l 
 
   *   K m e l i a   s o u r c e   f i l e s   w i t h   c o m m e n t s . 
 
   *   
 
   *   @ a u t h o r   a n d r e 
 
   *   @ s e e   L T S t o E P S   T O D O   I n s e r t   m e a n i n g f u l   c o m m e n t   h e r e 
 
   *   
 
   * / 
 
 p u b l i c   c l a s s   K M L t o T E X   {   
 
 	 p r o t e c t e d   s t a t i c   b o o l e a n   v e r b o s e   =   t r u e ; 
 
 
 
 	 p r o t e c t e d   s t a t i c   b o o l e a n   e r r v e r b o s e   =   t r u e ; 
 
 
 
 	 / * * 
 
 	   *   T h e   L a t e x C o n t e x t   i n n e r   c l a s s   s t o r e s   a   L a T e X   t r a n s l a t i o n   c o n t e x t .   T h i s 
 
 	   *   a v o i d s   m u l t i p l e   a r g u m e n t s ,   t e s t s   a n d   f i l e   o p e r a t i o n s . 
 
 	   *   
 
 	   *   @ a u t h o r   a n d r e 
 
 	   *   @ d e p r e c a t e d 
 
 	   * / 
 
 	 @ D e p r e c a t e d 
 
         s t a t i c   p r o t e c t e d   c l a s s   L a t e x C o n t e x t   { 
 
 	 	 p u b l i c   e n u m   L e v e l   { c o m p o s i t e ,   c o m p o n e n t ,   s e r v i c e } ; 
 
 	 	 b o o l e a n   v a l i d ;   / /   t r u e   i f   t h e   c o n t e x t   i s   v a l i d 
 
 	 	 L e v e l   g r a i n ;   / /   w h a t   y o u   w a n t   t o   d o c u m e n t 
 
 	 	 C o m p o n e n t   c o m p o s i t e ; 
 
 	 	 C o m p o n e n t   c o m p o n e n t ; 
 
 	 	 S e r v i c e   s e r v i c e ; 
 
 	 	 S t r i n g   s p e c d i r ; 
 
 	 	 S t r i n g   o u t p u t d i r ; 
 
 	 	 S t r i n g   f i g o u t p u t d i r ; 
 
 	 	 p u b l i c   L a t e x C o n t e x t ( )   { 
 
 	 	 	 s u p e r ( ) ; 
 
 	 	 	 / /   t h e   d e f a u l t   c o n s t r u c t o r 
 
 	 	 	 t h i s . v a l i d   =   f a l s e ; 
 
 	 	 } 
 
 	 	 / * * 
 
 	 	   *   @ r e t u r n   R e t u r n s   t h e   o u t p u t d i r . 
 
 	 	   *   @ u m l . p r o p e r t y   n a m e = " o u t p u t d i r " 
 
 	 	   * / 
 
 	 	 p u b l i c   S t r i n g   g e t O u t p u t d i r ( )   { 
 
 	 	 	 r e t u r n   t h i s . o u t p u t d i r ; 
 
 	 	 } 
 
 	 } 
 
 	 / /   i n n e r   c l a s s 
 
 
 
 	 / /   L A T E X   S T R I N G S 
 
 
 
 	 s t a t i c   S t r i n g   l a t e x F o o t e r   =   " \ \ s e c t i o n { C o n c l u s i o n } "   +   " \ n " 
 
 	 	 	 +   " \ \ l i s t o f f i g u r e s "   +   " \ n "   +   " % \ \ l i s t o f t a b l e s "   +   " \ n " 
 
 	 	 	 +   " \ \ l s t l i s t o f l i s t i n g s "   +   " \ n "   +   " % \ \ p r i n t i n d e x "   +   " \ n " 
 
 	 	 	 +   " \ \ e n d { d o c u m e n t } "   +   " \ n " ; 
 
 
 
 	 / /   L A T E X   C O M M A N D S 
 
 	 p u b l i c   s t a t i c   S t r i n g   S e t L a t e x H e a d e r ( S t r i n g   l a t e x s t y l e d i r ,   S t r i n g   a u t h o r , 
 
 	 	 	 S t r i n g   t i t l e )   { 
 
 	 	 S t r i n g   h e a d e r   =   " \ \ N e e d s T e X F o r m a t { L a T e X 2 e } "   +   " \ n " 
 
 	 	 	 	 +   " % g e n e r a t e d   b y   t h e   K M L t o T E X   e x p o r t   u t i l i t i e s "   +   " \ n " 
 
 	 	 	 	 +   " % a u t h o r   :   C O L O S S "   +   " \ n "   +   " % d a t e   :   "   +   n e w   D a t e ( )   +   " \ n " 
 
 	 	 	 	 +   " % \ \ b a t c h m o d e "   +   " \ n " 
 
 	 	 	 	 +   " \ \ d o c u m e n t c l a s s [ a 4 p a p e r , 1 1 p t ] { a r t i c l e } "   +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e [ d v i p s ] { e p s f i g } "   +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e [ T 1 ] { f o n t e n c } "   +   " \ n "   +   " \ \ u s e p a c k a g e { a e } " 
 
 	 	 	 	 +   " \ n "   +   " \ \ u s e p a c k a g e { x s p a c e } "   +   " \ n " 
 
 	 	 	 	 +   " % - - - - - - - -   L a T e X   s t y l e   f o r   K m e l i a   s p e c i f i c a t i o n s   "   +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e [ s a v e m e m ] { l i s t i n g s } "   +   " \ n " 
 
 	 	 	 	 +   " % - - - - - - - -   T O D O   S e t   a   K m l   l i s t i n g   c o n f i g u r a t i o n "   +   " \ n " ; 
 
 	 	 i f   ( l a t e x s t y l e d i r . e q u a l s ( " " ) ) 
 
 	 	 	 h e a d e r   + =   " \ \ d e f \ \ r e p L A T E X { . . / . . / . . / . . / L A T E X }   % T O   U P D A T E   L A T E X   S T Y L E S   D I R E C T O R Y " 
 
 	 	 	 	 	 +   " \ n " ; 
 
 	 	 e l s e 
 
 	 	 	 h e a d e r   + =   " \ \ d e f \ \ r e p L A T E X { "   +   l a t e x s t y l e d i r   +   " } "   +   " \ n " ; 
 
 	 	 h e a d e r   + =   " % - - - - - - - -   F i l e s   t o   p u t   i n   t h e   r e p L A T E X   d i r e c t o r y   " 
 
 	 	 	 	 +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e { \ \ r e p L A T E X / z e d b i s }         %   L a T e X / Z   u t i l i t i e s " 
 
 	 	 	 	 +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e { \ \ r e p L A T E X / d e c l a r }         %   v a r i o u s   s h o r t c u t s " 
 
 	 	 	 	 +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e { \ \ r e p L A T E X / a 4 p a s c }         %   f u l l   p a g e   " 
 
 	 	 	 	 +   " \ n " 
 
 	 	 	 	 +   " \ \ u s e p a c k a g e { \ \ r e p L A T E X / l i s t f o o t } " 
 
 	 	 	 	 +   " \ n " 
 
 	 	 	 	 +   " \ \ d e f \ \ r e p B I B L I O { . }                                 % T O   U P D A T E   B I B L I O G R A P H Y   R E F E R E N C E   D I R E C T O R Y " 
 
 	 	 	 	 +   " \ n " 
 
 	 	 	 	 +   " \ \ d e f \ \ r e p F I G U R E S { . / F I G U R E S }               %   D O T / E P S   F I G U R E   D I R E C T O R Y " 
 
 	 	 	 	 +   " \ n "   +   " \ \ u s e p a c k a g e { m u l t i c o l } "   +   " \ n "   +   " \ \ u s e p a c k a g e { u r l } " 
 
 	 	 	 	 +   " \ n "   +   " % - - - - - - - -   L o c a l   D e f i n i t i o n s   "   +   " \ n " 
 
 	 	 	 	 +   " \ \ n e w c o u n t e r { r e f e r e n c e s }                       %   f o r   t h e   f i g u r e s "   +   " \ n " 
 
 	 	 	 	 +   " \ \ n e w c o u n t e r { r e f t a b }                               %   f o r   t h e   t a b l e s "   +   " \ n " 
 
 	 	 	 	 +   " \ \ d e f \ \ k m e l i a { \ \ t e x t s f { K m e l i a } \ \ x s p a c e } "   +   " \ n " 
 
 	 	 	 	 +   " \ \ d e f \ \ L o t o s { \ \ t e x t s c { L o t o s } \ \ x s p a c e } "   +   " \ n "   +   " \ n " 
 
 	 	 	 	 +   " % - - - - - - - -   T i t l e   D e f i n i t i o n s   "   +   " \ n " ; 
 
 	 	 i f   ( t i t l e . e q u a l s ( " " ) ) 
 
 	 	 	 h e a d e r   + =   " \ \ t i t l e { \ \ k m e l i a   S p e c i f i c a t i o n s } "   +   " \ n " ; 
 
 	 	 e l s e 
 
 	 	 	 h e a d e r   + =   " \ \ t i t l e { "   +   t i t l e   +   " } "   +   " \ n " ; 
 
 	 	 i f   ( a u t h o r . e q u a l s ( " " ) ) 
 
 	 	 	 h e a d e r   + =   " \ \ a u t h o r { C o l o s s } "   +   " \ n " ; 
 
 	 	 e l s e 
 
 	 	 	 h e a d e r   + =   " \ \ a u t h o r { "   +   a u t h o r   +   " } "   +   " \ n " ; 
 
 	 	 h e a d e r   + =   " \ \ d a t e { \ \ t o d a y } "   +   " \ n "   +   " \ \ b e g i n { d o c u m e n t } "   +   " \ n " ; 
 
 	 	 / /   a d d s   a   t i t l e 
 
 	 	 h e a d e r   + =   " \ \ m a k e t i t l e "   +   " \ n " ; 
 
 	 	 / /   a d d s   a n   a b s t r a c t 
 
 	 	 h e a d e r   + =   " \ \ b e g i n { a b s t r a c t } "   +   " \ n " ; 
 
 	 	 h e a d e r   + =   " T h i s   d o c u m e n t   h a s   b e e n   p r o d u c e d   a u t o m a t i c a l l y   b y   t h e   C O S T O / \ \ k m e l i a   T e x   E x p o r t   t o o l . \ \ \ \ " +   " \ n " ; 
 
 	 	 h e a d e r   + =   " ~ \ \ \ \   "   + " P l e a s e   i n s e r t   h e r e   y o u r   a b s t r a c t   c o m m e n t   ~ \ \ \ \   "   +   " \ n " ; 
 
 	 	 h e a d e r   + =   " ~ \ \ \ \   \ \ n o i n d e n t   \ \ t e x t b f { K e y w o r d s } : ~ C o m p o n e n t s ,   S e r v i c e s ,   L T S ,   \ \ k m e l i a   ~ \ \ \ \ "   +   " \ n " ; 
 
 	 	 h e a d e r   + =   " \ \ e n d { a b s t r a c t } "   +   " \ n " ; 
 
 	 	 / /   a d d s   a   T O C 
 
 	 	 h e a d e r   + =   " \ \ n e w p a g e "   +   " \ n "   +   " \ \ t a b l e o f c o n t e n t s "   +   " \ n "   +   " \ \ n e w p a g e " 
 
 	 	 	 	 +   " \ n " ; 
 
 	 	 / /   a d d s   a n   i n t r o d u c t i o n 
 
 	 	 h e a d e r   + =   " \ \ s e c t i o n { I n t r o d u c t i o n } "   +   " \ n " ; 
 
 	 	 r e t u r n   h e a d e r ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   R e p l a c e s   f o r b i d d e n   L a T e X   c h a r a c t e r s 
 
 	   *   
 
 	   *   @ p a r a m   s 
 
 	   *                         t h e   s o u r c e 
 
 	   *   @ r e t u r n   t h e   c o r r e c t   s t r i n g 
 
 	   * / 
 
 	 p r i v a t e   s t a t i c   S t r i n g   L a t e x F i l t e r ( S t r i n g   s )   { 
 
 	 	 / /   r e t u r n   s . r e p l a c e ( ' _ ' ,   ' - ' ) ; 
 
 	 	 / /   r e t u r n   s . r e p l a c e A l l ( " _ " , " \ \ _ " ) ; 
 
 	 	 r e t u r n   s . r e p l a c e ( " _ " ,   " \ \ _ " ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   G e n e r a t e   t h e   L a T e X   f o r   a n   E P S   f i g u r e   i n c l u s i o n .   
 
 	   *   B y   d e f a u l t   t h e   w i d t h   =   1 2   c m . 
 
 	   *   
 
 	   *   @ p a r a m   f i l e n a m e   : 
 
 	   *                         S t r i n g 
 
 	   *   @ p a r a m   l e g e n d e 
 
 	   *   @ r e t u r n   t h e   L a T e X   f i g u r e   p a r a g r a p h 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   S t r i n g   L a t e x F i g ( S t r i n g   e p s f i l e n a m e ,   S t r i n g   l e g e n d e )   { 
 
 	 	 r e t u r n   " \ \ b e g i n { c e n t e r } "   +   " \ n "   +   " % \ \ b e g i n { f i g u r e } [ h ] "   +   " \ n " 
 
 	 	 	 	 +   " \ \ c e n t e r l i n e { \ \ e p s f i g { f i g u r e = \ \ r e p F I G U R E S / "   +   e p s f i l e n a m e 
 
 	 	 	 	 +   " , w i d t h = 1 2 c m } }                     %   T O   U P D A T E "   +   " \ n "   +   " \ \ l e g e n d e { " 
 
 	 	 	 	 +   e p s f i l e n a m e   +   " } { "   +   L a t e x F i l t e r ( l e g e n d e )   +   " } "   +   " \ n " 
 
 	 	 	 	 +   " % \ \ e n d { f i g u r e } "   +   " \ n "   +   " \ \ e n d { c e n t e r } "   +   " \ n " ; 
 
 	 	 / /   r e t u r n   " \ \ i n c l u d e g r a p h i c s [ w i d t h = \ \ l i n e w i d t h ] { "   +   f i l e n a m e   +   " } \ n " ; 
 
 	 } 
 
 	 / * * 
 
 	   *   G e n e r a t e   t h e   L a T e X   f o r   a n   E P S   f i g u r e   i n c l u s i o n .   
 
 	   *   Q u e r i e s   t h e   b o u n d i n g   b o x   t o   g e t   t h e   f i g u r e   s i z e . 
 
 	   *   
 
 	   *   @ p a r a m   f i l e n a m e   : 
 
 	   *                         S t r i n g 
 
 	   *   @ p a r a m   l e g e n d e 
 
 	   *   @ r e t u r n   t h e   L a T e X   f i g u r e   p a r a g r a p h 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   S t r i n g   L a t e x F i g ( S t r i n g   o u t p u t p a t h ,   S t r i n g   e p s f i l e n a m e ,   S t r i n g   l e g e n d e )   { 
 
 	         
 
 	 	 P o i n t   s i z e   =   E P S U t i l s . g e t B o u n d i n g B o x ( o u t p u t p a t h +   " F I G U R E S "   +   " / " + e p s f i l e n a m e ) ; 
 
 	 	 / / a s s u m e   a   r e s o l u t i o n   o f   2 5 0   d p i   = >   2 , 5   c m 
 
 	 	 / /   c m ( w i d t h )   =   s i z e . x   /   1 0 0 
 
 	 	 i f   ( s i z e . g e t X ( ) = = 0   & &   s i z e . g e t Y ( ) = = 0 )   { 
 
 	 	 	 	 s i z e . x   =   1 2 * 9 0 ; 
 
 	 	 	 	 S y s t e m . e r r . p r i n t ( e p s f i l e n a m e   + "   t a i l l e   " + s i z e . t o S t r i n g ( ) + " - " ) ; 
 
 	 	 	 } 
 
 	 	 r e t u r n   " \ \ b e g i n { c e n t e r } "   +   " \ n "   +   " % \ \ b e g i n { f i g u r e } [ h ] "   +   " \ n " 
 
 	 	 	 	 +   " \ \ c e n t e r l i n e { \ \ e p s f i g { f i g u r e = \ \ r e p F I G U R E S / "   +   e p s f i l e n a m e 
 
 	 	 	 	 +   " , w i d t h = " 
 
 	 	 	 	 +   ( s i z e . g e t X ( )   /   9 0 ) 
 
 	 	 	 	 + " c m } }                     %   T O   U P D A T E "   +   " \ n "   +   " \ \ l e g e n d e { " 
 
 	 	 	 	 +   e p s f i l e n a m e   +   " } { "   +   L a t e x F i l t e r ( l e g e n d e )   +   " } "   +   " \ n " 
 
 	 	 	 	 +   " % \ \ e n d { f i g u r e } "   +   " \ n "   +   " \ \ e n d { c e n t e r } "   +   " \ n " ; 
 
 	 	 / / T O D O   i m p r o v e   t h e   c o m p u t a t i o n 
 
 	 	 / /   r e t u r n   " \ \ i n c l u d e g r a p h i c s [ w i d t h = \ \ l i n e w i d t h ] { "   +   f i l e n a m e   +   " } \ n " ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   G e n e r a t e   a   l i s t i n g   p a r a g r a p h   f r o m   a   L T S . 
 
 	   *   
 
 	   *   @ p a r a m   l t s   : 
 
 	   *                         t h e   L T S   o f   a   S e r v i c e   o f   a   C o m p o n e n t 
 
 	   *   @ r e t u r n   t h e   L a T e X   l i s t i n g   p a r a g r a p h 
 
 	   * / 
 
 	 p r i v a t e   s t a t i c   S t r i n g   L a t e x L i s t i n g ( L T S   l t s )   { 
 
 	 	 S t r i n g   l a b e l   =   l t s . g e t C o m p o n e n t N a m e ( )   +   " . "   +   l t s . g e t S e r v i c e N a m e ( ) ; 
 
 	 	 r e t u r n   " \ \ f o o t n o t e s i z e "   +   " \ n "   +   " \ \ b e g i n { l s t l i s t i n g } [ c a p t i o n = { " 
 
 	 	 	 	 +   L a t e x F i l t e r ( " B e h a v i o u r   o f   "   +   l a b e l ) 
 
 	 	 	 	 +   " } , l a b e l = , f r a m e = l i n e s ] \ n "   +   l t s . t o S t r i n g ( ) 
 
 	 	 	 	 +   " \ n \ \ e n d { l s t l i s t i n g } \ n "   +   " \ \ n o r m a l s i z e "   +   " \ n " ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   G e n e r a t e   a   l i s t i n g   p a r a g r a p h   f r o m   a   S e r v i c e . 
 
 	   *   
 
 	   *   @ p a r a m   s e r v   : 
 
 	   *                         t h e   S e r v i c e   o f   a   C o m p o n e n t 
 
 	   *   @ r e t u r n   t h e   L a T e X   l i s t i n g   p a r a g r a p h 
 
 	   * / 
 
 	 p r i v a t e   s t a t i c   S t r i n g   L a t e x L i s t i n g ( S e r v i c e   s e r v )   { 
 
 	 	 S t r i n g   l a b e l   =   s e r v . g e t O w n e r ( ) . g e t N a m e ( )   +   " . "   +   s e r v . g e t N a m e ( ) ; 
 
 	 	 S t r i n g   t e x   =   " \ \ p a r a g r a p h { C o m m e n t s } \ n " ; 
 
 	 	 t e x   + =   L a t e x F i l t e r ( s e r v . g e t C o m m e n t ( ) )   +   " . \ n " ; 
 
 	 	 t e x   + =   " \ \ f o o t n o t e s i z e "   +   " \ n "   +   " \ \ b e g i n { l s t l i s t i n g } [ c a p t i o n = { " 
 
 	 	 +   L a t e x F i l t e r ( " S e r v i c e   "   +   l a b e l )   +   " } , l a b e l = , f r a m e = l i n e s ] \ n " 
 
 	 	 +   s e r v . t o S t r i n g ( )   +   " \ n \ \ e n d { l s t l i s t i n g } \ n "   +   " \ \ n o r m a l s i z e " 
 
 	 	 +   " \ n " ; 
 
 	 	 / /   T O D O   b e   f i n e r 
 
 	 	 r e t u r n   t e x ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   G e n e r a t e   a   l i s t i n g   p a r a g r a p h   f r o m   a   C o m p o n e n t . 
 
 	   *   
 
 	   *   @ p a r a m   c o m p   : 
 
 	   *                         t h e   C o m p o n e n t 
 
 	   *   @ r e t u r n   t h e   L a T e X   l i s t i n g   p a r a g r a p h 
 
 	   * / 
 
 	 p r i v a t e   s t a t i c   S t r i n g   L a t e x L i s t i n g ( C o m p o n e n t   c o m p )   { 
 
 	 	 S t r i n g   l a b e l   =   c o m p . g e t N a m e ( ) ; 
 
 	 	 S t r i n g   t e x   =   " " ; 
 
 	 	 t e x   + =   " \ \ p a r a g r a p h { D i a g r a m } \ n "   +   " \ \ b e g i n { c e n t e r } "   +   " \ n "   +   " % \ \ b e g i n { f i g u r e } [ h ] "   +   " \ n " 
 
 	 	 +   " \ \ c e n t e r l i n e { \ \ e p s f i g { f i g u r e = \ \ r e p F I G U R E S / "   +   l a b e l 
 
 	 	 +   " . e p s ,   w i d t h = 1 2   c m } } "   +   " \ n "   +   " \ \ l e g e n d e { " 
 
 	 	 +   l a b e l   +   " . d i a } { "   +   L a t e x F i l t e r ( l a b e l )   +   " } "   +   " \ n " 
 
 	 	 +   " % \ \ e n d { f i g u r e } "   +   " \ n "   +   " \ \ e n d { c e n t e r } "   +   " \ n " ; 
 
 	 	 t e x   + =   " \ \ p a r a g r a p h { C o m m e n t s } \ n " ; 
 
 	 	 t e x   + =   L a t e x F i l t e r ( c o m p . g e t C o m m e n t ( ) )   +   " . \ n " ; 
 
 	 	 t e x   + =   " \ \ f o o t n o t e s i z e "   +   " \ n "   +   " \ \ b e g i n { l s t l i s t i n g } [ c a p t i o n = { " 
 
 	 	 +   L a t e x F i l t e r ( " C o m p o n e n t   "   +   l a b e l )   +   " } , l a b e l = , f r a m e = l i n e s ] \ n " 
 
 	 	 +   c o m p . t o S t r i n g ( t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   t r u e ,   f a l s e ,   t r u e )   +   " \ n \ \ e n d { l s t l i s t i n g } \ n " 
 
 	 	 +   " \ \ n o r m a l s i z e "   +   " \ n " ; ; 
 
 	 	 / /   T O D O   b e   f i n e r 
 
 	 	 r e t u r n   t e x ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   G e n e r a t e   a   l i s t i n g   p a r a g r a p h   f r o m   a   C o m p o n e n t . 
 
 	   *   
 
 	   *   @ p a r a m   c o m p o s   : 
 
 	   *                         t h e   C o m p o s i t i o n 
 
 	   *   @ r e t u r n   t h e   L a T e X   l i s t i n g   p a r a g r a p h 
 
 	   * / 
 
 	 p r i v a t e   s t a t i c   S t r i n g   L a t e x L i s t i n g ( C o m p o s i t i o n   c o m p o s )   { 
 
 	 	 S t r i n g   l a b e l   =   c o m p o s . g e t O w n e r ( ) . g e t N a m e ( ) ; 
 
 	 	 S t r i n g   t e x   =   " \ \ p a r a g r a p h { C o m m e n t s } \ n " ; 
 
 	 	 t e x   + =   L a t e x F i l t e r ( c o m p o s . g e t C o m m e n t ( ) )   +   " . \ n " ; 
 
 	 	 t e x   + =   " \ \ f o o t n o t e s i z e "   +   " \ n "   +   " \ \ b e g i n { l s t l i s t i n g } [ c a p t i o n = { " 
 
 	 	 	 	 +   L a t e x F i l t e r ( " C o m p o s i t i o n   o f   "   +   l a b e l ) 
 
 	 	 	 	 +   " } , l a b e l = , f r a m e = l i n e s ] \ n "   +   c o m p o s . t o S t r i n g ( ) 
 
 	 	 	 	 +   " \ n \ \ e n d { l s t l i s t i n g } \ n "   +   " \ \ n o r m a l s i z e "   +   " \ n " ; 
 
 	 	 / /   T O D O   b e   f i n e r 
 
 	 	 r e t u r n   t e x ; 
 
 	 } 
 
 
 
 	 / /   F i l e   c o n t r o l   c o m m a n d s 
 
 	 / * * 
 
 	   *   O p e n s   a n   o u t p u t   L a t e x   F i l e   a n d   w r i t e   t h e   h e a d e r .   C r e a t e s   t h e   r e q u i r e d 
 
 	   *   d i r e c t o r i e s . 
 
 	   *   
 
 	   *   @ p a r a m   o u t p u t p a t h 
 
 	   *   @ p a r a m   f i l e n a m e 
 
 	   *   @ p a r a m   a u t h o r 
 
 	   *   @ r e t u r n 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   F i l e W r i t e r   O p e n T e x F i l e ( S t r i n g   o u t p u t p a t h ,   S t r i n g   f i l e n a m e , 
 
 	 	 	 S t r i n g   a u t h o r )   t h r o w s   I O E x c e p t i o n   { 
 
 	 	 i f   ( o u t p u t p a t h   = =   n u l l )   { 
 
 	 	 	 o u t p u t p a t h   =   S y s t e m . g e t P r o p e r t y ( " u s e r . d i r " ) ; 
 
 	 	 	 i f   ( v e r b o s e ) 
 
 	 	 	 	 S y s t e m . o u t . p r i n t l n ( " O u t p u t   t o   "   +   o u t p u t p a t h ) ; 
 
 	 	 } 
 
 	 	 S t r i n g   f i g o u t p u t d i r   =   o u t p u t p a t h   +   " F I G U R E S "   +   " / " ; 
 
 	 	 n e w   F i l e ( f i g o u t p u t d i r ) . m k d i r s ( ) ; 
 
 	 	 / /   c r e a t e s   t h e   m i s s i n g   d i r e c t o r i e s   i f   n e e d e d 
 
 	 	 F i l e W r i t e r   f w   =   n e w   F i l e W r i t e r ( o u t p u t p a t h   +   f i l e n a m e   +   " . t e x " ) ; 
 
 	 	 f w . w r i t e ( S e t L a t e x H e a d e r ( " " ,   " P a s c a l " ,   L a t e x F i l t e r ( f i l e n a m e ) ) ) ; 
 
 	 	 r e t u r n   f w ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   C l o s e   t h e   L a t e x   f i l e   w i t h   f o o t e r . 
 
 	   *   
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   C l o s e T e x F i l e ( F i l e W r i t e r   f w )   t h r o w s   I O E x c e p t i o n   { 
 
 	 	 f w . w r i t e ( l a t e x F o o t e r ) ; 
 
 	 	 f w . c l o s e ( ) ; 
 
 	 } 
 
 
 
 	 / /   L A T E X   g e n e r a t i o n   c o m m a n d s 
 
 	 
 
 	 
 
 	 / * * 
 
 	   *   L T S t o T e x   E x p o r t s   a   K m e l i a   L T S   t o   L a T e X   f i l e   -   a   t e x   d e s c r i p t i o n   a s   a 
 
 	   *   l i s t i n g   i n c l u s i o n   -   a   p o s t c r i p t   i n c l u s i o n   ( g e n e r a t e d   b y   L T S t o E P S   i f   l i n u x 
 
 	   *   o r   m a n u a l l y   i f   w i n d o w s ) . 
 
 	   *   
 
 	   *   @ p a r a m   l t s   : 
 
 	   *                         a   L T S   s h o u l d   b e   d e p e n d e n t   o f   a   s e r v i c e   a n d   a   c o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h   : 
 
 	   *                         S t r i n g 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   L T S t o T e x ( L T S   l t s ,   S t r i n g   o u t p u t p a t h ,   S t r i n g   a u t h o r ) 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   L T S t o T e x ( L T S   l t s ,   S t r i n g   o u t p u t p a t h )   t h r o w s   I O E x c e p t i o n   { 
 
 	 	 L T S t o T e x ( l t s ,   o u t p u t p a t h ,   " c o l o s s " , n u l l ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   L T S t o T e x   E x p o r t s   a   K m e l i a   L T S   t o   L a T e X   f i l e   -   a   t e x   d e s c r i p t i o n   a s   a 
 
 	   *   l i s t i n g   i n c l u s i o n   -   a   p o s t c r i p t   i n c l u s i o n   ( g e n e r a t e d   b y   L T S t o E P S   i f   l i n u x 
 
 	   *   o r   m a n u a l l y   i f   w i n d o w s ) . 
 
 	   *   
 
 	   *   @ p a r a m   l t s   : 
 
 	   *                         L T S   s h o u l d   b e   d e p e n d e n t   o f   a   s e r v i c e   a n d   a   c o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h   : 
 
 	   *                         S t r i n g 
 
 	   *   @ p a r a m   a u t h o r   : 
 
 	   *                         t h e   L T S   a u t h o r 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   L T S t o E P S 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   L T S t o T e x ( L T S   l t s ,   S t r i n g   o u t p u t p a t h ,   S t r i n g   a u t h o r , P r o p e r t i e s   p ) 
 
 	 	 	 t h r o w s   I O E x c e p t i o n   { 
 
 	 	 / /   b e g i n   o f   c o n t r o l s 
 
 	 	 i f   ( l t s   = =   n u l l ) 
 
 	 	 	 r e t u r n ; 
 
 	 	 S t r i n g   f i l e n a m e ; 
 
 	 	 i f   ( l t s . g e t O w n e r ( )   = =   n u l l   | |   l t s . g e t C o m p o n e n t N a m e ( )   = =   n u l l ) 
 
 	 	 	 f i l e n a m e   =   " N o L T S C o n t e x t " ; 
 
 	 	 e l s e 
 
 	 	 	 f i l e n a m e   =   l t s . g e t C o m p o n e n t N a m e ( )   +   " . "   +   l t s . g e t S e r v i c e N a m e ( ) ; 
 
 	 	 / /   e n d   o f   c o n t r o l s 
 
 	 	 F i l e W r i t e r   f w   =   O p e n T e x F i l e ( o u t p u t p a t h ,   f i l e n a m e ,   a u t h o r ) ; 
 
 	 	 f w . w r i t e ( L a t e x F i l t e r ( " T h i s   d o c u m e n t   i n c l u d e s   a n   a u t o m a t i c   s p e c i f i c a t i o n   o f   t h e   b e h a v i o u r   o f   S e r v i c e   " 
 
 	 	 	 	 	 	 +   l t s . g e t S e r v i c e N a m e ( ) 
 
 	 	 	 	 	 	 +   "   o f   t h e   c o m p o n e n t   " 
 
 	 	 	 	 	 	 +   l t s . g e t C o m p o n e n t N a m e ( )   +   " . \ n " ) ) ; 
 
 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s e c t i o n { B e h a v i o u r   o f   S e r v i c e   " 
 
 	 	 	 	 +   l t s . g e t S e r v i c e N a m e ( )   +   "   o f   t h e   c o m p o n e n t   " 
 
 	 	 	 	 +   l t s . g e t C o m p o n e n t N a m e ( )   +   " } \ n " ) ) ; 
 
 	 	 f w . w r i t e ( L a t e x L i s t i n g ( l t s ) ) ; 
 
 	 	 / /   g e n e r a t e s   t h e   p o s t s c r i p t   f i l e   f o r   t h e   L T S 
 
 	 	 L T S t o E P S . w r i t e ( l t s ,   o u t p u t p a t h   +   " F I G U R E S "   +   " / " ,   f i l e n a m e , p ) ; 
 
 	 	 
 
 	 	 f w . w r i t e ( L a t e x F i g ( o u t p u t p a t h , f i l e n a m e   +   " . d o t _ l a y o u t . e p s " ,   f i l e n a m e ) ) ; 
 
 	 	 f w . f l u s h ( ) ; 
 
 	 	 
 
 	 	 C l o s e T e x F i l e ( f w ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   S e r v i c e T o T e x   E x p o r t s   a   K m e l i a   L T S   t o   L a T e X   f i l e   -   a   t e x   d e s c r i p t i o n   a s   a 
 
 	   *   l i s t i n g   i n c l u s i o n   -   a   p o s t c r i p t   i n c l u s i o n   ( g e n e r a t e d   b y   L T S t o E P S ) . 
 
 	   *   
 
 	   *   @ p a r a m   s e r v   : 
 
 	   *                         a   K m e l i a   s e r v i c e   s h o u l d   b e   d e p e n d e n t   o f   a   c o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h   : 
 
 	   *                         S t r i n g 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   L T S t o T e x ( L T S   l t s ,   S t r i n g   o u t p u t p a t h ,   S t r i n g   a u t h o r ) 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   s e r v i c e T o T e x ( S e r v i c e   s e r v ,   S t r i n g   o u t p u t p a t h ) 
 
 	 	 	 t h r o w s   I O E x c e p t i o n   { 
 
 	 	 s e r v i c e T o T e x ( s e r v ,   o u t p u t p a t h ,   " c o l o s s " ,   n u l l ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   S e r v i c e T o T e x   E x p o r t s   a   K m e l i a   s e r v i c e   t o   L a T e X   f i l e   -   a   t e x   d e s c r i p t i o n 
 
 	   *   a s   a   l i s t i n g   i n c l u s i o n   -   a   p o s t c r i p t   i n c l u s i o n   ( g e n e r a t e d   b y   L T S t o E P S ) . 
 
 	   *   
 
 	   *   @ p a r a m   s e r v   : 
 
 	   *                         a   K m e l i a   s e r v i c e   s h o u l d   b e   d e p e n d e n t   o f   a   c o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h   : 
 
 	   *                         S t r i n g 
 
 	   *   @ p a r a m   a u t h o r   : 
 
 	   *                         t h e   s e r v i c e   a u t h o r 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   L T S t o E P S 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   s e r v i c e T o T e x ( S e r v i c e   s e r v ,   S t r i n g   o u t p u t p a t h , 
 
 	 	 	 S t r i n g   a u t h o r ,   P r o p e r t i e s   p r o p )   t h r o w s   I O E x c e p t i o n   { 
 
 	 	 / /   b e g i n   o f   c o n t r o l s 
 
 	 	 i f   ( s e r v   = =   n u l l ) 
 
 	 	 	 r e t u r n ; 
 
 	 	 S t r i n g   f i l e n a m e ; 
 
 	 	 i f   ( s e r v . g e t O w n e r ( )   = =   n u l l ) 
 
 	 	 	 f i l e n a m e   =   " N o S e r v i c e C o n t e x t " ; 
 
 	 	 e l s e 
 
 	 	 	 f i l e n a m e   =   s e r v . g e t O w n e r ( ) . g e t N a m e ( )   +   " . "   +   s e r v . g e t N a m e ( ) ; 
 
 	 	 / /   e n d   o f   c o n t r o l s 
 
 	 	 F i l e W r i t e r   f w   =   O p e n T e x F i l e ( o u t p u t p a t h ,   f i l e n a m e ,   a u t h o r ) ; 
 
 	 	 f w . w r i t e ( L a t e x F i l t e r ( " T h i s   d o c u m e n t   i n c l u d e s   a n   a u t o m a t i c   s p e c i f i c a t i o n   o f   t h e   b e h a v i o u r   o f   t h e   s e r v i c e   " 
 
 	 	 	 	 	 	 +   s e r v . g e t N a m e ( ) 
 
 	 	 	 	 	 	 +   "   o f   t h e   c o m p o n e n t   " 
 
 	 	 	 	 	 	 +   s e r v . g e t O w n e r ( ) . g e t N a m e ( )   +   " . \ n " ) ) ; 
 
 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s e c t i o n { S e r v i c e   "   +   s e r v . g e t N a m e ( ) 
 
 	 	 	 	 +   "   o f   t h e   c o m p o n e n t   "   +   s e r v . g e t O w n e r ( ) . g e t N a m e ( )   +   " } \ n " ) ) ; 
 
 	 	 f w . w r i t e ( L a t e x L i s t i n g ( s e r v ) ) ; 
 
 	 	 L T S t o E P S . w r i t e ( s e r v . g e t B e h a v i o r ( ) ,   o u t p u t p a t h   +   " F I G U R E S "   +   " / " , 
 
 	 	 	 	 f i l e n a m e ,   p r o p ) ; 
 
 	 	 
 
 	 	 f w . w r i t e ( L a t e x F i g ( o u t p u t p a t h , f i l e n a m e   +   " . d o t _ l a y o u t . e p s " ,   f i l e n a m e ) ) ; 
 
 	 	 C l o s e T e x F i l e ( f w ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   C o m p o n e n t T o T e x   E x p o r t s   a   K m e l i a   C o m p o n e n t   t o   L a T e X   f i l e   -   a   t e x 
 
 	   *   d e s c r i p t i o n   a s   a   l i s t i n g   i n c l u s i o n   -   a   p o s t c r i p t   i n c l u s i o n   ( g e n e r a t e d   b y 
 
 	   *   L T S t o E P S ) . 
 
 	   *   
 
 	   *   @ p a r a m   c o m p   : 
 
 	   *                         a   C o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   L T S t o T e x ( L T S   l t s ,   S t r i n g   o u t p u t p a t h ,   S t r i n g   a u t h o r ) 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   c o m p o n e n t T o T e x ( C o m p o n e n t   c o m p ,   S t r i n g   o u t p u t p a t h ) 
 
 	 	 	 t h r o w s   I O E x c e p t i o n   { 
 
 	 	 c o m p o n e n t T o T e x ( c o m p ,   o u t p u t p a t h ,   " c o l o s s " ,   n u l l ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   O u t p u t s   a   b a s e   c o m p o n e n t   t o   t h e   f i l e   ( p r i v a t e ) . 
 
 	   *   
 
 	   *   @ p a r a m   f w   : 
 
 	   *                         t h e   f i l e 
 
 	   *   @ p a r a m   f i l e n a m e   : 
 
 	   *                         t h e   f i l e   n a m e 
 
 	   *   @ p a r a m   c o m p   : 
 
 	   *                         t h e   c o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h   : 
 
 	   *                         t h e   o u t p u t   d i r e c t o r y 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   c o m p o n e n t T o T e x 
 
 	   * / 
 
 	 p r o t e c t e d   s t a t i c   v o i d   w r i t e B a s e C o m p o n e n t T o T e x ( F i l e W r i t e r   f w , 
 
 	 	 	 S t r i n g   f i l e n a m e ,   C o m p o n e n t   c o m p ,   S t r i n g   o u t p u t p a t h ,   P r o p e r t i e s   p r o p ) 
 
 	 	 	 t h r o w s   I O E x c e p t i o n   { 
 
 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s e c t i o n { C o m p o n e n t   "   +   c o m p . g e t N a m e ( )   +   " } \ n " ) ) ; 
 
 	 	 f w . w r i t e ( L a t e x L i s t i n g ( c o m p ) ) ; 
 
 	 	 f o r   ( S e r v i c e   s e r v   :   c o m p . g e t S e r v i c e s ( ) )   { 
 
 	 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s u b s e c t i o n { S e r v i c e   "   +   s e r v . g e t N a m e ( ) 
 
 	 	 	 	 	 +   " } \ n " ) ) ; 
 
 	 	 	 f w . w r i t e ( L a t e x L i s t i n g ( s e r v ) ) ; 
 
 	 	 	 i f   ( s e r v . g e t B e h a v i o r ( )   ! =   n u l l )   { 
 
 	 	 	 	 S t r i n g   s e r v f i l e n a m e   =   c o m p . g e t N a m e ( )   +   " . "   +   s e r v . g e t N a m e ( ) ; 
 
 	 	 	 	 L T S t o E P S . w r i t e ( s e r v . g e t B e h a v i o r ( ) , 
 
 	 	 	 	 	 	 o u t p u t p a t h   +   " F I G U R E S "   +   " / " ,   s e r v f i l e n a m e ,   p r o p ) ; 
 
 	 	 	 	 f w . w r i t e ( L a t e x F i g ( o u t p u t p a t h , s e r v f i l e n a m e   +   " . d o t _ l a y o u t . e p s " , 
 
 	 	 	 	 	 	 s e r v f i l e n a m e ) ) ; 
 
 	 	 	 } 
 
 	 	 } 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   O u t p u t s   a   c o m p o s i t e   c o m p o n e n t   t o   t h e   f i l e   ( p r i v a t e ) .   I   t h o u g h t   I   c o u l d 
 
 	   *   i n t r o d u c e   a   c h a p t e r   h e r e   b u t   t h e   p r o b l e m   i s   t h a t   I   d o n t   k n o w   t h e   n u m b e r 
 
 	   *   o f   c o m p o s i t i o n   l e v e l s .   I n   a n y   c a s e   t h i s   c o u l d   n o t   f i t   t o   t h e   L a t e x 
 
 	   *   d o c u m e n t   s t r u c t u r e . 
 
 	   *   
 
 	   *   @ p a r a m   f w   : 
 
 	   *                         t h e   f i l e 
 
 	   *   @ p a r a m   f i l e n a m e   : 
 
 	   *                         t h e   f i l e   n a m e 
 
 	   *   @ p a r a m   c o m p   : 
 
 	   *                         t h e   c o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h   : 
 
 	   *                         t h e   o u t p u t   d i r e c t o r y 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   c o m p o n e n t T o T e x 
 
 	   * / 
 
 	 p r o t e c t e d   s t a t i c   v o i d   w r i t e C o m p o n e n t T o T e x ( F i l e W r i t e r   f w ,   S t r i n g   f i l e n a m e , 
 
 	 	 	 C o m p o n e n t   c o m p ,   S t r i n g   o u t p u t p a t h ,   P r o p e r t i e s   p r o p )   t h r o w s   I O E x c e p t i o n   { 
 
 	 	 / /   w r i t e B a s e C o m p o n e n t T o T e x ( f w ,   f i l e n a m e ,   c o m p ,   o u t p u t p a t h ) ; 
 
 	 	 / /   t h e   c o m p o s i t e   l e v e l   c a n   s i m p l y   b e   s e e n   a s   a   b a s i c   c o m p o n e n t 
 
 	 	 / /   b u t   t h e   p r o m o t e d   s e r v i c e s   a r e   w r i t t e n   t w i c e 
 
 	 	 i f   ( c o m p . i s C o m p o s i t e ( ) )   { 
 
 	 	 	 / /   t h e   a b s t r a c t   p a r t 
 
 	 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s e c t i o n { C o m p o n e n t   "   +   c o m p . g e t N a m e ( ) 
 
 	 	 	 	 	 +   " } \ n " ) ) ; 
 
 	 	 	 f w . w r i t e ( L a t e x L i s t i n g ( c o m p ) ) ; 
 
 	 	 	 f o r   ( S e r v i c e   s e r v   :   c o m p . g e t S e r v i c e s ( ) )   { 
 
 	 	 	 	 i f   ( ! s e r v . i s P r o m o t e d ( ) )   { 
 
 	 	 	 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s u b s e c t i o n { S e r v i c e   " 
 
 	 	 	 	 	 	 	 +   s e r v . g e t N a m e ( )   +   " } \ n " ) ) ; 
 
 	 	 	 	 	 f w . w r i t e ( L a t e x L i s t i n g ( s e r v ) ) ; 
 
 	 	 	 	 	 i f   ( s e r v . g e t B e h a v i o r ( )   ! =   n u l l )   { 
 
 	 	 	 	 	 	 S t r i n g   s e r v f i l e n a m e   =   c o m p . g e t N a m e ( )   +   " . "   +   s e r v . g e t N a m e ( ) ; 
 
 	 	 	 	 	 	 L T S t o E P S . w r i t e ( s e r v . g e t B e h a v i o r ( ) ,   o u t p u t p a t h 
 
 	 	 	 	 	 	 	 	 +   " F I G U R E S "   +   " / " ,   s e r v f i l e n a m e ,   p r o p ) ; 
 
 	 	 	 	 	 	 f w . w r i t e ( L a t e x F i g ( o u t p u t p a t h , s e r v f i l e n a m e   +   " . d o t _ l a y o u t . e p s " , 
 
 	 	 	 	 	 	 	 	 s e r v f i l e n a m e ) ) ; 
 
 	 	 	 	 	 } 
 
 	 	 	 	 }   e l s e   i f   ( v e r b o s e ) 
 
 	 	 	 	 	 S y s t e m . o u t . p r i n t l n ( " p r o m o t e d   s e r v i c e :   "   +   s e r v . g e t N a m e ( ) ) ; 
 
 
 
 	 	 	 } 
 
 	 	 	 / /   t h e   c o m p o s i t i o n   p a r t 
 
 	 	 	 C o m p o s i t i o n   c o m p o s   =   c o m p . g e t C o m p o s i t i o n ( ) ; 
 
 	 	 	 f w . w r i t e ( L a t e x F i l t e r ( " \ \ s u b s e c t i o n { C o m p o s i t i o n   p a r t   o f   " 
 
 	 	 	 	 	 +   c o m p . g e t N a m e ( )   +   " } \ n " ) ) ; 
 
 	 	 	 f w . w r i t e ( L a t e x L i s t i n g ( c o m p o s ) ) ; 
 
 	 	 	 / /   T O D O   i n t r o d u c e   a n   a u t o m a t i c   D O T   p i c t u r e   h e r e   i f   p o s s i b l e   f o r   t h e 
 
 	 	 	 / /   l i n k s 
 
 	 	 	 f o r   ( C o m p o n e n t   p a r t   :   c o m p o s . g e t C o m p o n e n t s ( ) . v a l u e s ( ) )   { 
 
 	 	 	 	 w r i t e C o m p o n e n t T o T e x ( f w ,   f i l e n a m e ,   p a r t ,   o u t p u t p a t h , p r o p ) ; 
 
 	 	 	 } 
 
 	 	 }   e l s e 
 
 	 	 	 w r i t e B a s e C o m p o n e n t T o T e x ( f w ,   f i l e n a m e ,   c o m p ,   o u t p u t p a t h , p r o p ) ; 
 
 	 } 
 
 
 
 	 / * * 
 
 	   *   C o m p o n e n t T o T e x   E x p o r t s   a   K m e l i a   C o m p o n e n t   t o   L a T e X   f i l e   -   a   t e x 
 
 	   *   d e s c r i p t i o n   a s   a   l i s t i n g   i n c l u s i o n   -   a   p o s t c r i p t   i n c l u s i o n   ( g e n e r a t e d   b y 
 
 	   *   L T S t o E P S ) . 
 
 	   *   
 
 	   *   @ p a r a m   c o m p   : 
 
 	   *                         a   C o m p o n e n t 
 
 	   *   @ p a r a m   o u t p u t p a t h 
 
 	   *   @ p a r a m   a u t h o r   : 
 
 	   *                         t h e   s e r v i c e   a u t h o r 
 
 	   *   @ t h r o w s   I O E x c e p t i o n 
 
 	   *   @ s e e   L T S t o E P S 
 
 	   * / 
 
 	 p u b l i c   s t a t i c   v o i d   c o m p o n e n t T o T e x ( C o m p o n e n t   c o m p ,   S t r i n g   o u t p u t p a t h , 
 
 	 	 	 S t r i n g   a u t h o r ,   P r o p e r t i e s   p r o p )   t h r o w s   I O E x c e p t i o n   { 
 
 	 	 / /   b e g i n   o f   c o n t r o l s 
 
 	 	 i f   ( c o m p   = =   n u l l ) 
 
 	 	 	 r e t u r n ; 
 
 	 	 S t r i n g   f i l e n a m e   =   c o m p . g e t N a m e ( ) ; 
 
 	 	 / /   e n d   o f   c o n t r o l s 
 
 	 	 F i l e W r i t e r   f w   =   O p e n T e x F i l e ( o u t p u t p a t h ,   f i l e n a m e ,   a u t h o r ) ; 
 
 	 	 f w . w r i t e ( L a t e x F i l t e r ( " T h i s   d o c u m e n t   i n c l u d e s   a n   a u t o m a t i c   s p e c i f i c a t i o n   o f   t h e   c o m p o n e n t   " 
 
 	 	 	 	 	 	 +   f i l e n a m e   +   " . \ n " ) ) ; 
 
 	 	 w r i t e C o m p o n e n t T o T e x ( f w ,   f i l e n a m e ,   c o m p ,   o u t p u t p a t h ,   p r o p ) ; 
 
 	 	 C l o s e T e x F i l e ( f w ) ; 
 
 	 } 
 
 
 
 	 / /   L A T E X   m a i n   g e n e r a t i o n   c o m m a n d 
 
 
 
 	 p u b l i c   s t a t i c   v o i d   m a i n ( S t r i n g [ ]   a r g s )   t h r o w s   E x c e p t i o n   { 
 
 	 	 / /   u n   t e s t   s a n s   f a c t o r y 
 
 	 	 P r o p e r t i e s   u s e r p r o p   =   n e w   P r o p e r t i e s ( ) ; 
 
 	 	 u s e r p r o p . l o a d ( n e w   F i l e I n p u t S t r e a m ( " C o s t o l i b . u s e r p r e f s " ) ) ; 
 
 	 	 S t r i n g   a r c h i   =   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . a r c h i " ) ; 
 
 	 	 / /   i f   ( e r r v e r b o s e )   S y s t e m . e r r . p r i n t l n ( " a r c h i   :   "   +   a r c h i ) ; 
 
 	 	 S t r i n g   b a s e d i r ; 
 
 	 	 i f   ( a r c h i . e q u a l s ( " w i n d o w s " ) ) 
 
 	 	 	 b a s e d i r   =   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . W i n b a s e d i r " ) ; 
 
 	 	 e l s e   i f   ( a r c h i . e q u a l s ( " l i n u x " ) ) 
 
 	 	 	 b a s e d i r   =   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . L i n b a s e d i r " ) ; 
 
 	 	 e l s e 
 
 	 	 	 b a s e d i r   =   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . b a s e d i r " ) ; 
 
 	 	 i f   ( e r r v e r b o s e ) 
 
 	 	 	 S y s t e m . e r r . p r i n t l n ( " b a s e d i r   :   "   +   b a s e d i r ) ; 
 
 	 	 S t r i n g   s p e c d i r   =   b a s e d i r   +   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . s p e c d i r " ) ; 
 
 	 	 i f   ( e r r v e r b o s e ) 
 
 	 	 	 S y s t e m . e r r . p r i n t l n ( " s p e c d i r   :   "   +   s p e c d i r ) ; 
 
 	 	 S t r i n g   c o m p o n e n t _ n a m e   =   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . b a s e c o m p " ) ; 
 
 	 	 C o m p o n e n t   c o m p   =   L o a d e r . l o a d C o m p o n e n t ( s p e c d i r ,   c o m p o n e n t _ n a m e ) ; 
 
 	 	 S t r i n g   m a i n _ s e r v   =   u s e r p r o p . g e t P r o p e r t y ( " c o s t o . m a i n s e r v " ) ; 
 
 	 	 i f   ( e r r v e r b o s e ) 
 
 	 	 	 S y s t e m . e r r . p r i n t l n ( " m a i n _ s e r v   :   "   +   m a i n _ s e r v ) ; 
 
 	 	 S t r i n g   o u t p u t d i r   =   s p e c d i r   +   " L A T E X "   +   " / " ; 
 
 	 	 / /   F i l e   f = n e w   F i l e ( o u t p u t d i r ) ; 
 
 	 	 / /   i f   ( ! f . e x i s t s ( ) )   { 
 
 	 	 / /   f . m k d i r ( ) ; 
 
 	 	 / /   i f   ( v e r b o s e )   S y s t e m . o u t . p r i n t l n ( " c r e a t e   :   "   +   o u t p u t d i r ) ; 
 
 	 	 / /   } 
 
 	 	 i f   ( e r r v e r b o s e ) 
 
 	 	 	 S y s t e m . e r r . p r i n t l n ( " o u t p u t d i r   :   "   +   o u t p u t d i r ) ; 
 
 	 	 S e r v i c e   b a s e s e r v   =   c o m p . g e t S e r v i c e ( m a i n _ s e r v ) ; 
 
 	 	 / /   t e s t 1   :   L T S 
 
 	 	 / /   L T S   l t s   =   n e w   L T S ( b a s e s e r v . g e t B e h a v i o r ( ) ) ; 
 
 	 	 / /   L T S t o T e x ( l t s ,   o u t p u t d i r ) ; 
 
 	 	 / /   t e s t 2   :   s e r v i c e 
 
 	 	 / /   s e r v i c e T o T e x ( b a s e s e r v ,   o u t p u t d i r ) ; 
 
 	 	 / /   t e s t 3   :   c o m p o n e n t 
 
 	 	 c o m p o n e n t T o T e x ( c o m p ,   o u t p u t d i r ,   " P a s c a l   A n d r  " , n u l l ) ; 
 
 	 	 / /   t e s t 4   :   c o m p o s i t i o n 
 
 	 	 / /   C o m p o s i t i o n T o T e x ( c o m p ,   o u t p u t d i r ) ; 
 
 	 	 / /   g e n e r a t e s   d o t   a n d   e p s   f i l e s 
 
 	 	 / /   L T S   l t s ,   S t r i n g   o u t p u t p a t h ,   S t r i n g   f i l e n a m e 
 
 	 	 S y s t e m . o u t . p r i n t l n ( " l e v e l   :   c o m p   "   +   c o m p . g e t N a m e ( ) ) ; 
 
 	 	 / /   S y s t e m . o u t . p r i n t l n ( " l e v e l   :   c o m p   "   +   c o m p . t o S t r i n g ( ) ) ; 
 
 	 	 S y s t e m . o u t . p r i n t l n ( " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " ) ; 
 
 	 } 
 
 } 
 
