package app.model;

import java.net.URL;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * An interface describing functions required for a class to
 * provide language specific details and functionality to the 
 * editor
 */
public interface ProgrammingLanguage {
  /**
   * The name of the programming language
   */
  public String getName();
  
  /**
   * The icon of the programming language
   * @return The path of the icon
   */
  public URL getIcon();

  /**
   * The map containing the regex and corresponding style-classes to be used for syntax highlighting
   */
  public Map<Pattern,String> getPatternMap();

  /**
   * The pattern containing all regexes for syntax highlighting
   */
  public Pattern getPattern();

  /**
   * Comment out a line
   * @param line The text of the line to comment out
   * @return The commented line
   */
  public String commentLine(String line);

  /**
   * Uncomment a line
   * @param line The text of the line to uncomment
   * @return The uncommented line
   */
  public String unCommentLine(String line);

  /**
   * Whether or not a line is commented
   * @param line The text of the line
   */
  public boolean isCommentedLine(String line);

  /**
   * Comment out an area of text
   * @param selection The text of the area to comment out
   * @return The commented area
   */
  public String commentSelection(String selection);

  /**
   * Uncomment a line
   * @param selection The text of the line to uncomment
   * @return The uncommented area
   */
  public String unCommentSelection(String selection);

  /**
   * Whether or not an area of text is commented
   * @param selection The content of the area
   */
  public boolean isCommentedSelection(String selection);

}
