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; |
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() { |
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 |
|
|
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); |