package net.miginfocom.layout;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.ObjectStreamException;

public final class LC implements Externalizable {
   private int wrapAfter = 2097051;
   private Boolean leftToRight = null;
   private UnitValue[] insets = null;
   private UnitValue alignX = null;
   private UnitValue alignY = null;
   private BoundSize gridGapX = null;
   private BoundSize gridGapY = null;
   private BoundSize width;
   private BoundSize height;
   private BoundSize packW;
   private BoundSize packH;
   private float pwAlign;
   private float phAlign;
   private int debugMillis;
   private int hideMode;
   private boolean noCache;
   private boolean flowX;
   private boolean fillX;
   private boolean fillY;
   private boolean topToBottom;
   private boolean noGrid;
   private boolean visualPadding;

   public LC() {
      this.width = BoundSize.NULL_SIZE;
      this.height = BoundSize.NULL_SIZE;
      this.packW = BoundSize.NULL_SIZE;
      this.packH = BoundSize.NULL_SIZE;
      this.pwAlign = 0.5F;
      this.phAlign = 1.0F;
      this.debugMillis = 0;
      this.hideMode = 0;
      this.noCache = false;
      this.flowX = true;
      this.fillX = false;
      this.fillY = false;
      this.topToBottom = true;
      this.noGrid = false;
      this.visualPadding = true;
   }

   public boolean isNoCache() {
      return this.noCache;
   }

   public void setNoCache(boolean var1) {
      this.noCache = var1;
   }

   public final UnitValue getAlignX() {
      return this.alignX;
   }

   public final void setAlignX(UnitValue var1) {
      this.alignX = var1;
   }

   public final UnitValue getAlignY() {
      return this.alignY;
   }

   public final void setAlignY(UnitValue var1) {
      this.alignY = var1;
   }

   public final int getDebugMillis() {
      return this.debugMillis;
   }

   public final void setDebugMillis(int var1) {
      this.debugMillis = var1;
   }

   public final boolean isFillX() {
      return this.fillX;
   }

   public final void setFillX(boolean var1) {
      this.fillX = var1;
   }

   public final boolean isFillY() {
      return this.fillY;
   }

   public final void setFillY(boolean var1) {
      this.fillY = var1;
   }

   public final boolean isFlowX() {
      return this.flowX;
   }

   public final void setFlowX(boolean var1) {
      this.flowX = var1;
   }

   public final BoundSize getGridGapX() {
      return this.gridGapX;
   }

   public final void setGridGapX(BoundSize var1) {
      this.gridGapX = var1;
   }

   public final BoundSize getGridGapY() {
      return this.gridGapY;
   }

   public final void setGridGapY(BoundSize var1) {
      this.gridGapY = var1;
   }

   public final int getHideMode() {
      return this.hideMode;
   }

   public final void setHideMode(int var1) {
      if (var1 >= 0 && var1 <= 3) {
         this.hideMode = var1;
      } else {
         throw new IllegalArgumentException("Wrong hideMode: " + var1);
      }
   }

   public final UnitValue[] getInsets() {
      return this.insets != null ? new UnitValue[]{this.insets[0], this.insets[1], this.insets[2], this.insets[3]} : null;
   }

   public final void setInsets(UnitValue[] var1) {
      this.insets = var1 != null ? new UnitValue[]{var1[0], var1[1], var1[2], var1[3]} : null;
   }

   public final Boolean getLeftToRight() {
      return this.leftToRight;
   }

   public final void setLeftToRight(Boolean var1) {
      this.leftToRight = var1;
   }

   public final boolean isNoGrid() {
      return this.noGrid;
   }

   public final void setNoGrid(boolean var1) {
      this.noGrid = var1;
   }

   public final boolean isTopToBottom() {
      return this.topToBottom;
   }

   public final void setTopToBottom(boolean var1) {
      this.topToBottom = var1;
   }

   public final boolean isVisualPadding() {
      return this.visualPadding;
   }

   public final void setVisualPadding(boolean var1) {
      this.visualPadding = var1;
   }

   public final int getWrapAfter() {
      return this.wrapAfter;
   }

   public final void setWrapAfter(int var1) {
      this.wrapAfter = var1;
   }

   public final BoundSize getPackWidth() {
      return this.packW;
   }

   public final void setPackWidth(BoundSize var1) {
      this.packW = var1 != null ? var1 : BoundSize.NULL_SIZE;
   }

   public final BoundSize getPackHeight() {
      return this.packH;
   }

   public final void setPackHeight(BoundSize var1) {
      this.packH = var1 != null ? var1 : BoundSize.NULL_SIZE;
   }

   public final float getPackHeightAlign() {
      return this.phAlign;
   }

   public final void setPackHeightAlign(float var1) {
      this.phAlign = Math.max(0.0F, Math.min(1.0F, var1));
   }

   public final float getPackWidthAlign() {
      return this.pwAlign;
   }

   public final void setPackWidthAlign(float var1) {
      this.pwAlign = Math.max(0.0F, Math.min(1.0F, var1));
   }

   public final BoundSize getWidth() {
      return this.width;
   }

   public final void setWidth(BoundSize var1) {
      this.width = var1 != null ? var1 : BoundSize.NULL_SIZE;
   }

   public final BoundSize getHeight() {
      return this.height;
   }

   public final void setHeight(BoundSize var1) {
      this.height = var1 != null ? var1 : BoundSize.NULL_SIZE;
   }

   public final LC pack() {
      return this.pack("pref", "pref");
   }

   public final LC pack(String var1, String var2) {
      this.setPackWidth(var1 != null ? ConstraintParser.parseBoundSize(var1, false, false) : BoundSize.NULL_SIZE);
      this.setPackHeight(var2 != null ? ConstraintParser.parseBoundSize(var2, false, false) : BoundSize.NULL_SIZE);
      return this;
   }

   public final LC packAlign(float var1, float var2) {
      this.setPackWidthAlign(var1);
      this.setPackHeightAlign(var2);
      return this;
   }

   public final LC wrap() {
      this.setWrapAfter(0);
      return this;
   }

   public final LC wrapAfter(int var1) {
      this.setWrapAfter(var1);
      return this;
   }

   public final LC noCache() {
      this.setNoCache(true);
      return this;
   }

   public final LC flowY() {
      this.setFlowX(false);
      return this;
   }

   public final LC flowX() {
      this.setFlowX(true);
      return this;
   }

   public final LC fill() {
      this.setFillX(true);
      this.setFillY(true);
      return this;
   }

   public final LC fillX() {
      this.setFillX(true);
      return this;
   }

   public final LC fillY() {
      this.setFillY(true);
      return this;
   }

   public final LC leftToRight(boolean var1) {
      this.setLeftToRight(var1 ? Boolean.TRUE : Boolean.FALSE);
      return this;
   }

   public final LC rightToLeft() {
      this.setLeftToRight(Boolean.FALSE);
      return this;
   }

   public final LC bottomToTop() {
      this.setTopToBottom(false);
      return this;
   }

   public final LC topToBottom() {
      this.setTopToBottom(true);
      return this;
   }

   public final LC noGrid() {
      this.setNoGrid(true);
      return this;
   }

   public final LC noVisualPadding() {
      this.setVisualPadding(false);
      return this;
   }

   public final LC insetsAll(String var1) {
      UnitValue var2 = ConstraintParser.parseUnitValue(var1, true);
      UnitValue var3 = ConstraintParser.parseUnitValue(var1, false);
      this.insets = new UnitValue[]{var3, var2, var3, var2};
      return this;
   }

   public final LC insets(String var1) {
      this.insets = ConstraintParser.parseInsets(var1, true);
      return this;
   }

   public final LC insets(String var1, String var2, String var3, String var4) {
      this.insets = new UnitValue[]{ConstraintParser.parseUnitValue(var1, false), ConstraintParser.parseUnitValue(var2, true), ConstraintParser.parseUnitValue(var3, false), ConstraintParser.parseUnitValue(var4, true)};
      return this;
   }

   public final LC alignX(String var1) {
      this.setAlignX(ConstraintParser.parseUnitValueOrAlign(var1, true, (UnitValue)null));
      return this;
   }

   public final LC alignY(String var1) {
      this.setAlignY(ConstraintParser.parseUnitValueOrAlign(var1, false, (UnitValue)null));
      return this;
   }

   public final LC align(String var1, String var2) {
      if (var1 != null) {
         this.alignX(var1);
      }

      if (var2 != null) {
         this.alignY(var2);
      }

      return this;
   }

   public final LC gridGapX(String var1) {
      this.setGridGapX(ConstraintParser.parseBoundSize(var1, true, true));
      return this;
   }

   public final LC gridGapY(String var1) {
      this.setGridGapY(ConstraintParser.parseBoundSize(var1, true, false));
      return this;
   }

   public final LC gridGap(String var1, String var2) {
      if (var1 != null) {
         this.gridGapX(var1);
      }

      if (var2 != null) {
         this.gridGapY(var2);
      }

      return this;
   }

   public final LC debug(int var1) {
      this.setDebugMillis(var1);
      return this;
   }

   public final LC hideMode(int var1) {
      this.setHideMode(var1);
      return this;
   }

   public final LC minWidth(String var1) {
      this.setWidth(LayoutUtil.derive(this.getWidth(), ConstraintParser.parseUnitValue(var1, true), (UnitValue)null, (UnitValue)null));
      return this;
   }

   public final LC width(String var1) {
      this.setWidth(ConstraintParser.parseBoundSize(var1, false, true));
      return this;
   }

   public final LC maxWidth(String var1) {
      this.setWidth(LayoutUtil.derive(this.getWidth(), (UnitValue)null, (UnitValue)null, ConstraintParser.parseUnitValue(var1, true)));
      return this;
   }

   public final LC minHeight(String var1) {
      this.setHeight(LayoutUtil.derive(this.getHeight(), ConstraintParser.parseUnitValue(var1, false), (UnitValue)null, (UnitValue)null));
      return this;
   }

   public final LC height(String var1) {
      this.setHeight(ConstraintParser.parseBoundSize(var1, false, false));
      return this;
   }

   public final LC maxHeight(String var1) {
      this.setHeight(LayoutUtil.derive(this.getHeight(), (UnitValue)null, (UnitValue)null, ConstraintParser.parseUnitValue(var1, false)));
      return this;
   }

   private Object readResolve() throws ObjectStreamException {
      return LayoutUtil.getSerializedObject(this);
   }

   public void readExternal(ObjectInput var1) throws IOException, ClassNotFoundException {
      LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(var1));
   }

   public void writeExternal(ObjectOutput var1) throws IOException {
      if (this.getClass() == LC.class) {
         LayoutUtil.writeAsXML(var1, this);
      }

   }
}
