@Override
  public void doAction(char cha) throws ConnectionSectionException, NotationException {

    /* list of connections is empty */
    if (cha == '$') {
      if (sourcepolymerid == "" && _parser.notationContainer.getListOfConnections().size() == 0) {
        LOG.info("Connection section is empty:");
        LOG.info("Transition to group section:");
        _parser.setState(new GroupingParser(_parser));

      } else {
        LOG.error("Missing target polymer ID in connection section:");
        throw new ConnectionSectionException("Missing target polymer id in connection section. Source of connection is " + sourcepolymerid);
      }
    } /* target polymer ID is starting */ else if (cha == ',' && checkBracketsParenthesis()) {
      if (_parser.checkPolymeridConnection(sourcepolymerid)) {
        LOG.info("Target polymer ID is read:");
        _parser.notationContainer.addConnection(new ConnectionNotation(sourcepolymerid));
        _parser.setState(new ConnectionsReadSecondIDParser(_parser));
      } else {
        LOG.error("Source polymer ID is not correct in the connection section: " + sourcepolymerid);
        throw new ConnectionSectionException("Source polymer id is not correct in the connection section: "
            + sourcepolymerid);
      }

    } else {
      sourcepolymerid += cha;
      if (cha == '(') {
        parenthesisCounterOpen += 1;
      }
      if (cha == ')') {
        parenthesisCounterClose += 1;
      }

    }
  }
@Override
  public void doAction(char cha) throws ConnectionSectionException, NotationException {

    
    if (cha == '$') {
      if (sourcepolymerid == "" && _parser.notationContainer.getListOfConnections().size() == 0) {
        LOG.info("Connection section is empty:");
        LOG.info("Transition to group section:");
        _parser.setState(new GroupingParser(_parser));

      } else {
        LOG.error("Missing target polymer ID in connection section:");
        throw new ConnectionSectionException("Missing target polymer id in connection section. Source of connection is " + sourcepolymerid);
      }
    }  else if (cha == ',' && checkBracketsParenthesis()) {
      if (_parser.checkPolymeridConnection(sourcepolymerid)) {
        LOG.info("Target polymer ID is read:");
        _parser.notationContainer.addConnection(new ConnectionNotation(sourcepolymerid));
        _parser.setState(new ConnectionsReadSecondIDParser(_parser));
      } else {
        LOG.error("Source polymer ID is not correct in the connection section: " + sourcepolymerid);
        throw new ConnectionSectionException("Source polymer id is not correct in the connection section: "
            + sourcepolymerid);
      }

    } else {
      sourcepolymerid += cha;
      if (cha == '(') {
        parenthesisCounterOpen += 1;
      }
      if (cha == ')') {
        parenthesisCounterClose += 1;
      }

    }
  }
@ Override public void doAction ( char cha ) throws ConnectionSectionException , NotationException { /* list of connections is empty */ if ( cha == ' ' ) { if ( sourcepolymerid == "" && _parser . notationContainer . getListOfConnections ( ) . size ( ) == 0 ) { LOG . info ( "Connection section is empty:" ) ; LOG . info ( "Transition to group section:" ) ; _parser . setState ( new GroupingParser ( _parser ) ) ; } else { LOG . error ( "Missing target polymer ID in connection section:" ) ; throw new ConnectionSectionException ( "Missing target polymer id in connection section. Source of connection is " + sourcepolymerid ) ; } } /* target polymer ID is starting */ else if ( cha == ' ' && checkBracketsParenthesis ( ) ) { if ( _parser . checkPolymeridConnection ( sourcepolymerid ) ) { LOG . info ( "Target polymer ID is read:" ) ; _parser . notationContainer . addConnection ( new ConnectionNotation ( sourcepolymerid ) ) ; _parser . setState ( new ConnectionsReadSecondIDParser ( _parser ) ) ; } else { LOG . error ( "Source polymer ID is not correct in the connection section: " + sourcepolymerid ) ; throw new ConnectionSectionException ( "Source polymer id is not correct in the connection section: " + sourcepolymerid ) ; } } else { sourcepolymerid += cha ; if ( cha == ' ' ) { parenthesisCounterOpen += 1 ; } if ( cha == ' ' ) { parenthesisCounterClose += 1 ; } } }
{@inheritDoc}

@throws NotationException if connection is not valid
{ @inheritDoc }