Package io.jenetics

Class LongGene

    • Method Detail

      • allele

        public Long allele()
        Description copied from interface: Gene
        Return the allele of this gene.
        Specified by:
        allele in interface Gene<Long,​LongGene>
        Returns:
        the allele of this gene.
      • range

        public LongRange range()
        Return the range of this gene.
        Returns:
        the range of this gene
        Since:
        4.4
      • byteValue

        public byte byteValue()
        Description copied from interface: NumericGene
        Returns the value of the specified gene as an byte. This may involve rounding or truncation.
        Specified by:
        byteValue in interface NumericGene<Long,​LongGene>
        Returns:
        the numeric value represented by this object after conversion to type byte.
      • shortValue

        public short shortValue()
        Description copied from interface: NumericGene
        Returns the value of the specified gene as an short. This may involve rounding or truncation.
        Specified by:
        shortValue in interface NumericGene<Long,​LongGene>
        Returns:
        the numeric value represented by this object after conversion to type short.
      • intValue

        public int intValue()
        Description copied from interface: NumericGene
        Returns the value of the specified gene as an int. This may involve rounding or truncation.
        Specified by:
        intValue in interface NumericGene<Long,​LongGene>
        Returns:
        the numeric value represented by this object after conversion to type int.
      • longValue

        public long longValue()
        Description copied from interface: NumericGene
        Returns the value of the specified gene as an long. This may involve rounding or truncation.
        Specified by:
        longValue in interface NumericGene<Long,​LongGene>
        Returns:
        the numeric value represented by this object after conversion to type long.
      • floatValue

        public float floatValue()
        Description copied from interface: NumericGene
        Returns the value of the specified gene as an float. This may involve rounding or truncation.
        Specified by:
        floatValue in interface NumericGene<Long,​LongGene>
        Returns:
        the numeric value represented by this object after conversion to type float.
      • doubleValue

        public double doubleValue()
        Description copied from interface: NumericGene
        Returns the value of the specified gene as an double. This may involve rounding or truncation.
        Specified by:
        doubleValue in interface NumericGene<Long,​LongGene>
        Returns:
        the numeric value represented by this object after conversion to type double.
      • mean

        public LongGene mean​(LongGene that)
        Description copied from interface: Mean
        Return the (usually arithmetic) mean value of this and that. For NumericGenes the mean is the arithmetic mean.
        Specified by:
        mean in interface Mean<LongGene>
        Parameters:
        that - the second value for calculating the mean.
        Returns:
        the mean value of this and that.
      • newInstance

        public LongGene newInstance​(long allele)
        Create a new gene from the given value and the gene context.
        Parameters:
        allele - the value of the new gene.
        Returns:
        a new gene with the given value.
        Since:
        5.0
      • newInstance

        public LongGene newInstance()
        Description copied from interface: Gene
        Return a new, random gene with the same type and with the same constraints than this gene. For all genes returned by this method holds gene.getClass() == gene.newInstance().getClass(). Implementations of this method has to use the Random object which can be fetched from the RandomRegistry.
        Specified by:
        newInstance in interface Factory<LongGene>
        Specified by:
        newInstance in interface Gene<Long,​LongGene>
        Returns:
        a new instance of type T
      • of

        public static LongGene of​(long allele,
                                  long min,
                                  long max)
        Create a new random LongGene with the given value and the given range. If the value isn't within the interval [min, max], no exception is thrown. In this case the method isValid() returns false.
        Parameters:
        allele - the value of the gene.
        min - the minimal valid value of this gene (inclusively).
        max - the maximal valid value of this gene (inclusively).
        Returns:
        a new LongGene with the given parameters.
      • of

        public static LongGene of​(long allele,
                                  LongRange range)
        Create a new random LongGene with the given value and the given range. If the value isn't within the interval [min, max], no exception is thrown. In this case the method isValid() returns false.
        Parameters:
        allele - the value of the gene.
        range - the long range to use
        Returns:
        a new random LongGene
        Throws:
        NullPointerException - if the given range is null.
        Since:
        3.2
      • of

        public static LongGene of​(long min,
                                  long max)
        Create a new random LongGene. It is guaranteed that the value of the LongGene lies in the interval [min, max].
        Parameters:
        min - the minimal valid value of this gene (inclusively).
        max - the maximal valid value of this gene (inclusively).
        Returns:
        a new LongGene with the given parameters.
      • of

        public static LongGene of​(LongRange range)
        Create a new random LongGene. It is guaranteed that the value of the LongGene lies in the interval [min, max].
        Parameters:
        range - the long range to use
        Returns:
        a new random LongGene
        Throws:
        NullPointerException - if the given range is null.
        Since:
        3.2