class_body
{ "{"
block_comment "/** A fraction representing \"2 / 1\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "TWO"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "2"
, ","
decimal_integer_literal "1"
) ")"
; ";"
block_comment "/** A fraction representing \"1\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "ONE"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "1"
, ","
decimal_integer_literal "1"
) ")"
; ";"
block_comment "/** A fraction representing \"0\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "ZERO"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "0"
, ","
decimal_integer_literal "1"
) ")"
; ";"
block_comment "/** A fraction representing \"4/5\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "FOUR_FIFTHS"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "4"
, ","
decimal_integer_literal "5"
) ")"
; ";"
block_comment "/** A fraction representing \"1/5\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "ONE_FIFTH"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "1"
, ","
decimal_integer_literal "5"
) ")"
; ";"
block_comment "/** A fraction representing \"1/2\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "ONE_HALF"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "1"
, ","
decimal_integer_literal "2"
) ")"
; ";"
block_comment "/** A fraction representing \"1/4\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "ONE_QUARTER"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "1"
, ","
decimal_integer_literal "4"
) ")"
; ";"
block_comment "/** A fraction representing \"1/3\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "ONE_THIRD"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "1"
, ","
decimal_integer_literal "3"
) ")"
; ";"
block_comment "/** A fraction representing \"3/5\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "THREE_FIFTHS"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "3"
, ","
decimal_integer_literal "5"
) ")"
; ";"
block_comment "/** A fraction representing \"3/4\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "THREE_QUARTERS"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "3"
, ","
decimal_integer_literal "4"
) ")"
; ";"
block_comment "/** A fraction representing \"2/5\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "TWO_FIFTHS"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "2"
, ","
decimal_integer_literal "5"
) ")"
; ";"
block_comment "/** A fraction representing \"2/4\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "TWO_QUARTERS"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "2"
, ","
decimal_integer_literal "4"
) ")"
; ";"
block_comment "/** A fraction representing \"2/3\". */"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "Fraction"
variable_declarator
identifier "TWO_THIRDS"
= "="
object_creation_expression
new "new"
type_identifier "Fraction"
argument_list
( "("
decimal_integer_literal "2"
, ","
decimal_integer_literal "3"
) ")"
; ";"
block_comment "/** A fraction representing \"-1 / 1\". */"
field_declaration (+21 nodes collapsed)
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "3698073679419233275L"
; ";"
block_comment "/** The denominator. */"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "denominator"
; ";"
block_comment "/** The numerator. */"
field_declaration
modifiers
private "private"
final "final"
integral_type
int "int"
variable_declarator
identifier "numerator"
; ";"
block_comment "/**\n * Create a fraction given the double value.\n * "...
constructor_declaration (+28 nodes collapsed)
block_comment "/**\n * Create a fraction given the double value and maxi"...
constructor_declaration (+43 nodes collapsed)
block_comment "/**\n * Create a fraction given the double value and maxi"...
constructor_declaration (+35 nodes collapsed)
block_comment "/**\n * Create a fraction given the double value and eith"...
constructor_declaration (+530 nodes collapsed)
block_comment "/**\n * Create a fraction from an int.\n * The fractio"...
constructor_declaration (+23 nodes collapsed)
block_comment "/**\n * Create a fraction given the numerator and denomin"...
constructor_declaration (+208 nodes collapsed)
block_comment "/**\n * Returns the absolute value of this fraction.\n "...
method_declaration (+52 nodes collapsed)
block_comment "/**\n * Compares this object to another based on size.\n "...
method_declaration (+92 nodes collapsed)
block_comment "/**\n * Gets the fraction as a <tt>double</tt>. This calc"...
method_declaration (+32 nodes collapsed)
block_comment "/**\n * Test for the equality of two fractions. If the l"...
method_declaration (+87 nodes collapsed)
block_comment "/**\n * Gets the fraction as a <tt>float</tt>. This calcu"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Access the denominator.\n * @return the denomi"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getDenominator"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "denominator"
; ";"
} "}"
block_comment "/**\n * Access the numerator.\n * @return the numerato"...
method_declaration
modifiers
public "public"
integral_type
int "int"
identifier "getNumerator"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "numerator"
; ";"
} "}"
block_comment "/**\n * Gets a hashCode for the fraction.\n * @return "...
method_declaration (+34 nodes collapsed)
block_comment "/**\n * Gets the fraction as an <tt>int</tt>. This return"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Gets the fraction as a <tt>long</tt>. This return"...
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Return the additive inverse of this fraction.\n "...
method_declaration (+57 nodes collapsed)
block_comment "/**\n * Return the multiplicative inverse of this fractio"...
method_declaration (+23 nodes collapsed)
block_comment "/**\n * <p>Adds the value of this fraction to another, re"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Add an integer to the fraction.\n * @param i t"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * <p>Subtracts the value of another fraction from t"...
method_declaration (+26 nodes collapsed)
block_comment "/**\n * Subtract an integer from the fraction.\n * @pa"...
method_declaration (+35 nodes collapsed)
block_comment "/**\n * Implement add and subtract using algorithm descri"...
method_declaration (+458 nodes collapsed)
block_comment "/**\n * <p>Multiplies the value of this fraction by anoth"...
method_declaration (+153 nodes collapsed)
block_comment "/**\n * Multiply the fraction by an integer.\n * @para"...
method_declaration (+32 nodes collapsed)
block_comment "/**\n * <p>Divide the value of this fraction by another.<"...
method_declaration (+92 nodes collapsed)
block_comment "/**\n * Divide the fraction by an integer.\n * @param "...
method_declaration (+32 nodes collapsed)
block_comment "/**\n * <p>\n * Gets the fraction percentage as a <tt>"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "percentageValue"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
method_invocation
method_invocation
identifier "multiply"
argument_list
( "("
decimal_integer_literal "100"
) ")"
. "."
identifier "doubleValue"
argument_list
( "("
) ")"
; ";"
} "}"
block_comment "/**\n * <p>Creates a {@code Fraction} instance with the 2"...
method_declaration (+218 nodes collapsed)
block_comment "/**\n * <p>\n * Returns the {@code String} representin"...
method_declaration (+91 nodes collapsed)
block_comment "/** {@inheritDoc} */"
method_declaration (+21 nodes collapsed)
} "}"