com.compomics.util.experiment.massspectrometry
Class Charge

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.massspectrometry.Charge
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Charge
extends ExperimentObject

This class models a charge.

Author:
Marc Vaudel
See Also:
Serialized Form

Field Summary
static int MINUS
          Static int to modele a negative charge.
static int NEUTRAL
          Static int to modele a neutral component.
static int PLUS
          Static int to modele a positive charge.
 int sign
          Sign of the charge according to the static fields.
 int value
          Value of the charge.
 
Constructor Summary
Charge(int sign, int value)
          Constructor for a charge.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getChargeAsFormattedString()
          Returns the charge as a string of + or -.
 int hashCode()
           
 java.lang.String toString()
          Returns a string representing the charge.
 
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, getParameterKey, getUrParam
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PLUS

public static final int PLUS
Static int to modele a positive charge.

See Also:
Constant Field Values

MINUS

public static final int MINUS
Static int to modele a negative charge.

See Also:
Constant Field Values

NEUTRAL

public static final int NEUTRAL
Static int to modele a neutral component.

See Also:
Constant Field Values

sign

public int sign
Sign of the charge according to the static fields.


value

public int value
Value of the charge.

Constructor Detail

Charge

public Charge(int sign,
              int value)
Constructor for a charge.

Parameters:
sign - sign of the charge as specified in static fields
value - value of the charge
Method Detail

toString

public java.lang.String toString()
Returns a string representing the charge. For example 2+.

Overrides:
toString in class java.lang.Object
Returns:
charge as a string

getChargeAsFormattedString

public java.lang.String getChargeAsFormattedString()
Returns the charge as a string of + or -. One for each charge. A charge of 1 however returns the empty string.

Returns:
the charge as a string of +

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2013. All Rights Reserved.