Search in sources :

Example 1 with Mode

use of cbit.vcell.model.NodeReference.Mode in project vcell by virtualcell.

the class XmlReader method getNodeReference.

/**
 * This method returns a nodeReference onject from a XML representation.
 * Creation date: (4/24/2001 5:35:56 PM)
 * @return cbit.vcell.model.NodeReference
 * @param param org.jdom.Element
 */
private NodeReference getNodeReference(Element param) throws XmlParseException {
    String tempname = param.getName();
    NodeReference newNodeRef = null;
    int type = NodeReference.UNKNOWN_NODE;
    String name = null;
    // determine the type of nodereference to create
    if (tempname.equalsIgnoreCase(XMLTags.SpeciesContextShapeTag)) {
        type = NodeReference.SPECIES_CONTEXT_NODE;
        name = unMangle(param.getAttributeValue(XMLTags.SpeciesContextRefAttrTag));
    } else if (tempname.equalsIgnoreCase(XMLTags.SimpleReactionShapeTag)) {
        type = NodeReference.SIMPLE_REACTION_NODE;
        name = unMangle(param.getAttributeValue(XMLTags.SimpleReactionRefAttrTag));
    } else if (tempname.equalsIgnoreCase(XMLTags.FluxReactionShapeTag)) {
        type = NodeReference.FLUX_REACTION_NODE;
        name = unMangle(param.getAttributeValue(XMLTags.FluxReactionRefAttrTag));
    } else if (tempname.equalsIgnoreCase(XMLTags.ReactionRuleShapeTag)) {
        type = NodeReference.REACTION_RULE_NODE;
        name = unMangle(param.getAttributeValue(XMLTags.ReactionRuleRef2AttrTag));
    } else if (tempname.equalsIgnoreCase(XMLTags.RuleParticipantFullShapeTag) || tempname.equalsIgnoreCase(XMLTags.RuleParticipantShapeTag)) {
        type = NodeReference.RULE_PARTICIPANT_SIGNATURE_FULL_NODE;
        name = unMangle(param.getAttributeValue(XMLTags.RuleParticipantRefAttrTag));
    } else if (tempname.equalsIgnoreCase(XMLTags.RuleParticipantShortShapeTag)) {
        type = NodeReference.RULE_PARTICIPANT_SIGNATURE_SHORT_NODE;
        name = unMangle(param.getAttributeValue(XMLTags.RuleParticipantRefAttrTag));
    } else {
        throw new XmlParseException("An unknown type was found " + tempname + ",when processing noderefence!");
    }
    String modeString = unMangle(param.getAttributeValue(XMLTags.NodeReferenceModeAttrTag));
    NodeReference.Mode mode = NodeReference.Mode.none;
    if (modeString != null) {
        mode = Mode.fromValue(modeString);
    }
    java.awt.Point location = new java.awt.Point(Integer.parseInt(param.getAttributeValue(XMLTags.LocationXAttrTag)), Integer.parseInt(param.getAttributeValue(XMLTags.LocationYAttrTag)));
    newNodeRef = new NodeReference(mode, type, name, location);
    return newNodeRef;
}
Also used : Mode(cbit.vcell.model.NodeReference.Mode) NodeReference(cbit.vcell.model.NodeReference)

Aggregations

NodeReference (cbit.vcell.model.NodeReference)1 Mode (cbit.vcell.model.NodeReference.Mode)1