/[gzz]/gzz/gzz/vob/LinebreakableChain.java
ViewVC logotype

Diff of /gzz/gzz/vob/LinebreakableChain.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by benja, Sat Sep 21 16:53:34 2002 UTC revision 1.6 by benja, Sat Sep 21 21:49:04 2002 UTC
# Line 31  String rcsid = "$Id$"; Line 31  String rcsid = "$Id$";
31      public static final int GLUE_LENGTH = 0;      public static final int GLUE_LENGTH = 0;
32      public static final int GLUE_STRETCH = 1;      public static final int GLUE_STRETCH = 1;
33      public static final int GLUE_SHRINK = 2;      public static final int GLUE_SHRINK = 2;
34        public static final int BREAKS = 3;
35    
36        protected static final int PROPERTIES = 4;
37    
38      int nboxes;      int nboxes;
39      protected HBox[] boxes;      protected HBox[] boxes;
# Line 57  String rcsid = "$Id$"; Line 60  String rcsid = "$Id$";
60      }      }
61    
62      public void addGlue(float len, float str, float shr) {      public void addGlue(float len, float str, float shr) {
63          glues[nboxes*3 + GLUE_LENGTH] += len;          glues[nboxes*PROPERTIES + GLUE_LENGTH] += len;
64          glues[nboxes*3 + GLUE_STRETCH] += str;          glues[nboxes*PROPERTIES + GLUE_STRETCH] += str;
65          glues[nboxes*3 + GLUE_SHRINK] += shr;          glues[nboxes*PROPERTIES + GLUE_SHRINK] += shr;
66        }
67    
68        public void addBreak() {
69            glues[nboxes*PROPERTIES + BREAKS]++;
70      }      }
71    
72      public int length() {      public int length() {
# Line 73  String rcsid = "$Id$"; Line 80  String rcsid = "$Id$";
80      public float getGlue(int n, int property) {      public float getGlue(int n, int property) {
81          if(property < 0 || property > 2)          if(property < 0 || property > 2)
82              throw new IllegalArgumentException("illegal property: "+property);              throw new IllegalArgumentException("illegal property: "+property);
83          return glues[(n * 3) + property];          return glues[(n * PROPERTIES) + property];
84        }
85        
86        public int getBreaks(int n) {
87            return (int)glues[(n * PROPERTIES) + BREAKS];
88      }      }
89    
90    
# Line 87  String rcsid = "$Id$"; Line 98  String rcsid = "$Id$";
98       */       */
99      void allocCopy(int n) {      void allocCopy(int n) {
100          HBox[] nboxes = new HBox[n];          HBox[] nboxes = new HBox[n];
101          float[] nglues = new float[3*(n+1)];          float[] nglues = new float[PROPERTIES*(n+1)];
102          if(boxes != null) {          if(boxes != null) {
103              System.arraycopy(boxes, 0, nboxes, 0, boxes.length);              System.arraycopy(boxes, 0, nboxes, 0, boxes.length);
104              System.arraycopy(glues, 0, nglues, 0, glues.length);              System.arraycopy(glues, 0, nglues, 0, glues.length);

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26