Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jpicedt/format/latex/parser/PicArrowTypeExpression.java


1   /*
2    PicArrowTypeExpression.java - July 23, 2002 - jPicEdt 1.3.2, a picture editor for LaTeX.
3    Copyright (C) 1999-2002 Sylvain Reynal
4   
5    Département de Physique
6    Ecole Nationale Supérieure de l'Electronique et de ses Applications (ENSEA)
7    6, avenue du Ponceau
8    F-95014 CERGY CEDEX
9   
10   Tel : +33 130 736 245
11   Fax : +33 130 736 667
12   e-mail : reynal@ensea.fr
13   jPicEdt web page : http://www.jpicedt.org/
14    
15   This program is free software; you can redistribute it and/or
16   modify it under the terms of the GNU General Public License
17   as published by the Free Software Foundation; either version 2
18   of the License, or any later version.
19    
20   This program is distributed in the hope that it will be useful,
21   but WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23   GNU General Public License for more details.
24    
25   You should have received a copy of the GNU General Public License
26   along with this program; if not, write to the Free Software
27   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28   */
29  
30  package jpicedt.format.latex.parser;
31  
32  import jpicedt.graphic.io.parser.*;
33  import jpicedt.graphic.model.*;
34  
35  /**
36   * "0/1 0/1" arrow type (we take for granted that this string is followed by a LaTeX-picPoint, as in
37   * %Line 0 1 (2.3,4.5)..., possibly with leading whitespaces)
38   */
39  public class PicArrowTypeExpression extends WordExpression  implements ExpressionConstants, PicObjectConstants {
40  
41      private Pool pool;
42  
43      public PicArrowTypeExpression(Pool pl){
44      super("(", false); // postfix="(" (start of PicPoint), not swallowed
45      pool = pl;
46      }
47  
48      public void action(ParserEvent e){
49    
50      if (DEBUG) System.out.println(e);
51      String s = (String)e.getValue();
52      if (s.startsWith("0 1")) {
53        pool.currentObj.setAttribute(LEFT_ARROW, Arrow.NONE);
54        pool.currentObj.setAttribute(RIGHT_ARROW, Arrow.ARROW_HEAD);
55        return;
56      }
57      else if (s.startsWith("1 0")) {
58        pool.currentObj.setAttribute(LEFT_ARROW, Arrow.ARROW_HEAD);
59        pool.currentObj.setAttribute(RIGHT_ARROW, Arrow.NONE);
60        return;
61      }
62      else if (s.startsWith("1 1")) {
63        pool.currentObj.setAttribute(LEFT_ARROW, Arrow.ARROW_HEAD);
64        pool.currentObj.setAttribute(RIGHT_ARROW, Arrow.ARROW_HEAD);
65        return;
66      }
67      else {
68        pool.currentObj.setAttribute(LEFT_ARROW, Arrow.NONE);
69        pool.currentObj.setAttribute(RIGHT_ARROW, Arrow.NONE);
70      }
71      }
72  }