edu.rice.cs.drjava.model.definitions.reducedmodel
Class Gap

java.lang.Object
  extended by edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedToken
      extended by edu.rice.cs.drjava.model.definitions.reducedmodel.Gap
All Implemented Interfaces:
ReducedModelStates

 class Gap
extends ReducedToken

A subclass of ReducedToken that represents sequences of non-special characters.

Version:
$Id: Gap.java 5175 2010-01-20 08:46:32Z mgricken $

Field Summary
private  int _size
           
 
Fields inherited from interface edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelStates
FREE, INSIDE_BLOCK_COMMENT, INSIDE_DOUBLE_QUOTE, INSIDE_LINE_COMMENT, INSIDE_SINGLE_QUOTE, STUTTER
 
Constructor Summary
Gap(int size, ReducedModelState state)
          Creates a new Gap.
 
Method Summary
 void flip()
          Blows up.
 int getSize()
          Gets the size of this gap.
 String getType()
          Gets the token type.
 void grow(int delta)
          Increases the size of the gap.
 boolean isBlockCommentEnd()
          Determines that this is not the end of a block comment.
 boolean isBlockCommentStart()
          Determines that this is not the start of a block comment.
 boolean isClosed()
          Determines that this is not closed.
 boolean isClosedBrace()
          Determines that this is not a closed brace.
 boolean isDoubleEscape()
          Determines that this is not a double escape.
 boolean isDoubleEscapeSequence()
          Determines that this is not a double escape sequence.
 boolean isDoubleQuote()
          Determines that this is not a ".
 boolean isEscapedDoubleQuote()
          Determines that this is not a \".
 boolean isEscapedSingleQuote()
          Determines that this is not a \'.
 boolean isGap()
          Determines that this is a gap.
 boolean isLineComment()
          Determines that this is not a line comment.
 boolean isMatch(Brace other)
          Determines that this is not a match.
 boolean isMatchable()
          Determines that this ReducedToken is not matchable (one of "{", "}", "(", ")", "[", "]")
 boolean isMultipleCharBrace()
          Determines that this is not a multi-char brace.
 boolean isNewline()
          Determines that this is not a newline.
 boolean isOpen()
          Determines that this is not open.
 boolean isOpenBrace()
          Determines that this is not an open brace.
 boolean isSingleQuote()
          Determines that this is not a '.
 boolean isSlash()
          Determines that this is not a /.
 boolean isStar()
          Determines that this is not a *.
 void setType(String type)
          Blows up.
 void shrink(int delta)
          Decreases the size of the gap.
 String toString()
          Converts a Brace to a String.
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedToken
getHighlightState, getState, isCommented, isCommentStart, isQuoted, isShadowed, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_size

private volatile int _size
Constructor Detail

Gap

Gap(int size,
    ReducedModelState state)
Creates a new Gap.

Parameters:
size - the size of the gap
state - the state of the reduced model
Method Detail

getSize

public int getSize()
Gets the size of this gap.

Specified by:
getSize in class ReducedToken
Returns:
_size

getType

public String getType()
Gets the token type.

Specified by:
getType in class ReducedToken
Returns:
the empty string

setType

public void setType(String type)
Blows up. The type of a Gap cannot be set.

Specified by:
setType in class ReducedToken
Parameters:
type - the type to set to
Throws:
RuntimeException - always

flip

public void flip()
Blows up. A Gap cannot be flipped.

Specified by:
flip in class ReducedToken
Throws:
RuntimeException - always

grow

public void grow(int delta)
Increases the size of the gap.

Specified by:
grow in class ReducedToken
Parameters:
delta - the amount by which the gap is augmented.

shrink

public void shrink(int delta)
Decreases the size of the gap.

Specified by:
shrink in class ReducedToken
Parameters:
delta - the amount by which the gap is diminished.

toString

public String toString()
Converts a Brace to a String. Used for debugging.

Overrides:
toString in class Object
Returns:
the String representation of the Gap

isMultipleCharBrace

public boolean isMultipleCharBrace()
Determines that this is not a multi-char brace.

Specified by:
isMultipleCharBrace in class ReducedToken
Returns:
false

isGap

public boolean isGap()
Determines that this is a gap.

Specified by:
isGap in class ReducedToken
Returns:
true

isLineComment

public boolean isLineComment()
Determines that this is not a line comment.

Specified by:
isLineComment in class ReducedToken
Returns:
false

isBlockCommentStart

public boolean isBlockCommentStart()
Determines that this is not the start of a block comment.

Specified by:
isBlockCommentStart in class ReducedToken
Returns:
false

isBlockCommentEnd

public boolean isBlockCommentEnd()
Determines that this is not the end of a block comment.

Specified by:
isBlockCommentEnd in class ReducedToken
Returns:
false

isNewline

public boolean isNewline()
Determines that this is not a newline.

Specified by:
isNewline in class ReducedToken
Returns:
false

isSlash

public boolean isSlash()
Determines that this is not a /.

Specified by:
isSlash in class ReducedToken
Returns:
false

isStar

public boolean isStar()
Determines that this is not a *.

Specified by:
isStar in class ReducedToken
Returns:
false

isDoubleQuote

public boolean isDoubleQuote()
Determines that this is not a ".

Specified by:
isDoubleQuote in class ReducedToken
Returns:
false

isSingleQuote

public boolean isSingleQuote()
Determines that this is not a '.

Specified by:
isSingleQuote in class ReducedToken
Returns:
false

isDoubleEscapeSequence

public boolean isDoubleEscapeSequence()
Determines that this is not a double escape sequence.

Specified by:
isDoubleEscapeSequence in class ReducedToken
Returns:
false

isDoubleEscape

public boolean isDoubleEscape()
Determines that this is not a double escape.

Specified by:
isDoubleEscape in class ReducedToken
Returns:
false

isEscapedSingleQuote

public boolean isEscapedSingleQuote()
Determines that this is not a \'.

Specified by:
isEscapedSingleQuote in class ReducedToken
Returns:
false

isEscapedDoubleQuote

public boolean isEscapedDoubleQuote()
Determines that this is not a \".

Specified by:
isEscapedDoubleQuote in class ReducedToken
Returns:
false

isOpen

public boolean isOpen()
Determines that this is not open.

Specified by:
isOpen in class ReducedToken
Returns:
false

isClosed

public boolean isClosed()
Determines that this is not closed.

Specified by:
isClosed in class ReducedToken
Returns:
boolean

isMatch

public boolean isMatch(Brace other)
Determines that this is not a match.

Specified by:
isMatch in class ReducedToken
Parameters:
other - the token to compare to
Returns:
false

isMatchable

public boolean isMatchable()
Determines that this ReducedToken is not matchable (one of "{", "}", "(", ")", "[", "]")

Specified by:
isMatchable in class ReducedToken

isOpenBrace

public boolean isOpenBrace()
Determines that this is not an open brace.

Specified by:
isOpenBrace in class ReducedToken
Returns:
boolean

isClosedBrace

public boolean isClosedBrace()
Determines that this is not a closed brace.

Specified by:
isClosedBrace in class ReducedToken
Returns:
boolean