Package com.jitcaforwin.extended.internal.artist

Examples of com.jitcaforwin.extended.internal.artist.GroupArtistImpl


  public static GroupArtist createGroup(String names, Source source){
    if (!isGroup(names)){
      throw new JitcaUnexpectedError("It was tried to build a group based on an artist's name which is not a group!");
    }
   
    GroupArtist group = new GroupArtistImpl(names, source);
   
    StringBuffer artist = new StringBuffer();
    boolean divider = false;
    for (Token token : Scanner.scan(names)){
      if (token instanceof StringToken){
        artist.append(((StringToken) token).getValue());
        artist.append(" ");
        divider = false;
      } else if (token instanceof DividerToken){
        if (!divider){  // The last token was not a divider
          artist.deleteCharAt(artist.length()-1)// Remove last space
          group.addArtist(artist.toString());
          artist = new StringBuffer(); // Clear String Buffer 
        }
        divider = true;
      }
    }
   
    if (artist.length() > 1){
      artist.deleteCharAt(artist.length() - 1)// Remove last space
      group.addArtist(artist.toString());
    }
   
    return group;
  }
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.internal.artist.GroupArtistImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.