Class ScalarFormat


  • public class ScalarFormat
    extends java.lang.Object
    ScalarFormat.java This class exists just to make it easy to hold onto sensible groupings and conventions for formatting scalars. This is used by Scalar in the toString(ScalarFormat) and the addToStringBuffer(StringBuffer, ScalarFormat) methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      ScalarFormat()
      Create a default ScalarFormat.
      ScalarFormat​(int radix, boolean zeroPadded, boolean signed, java.lang.String pre, java.lang.String post)
      Create a ScalarFormat with the given values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getPost()
      Returns the postfix string.
      java.lang.String getPre()
      Returns the prefix string.
      int getRadix()
      Returns the radix.
      boolean isSigned()
      Returns whether value should be treated as signed.
      boolean isZeroPadded()
      Returns whether value should be zero padded.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ScalarFormat

        public ScalarFormat()

        Create a default ScalarFormat. (hex, zeropadded, unsigned no pre or post strings)

      • ScalarFormat

        public ScalarFormat​(int radix,
                            boolean zeroPadded,
                            boolean signed,
                            java.lang.String pre,
                            java.lang.String post)

        Create a ScalarFormat with the given values.

        Parameters:
        radix - the radix to use (only 2,8,10 and 16 are valid)..
        zeroPadded - true if value should be 0 padded.
        signed - true if value should be treated as signed.
        pre - string to add after optional sign but before value.
        post - string to add at end of the value.
        Throws:
        java.lang.IllegalArgumentException - if radix is not one of (2,8,10,16).
    • Method Detail

      • isZeroPadded

        public boolean isZeroPadded()

        Returns whether value should be zero padded.

        Returns:
        whether value should be zero padded.
      • isSigned

        public boolean isSigned()

        Returns whether value should be treated as signed.

        Returns:
        whether value should be treated as signed.
      • getPre

        public java.lang.String getPre()

        Returns the prefix string.

        Returns:
        the prefix string.
      • getPost

        public java.lang.String getPost()

        Returns the postfix string.

        Returns:
        the postfix string.
      • getRadix

        public int getRadix()

        Returns the radix.

        Returns:
        the radix.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()