Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.

fj
Enum Digit

java.lang.Object
  extended by java.lang.Enum<Digit>
      extended by fj.Digit
All Implemented Interfaces:
Serializable, Comparable<Digit>

public enum Digit
extends Enum<Digit>

The digits zero to nine.


Enum Constant Summary
_0
          Zero.
_1
          One.
_2
          Two.
_3
          Three.
_4
          Four.
_5
          Five.
_6
          Six.
_7
          Seven.
_8
          Eight.
_9
          Nine.
 
Field Summary
static F<Character,Option<Digit>> fromChar
          First-class conversion from a character to a digit.
static F<Long,Digit> fromLong
          First-class conversion from a long to a digit.
static F<Digit,Character> toChar
          First-class conversion from a digit to a character.
static F<Digit,Long> toLong
          First-class conversion from digit to a long.
 
Method Summary
static Option<Digit> fromChar(char c)
          Converts the given character in the given long value to a digit.
static Digit fromLong(long i)
          Converts the right-most digit in the given long value to a digit.
 char toChar()
          Converts this digit to a character.
 long toLong()
          Converts this digit to a long.
static Digit valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Digit[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

_0

public static final Digit _0
Zero.


_1

public static final Digit _1
One.


_2

public static final Digit _2
Two.


_3

public static final Digit _3
Three.


_4

public static final Digit _4
Four.


_5

public static final Digit _5
Five.


_6

public static final Digit _6
Six.


_7

public static final Digit _7
Seven.


_8

public static final Digit _8
Eight.


_9

public static final Digit _9
Nine.

Field Detail

toLong

public static final F<Digit,Long> toLong
First-class conversion from digit to a long.


fromLong

public static final F<Long,Digit> fromLong
First-class conversion from a long to a digit.


toChar

public static final F<Digit,Character> toChar
First-class conversion from a digit to a character.


fromChar

public static final F<Character,Option<Digit>> fromChar
First-class conversion from a character to a digit.

Method Detail

values

public static Digit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Digit c : Digit.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Digit valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toLong

public long toLong()
Converts this digit to a long.

Returns:
A long for this digit.

toChar

public char toChar()
Converts this digit to a character.

Returns:
A character for this digit.

fromLong

public static Digit fromLong(long i)
Converts the right-most digit in the given long value to a digit.

Parameters:
i - The long to convert.
Returns:
The right-most digit in the given long value as a digit.

fromChar

public static Option<Digit> fromChar(char c)
Converts the given character in the given long value to a digit.

Parameters:
c - The character to convert.
Returns:
The character in the given long value as a digit.

Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.