|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.tables.EList | +--org.erights.e.elib.tables.ConstList | +--org.erights.e.elib.tables.Twine
Untamed:
Field Summary | |
private static StaticMaker |
OptTwineMaker
Initialized lazily to avoid a circular initialization problem |
private static long |
serialVersionUID
|
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) |
Twine()
Package scoped to deter the creation of any other immediate subclasses besides AtomicTwine and CompositeTwine. |
Method Summary | |
ConstList |
add(Object other)
Enabled: Return a new Twine that represents a concatenation of the parts of this and other. |
Twine |
asFrom(String url)
Enabled: startLine defaults to 1 and startCol defaults to 0 |
Twine |
asFrom(String url,
int startLine,
int startCol)
Enabled: Returns a new Twine on the same underlying bare String as this one, but marked as being contiguous text starting at the position described by the argument. |
abstract String |
bare()
Enabled: Explicitly gets the String part of the twine. |
Twine |
canonical()
Enabled: Each crlf is turned into an lf to deal with MSWindows, and then each remaining cr is turned into an lf to deal with Mac. |
abstract char |
charAt(int index)
Enabled: From the E language, this is identical to get/1. |
double |
compareTo(ConstList other)
Enabled: Compares the bare strings. |
int |
compareToIgnoreCase(String other)
Enabled: Compares the bare strings ignoring case differences |
boolean |
endsWith(String suffix)
Enabled: @see String#endsWith |
boolean |
equalsIgnoreCase(String other)
Enabled: Compares the bare strings ignoring case differences |
static Twine |
fromChars(ConstList chars,
SourceSpan optSourceSpan)
Enabled: |
static Twine |
fromParts(ConstList parts)
Enabled: Make a Twine whose parts are this list of AtomicTwines. |
static Twine |
fromString(String str)
Enabled: Makes a Twine with no information besides str. |
static Twine |
fromString(String str,
SourceSpan optSourceSpan)
Enabled: Makes a Twine on str from optSourceSpan. |
Object |
get(int index)
Enabled: |
byte[] |
getBytes()
Enabled: In E, the encoding always defaults to "UTF-8", period. |
byte[] |
getBytes(String enc)
Enabled: @see String#getBytes |
abstract SourceSpan |
getOptSpan()
Enabled: Gets the sourceSpan part of the twine, if it's there. |
int[] |
getPartAt(int pos)
Enabled: If pos is a position within this Twine, return a pair consisting of the index in the getParts() list of the AtomicTwine containing this position, and the offset into this part of this position. |
abstract ConstList |
getParts()
Enabled: @return A list of AtomicTwines. |
ConstMap |
getSourceMap()
Enabled: Returns a mapping from intervals in the Twine to spans showing where they came from. |
static StaticMaker |
GetTwineMaker()
Enabled: |
int |
indexOf(String str)
Enabled: Just like EList.startOf(EList) , but with a String argument for
convenience of the Java programmer. |
int |
indexOf(String str,
int fromIndex)
Enabled: Just like startOf(EList, int) , but with a String argument for
convenience of the Java programmer. |
Twine |
infect(String str)
Enabled: oneToOne defaults to false |
Twine |
infect(String str,
boolean oneToOne)
Enabled: Returns a Twine with str as the string part, and the source info from this Twine. |
(package private) abstract Twine |
infectOneToOne(String str)
|
abstract boolean |
isBare()
Enabled: Is the bare string all the info there is? |
int |
lastIndexOf(String str)
Enabled: Just like EList.lastStartOf(EList) , but with a String argument for
convenience of the Java programmer. |
int |
lastIndexOf(String str,
int fromIndex)
Enabled: Just like lastStartOf(EList, int) , but with a String argument
for convenience of the Java programmer. |
int |
lastStartOf(EList candidate,
int start)
Enabled: Overridden for performance |
ConstList |
multiply(int reps)
Enabled: The result will be a Twine |
Twine |
quote()
Enabled: Returns a string that, when interpreted as a literal, represents the original string. |
Twine |
replaceAll(String oldStr,
String newStr)
Enabled: In E, we have the string-based replaceAll() rather than the character-based replace(). |
Twine |
rjoin(Twine[] fields)
Enabled: Like Python's joinFields(), but with the receiver and argument reversed (hence the initial "r"). |
abstract ConstList |
run(int start,
int bound)
Enabled: Returns a Twine. |
ConstList |
run(Object intReg)
Enabled: Returns a Twine. |
ConstList |
split(String sep)
Enabled: Like Python's splitFields(), this returns a list of the "fields" of this twine (substrings of this twine), using 'sep' as a separator. |
int |
startOf(EList candidate,
int start)
Enabled: Overridden for performance |
boolean |
startsWith(String prefix)
Enabled: @see String#startsWith |
boolean |
startsWith(String prefix,
int offset)
Enabled: @see String#startsWith |
Twine |
toLowerCase()
Enabled: |
String |
toString()
Suppressed: |
Twine |
toUpperCase()
Enabled: |
Twine |
trim()
Enabled: |
Class |
valueType()
Enabled: @return Character.class |
Methods inherited from class org.erights.e.elib.tables.ConstList |
__optUncall, __printOn, 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, size, sort, sort, startOf, with, with |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.erights.e.elib.tables.Selfless |
getSpreadUncall |
Field Detail |
private static final long serialVersionUID
private static StaticMaker OptTwineMaker
Constructor Detail |
Twine()
Method Detail |
public static StaticMaker GetTwineMaker()
public static Twine fromParts(ConstList parts)
The list of parts is assumed to already be maximally merged. If it's an empty list, return the EmptyTwine. If it's a singleton list, return that part. Otherwise return a CompositeTwine on these parts.
public static Twine fromString(String str)
If str is empty, returns the empty CompositeTwine. Otherwise, returns a new SimpleTwine on str.
public static Twine fromString(String str, SourceSpan optSourceSpan)
If str is empty, returns the EmptyTwine. Otherwise, returns a new SimpleTwine on str or a LocatedTwine on both args.
public static Twine fromChars(ConstList chars, SourceSpan optSourceSpan)
chars
-
public Twine asFrom(String url)
public Twine asFrom(String url, int startLine, int startCol)
public abstract ConstList getParts()
public int[] getPartAt(int pos) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public ConstMap getSourceMap()
Unfortunately, because of the way the E implementation is layered, the keys in this mapping cannot be int-regions (as these are implemented in the E language, which is in a layer that depends on this layer, and we're trying to avoid inter-layer cyclic dependencies). Instead, the keys are represented as a pair of ints representing start..!bound. Note that this is inclusive-exclusive, while the info in the spans are inclusive-inclusive.
The mapping is ordered to facilitate binary search. Intervals with no SourceSpan information are left out of the map.
public abstract String bare()
When using this call, this call itself will be the top level construct for breaking cycles. XXX where & what do we stabilize?
public abstract boolean isBare()
public abstract SourceSpan getOptSpan()
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.
abstract Twine infectOneToOne(String str)
public Twine infect(String str)
public Twine infect(String str, boolean oneToOne)
str
- The string to annotate with source-span info from this
Twine.oneToOne
- If true, the two strings must be the same size, in
which case this Twine's source-span info is mapped
one to one onto the new string. If false, then the
new string will only get a non-oneToOne form of this
Twine's overall source-span.public ConstList add(Object other)
The last part of this may be merged with the first part of other.
add
in class EList
public ConstList multiply(int reps)
multiply
in class EList
public Twine canonical()
public ConstList run(Object intReg)
run
in class EList
public abstract ConstList run(int start, int bound)
run
in class EList
public Twine quote()
public Object get(int index) throws IndexOutOfBoundsException
get
in class EList
IndexOutOfBoundsException
- if index isn't in 0..!size.public double compareTo(ConstList other)
Optimized for the case where both are Twine. Otherwise should be identical.
compareTo
in class ConstList
public Class valueType()
valueType
in class EList
public abstract char charAt(int index) throws IndexOutOfBoundsException
IndexOutOfBoundsException
String.charAt(int)
public int compareToIgnoreCase(String other)
String.compareToIgnoreCase(java.lang.String)
public boolean equalsIgnoreCase(String other)
String.equalsIgnoreCase(java.lang.String)
public boolean startsWith(String prefix)
public boolean startsWith(String prefix, int offset)
public boolean endsWith(String suffix)
public byte[] getBytes() throws UnsupportedEncodingException
UnsupportedEncodingException
String.getBytes(int, int, byte[], int)
public byte[] getBytes(String enc) throws UnsupportedEncodingException
UnsupportedEncodingException
public int indexOf(String str)
EList.startOf(EList)
, but with a String argument for
convenience of the Java programmer.
public int indexOf(String str, int fromIndex)
startOf(EList, int)
, but with a String argument for
convenience of the Java programmer.
public int startOf(EList candidate, int start)
startOf
in class EList
public int lastIndexOf(String str)
EList.lastStartOf(EList)
, but with a String argument for
convenience of the Java programmer.
public int lastIndexOf(String str, int fromIndex)
lastStartOf(EList, int)
, but with a String argument
for convenience of the Java programmer.
public int lastStartOf(EList candidate, int start)
lastStartOf
in class EList
public Twine replaceAll(String oldStr, String newStr)
For each match, the source info from the twine matching oldStr infects the substituted newStr. Ignoring the source info, 'str replaceAll(oldStr, newStr)' should be equivalent to 'newStr rjoin(str split(oldStr))'.
If oldStr is the null string (""), replaceAll() throws an IllegalArgumentException.
String.replace(char, char)
public ConstList split(String sep)
The returned list will have one more element than the number of non-overlapping occurrences of 'sep'.
Unlike Python, if sep is the null string (""), split() throws an IllegalArgumentException.
public Twine rjoin(Twine[] fields)
Concatenates the fields with this twine as the intervening separator. Ignoring source info, and if 'sep' is not the null string, 'sep.rjoin(str.split(sep))' should be equivalent to 'str'.
public String toString()
toString
in class EList
public Twine toLowerCase()
public Twine toUpperCase()
public Twine trim()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |