Many changes:
[fanfix.git] / src / jexer / bits / Cell.java
index d4d78ba3ab25b4446eaed222796a055e7fd82a94..f7b71a5f43a2b4cd8c1c1f8cc44bb54e5bae0948 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2017 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -33,11 +33,45 @@ package jexer.bits;
  */
 public final class Cell extends CellAttributes {
 
+    // ------------------------------------------------------------------------
+    // Variables --------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * The character at this cell.
      */
     private char ch;
 
+    // ------------------------------------------------------------------------
+    // Constructors -----------------------------------------------------------
+    // ------------------------------------------------------------------------
+
+    /**
+     * Public constructor sets default values of the cell to blank.
+     *
+     * @see #isBlank()
+     * @see #reset()
+     */
+    public Cell() {
+        reset();
+    }
+
+    /**
+     * Public constructor sets the character.  Attributes are the same as
+     * default.
+     *
+     * @param ch character to set to
+     * @see #reset()
+     */
+    public Cell(final char ch) {
+        reset();
+        this.ch = ch;
+    }
+
+    // ------------------------------------------------------------------------
+    // Cell -------------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * Getter for cell character.
      *
@@ -80,6 +114,7 @@ public final class Cell extends CellAttributes {
             && !isReverse()
             && !isUnderline()
             && !isProtect()
+            && !isRGB()
             && (ch == ' ')
         ) {
             return true;
@@ -101,8 +136,11 @@ public final class Cell extends CellAttributes {
         }
 
         Cell that = (Cell) rhs;
-        return (super.equals(rhs)
-            && (ch == that.ch));
+
+        if (ch == that.ch) {
+            return super.equals(rhs);
+        }
+        return false;
     }
 
     /**
@@ -146,28 +184,6 @@ public final class Cell extends CellAttributes {
         super.setTo(that);
     }
 
-    /**
-     * Public constructor sets default values of the cell to blank.
-     *
-     * @see #isBlank()
-     * @see #reset()
-     */
-    public Cell() {
-        reset();
-    }
-
-    /**
-     * Public constructor sets the character.  Attributes are the same as
-     * default.
-     *
-     * @param ch character to set to
-     * @see #reset()
-     */
-    public Cell(final char ch) {
-        reset();
-        this.ch = ch;
-    }
-
     /**
      * Make human-readable description of this Cell.
      *
@@ -175,7 +191,7 @@ public final class Cell extends CellAttributes {
      */
     @Override
     public String toString() {
-        return String.format("fore: %d back: %d bold: %s blink: %s ch %c",
+        return String.format("fore: %s back: %s bold: %s blink: %s ch %c",
             getForeColor(), getBackColor(), isBold(), isBlink(), ch);
     }
 }