TrendsToolkit.java :  » Graphic-Library » GLIPS-Graffiti-editor-1.5 » fr » itris » glips » extension » jwidget » trends » Java Open Source

Java Open Source » Graphic Library » GLIPS Graffiti editor 1.5 
GLIPS Graffiti editor 1.5 » fr » itris » glips » extension » jwidget » trends » TrendsToolkit.java
package fr.itris.glips.extension.jwidget.trends;

/**
 * the class of the toolkit for the trends
 * @author ITRIS, Jordi SUC
 */
public class TrendsToolkit {

  /**
   * the string separating a tag name from its type
   */
  public static final String tagNameSeparator="/**/";
  
  /**
   * returns the displayable tag name corresponding to the given tag name
   * @param tagName a tag name
   * @return the displayable tag name corresponding to the given tag name
   */
  public static String getDisplayableTagName(String tagName){
    
    String value="";
    
    //getting the position of the separator
    int pos=tagName.indexOf(TrendsToolkit.tagNameSeparator);
    
    if(pos!=-1){
      
      //getting the displayable tag name string
      value=tagName.substring(0, pos);
    }

    return value;
  }
  
  /**
   * returns the tag type corresponding to the given tag name
   * @param tagName a tag name
   * @return the tag type corresponding to the given tag name
   */
  public static String getTagType(String tagName){
    
    String tagType="";
    
    //getting the position of the separator
    int pos=tagName.indexOf(TrendsToolkit.tagNameSeparator);
    
    if(pos!=-1){
      
      //getting the string defining the tag type
      tagType=tagName.substring(
          pos+TrendsToolkit.tagNameSeparator.length(), tagName.length());
    }

    return tagType;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.