aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-05 04:25:24 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-05 04:25:24 +0200
commit972dc59b6fb1af69c79fd7c0d1ed1342e2f0c9b3 (patch)
tree775ba644ddd4fc980ce49e1243c658ea74e78a1f
parentderp (diff)
downloadjlibgamma-972dc59b6fb1af69c79fd7c0d1ed1342e2f0c9b3.tar.gz
jlibgamma-972dc59b6fb1af69c79fd7c0d1ed1342e2f0c9b3.tar.bz2
jlibgamma-972dc59b6fb1af69c79fd7c0d1ed1342e2f0c9b3.tar.xz
m + add toString for classes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/libgamma/AdjustmentMethodCapabilities.java23
-rw-r--r--src/libgamma/CRTC.java10
-rw-r--r--src/libgamma/CRTCInformation.java54
-rw-r--r--src/libgamma/GammaRamps.java16
-rw-r--r--src/libgamma/LibgammaException.java10
-rw-r--r--src/libgamma/Partition.java11
-rw-r--r--src/libgamma/Ramp.java9
-rw-r--r--src/libgamma/Site.java11
8 files changed, 139 insertions, 5 deletions
diff --git a/src/libgamma/AdjustmentMethodCapabilities.java b/src/libgamma/AdjustmentMethodCapabilities.java
index 4d8f353..36cfbb9 100644
--- a/src/libgamma/AdjustmentMethodCapabilities.java
+++ b/src/libgamma/AdjustmentMethodCapabilities.java
@@ -140,5 +140,28 @@ public class AdjustmentMethodCapabilities
*/
public boolean fake;
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return "<AdjustmentMethodCapabilities: " +
+ "information = " + Integer.toString(this.crtc_information) + ", " +
+ "default_site_known = " + Boolean.toString(this.default_site_known) + ", " +
+ "multiple_sites = " + Boolean.toString(this.multiple_sites) + ", " +
+ "multiple_partitions = " + Boolean.toString(this.multiple_partitions) + ", " +
+ "multiple_crtcs = " + Boolean.toString(this.multiple_crtcs) + ", " +
+ "partitions_are_graphics_cards = " + Boolean.toString(this.partitions_are_graphics_cards) + ", " +
+ "site_restore = " + Boolean.toString(this.site_restore) + ", " +
+ "partition_restore = " + Boolean.toString(this.partition_restore) + ", " +
+ "crtc_restore = " + Boolean.toString(this.crtc_restore) + ", " +
+ "identical_gamma_sizes = " + Boolean.toString(this.identical_gamma_sizes) + ", " +
+ "fixed_gamma_size = " + Boolean.toString(this.fixed_gamma_size) + ", " +
+ "fixed_gamma_depth = " + Boolean.toString(this.fixed_gamma_depth) + ", " +
+ "real = " + Boolean.toString(this.real) + ", " +
+ "fake = " + Boolean.toString(this.fake) + ">";
+ }
+
}
diff --git a/src/libgamma/CRTC.java b/src/libgamma/CRTC.java
index 8fc1ec9..15a0672 100644
--- a/src/libgamma/CRTC.java
+++ b/src/libgamma/CRTC.java
@@ -141,6 +141,16 @@ public class CRTC
}
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return "<Site: partition = " + this.partition.toString() + ", " +
+ "crtc = " + Integer.toString(this.crtc) + ">";
+ }
+
+
/**
* Create a CRTC state.
diff --git a/src/libgamma/CRTCInformation.java b/src/libgamma/CRTCInformation.java
index 1093357..532e984 100644
--- a/src/libgamma/CRTCInformation.java
+++ b/src/libgamma/CRTCInformation.java
@@ -203,11 +203,11 @@ public class CRTCInformation
this.gamma_size_error = make_error(ints[12]);
this.gamma_depth = (short)(ints[13]);
this.gamma_depth_error = make_error(ints[14]);
- this.gamma_support = ints[15];
+ this.gamma_support = ints[15] != 0;
this.gamma_support_error = make_error(ints[16]);
this.subpixel_order = SubpixelOrder.VALUES[ints[17]];
this.subpixel_order_error = make_error(ints[18]);
- this.active = ints[19];
+ this.active = ints[19] != 0;
this.active_error = make_error(ints[20]);
this.connector_name_error = make_error(ints[21]);
this.connector_type = ConnectorType.VALUES[ints[22]];
@@ -371,9 +371,9 @@ public class CRTCInformation
/**
- * Non-zero gamma ramp adjustments are supported.
+ * Whether gamma ramp adjustments are supported.
*/
- public final int gamma_support;
+ public final boolean gamma_support;
/**
* Error that occurred when fetching the value for
@@ -399,7 +399,7 @@ public class CRTCInformation
/**
* Whether there is a monitors connected to the CRTC.
*/
- public final int active;
+ public final boolean active;
/**
* Error that occurred when fetching the value for
@@ -481,6 +481,50 @@ public class CRTCInformation
public final boolean has_error;
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ String depth_str = Integer.toString(this.gamma_depth);
+ if (this.gamma_depth == -1) depth_str = "float";
+ if (this.gamma_depth == -1) depth_str = "double";
+
+ return "<CRTCInformation: " +
+ "edid = " + behex(this.edid) + ", " +
+ "edid_error = " + this.edid_error.toString() + ", " +
+ "width_mm = " + Integer.toString(this.width_mm) + ", " +
+ "width_mm_error = " + this.width_mm_error.toString() + ", " +
+ "height_mm = " + Integer.toString(this.height_mm) + ", " +
+ "height_mm_error = " + this.height_mm_error.toString() + ", " +
+ "width_mm_edid = " + Integer.toString(this.width_mm_edid) + ", " +
+ "width_mm_edid_error = " + this.width_mm_edid_error.toString() + ", " +
+ "height_mm_edid = " + Integer.toString(this.height_mm_edid) + ", " +
+ "height_mm_edid_error = " + this.height_mm_edid_error.toString() + ", " +
+ "red_gamma_size = " + Integer.toString(this.red_gamma_size) + ", " +
+ "green_gamma_size = " + Integer.toString(this.green_gamma_size) + ", " +
+ "blue_gamma_size = " + Integer.toString(this.blue_gamma_size) + ", " +
+ "gamma_size_error = " + this.gamma_size_error.toString() + ", " +
+ "gamma_depth = " + depth_str + ", " +
+ "gamma_depth_error = " + this.gamma_depth_error.toString() + ", " +
+ "gamma_support = " + Boolean.toString(this.gamma_support) + ", " +
+ "gamma_support_error = " + this.gamma_support_error.toString() + ", " +
+ "subpixel_order = " + this.subpixel_order.toString() + ", " +
+ "subpixel_order_error = " + this.subpixel_order_error.toString() + ", " +
+ "active = " + Boolean.toString(this.active) + ", " +
+ "active_error = " + this.active_error.toString() + ", " +
+ "connector_name = " + this.connector_name + ", " +
+ "connector_name_error = " + this.connector_name_error.toString() + ", " +
+ "connector_type = " + this.connector_type.toString() + ", " +
+ "connector_type_error = " + this.connector_type_error.toString() + ", " +
+ "gamma_red = " + Float.toString(this.gamma_red) + ", " +
+ "gamma_green = " + Float.toString(this.gamma_green) + ", " +
+ "gamma_blue = " + Float.toString(this.gamma_blue) + ", " +
+ "gamma_error = " + this.gamma_error.toString() + ", " +
+ "has_error = " + Boolean.toString(this.has_error) + ">";
+ }
+
+
/**
* Convert a raw representation of an EDID to a lowercase hexadecimal representation.
diff --git a/src/libgamma/GammaRamps.java b/src/libgamma/GammaRamps.java
index 895ea2e..35f9d4b 100644
--- a/src/libgamma/GammaRamps.java
+++ b/src/libgamma/GammaRamps.java
@@ -147,6 +147,22 @@ public class GammaRamps<T extends Ramp>
/**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ String depth_str = Integer.toString(this.depth);
+ if (this.depth == -1) depth_str = "float";
+ if (this.depth == -1) depth_str = "double";
+
+ return "<GammaRamps: depth = " + depth_str + ", " +
+ "red = " + this.red.toString() +
+ "green = " + this.green.toString() +
+ "blue = " + this.blue.toString() + ">";
+ }
+
+
+ /**
* Create and initialise a gamma ramp in the proper way that allows all adjustment
* methods to read from and write to it without causing segmentation violation.
*
diff --git a/src/libgamma/LibgammaException.java b/src/libgamma/LibgammaException.java
index 79c41e8..bc8611e 100644
--- a/src/libgamma/LibgammaException.java
+++ b/src/libgamma/LibgammaException.java
@@ -378,6 +378,16 @@ public class LibgammaException extends Exception
public final String string;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ return this.string;
+ }
+
+
/**
* Returns the name of the definition associated with
diff --git a/src/libgamma/Partition.java b/src/libgamma/Partition.java
index e5022a8..740bc11 100644
--- a/src/libgamma/Partition.java
+++ b/src/libgamma/Partition.java
@@ -102,6 +102,17 @@ public class Partition
}
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return "<Partition: site = " + this.site.toString() + ", " +
+ "partition = " + Integer.toString(this.partition) + ", " +
+ "crtcs_available = " + Integer.toString(this.crtcs_available) + ">";
+ }
+
+
/**
* Create a partition state.
diff --git a/src/libgamma/Ramp.java b/src/libgamma/Ramp.java
index e3e7ec3..ef55f9d 100644
--- a/src/libgamma/Ramp.java
+++ b/src/libgamma/Ramp.java
@@ -58,6 +58,15 @@ public abstract class Ramp
/**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return "<Ramp: size = " + Integer.toString(size) + ">";
+ }
+
+
+ /**
* Read the value of a stop in an 8-bit ramp.
*
* @param address The address of the ramp.
diff --git a/src/libgamma/Site.java b/src/libgamma/Site.java
index 7f52fa5..a23ce29 100644
--- a/src/libgamma/Site.java
+++ b/src/libgamma/Site.java
@@ -111,6 +111,17 @@ public class Site
}
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return "<Site: method = " + this.method.toString() + ", " +
+ "site = " + (this.site == null ? "<null>" : this.site) + ", " +
+ "partitions_available = " + Integer.toString(this.partitions_available) + ">";
+ }
+
+
/**