int (final GridConstraints gc, final boolean horizontal) { int anchor = gc.getAnchor(); int fill = gc.getFill(); int leftMask = horizontal ? GridConstraints.ANCHOR_WEST : GridConstraints.ANCHOR_NORTH; int rightMask = horizontal ? GridConstraints.ANCHOR_EAST : GridConstraints.ANCHOR_SOUTH; int fillMask = horizontal ? GridConstraints.FILL_HORIZONTAL : GridConstraints.FILL_VERTICAL; if ((fill & fillMask) != 0) return GridConstraints.ALIGN_FILL; if ((anchor & rightMask) != 0) return GridConstraints.ALIGN_RIGHT; if ((anchor & leftMask) != 0) return GridConstraints.ALIGN_LEFT; return GridConstraints.ALIGN_CENTER; }