-
-
Save hovo1990/8d31e47156ffbc7d1fae2dca77d285c7 to your computer and use it in GitHub Desktop.
JSBML Official Sample QualitativeSpecies.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public String getCompartment() { | |
return isSetCompartment() ? compartment : ""; | |
} | |
/** | |
* @return the constant | |
*/ | |
public boolean getConstant() { | |
if (isSetConstant()) { | |
return constant.booleanValue(); | |
} | |
throw new PropertyUndefinedError(QualConstants.constant, this); | |
} | |
/** | |
* @return the initialLevel | |
*/ | |
public int getInitialLevel() { | |
if (isSetInitialLevel()) { | |
return initialLevel.intValue(); | |
} | |
throw new PropertyUndefinedError(QualConstants.initialLevel, this); | |
} | |
/** | |
* @return the maxLevel | |
*/ | |
public int getMaxLevel() { | |
if (isSetMaxLevel()) { | |
return maxLevel.intValue(); | |
} | |
throw new PropertyUndefinedError(QualConstants.maxLevel, this); | |
} | |
/* (non-Javadoc) | |
* @see org.sbml.jsbml.CompartmentalizedSBase#isSetCompartment() | |
*/ | |
@Override | |
public boolean isSetCompartment() { | |
return compartment != null; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public boolean isSetConstant() { | |
return constant != null; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public boolean isSetInitialLevel() { | |
return initialLevel != null; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public boolean isSetMaxLevel() { | |
return maxLevel != null; | |
} | |
@Override | |
public boolean setCompartment(Compartment compartment) { | |
if (compartment != null) { | |
return setCompartment(compartment.getId()); | |
} | |
return unsetCompartment(); | |
} | |
/* (non-Javadoc) | |
* @see org.sbml.jsbml.CompartmentalizedSBase#setCompartment(java.lang.String) | |
*/ | |
@Override | |
public boolean setCompartment(String compartment) { | |
if (compartment != this.compartment) { | |
String oldCompartment = this.compartment; | |
if ((compartment == null) || (compartment.length() == 0)) { | |
this.compartment = null; | |
} else { | |
this.compartment = compartment; | |
} | |
firePropertyChange(QualConstants.compartment, oldCompartment, | |
this.compartment); | |
return true; | |
} | |
return false; | |
} | |
/** | |
* Sets the constant attribute. | |
* | |
* @param constant | |
* the constant to set | |
*/ | |
public void setConstant(boolean constant) { | |
Boolean oldConstant = this.constant; | |
this.constant = constant; | |
firePropertyChange(QualConstants.constant, oldConstant, this.constant); | |
} | |
/** | |
* Sets the initialLevel attribute. | |
* | |
* <p>The initialLevel is a non-negative integer that defines the initial level of the | |
* {@link QualitativeSpecies} in its {@link Compartment}. This attribute is optional | |
* but cannot exceed the value of the maxLevel attribute, if both are set. | |
* | |
* @param initialLevel | |
* the initialLevel to set | |
*/ | |
public void setInitialLevel(int initialLevel) { | |
Integer oldInitialLevel = this.initialLevel; | |
this.initialLevel = initialLevel; | |
firePropertyChange(QualConstants.initialLevel, oldInitialLevel, | |
this.initialLevel); | |
//TODO: Should there be a test to see if this value is greater than the maxLevel attribute, if it's set? | |
} | |
/** | |
* Sets the maxLevel attribute. | |
* | |
* | |
* @param maxLevel | |
* the maxLevel to set | |
*/ | |
public void setMaxLevel(int maxLevel) { | |
Integer oldMaxLevel = this.maxLevel; | |
this.maxLevel = maxLevel; | |
firePropertyChange(QualConstants.maxLevel, oldMaxLevel, this.maxLevel); | |
} | |
@Override | |
public boolean unsetCompartment() { | |
if (isSetCompartment()) { | |
compartment = null; | |
return true; | |
} | |
return false; | |
} | |
/** | |
* @return {@code true} if the unset of the constant attribute was successful | |
*/ | |
public boolean unsetConstant() { | |
if (isSetConstant()) { | |
boolean oldConstant = constant; | |
constant = null; | |
firePropertyChange(QualConstants.constant, oldConstant, constant); | |
return true; | |
} else { | |
return false; | |
} | |
} | |
/** | |
* @return {@code true} if unset initialLevel attribute was successful | |
*/ | |
public boolean unsetInitialLevel() { | |
if (isSetInitialLevel()) { | |
Integer oldInitialLevel = initialLevel; | |
initialLevel = null; | |
firePropertyChange(QualConstants.initialLevel, oldInitialLevel, | |
initialLevel); | |
return true; | |
} else { | |
return false; | |
} | |
} | |
/** | |
* @return {@code true} if unset maxLevel attribute was successful | |
*/ | |
public boolean unsetMaxLevel() { | |
if (isSetMaxLevel()) { | |
Integer oldMaxLevel = maxLevel; | |
maxLevel = null; | |
firePropertyChange(QualConstants.maxLevel, oldMaxLevel, maxLevel); | |
return true; | |
} else { | |
return false; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment