Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.makumba.analyser.engine
Class SyntaxPoint

    java.lang.Object
      org.makumba.analyser.engine.SyntaxPoint

All Implemented Interfaces:
  Comparable<SyntaxPoint>

Direct Known Subclasses:
  SyntaxPoint.End

    public abstract class SyntaxPoint

extends Object
implements Comparable<SyntaxPoint>

Keeps track of important points in a file. Syntax points are typically stored in a sorted set, and used for syntax colouring. A syntax colourer would load the file, then go through the syntax points and change the coloring context at each syntax point. This is an abstract class, but can be easily instantiated with an anonymous inner class like this: SyntaxPoint comment=new SyntaxPoint(position) { public String getType(){ return "JSPcomment";}}; idea: the class can also find identifiers in the text and ask the owners of other enclosing syntax points (or the owner of the whole text info) if they can account for them. For example in the case of a makumba JSP, a LIST tag can account for a OQL label, an MDD field, a MDD name or a $attribute). If yes, syntax points are produced by the respective entity, and presented in different colours or as links idea: a syntax point walker that goes through a text and invokes methods of a syntax colourer like beginText(), beginJSPComment, endJspComment, beginTag... etc

Version:
  $Id: SyntaxPoint.java 2231 2008-03-03 00:59:26Z cristian_bogdan $
Author:
  Cristian Bogdan

Nested Class Summary
`static class` | `SyntaxPoint.End` A simple implementation: ends of strings marked by other syntax points

Field Summary
`(package private) boolean` | `begin` Is this point a begin or an end of something (where applicable)
`(package private) int` | `column` Redundant but useful data: column of the position in the text
`(package private) int` | `line` Redundant but useful data: line of the position in the text
`(package private) int` | `offset` The offset sufferred due to includes
`(package private) int` | `position` The position in the file
`(package private) SourceSyntaxPoints` | `sourceFile` The file in which this syntax point was detected

Constructor Summary
`SyntaxPoint(int position)` Simpler constructor
`SyntaxPoint(int position, boolean begin)` Default constructor

Method Summary
`int` | `compareTo(SyntaxPoint sp)` Compares two objects, for sorting in the syntaxPoints collection
`boolean` | `equals(Object o)` Performs a simple comparison, for hashing reasons
`int` | `getColumn()` Gets the column number in the file
`File` | `getFile()` The file that contains this point
`int` | `getIncludeOffset()` Gets the offset by which this SyntaxPoint has moved from the original position due to includes
`int` | `getLine()` Gets the line number in the file
`int` | `getOriginalColumn(int lineLength)` This is a temporary workaround for '@included' files not having their syntaxpoints & offsets detected correctly.
`int` | `getOriginalPosition()`
`Object` | `getOtherInfo()` Additional information which can be returned by subclasses
`int` | `getPosition()` Gets the position in the file
`SourceSyntaxPoints` | `getSourceSyntaxPoints()`
`abstract String` | `getType()` The type of this point, will be defined by the subclass
`int` | `hashCode()` Generates the hashcode of the SyntaxPoint
`boolean` | `isBegin()` Checks whether this this point is the beginning of the end of something.
`static SyntaxPoint` | `makeEnd(SyntaxPoint begin, int position)` Makes an end for a given syntax point
`(package private) void` | `moveByInclude(int delta)` Adjusts the offset and position at inclusion of a file
`String` | `toString()` Prints the position and type of the SyntaxPoint, for debugging

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### position

    int position

  The position in the file

### offset

    int offset

  The offset sufferred due to includes

### begin

    boolean begin

  Is this point a begin or an end of something (where applicable)

### line

    int line

  Redundant but useful data: line of the position in the text

### column

    int column

  Redundant but useful data: column of the position in the text

### sourceFile

    SourceSyntaxPoints sourceFile

  The file in which this syntax point was detected

Constructor Detail

### SyntaxPoint

    public SyntaxPoint(int position,
                       boolean begin)

  Default constructor

  Parameters:
    `position` - the position of this SyntaxPoint
    `begin` - is this SyntaxPoint the beginning

### SyntaxPoint

    public SyntaxPoint(int position)

  Simpler constructor

Method Detail

### getPosition

    public int getPosition()

  Gets the position in the file

  Returns:
    the position in the file

### getIncludeOffset

    public int getIncludeOffset()

  Gets the offset by which this SyntaxPoint has moved from the original position due to includes

  Returns:
    the offset caused by inclusions

### getOriginalPosition

    public int getOriginalPosition()

### getLine

    public int getLine()

  Gets the line number in the file

### getColumn

    public int getColumn()

  Gets the column number in the file

  Returns:
    the column number in the file

### getOriginalColumn

    public int getOriginalColumn(int lineLength)

  This is a temporary workaround for '@included' files not having their syntaxpoints & offsets detected correctly.

  Parameters:
    `lineLength` - the length of the line
  Returns:
    the correct column

### isBegin

    public boolean isBegin()

  Checks whether this this point is the beginning of the end of something. Ends are stored one position after the last character of the entity so substring() works right away

  Returns:
    `true` if this is a beginning, `false` otherwise

### getType

    public abstract String getType()

  The type of this point, will be defined by the subclass

### getOtherInfo

    public Object getOtherInfo()

  Additional information which can be returned by subclasses

### getFile

    public File getFile()

  The file that contains this point

### makeEnd

    public static SyntaxPoint makeEnd(SyntaxPoint begin,
                                      int position)

  Makes an end for a given syntax point

  Parameters:
    `begin` - the begin SyntaxPoint
    `position` - the position of the end

### moveByInclude

    void moveByInclude(int delta)

  Adjusts the offset and position at inclusion of a file

  Parameters:
    `delta` - the length of the included file

### compareTo

    public int compareTo(SyntaxPoint sp)

  Compares two objects, for sorting in the syntaxPoints collection

  Specified by:
    `compareTo` in interface `Comparable<SyntaxPoint>`
  Parameters:
    `o` - object to be compared with
  Returns:
    -1 if this is before, 1 if after

### equals

    public boolean equals(Object o)

  Performs a simple comparison, for hashing reasons

  Overrides:
    `equals` in class `Object`
  Parameters:
    `o` - the object to be compared with
  Returns:
    `true` if the two objects are equal, `false` otherwise

### hashCode

    public int hashCode()

  Generates the hashcode of the SyntaxPoint

  Overrides:
    `hashCode` in class `Object`
  Returns:
    The computed hashcode

### toString

    public String toString()

  Prints the position and type of the SyntaxPoint, for debugging

  Overrides:
    `toString` in class `Object`
  Returns:
    A String that can be used for debugging

### getSourceSyntaxPoints

    public SourceSyntaxPoints getSourceSyntaxPoints()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Docs generated on 2009-02-25 14:20