Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

pspdash
Interface LanguageFilter  view LanguageFilter download LanguageFilter.java

All Superinterfaces:
TinyCGI
All Known Implementing Classes:
AbstractLanguageFilter

public interface LanguageFilter
extends TinyCGI

The LanguageFilter interface supports the generation of LOC counts and redlines in custom programming languages. The pspdiff script can count physical LOC changes in any text-based language. To support new languages, simply write a java class which implements this interface.


Field Summary
static char COMMENT_END
          a character used to flag the end of a comment
static char COMMENT_START
          a character used to flag the start of a comment
static int LANGUAGE_MATCH
          a constant indicating that this class definitely can act as a filter for a particular file.
static int LANGUAGE_MISMATCH
          a constant indicating that this class definitely cannot act as a filter for a particular file.
static char LOGICAL_LOC_SEPARATOR
          a character used to flag logical LOC
 
Fields inherited from interface pspdash.TinyCGI
DATA_REPOSITORY, OBJECT_CACHE, PSP_PROPERTIES, TINY_WEB_SERVER
 
Method Summary
 java.lang.String[][] getOptions()
          Return an array describing the options recognized by this language filter.
 void highlightSyntax(java.lang.StringBuffer file)
          Insert flags in a file to highlight the syntax of the language.
 boolean isSignificant(java.lang.String line)
          Test a line of code to see if it is countable.
 int languageMatches(java.lang.String filename, java.lang.String contents, java.lang.String options)
          Judge whether this filter is capable of acting as a filter for a particular file.
 void service(java.io.InputStream in, java.io.OutputStream out, java.util.Map env)
          Display any caveats about the results generated by this language filter.
 

Field Detail

LANGUAGE_MISMATCH

public static final int LANGUAGE_MISMATCH
a constant indicating that this class definitely cannot act as a filter for a particular file.

See Also:
Constant Field Values

LANGUAGE_MATCH

public static final int LANGUAGE_MATCH
a constant indicating that this class definitely can act as a filter for a particular file.

See Also:
Constant Field Values

COMMENT_START

public static final char COMMENT_START
a character used to flag the start of a comment

See Also:
Constant Field Values

COMMENT_END

public static final char COMMENT_END
a character used to flag the end of a comment

See Also:
Constant Field Values

LOGICAL_LOC_SEPARATOR

public static final char LOGICAL_LOC_SEPARATOR
a character used to flag logical LOC

See Also:
Constant Field Values
Method Detail

languageMatches

public int languageMatches(java.lang.String filename,
                           java.lang.String contents,
                           java.lang.String options)
Judge whether this filter is capable of acting as a filter for a particular file.


highlightSyntax

public void highlightSyntax(java.lang.StringBuffer file)
Insert flags in a file to highlight the syntax of the language. When counting LOC changes between two files, pspdiff will call this method twice - once for each file.


isSignificant

public boolean isSignificant(java.lang.String line)
Test a line of code to see if it is countable.


getOptions

public java.lang.String[][] getOptions()
Return an array describing the options recognized by this language filter. The array should contain an entry for each option. Each option entry should be a two-element string array; the first String is the HTML text of the option, and the second string is the HTML description of that option. Example: { { "+{", "Count a curly brace on a line by itself as a line of code." }, { "-{", "Do not count a curly brace on a line by itself as a LOC <b>(default)</b>." } };


service

public void service(java.io.InputStream in,
                    java.io.OutputStream out,
                    java.util.Map env)
             throws java.io.IOException
Display any caveats about the results generated by this language filter. These can take the user-selected options into account. The HTML output by this function will be included in a larger page, so it should not include the typical <HTML>, <HEAD>, or <BODY> tags.

Specified by:
service in interface TinyCGI