[FOray-commit] SF.net SVN: foray: [8561] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-01-31 20:29:47
|
Revision: 8561
http://svn.sourceforge.net/foray/?rev=8561&view=rev
Author: victormote
Date: 2007-01-31 12:29:39 -0800 (Wed, 31 Jan 2007)
Log Message:
-----------
Conform to axsl changes for converting an enumeration to a typesafe enum.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-01-31 19:02:30 UTC (rev 8560)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-01-31 20:29:39 UTC (rev 8561)
@@ -36,7 +36,7 @@
import org.axsl.areaW.NormalBlockArea;
import org.axsl.areaW.TableArea;
import org.axsl.common.AbsoluteAxis;
-import org.axsl.common.Constants;
+import org.axsl.common.AbsoluteDirection;
import org.axsl.common.FoValue;
import org.axsl.common.LinkType;
import org.axsl.common.RelativeAxis;
@@ -352,7 +352,7 @@
if (this.getBPAxis() == AbsoluteAxis.VERTICAL) {
// Our BP Axis is vertical
final boolean goingRight = this.traitIPDirectionOdd()
- == Constants.DIRECTION_LEFT_TO_RIGHT;
+ == AbsoluteDirection.LEFT_TO_RIGHT;
if (goingRight) {
x -= this.traitBorderStartWidth();
} else {
@@ -361,7 +361,7 @@
} else {
// Our BP Axis is horizontal
final boolean goingRight = this.traitBPDirection()
- == Constants.DIRECTION_LEFT_TO_RIGHT;
+ == AbsoluteDirection.LEFT_TO_RIGHT;
if (goingRight) {
x -= this.traitBorderBeforeWidth();
} else {
@@ -382,7 +382,7 @@
if (this.getBPAxis() == AbsoluteAxis.VERTICAL) {
// Our BP Axis is vertical
final boolean goingDown = this.traitBPDirection()
- == Constants.DIRECTION_TOP_TO_BOTTOM;
+ == AbsoluteDirection.TOP_TO_BOTTOM;
if (goingDown) {
y += this.traitBorderBeforeWidth();
} else {
@@ -391,7 +391,7 @@
} else {
// Our BP Axis is horizontal
final boolean goingUp = this.traitIPDirectionOdd()
- == Constants.DIRECTION_BOTTOM_TO_TOP;
+ == AbsoluteDirection.BOTTOM_TO_TOP;
if (goingUp) {
y -= this.traitBorderStartWidth();
} else {
@@ -452,7 +452,7 @@
if (this.getBPAxis() == AbsoluteAxis.VERTICAL) {
// Our BP Axis is vertical
final boolean goingRight = this.traitIPDirectionOdd()
- == Constants.DIRECTION_LEFT_TO_RIGHT;
+ == AbsoluteDirection.LEFT_TO_RIGHT;
if (goingRight) {
x -= this.traitPaddingStart();
} else {
@@ -461,7 +461,7 @@
} else {
// Our BP Axis is horizontal
final boolean goingRight = this.traitBPDirection()
- == Constants.DIRECTION_LEFT_TO_RIGHT;
+ == AbsoluteDirection.LEFT_TO_RIGHT;
if (goingRight) {
x -= this.traitPaddingBefore();
} else {
@@ -481,7 +481,7 @@
int y = crOriginY();
if (this.getBPAxis() == AbsoluteAxis.VERTICAL) {
final boolean goingDown = this.traitBPDirection()
- == Constants.DIRECTION_TOP_TO_BOTTOM;
+ == AbsoluteDirection.TOP_TO_BOTTOM;
if (goingDown) {
y += this.traitPaddingBefore();
} else {
@@ -490,7 +490,7 @@
} else {
// Our BP Axis is horizontal
final boolean goingRight = this.traitBPDirection()
- == Constants.DIRECTION_LEFT_TO_RIGHT;
+ == AbsoluteDirection.LEFT_TO_RIGHT;
if (goingRight) {
y -= this.traitPaddingBefore();
} else {
@@ -534,26 +534,24 @@
public int crOriginX() {
// Start at the parent's content origin.
int x = crReferenceX();
- switch (getWritingMode().getIPDirectionOdd()) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ final AbsoluteDirection ipOdd = getWritingMode().getIPDirectionOdd();
+ if (ipOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
x += this.crOriginIPDOffset();
return x;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (ipOdd == AbsoluteDirection.RIGHT_TO_LEFT) {
x -= this.crOriginIPDOffset();
return x;
}
- }
- switch (getWritingMode().getBPDirection()) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ final AbsoluteDirection bpd = getWritingMode().getBPDirection();
+ if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
x += this.crOriginBPDOffset();
return x;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
x -= this.crOriginBPDOffset();
return x;
}
- }
return x;
}
@@ -573,26 +571,24 @@
public int crOriginY() {
// Start at the parent's content origin.
int y = getParentArea().crOriginY();
- switch (getWritingMode().getBPDirection()) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ final AbsoluteDirection bpd = getWritingMode().getBPDirection();
+ if (bpd == AbsoluteDirection.TOP_TO_BOTTOM) {
y -= this.crOriginBPDOffset();
return y;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
y += this.crOriginBPDOffset();
return y;
}
- }
- switch (getWritingMode().getIPDirectionOdd()) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ final AbsoluteDirection ipOdd = getWritingMode().getIPDirectionOdd();
+ if (ipOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
y -= this.crOriginIPDOffset();
return y;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (ipOdd == AbsoluteDirection.RIGHT_TO_LEFT) {
y += this.crOriginIPDOffset();
return y;
}
- }
return y;
}
@@ -791,15 +787,15 @@
return traitGeneratedBy().traitSpaceEndOptimum(this, ancestor.crIPD());
}
- public byte traitBPDirection() {
+ public AbsoluteDirection traitBPDirection() {
return traitGeneratedBy().traitBPDirection(this);
}
- public byte traitIPDirectionOdd() {
+ public AbsoluteDirection traitIPDirectionOdd() {
return traitGeneratedBy().traitIPDirectionOdd(this);
}
- public byte traitIPDirectionEven() {
+ public AbsoluteDirection traitIPDirectionEven() {
return traitGeneratedBy().traitIPDirectionEven(this);
}
@@ -921,7 +917,7 @@
* DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, depending on
* the writing-mode.
*/
- public byte contentStackingDirectionAbsolute() {
+ public AbsoluteDirection contentStackingDirectionAbsolute() {
final RelativeAxis relative = contentStackingAxisRelative();
return getWritingMode().getAbsoluteDirFromRelativeAxis(relative);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-01-31 19:02:30 UTC (rev 8560)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-01-31 20:29:39 UTC (rev 8561)
@@ -34,7 +34,7 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
import org.axsl.common.AbsoluteAxis;
-import org.axsl.common.Constants;
+import org.axsl.common.AbsoluteDirection;
import org.axsl.common.FoValue;
import org.axsl.common.RelativeAxis;
import org.axsl.foR.FObj;
@@ -385,44 +385,42 @@
}
public int crOriginX() {
- switch (getWritingMode().getAbsoluteDirFromRelativeAxis(
- RelativeAxis.BLOCK_PROGRESSION)) {
- case Constants.DIRECTION_TOP_TO_BOTTOM:
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ final AbsoluteDirection direction = getWritingMode()
+ .getAbsoluteDirFromRelativeAxis(
+ RelativeAxis.BLOCK_PROGRESSION);
+ if (direction.isVertical()) {
if (getWritingMode().getIPDirectionOdd()
- == Constants.DIRECTION_LEFT_TO_RIGHT) {
+ == AbsoluteDirection.LEFT_TO_RIGHT) {
return getMarginLeft();
}
return this.traitPageWidth() - getMarginRight();
}
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (direction == AbsoluteDirection.LEFT_TO_RIGHT) {
return getMarginLeft();
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (direction == AbsoluteDirection.RIGHT_TO_LEFT) {
return this.traitPageWidth() - getMarginRight();
}
- }
return 0;
}
public int crOriginY() {
- switch (getWritingMode().getAbsoluteDirFromRelativeAxis(
- RelativeAxis.BLOCK_PROGRESSION)) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
- return traitPageHeight() - getMarginTop();
- }
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- return getMarginBottom();
- }
- case Constants.DIRECTION_LEFT_TO_RIGHT:
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ final AbsoluteDirection direction = getWritingMode()
+ .getAbsoluteDirFromRelativeAxis(
+ RelativeAxis.BLOCK_PROGRESSION);
+ if (direction.isHorizontal()) {
if (getWritingMode().getIPDirectionOdd()
- == Constants.DIRECTION_TOP_TO_BOTTOM) {
+ == AbsoluteDirection.TOP_TO_BOTTOM) {
return traitPageHeight() - getMarginTop();
}
return getMarginBottom();
}
+ if (direction == AbsoluteDirection.TOP_TO_BOTTOM) {
+ return traitPageHeight() - getMarginTop();
}
+ if (direction == AbsoluteDirection.BOTTOM_TO_TOP) {
+ return getMarginBottom();
+ }
return 0;
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2007-01-31 19:02:30 UTC (rev 8560)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2007-01-31 20:29:39 UTC (rev 8561)
@@ -33,7 +33,7 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
import org.axsl.common.AbsoluteAxis;
-import org.axsl.common.Constants;
+import org.axsl.common.AbsoluteDirection;
import org.axsl.common.RelativeAxis;
import org.axsl.foR.fo.RegionBody;
import org.axsl.foR.fo.SimplePageMaster;
@@ -129,46 +129,40 @@
public int brOriginX() {
// Start at the parent's content origin.
- int x = getParentArea().crOriginX();
+ final int x = getParentArea().crOriginX();
final SimplePageMaster spm = getPageMaster();
- switch (getParentArea().contentStackingDirectionAbsolute()) {
- case Constants.DIRECTION_TOP_TO_BOTTOM:
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- // x is where it needs to be
- break;
+ final AbsoluteDirection stackingDirection
+ = getParentArea().contentStackingDirectionAbsolute();
+ if (stackingDirection.isVertical()) {
+ /* x is where it needs to be. */
+ return x;
}
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
- x += spm.getStartExtent();
- break;
+ if (stackingDirection == AbsoluteDirection.LEFT_TO_RIGHT) {
+ return x + spm.getStartExtent();
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
- x -= spm.getEndExtent();
- break;
+ if (stackingDirection == AbsoluteDirection.RIGHT_TO_LEFT) {
+ return x - spm.getEndExtent();
}
- }
return x;
}
public int brOriginY() {
// Start at the parent's content origin.
- int y = getParentArea().crOriginY();
+ final int y = getParentArea().crOriginY();
final SimplePageMaster spm = getPageMaster();
- switch (getWritingMode().getAbsoluteDirFromRelativeAxis(
- RelativeAxis.BLOCK_PROGRESSION)) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
- y -= spm.getBeforeExtent();
- break;
+ final AbsoluteDirection direction
+ = getWritingMode().getAbsoluteDirFromRelativeAxis(
+ RelativeAxis.BLOCK_PROGRESSION);
+ if (direction.isHorizontal()) {
+ /* y is where it needs to be. */
+ return y;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- y += spm.getAfterExtent();
- break;
+ if (direction == AbsoluteDirection.TOP_TO_BOTTOM) {
+ return y - spm.getBeforeExtent();
}
- case Constants.DIRECTION_LEFT_TO_RIGHT:
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
- // y is where it needs to be
- break;
+ if (direction == AbsoluteDirection.BOTTOM_TO_TOP) {
+ return y + spm.getAfterExtent();
}
- }
return y;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-01-31 19:02:30 UTC (rev 8560)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-01-31 20:29:39 UTC (rev 8561)
@@ -31,6 +31,7 @@
import org.foray.common.XMLCharacter;
import org.axsl.common.AbsoluteAxis;
+import org.axsl.common.AbsoluteDirection;
import org.axsl.common.Constants;
import org.axsl.common.FoValue;
import org.axsl.common.RelativeAxis;
@@ -1643,35 +1644,35 @@
/**
* {@inheritDoc}
*/
- public byte traitIPDirectionOdd(final FOContext context) {
+ public AbsoluteDirection traitIPDirectionOdd(final FOContext context) {
return propertyList.traitIPDirectionOdd(context);
}
/**
* {@inheritDoc}
*/
- public byte traitIPDirectionEven(final FOContext context) {
+ public AbsoluteDirection traitIPDirectionEven(final FOContext context) {
return propertyList.traitIPDirectionEven(context);
}
/**
* {@inheritDoc}
*/
- public byte traitBPDirection(final FOContext context) {
+ public AbsoluteDirection traitBPDirection(final FOContext context) {
return propertyList.traitBPDirection(context);
}
/**
* {@inheritDoc}
*/
- public byte traitShiftDirectionOdd(final FOContext context) {
+ public AbsoluteDirection traitShiftDirectionOdd(final FOContext context) {
return propertyList.traitShiftDirectionOdd(context);
}
/**
* {@inheritDoc}
*/
- public byte traitShiftDirectionEven(final FOContext context) {
+ public AbsoluteDirection traitShiftDirectionEven(final FOContext context) {
return propertyList.traitShiftDirectionEven(context);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-01-31 19:02:30 UTC (rev 8560)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-01-31 20:29:39 UTC (rev 8561)
@@ -145,6 +145,7 @@
import org.foray.fotree.xml.prop.Lang;
import org.axsl.common.AbsoluteAxis;
+import org.axsl.common.AbsoluteDirection;
import org.axsl.common.Constants;
import org.axsl.common.FoProperty;
import org.axsl.common.FoValue;
@@ -2133,7 +2134,7 @@
* DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, depending on
* the writing-mode.
*/
- public byte traitIPDirectionOdd(final FOContext context) {
+ public AbsoluteDirection traitIPDirectionOdd(final FOContext context) {
return getWritingMode(context).getIPDirectionOdd();
}
@@ -2142,7 +2143,7 @@
* DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, depending on
* the writing-mode.
*/
- public byte traitIPDirectionEven(final FOContext context) {
+ public AbsoluteDirection traitIPDirectionEven(final FOContext context) {
return getWritingMode(context).getIPDirectionEven();
}
@@ -2151,7 +2152,7 @@
* DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, depending on
* the writing-mode.
*/
- public byte traitBPDirection(final FOContext context) {
+ public AbsoluteDirection traitBPDirection(final FOContext context) {
return getWritingMode(context).getBPDirection();
}
@@ -2160,7 +2161,7 @@
* DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, depending on
* the writing-mode.
*/
- public byte traitShiftDirectionOdd(final FOContext context) {
+ public AbsoluteDirection traitShiftDirectionOdd(final FOContext context) {
return getWritingMode(context).getShiftOdd();
}
@@ -2169,7 +2170,7 @@
* DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, depending on
* the writing-mode.
*/
- public byte traitShiftDirectionEven(final FOContext context) {
+ public AbsoluteDirection traitShiftDirectionEven(final FOContext context) {
return getWritingMode(context).getShiftEven();
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2007-01-31 19:02:30 UTC (rev 8560)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2007-01-31 20:29:39 UTC (rev 8561)
@@ -29,6 +29,7 @@
package org.foray.fotree.value;
import org.axsl.common.AbsoluteAxis;
+import org.axsl.common.AbsoluteDirection;
import org.axsl.common.Constants;
import org.axsl.common.RelativeAxis;
@@ -50,18 +51,20 @@
private static HashMap writingModes = new HashMap();
- private byte ipdOdd;
- private byte ipdEven;
- private byte bpd;
- private byte shiftOdd;
- private byte shiftEven;
+ private AbsoluteDirection ipdOdd;
+ private AbsoluteDirection ipdEven;
+ private AbsoluteDirection bpd;
+ private AbsoluteDirection shiftOdd;
+ private AbsoluteDirection shiftEven;
private boolean paired;
/**
* Constructor.
*/
- private DtWritingMode(final byte ipdOdd, final byte ipdEven, final byte bpd,
- final byte shiftOdd, final byte shiftEven, final boolean paired) {
+ private DtWritingMode(final AbsoluteDirection ipdOdd,
+ final AbsoluteDirection ipdEven, final AbsoluteDirection bpd,
+ final AbsoluteDirection shiftOdd, final AbsoluteDirection shiftEven,
+ final boolean paired) {
this.ipdOdd = ipdOdd;
this.ipdEven = ipdEven;
this.bpd = bpd;
@@ -94,250 +97,208 @@
final String writingModeName) {
if (writingModeName.equals("lr-tb")) {
return new DtWritingMode(
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
false);
}
if (writingModeName.equals("rl-tb")) {
return new DtWritingMode(
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
false);
}
if (writingModeName.equals("tb-rl")) {
return new DtWritingMode(
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_LEFT_TO_RIGHT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.LEFT_TO_RIGHT,
false);
}
if (writingModeName.equals("tb-lr")) {
return new DtWritingMode(
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
false);
}
if (writingModeName.equals("bt-lr")) {
return new DtWritingMode(
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
false);
}
if (writingModeName.equals("bt-rl")) {
return new DtWritingMode(
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_LEFT_TO_RIGHT,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.LEFT_TO_RIGHT,
false);
}
if (writingModeName.equals("lr-bt")) {
return new DtWritingMode(
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
false);
}
if (writingModeName.equals("rl-bt")) {
return new DtWritingMode(
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
false);
}
if (writingModeName.equals("lr-alternating-rl-bt")) {
return new DtWritingMode(
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
false);
}
if (writingModeName.equals("lr-alternating-rl-tb")) {
return new DtWritingMode(
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
false);
}
if (writingModeName.equals("lr-inverting-rl-bt")) {
return new DtWritingMode(
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants.DIRECTION_TOP_TO_BOTTOM,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.TOP_TO_BOTTOM,
false);
}
if (writingModeName.equals("lr-inverting-rl-tb")) {
return new DtWritingMode(
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_BOTTOM_TO_TOP,
- Constants. DIRECTION_TOP_TO_BOTTOM,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.BOTTOM_TO_TOP,
+ AbsoluteDirection.TOP_TO_BOTTOM,
false);
}
if (writingModeName.equals("tb-lr-in-lr-pairs")) {
return new DtWritingMode(
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_TOP_TO_BOTTOM,
- Constants.DIRECTION_LEFT_TO_RIGHT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
- Constants.DIRECTION_RIGHT_TO_LEFT,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.TOP_TO_BOTTOM,
+ AbsoluteDirection.LEFT_TO_RIGHT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
+ AbsoluteDirection.RIGHT_TO_LEFT,
true);
}
return null;
}
/**
- * @return The block-progression-direction for this writing-mode, one of
- * DIRECTION_TOP_TO_BOTTOM, DIRECTION_BOTTOM_TO_TOP,
- * DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT.
+ * {@inheritDoc}
*/
- public byte getBPDirection() {
+ public AbsoluteDirection getBPDirection() {
return bpd;
}
+
/**
- * @return Returns the inline-progression-direction for even-numbered
- * lines for this writing-mode, one of DIRECTION_TOP_TO_BOTTOM,
- * DIRECTION_BOTTOM_TO_TOP, DIRECTION_LEFT_TO_RIGHT,
- * or DIRECTION_RIGHT_TO_LEFT.
+ * {@inheritDoc}
*/
- public byte getIPDirectionEven() {
+ public AbsoluteDirection getIPDirectionEven() {
return ipdEven;
}
+
/**
- * @return Returns the inline-progression-direction for odd-numbered
- * lines for this writing-mode, one of DIRECTION_TOP_TO_BOTTOM,
- * DIRECTION_BOTTOM_TO_TOP, DIRECTION_LEFT_TO_RIGHT,
- * or DIRECTION_RIGHT_TO_LEFT.
+ * {@inheritDoc}
*/
- public byte getIPDirectionOdd() {
+ public AbsoluteDirection getIPDirectionOdd() {
return ipdOdd;
}
+
/**
- * @return Returns true if characters are written in pairs in this
- * writing-mode.
+ * {@inheritDoc}
*/
public boolean isPaired() {
return paired;
}
+
/**
- * @return Returns the shift-direction for even-numbered lines for this
- * writing-mode.
+ * {@inheritDoc}
*/
- public byte getShiftEven() {
+ public AbsoluteDirection getShiftEven() {
return shiftEven;
}
+
/**
- * @return Returns the shift-direction for odd-numbered lines for this
- * writing-mode.
+ * {@inheritDoc}
*/
- public byte getShiftOdd() {
+ public AbsoluteDirection getShiftOdd() {
return shiftOdd;
}
/**
- * Tells which axis (block-progression or inline-progression) is the
- * horizontal axis.
- * @return Either AXIS_BP or AXIS_IP, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public RelativeAxis getHorizontalAxis() {
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT:
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd.isHorizontal()) {
return RelativeAxis.BLOCK_PROGRESSION;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM:
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- return RelativeAxis.INLINE_PROGRESSION;
- }
- }
- return RelativeAxis.INVALID;
+ return RelativeAxis.INLINE_PROGRESSION;
}
/**
- * Tells which axis (block-progression or inline-progression) is the
- * vertical axis.
- * @return Either AXIS_BP or AXIS_IP, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public RelativeAxis getVerticalAxis() {
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT:
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd.isHorizontal()) {
return RelativeAxis.INLINE_PROGRESSION;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM:
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- return RelativeAxis.BLOCK_PROGRESSION;
- }
- }
- return RelativeAxis.INVALID;
+ return RelativeAxis.BLOCK_PROGRESSION;
}
/**
* {@inheritDoc}
*/
public AbsoluteAxis getBPAxis() {
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT:
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd.isHorizontal()) {
return AbsoluteAxis.HORIZONTAL;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM:
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- return AbsoluteAxis.VERTICAL;
- }
- }
- return AbsoluteAxis.INVALID;
+ return AbsoluteAxis.VERTICAL;
}
/**
* {@inheritDoc}
*/
public AbsoluteAxis getIPAxis() {
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT:
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd.isHorizontal()) {
return AbsoluteAxis.VERTICAL;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM:
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
- return AbsoluteAxis.HORIZONTAL;
- }
- }
- return AbsoluteAxis.INVALID;
+ return AbsoluteAxis.HORIZONTAL;
}
/**
- * Converts a relative axis(block-progression or inline-progress) to an
- * absolute axis (horizontal or vertical) for this writing mode.
- * @param relativeAxis Either AXIS_BP or AXIS_IP.
- * @return Either AXIS_HORIZONTAL or AXIS_VERTICAL, or -1 if writing-mode
- * or input is invalid.
+ * {@inheritDoc}
*/
public AbsoluteAxis getAbsoluteAxis(final RelativeAxis relativeAxis) {
if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
@@ -367,203 +328,160 @@
}
/**
- * Tells which absolute direction is the "start" direction.
- * @return One of DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_TOP, OR
- * DIRECTION_BOTTOM, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getStart() {
- switch (ipdOdd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_LEFT;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_RIGHT;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_TOP;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_BOTTOM;
}
- }
return -1;
}
/**
- * Tells which absolute direction is the "end" direction.
- * @return One of DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_TOP, OR
- * DIRECTION_BOTTOM, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getEnd() {
- switch (ipdOdd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_RIGHT;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_LEFT;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_BOTTOM;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_TOP;
}
- }
return -1;
}
/**
- * Tells which absolute direction is the "before" direction.
- * @return One of DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_TOP, OR
- * DIRECTION_BOTTOM, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getBefore() {
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_LEFT;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_RIGHT;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (bpd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_TOP;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_BOTTOM;
}
- }
return -1;
}
/**
- * Tells which absolute direction is the "before" direction.
- * @return One of DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_TOP, OR
- * DIRECTION_BOTTOM, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getAfter() {
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_RIGHT;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_LEFT;
}
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (bpd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_BOTTOM;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_TOP;
}
- }
return -1;
}
/**
- * Tells which relative direction is the "left" direction.
- * @return One of DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, OR
- * DIRECTION_AFTER, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getLeft() {
- switch (ipdOdd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_START;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_END;
}
- }
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+
+ if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_BEFORE;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_AFTER;
}
- }
return -1;
}
/**
- * Tells which relative direction is the "right" direction.
- * @return One of DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, OR
- * DIRECTION_AFTER, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getRight() {
- switch (ipdOdd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_END;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (ipdOdd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_START;
}
- }
- switch (bpd) {
- case Constants.DIRECTION_LEFT_TO_RIGHT: {
+ if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Constants.DIRECTION_AFTER;
}
- case Constants.DIRECTION_RIGHT_TO_LEFT: {
+ if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Constants.DIRECTION_BEFORE;
}
- }
return -1;
}
/**
- * Tells which relative direction is the "top" direction.
- * @return One of DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, OR
- * DIRECTION_AFTER, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getTop() {
- switch (ipdOdd) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_START;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_END;
}
- }
- switch (bpd) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (bpd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_BEFORE;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_AFTER;
}
- }
return -1;
}
/**
- * Tells which relative direction is the "bottom" direction.
- * @return One of DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, OR
- * DIRECTION_AFTER, or -1 if writing-mode is invalid.
+ * {@inheritDoc}
*/
public byte getBottom() {
- switch (ipdOdd) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_END;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_START;
}
- }
- switch (bpd) {
- case Constants.DIRECTION_TOP_TO_BOTTOM: {
+ if (bpd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Constants.DIRECTION_AFTER;
}
- case Constants.DIRECTION_BOTTOM_TO_TOP: {
+ if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Constants.DIRECTION_BEFORE;
}
- }
return -1;
}
/**
- * @param relativeDir One of DIRECTION_START, DIRECTION_END,
- * DIRECTION_BEFORE, or DIRECTION_AFTER.
- * @return The corresponding absolute direction, one of DIRECTION_LEFT,
- * DIRECTION_RIGHT, DIRECTION_TOP, DIRECTION_BOTTOM, or -1 for invalid
- * input or writing mode.
+ * {@inheritDoc}
*/
public byte getAbsoluteDirection(final byte relativeDir) {
switch (relativeDir) {
@@ -584,31 +502,18 @@
}
/**
- * Given a relative axis, this method returns the related absolute
- * direction that applies to that axis.
- * @param relativeAxis One of AXIS_BP or AXIS_IP.
- * @return The corresponding absolute direction, one of
- * DIRECTION_TOP_TO_BOTTOM, DIRECTION_BOTTOM_TO_TOP,
- * DIRECTION_LEFT_TO_RIGHT, or DIRECTION_RIGHT_TO_LEFT, or -1 for invalid
- * input or writing mode.
+ * {@inheritDoc}
*/
- public byte getAbsoluteDirFromRelativeAxis(
+ public AbsoluteDirection getAbsoluteDirFromRelativeAxis(
final RelativeAxis relativeAxis) {
if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
return this.bpd;
}
- if (relativeAxis == RelativeAxis.INLINE_PROGRESSION) {
- return this.ipdOdd;
- }
- return -1;
+ return this.ipdOdd;
}
/**
- * @param absoluteDir One of DIRECTION_LEFT, DIRECTION_RIGHT,
- * DIRECTION_TOP, or DIRECTION_BOTTOM.
- * @return The corresponding relative direction, one of DIRECTION_START,
- * DIRECTION_END, DIRECTION_BEFORE, DIRECTION_AFTER, or -1 for invalid
- * input or writing mode.
+ * {@inheritDoc}
*/
public byte getRelativeDirection(final byte absoluteDir) {
switch (absoluteDir) {
@@ -629,13 +534,7 @@
}
/**
- * @param inputDirection Either a relative direction constant
- * (DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, or DIRECTION_AFTER),
- * or an absolute direction constant (DIRECTION_LEFT, DIRECTION_RIGHT,
- * DIRECTION_TOP, DIRECTION_BOTTOM) to be converted.
- * @return For absolute direction input, the corresponding relative
- * direction. For relative direction input, the corresponding absolute
- * direction. For an error either in the input or a bad writing mode, -1.
+ * {@inheritDoc}
*/
public int getCorresponding(final int inputDirection) {
switch (inputDirection) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|