de.smartics.util.source
Class SourceCodeLocation

Package class diagram package SourceCodeLocation
java.lang.Object
  extended by de.smartics.util.source.SourceCodeLocation
All Implemented Interfaces:
Serializable

public class SourceCodeLocation
     
     
extends Object
implements Serializable

Provides information about a source code location.

See Also:
Serialized Form
To Do:
Serial: check validity of lines and columns when read from stream.

Nested Class Summary
static class SourceCodeLocation.Position
          Defines a position in the source code.
 
Field Summary
static SourceCodeLocation UNKNOWN_LOCATION
          Defines an unknown location.
 
Constructor Summary
SourceCodeLocation(SourceCodeLocation.Position start, SourceCodeLocation.Position end)
          Default constructor.
 
Method Summary
 SourceCodeLocation.Position getEnd()
          Returns the end position of the source code location.
 SourceCodeLocation.Position getStart()
          Returns the start position of the source code location.
 boolean isKnown()
          Checks if the location is known.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_LOCATION

public static final SourceCodeLocation UNKNOWN_LOCATION
Defines an unknown location. The fields must not be accessed.

Constructor Detail

SourceCodeLocation

public SourceCodeLocation(SourceCodeLocation.Position start,
                          SourceCodeLocation.Position end)
                   throws IllegalArgumentException
Default constructor.

Parameters:
start - the start position of the source code location.
end - the end position of the source code location.
Throws:
IllegalArgumentException - if start or end are null or start position is greater than the end position.
Method Detail

getStart

public SourceCodeLocation.Position getStart()
Returns the start position of the source code location.

Returns:
the start position of the source code location.

getEnd

public SourceCodeLocation.Position getEnd()
Returns the end position of the source code location.

Returns:
the end position of the source code location.

isKnown

public boolean isKnown()
Checks if the location is known.

Returns:
true if it is a known location with valid content, false if it is an unknown location identified by UNKNOWN_LOCATION.

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


Copyright © 2011-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.