org.erights.e.elib.tables
Class LocatedTwine

java.lang.Object
  |
  +--org.erights.e.elib.tables.EList
        |
        +--org.erights.e.elib.tables.ConstList
              |
              +--org.erights.e.elib.tables.Twine
                    |
                    +--org.erights.e.elib.tables.AtomicTwine
                          |
                          +--org.erights.e.elib.tables.LocatedTwine
All Implemented Interfaces:
ArrayedList, DeepPassByCopy, EPrintable, Guard, Iteratable, Marker, PassByConstruction, Persistent, Selfless, Serializable, SlotGuard, ValueGuard

final class LocatedTwine
extends AtomicTwine

A Twine containing only a non-empty String and corresponding source-span info.

Author:
Mark S. Miller

Field Summary
private  SourceSpan mySpan
           
(package private)  String myStr
           
private static long serialVersionUID
           
 
Fields inherited from class org.erights.e.elib.tables.Twine
 
Fields inherited from class org.erights.e.elib.tables.ConstList
EmptyList
 
Fields inherited from interface org.erights.e.elib.serial.DeepPassByCopy
HONORARY, HONORED_NAMES
 
Fields inherited from interface org.erights.e.elib.serial.Persistent
HONORARY, HONORED_NAMES
 
Constructor Summary
(package private) LocatedTwine(String str, SourceSpan span)
           
 
Method Summary
 void __printOn(TextWriter out)
          Just prints the string part.
 String bare()
          Enabled: Explicitly gets the String part of the twine.
 char charAt(int index)
          Enabled: From the E language, this is identical to get/1.
 SourceSpan getOptSpan()
          Enabled: Gets the sourceSpan part of the twine, if it's there.
 ConstList getParts()
          Enabled: @return A list of AtomicTwines.
 Object getSecretArray()
          An array of my characters.
 Object[] getSpreadUncall()
          '__makeTwine fromString(myStr, mySpan)'
(package private)  Twine infectOneToOne(String str)
           
 boolean isBare()
          Enabled: Is the bare string all the info there is?
(package private)  ConstList mergedParts(AtomicTwine other)
          Two LocatedTwines can merge if the joining of their spans looses no information.
 ConstList run(int start, int bound)
          Returns a Twine which is either empty or is a LocatedTwine describing where the extracted run came from.
 int size()
          Enabled: How many entries are in the list?
 
Methods inherited from class org.erights.e.elib.tables.Twine
add, asFrom, asFrom, canonical, compareTo, compareToIgnoreCase, endsWith, equalsIgnoreCase, fromChars, fromParts, fromString, fromString, get, getBytes, getBytes, getPartAt, getSourceMap, GetTwineMaker, indexOf, indexOf, infect, infect, lastIndexOf, lastIndexOf, lastStartOf, multiply, quote, replaceAll, rjoin, run, split, startOf, startsWith, startsWith, toLowerCase, toString, toUpperCase, trim, valueType
 
Methods inherited from class org.erights.e.elib.tables.ConstList
__optUncall, accepts, and, butNot, coerce, coerce, compareTo, fromArray, fromArray, get, GetMaker, getName, makeSlot, makeSlot, match, not, or, readOnly, snapshot, xor
 
Methods inherited from class org.erights.e.elib.tables.EList
asKeys, asMap, asSet, contains, diverge, diverge, getArray, getArray, getArray, includes, indexOf1, indexOf1, iterate, last, lastIndexOf1, lastIndexOf1, lastStartOf, printOn, sort, sort, startOf, with, with
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID

mySpan

private final SourceSpan mySpan

myStr

final String myStr
Constructor Detail

LocatedTwine

LocatedTwine(String str,
             SourceSpan span)
Method Detail

getSpreadUncall

public Object[] getSpreadUncall()
'__makeTwine fromString(myStr, mySpan)'


isBare

public boolean isBare()
Description copied from class: Twine
Enabled: Is the bare string all the info there is?

Specified by:
isBare in class Twine

run

public ConstList run(int start,
                     int bound)
Returns a Twine which is either empty or is a LocatedTwine describing where the extracted run came from.

Specified by:
run in class Twine

__printOn

public void __printOn(TextWriter out)
               throws IOException
Just prints the string part.

Specified by:
__printOn in interface EPrintable
Overrides:
__printOn in class ConstList
IOException

mergedParts

ConstList mergedParts(AtomicTwine other)
Two LocatedTwines can merge if the joining of their spans looses no information.

Specified by:
mergedParts in class AtomicTwine

getOptSpan

public SourceSpan getOptSpan()
Description copied from class: Twine
Enabled: Gets the sourceSpan part of the twine, if it's there.

If this is an AtomicTwine, then, if the SourceSpan is there, it's as accurate as you're going to get. If this is a CompositeTwine, then, if the SourceSpan is there, it describes a span that includes all the individual spans. If a CompositeTwine returns null, there may still be SourceSpans on the atomic parts, but they couldn't all be summarized into one covering span.

Specified by:
getOptSpan in class Twine

charAt

public char charAt(int index)
            throws IndexOutOfBoundsException
Description copied from class: Twine
Enabled: From the E language, this is identical to get/1. But we provide it so the ELib programmer can avoid boxing the character.

Specified by:
charAt in class Twine
IndexOutOfBoundsException
See Also:
String.charAt(int)

size

public int size()
Description copied from class: EList
Enabled: How many entries are in the list?

Specified by:
size in class EList

bare

public String bare()
Description copied from class: Twine
Enabled: Explicitly gets the String part of the twine.

When using this call, this call itself will be the top level construct for breaking cycles. XXX where & what do we stabilize?

Specified by:
bare in class Twine

getParts

public ConstList getParts()
Description copied from class: Twine
Enabled: @return A list of AtomicTwines. An empty Twine returns the empty list.

Specified by:
getParts in class Twine

infectOneToOne

Twine infectOneToOne(String str)
Specified by:
infectOneToOne in class Twine

getSecretArray

public Object getSecretArray()
An array of my characters.

Specified by:
getSecretArray in interface ArrayedList
Returns:


comments?