private void addConfig(final String line){
  int defaultDelay;
  StringTokenizer st=new StringTokenizer(line," \t");
  if (!st.hasMoreTokens()) {
    LOGGER.warn("Invalid map entry: " + line);
    return;
  }
  final String name=st.nextToken();
  if (!st.hasMoreTokens()) {
    LOGGER.error("Invalid map entry: " + line);
    return;
  }
  String index=st.nextToken();
  int pos=index.indexOf('@');
  if (pos != -1) {
    final String val=index.substring(pos + 1);
    index=index.substring(0,pos);
    try {
      defaultDelay=Integer.parseInt(val);
    }
 catch (    final NumberFormatException ex) {
      LOGGER.error("Invalid default delay: " + val);
      return;
    }
  }
 else {
    defaultDelay=TilesetAnimationMap.DEFAULT_DELAY;
  }
  if (!st.hasMoreTokens()) {
    LOGGER.error("Invalid map entry: " + line);
    return;
  }
  final String frames=st.nextToken();
  st=new StringTokenizer(frames,":");
  final int[] frameIndexes=new int[st.countTokens()];
  final int[] frameDelays=new int[frameIndexes.length];
  for (int i=0; i < frameIndexes.length; i++) {
    String frameIndex=st.nextToken();
    pos=frameIndex.indexOf('@');
    if (pos != -1) {
      final String val=frameIndex.substring(pos + 1);
      frameIndex=frameIndex.substring(0,pos);
      try {
        frameDelays[i]=Integer.parseInt(val);
      }
 catch (      final NumberFormatException ex) {
        LOGGER.error("Invalid delay #" + (i + 1) + " <"+ val+ ">: "+ line);
        return;
      }
    }
 else {
      frameDelays[i]=defaultDelay;
    }
    try {
      frameIndexes[i]=Integer.parseInt(frameIndex);
    }
 catch (    final NumberFormatException ex) {
      LOGGER.error("Invalid frame #" + (i + 1) + " <"+ frameIndex+ ">: "+ line);
      return;
    }
  }
  if (index.equals("*")) {
    add(name,frameIndexes,frameDelays);
  }
 else {
    try {
      add(name,Integer.parseInt(index),frameIndexes,frameDelays);
    }
 catch (    final NumberFormatException ex) {
      LOGGER.error("Invalid tile index: " + line);
      return;
    }
  }
}

private void addConfig ( final String line ) { int defaultDelay ; StringTokenizer st = new StringTokenizer ( line , " \t" ) ; if ( ! st . hasMoreTokens ( ) ) { LOGGER . warn ( "Invalid map entry: " + line ) ; return ; } final String name = st . nextToken ( ) ; if ( ! st . hasMoreTokens ( ) ) { LOGGER . error ( "Invalid map entry: " + line ) ; return ; } String index = st . nextToken ( ) ; int pos = index . indexOf ( '@' ) ; if ( pos != - 1 ) { final String val = index . substring ( pos + 1 ) ; index = index . substring ( 0 , pos ) ; try { defaultDelay = Integer . parseInt ( val ) ; } catch ( final NumberFormatException ex ) { LOGGER . error ( "Invalid default delay: " + val ) ; return ; } } else { defaultDelay = TilesetAnimationMap . DEFAULT_DELAY ; } if ( ! st . hasMoreTokens ( ) ) { LOGGER . error ( "Invalid map entry: " + line ) ; return ; } final String frames = st . nextToken ( ) ; st = new StringTokenizer ( frames , ":" ) ; final int [ ] frameIndexes = new int [ st . countTokens ( ) ] ; final int [ ] frameDelays = new int [ frameIndexes . length ] ; for ( int i = 0 ; i < frameIndexes . length ; i ++ ) { String frameIndex = st . nextToken ( ) ; pos = frameIndex . indexOf ( '@' ) ; if ( pos != - 1 ) { final String val = frameIndex . substring ( pos + 1 ) ; frameIndex = frameIndex . substring ( 0 , pos ) ; try { frameDelays [ i ] = Integer . parseInt ( val ) ; } catch ( final NumberFormatException ex ) { LOGGER . error ( "Invalid delay #" + ( i + 1 ) + " <" + val + ">: " + line ) ; return ; } } else { frameDelays [ i ] = defaultDelay ; } try { frameIndexes [ i ] = Integer . parseInt ( frameIndex ) ; } catch ( final NumberFormatException ex ) { LOGGER . error ( "Invalid frame #" + ( i + 1 ) + " <" + frameIndex + ">: " + line ) ; return ; } } if ( index . equals ( "*" ) ) { add ( name , frameIndexes , frameDelays ) ; } else { try { add ( name , Integer . parseInt ( index ) , frameIndexes , frameDelays ) ; } catch ( final NumberFormatException ex ) { LOGGER . error ( "Invalid tile index: " + line ) ; return ; } } }
parse and add a configuration line .
