uk.ac.ebi.intenz.domain.enzyme
Class EnzymeCommissionNumber

java.lang.Object
  extended by uk.ac.ebi.intenz.domain.DomainObject
      extended by uk.ac.ebi.intenz.domain.enzyme.EnzymeCommissionNumber
All Implemented Interfaces:
Comparable<EnzymeCommissionNumber>

public class EnzymeCommissionNumber
extends DomainObject
implements Comparable<EnzymeCommissionNumber>

This class represents an Enzyme Commission (EC) number.

The general valid format looks as follows:

\d+(?:\.\d+(?:\.\d+(?:\.n?\d+){0,1}){0,1}){0,1}

For instance, the first enzyme has the EC 1.1.1.1.

The first digit is the number of the class the enzyme belongs to.
The second digit is the number of the subclass the enzyme belongs to.
The third digit is the number of the sub-subclass the enzyme belongs to.
The last digit is the number of the enzyme within the sub-subclass. In case of preliminary EC numbers, it is prefixed with n.

Instances of this class are immutable.

Version:
$Revision: 1.2 $ $Date: 2008/01/28 12:33:00 $
Author:
Michael Darsow

Nested Class Summary
static class EnzymeCommissionNumber.Type
          Type of EC number.
 
Field Summary
static char PRELIMINARY_PREFIX
          The character prefixing the fourth digit in preliminary EC numbers.
static EnzymeCommissionNumber UNDEF
          Constant for an undefined EC which can be used for new enzyme suggestions where the EC number is not known (yet).
 
Fields inherited from class uk.ac.ebi.intenz.domain.DomainObject
id
 
Method Summary
 int compareTo(EnzymeCommissionNumber ec)
          Compares this EC number with another one.
static EnzymeCommissionNumber copy(EnzymeCommissionNumber ecToCopy)
          Creates a copy of the given EnzymeCommissionNumber.
 boolean equals(Object obj)
           
 int getEc1()
          Returns the enzyme's class number.
 int getEc2()
          Returns the enzyme's subclass number.
 int getEc3()
          Returns the enzyme's sub-subclass number.
 int getEc4()
          Returns the enzyme's number.
 EnzymeCommissionNumber.Type getType()
          Returns the type of this EC number.
 int hashCode()
           
static boolean isPreliminary(String ecString)
          Checks lazily if the given EC number is preliminary (according to UniProt format of preliminary EC numbers, see PRELIMINARY_PREFIX).
static boolean isValid(String ecString)
          Checks whether a given EC number is valid.
 String toString()
          Returns a string representation of this EC number.
static EnzymeCommissionNumber valueOf(int ec1)
          Returns an EnzymeCommissionNumber instance defined by the given integer.
static EnzymeCommissionNumber valueOf(int ec1, int ec2)
          Returns an EnzymeCommissionNumber instance defined by the given integers.
static EnzymeCommissionNumber valueOf(int ec1, int ec2, int ec3)
          Returns an EnzymeCommissionNumber instance defined by the given integers.
static EnzymeCommissionNumber valueOf(int ec1, int ec2, int ec3, int ec4)
          Returns an EnzymeCommissionNumber instance defined by the given integers.
static EnzymeCommissionNumber valueOf(int ec1, int ec2, int ec3, int ec4, boolean preliminary)
          Constructor allowing preliminary EC numbers.
static EnzymeCommissionNumber valueOf(String ecString)
          Returns an EnzymeCommissionNumber instance defined by the given string.
 
Methods inherited from class uk.ac.ebi.intenz.domain.DomainObject
getId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEF

public static final EnzymeCommissionNumber UNDEF
Constant for an undefined EC which can be used for new enzyme suggestions where the EC number is not known (yet).


PRELIMINARY_PREFIX

public static final char PRELIMINARY_PREFIX
The character prefixing the fourth digit in preliminary EC numbers.

See Also:
Constant Field Values
Method Detail

valueOf

public static EnzymeCommissionNumber valueOf(int ec1)
                                      throws EcException
Returns an EnzymeCommissionNumber instance defined by the given integer.

If this requirement is met the EC number is valid. However, it does not implicitly mean, that this EC number is a valid number of the official Enzyme List. This has to be checked separately, outside this class.

Parameters:
ec1 - The enzyme's class number (must be a pos. integer).
Returns:
an EnzymeCommissionNumber instance.
Throws:
EcException - if one of the parameters is invalid.

valueOf

public static EnzymeCommissionNumber valueOf(int ec1,
                                             int ec2)
                                      throws EcException
Returns an EnzymeCommissionNumber instance defined by the given integers.

All parameters have to be positive integers. A parameter can only be 0 if the succeeding parameter in the formal parameters list is > 0.

Creating a class by giving 1,0 as parameters is alright, but it is invalid to create an EC number as follows: 0,1.
If this requirement is met the EC number is valid. However, it does not implicitly mean, that this EC number is a valid number of the official Enzyme List. This has to be checked separately, outside this class.

Parameters:
ec1 - The enzyme's class number.
ec2 - The enzyme's subclass number.
Returns:
an EnzymeCommissionNumber instance.
Throws:
EcException - if one of the parameters is invalid.

valueOf

public static EnzymeCommissionNumber valueOf(int ec1,
                                             int ec2,
                                             int ec3)
                                      throws EcException
Returns an EnzymeCommissionNumber instance defined by the given integers.

All parameters have to be positive integers. A parameter can only be 0 if none of the succeeding parameters in the formal parameters list is > 0.

Creating a class by giving 1,0,0 as parameters is alright, but it is invalid to create an EC number as follows: 0,1,1.
If this requirement is met the EC number is valid. However, it does not implicitly mean, that this EC number is a valid number of the official Enzyme List. This has to be checked separately, outside this class.

Parameters:
ec1 - The enzyme's class number.
ec2 - The enzyme's subclass number.
ec3 - The enzyme's sub-subclass number.
Returns:
an EnzymeCommissionNumber instance.
Throws:
EcException - if one of the parameters is invalid.

valueOf

public static EnzymeCommissionNumber valueOf(int ec1,
                                             int ec2,
                                             int ec3,
                                             int ec4)
                                      throws EcException
Returns an EnzymeCommissionNumber instance defined by the given integers.

A parameter can only be 0 if none of the succeeding parameters in the formal parameters list is > 0.

Creating a class by giving 1,0,0,0 as parameters is alright, but it is invalid to create an EC number as follows: 0,1,1,1.
If this requirement is met the EC number is valid. However, it does not implicitly mean, that this EC number is a valid number of the official Enzyme List. This has to be checked separately, outside this class.

Parameters:
ec1 - The enzyme's class number.
ec2 - The enzyme's subclass number.
ec3 - The enzyme's sub-subclass number.
ec4 - The enzyme's number.
Returns:
an EnzymeCommissionNumber instance.
Throws:
EcException - if one of the parameters is invalid.

valueOf

public static EnzymeCommissionNumber valueOf(int ec1,
                                             int ec2,
                                             int ec3,
                                             int ec4,
                                             boolean preliminary)
                                      throws EcException
Constructor allowing preliminary EC numbers.

Parameters:
ec1 -
ec2 -
ec3 -
ec4 -
preliminary - is this a preliminary EC number?
Returns:
An EC number instance.
Throws:
EcException - if the EC number is not valid.

valueOf

public static EnzymeCommissionNumber valueOf(String ecString)
                                      throws EcException,
                                             NumberFormatException
Returns an EnzymeCommissionNumber instance defined by the given string.

Calls valueOf(int, int, int, int, boolean).

Parameters:
ecString - A string representing an EC number.
Throws:
NullPointerException - if ecString is null.
EcException - if one of the parameters is invalid.
NumberFormatException - if ecString contained invalid characters.

copy

public static EnzymeCommissionNumber copy(EnzymeCommissionNumber ecToCopy)
Creates a copy of the given EnzymeCommissionNumber.

Parameters:
ecToCopy - The EC to be copied.
Returns:
a copy of the given EnzymeCommissionNumber.
Throws:
NullPointerException - if ecToCopy is null.

compareTo

public int compareTo(EnzymeCommissionNumber ec)
Compares this EC number with another one. The four digits are considered one after the other, but within the same subsubclass a preliminary EC is always lesser than an 'official' one, independently of the fourth digit.

Specified by:
compareTo in interface Comparable<EnzymeCommissionNumber>
Parameters:
ec - The object to be compared to this instance.
Returns:
a pos. integer if this instance is greater than, a neg. integer if it is less than or 0 if it equals o.

getType

public EnzymeCommissionNumber.Type getType()
Returns the type of this EC number.

Returns:
the type.

isValid

public static boolean isValid(String ecString)
Checks whether a given EC number is valid. A valid EC number must be of the following format:
\d+(?:\.\d+(?:\.\d+(?:\.\d+){0,1}){0,1}){0,1} Examples:

Parameters:
ecString - The EC string to be checked.
Returns:
true, if the EC is valid.

isPreliminary

public static boolean isPreliminary(String ecString)
Checks lazily if the given EC number is preliminary (according to UniProt format of preliminary EC numbers, see PRELIMINARY_PREFIX).

Parameters:
ecString -
Returns:
true if the parameter contains the prefix for preliminary EC numbers.

toString

public String toString()
Returns a string representation of this EC number.

Overrides:
toString in class Object
Returns:
the EC number as a string.

hashCode

public int hashCode()
Overrides:
hashCode in class DomainObject

equals

public boolean equals(Object obj)
Overrides:
equals in class DomainObject

getEc1

public int getEc1()
Returns the enzyme's class number.

Returns:
the enzyme's class number.

getEc2

public int getEc2()
Returns the enzyme's subclass number.

Returns:
the enzyme's subclass number.

getEc3

public int getEc3()
Returns the enzyme's sub-subclass number.

Returns:
the enzyme's sub-subclass number.

getEc4

public int getEc4()
Returns the enzyme's number.

Returns:
the enzyme's number.


Copyright © 2013 EMBL-EBI. All Rights Reserved.