Class Festkommazahl

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Festkommazahl>

    public class Festkommazahl
    extends java.lang.Number
    implements java.lang.Comparable<Festkommazahl>
    Repräsentiert eine Zahl mit einer festen Anzahl Kommastellen.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Festkommazahl EINS
      Repräsentiert 1 als Festkommazahl.
      static Festkommazahl NULL
      Repräsentiert 0 als Festkommazahl.
    • Constructor Summary

      Constructors 
      Constructor Description
      Festkommazahl​(double wert)
      Konstruiert eine Festkommazahl mit dem angegebenen Wert und dem Skalierungsfaktor 1.
      Festkommazahl​(double wert, float skalierung)
      Konstruiert eine Festkommazahl mit dem angegebenen Wert und Skalierungsfaktor.
      Festkommazahl​(double wert, int stellen)
      Konstruiert eine Festkommazahl mit dem angegebenen Wert und der genannten Anzahl Dezimalstellen.
    • Method Summary

      Modifier and Type Method Description
      int compareTo​(Festkommazahl zahl)  
      double doubleValue()  
      float floatValue()  
      int intValue()  
      long longValue()  
      • Methods inherited from class java.lang.Number

        byteValue, shortValue
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NULL

        public static final Festkommazahl NULL
        Repräsentiert 0 als Festkommazahl.
      • EINS

        public static final Festkommazahl EINS
        Repräsentiert 1 als Festkommazahl.
    • Constructor Detail

      • Festkommazahl

        public Festkommazahl​(double wert)
        Konstruiert eine Festkommazahl mit dem angegebenen Wert und dem Skalierungsfaktor 1.
        Parameters:
        wert - Der skalierte Wert der neuen Festkommzahl
      • Festkommazahl

        public Festkommazahl​(double wert,
                             float skalierung)
        Konstruiert eine Festkommazahl mit dem angegebenen Wert und Skalierungsfaktor.
        Parameters:
        wert - Der skalierte Wert der neuen Festkommzahl
        skalierung - Faktor mit dem der Wert skaliert wird
      • Festkommazahl

        public Festkommazahl​(double wert,
                             int stellen)
        Konstruiert eine Festkommazahl mit dem angegebenen Wert und der genannten Anzahl Dezimalstellen.
        Parameters:
        wert - Der skalierte Wert der neuen Festkommzahl
        stellen - Anzahl von Dezimalstellen um die der Wert skaliert werden soll. Eine Zahl kleiner 0 entspricht dabei Kommastellen und eine Zahl größer 0 entspricht Zehnerpotenzen.
    • Method Detail

      • compareTo

        public int compareTo​(Festkommazahl zahl)
        Specified by:
        compareTo in interface java.lang.Comparable<Festkommazahl>
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class java.lang.Number
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class java.lang.Number
      • intValue

        public int intValue()
        Specified by:
        intValue in class java.lang.Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class java.lang.Number