codesimian
Class StringSkeleton

java.lang.Object
  extended by codesimian.StringSkeleton

public class StringSkeleton
extends java.lang.Object

A "skeleton" amount of code for a string CS.

StringSkeleton contains only 1 var: StringBuffer.
Params that appear to be here are really from the constant-pool.
Params that you try to set really just change a char value.

Any class that is a long STRING or uses one should probably use a StringSkeleton.

P(int) returns a Const from the constant-pool with the value of the char at a specified index in the string.


setP(int,CS setTo) sets a char in the string to setTo.C().


Field Summary
protected  java.lang.StringBuffer stringBuffer
           
 
Constructor Summary
StringSkeleton()
           
StringSkeleton(java.lang.String initialString)
           
 
Method Summary
 int countP()
          returns the string length
 boolean deleteP(int index)
          removes a char from the string.
 java.lang.StringBuffer getSB()
           
 int indexP(CS myParam)
          My only params are from Const.pool().
 boolean insertP(int index, CS insertThisCharValue)
           
 CS P(int index)
          Returns a Const with value (double) getSB().charAt(index), the letter at that position in the string.
 java.lang.String paramsToString()
          params are represented as char values in a String.
 CS PWithName(java.lang.String paramName)
          Returns null.
 boolean setP(int index, CS setTo)
          Sets a char in the string to setTo.charValue().
 boolean setSB(java.lang.StringBuffer setTo)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stringBuffer

protected java.lang.StringBuffer stringBuffer
Constructor Detail

StringSkeleton

public StringSkeleton()

StringSkeleton

public StringSkeleton(java.lang.String initialString)
Method Detail

insertP

public boolean insertP(int index,
                       CS insertThisCharValue)

setP

public boolean setP(int index,
                    CS setTo)
Sets a char in the string to setTo.charValue(). Returns false if index<0 or countP()

P

public CS P(int index)
Returns a Const with value (double) getSB().charAt(index), the letter at that position in the string.


deleteP

public boolean deleteP(int index)
removes a char from the string. Returns a Const from the constant-pool with the deleted char's value. Returns null if can not be deleted. public CS deleteP(int index){ try{ CS deleted = Const.pool( getSB().charAt(index) ); StringBuffer shorterSB = getSB().deleteCharAt(index); if(setSB(shorterSB)) return deleted; return null; }catch(IndexOutOfBoundsException e){ return null; } }


countP

public int countP()
returns the string length


indexP

public int indexP(CS myParam)
My only params are from Const.pool(). Returns the index of the last param that equals myParam (in indexP(CS myParam)) and is from the constant-pool, else returns -1.

This function is not much useful because theres only approximately 70 useful chars, and many will be repeated in the same string.


PWithName

public CS PWithName(java.lang.String paramName)
Returns null. StringSkeleton does not care what the names of its params are because its params are encapsulated illusions. They're really only chars in a String.


getSB

public java.lang.StringBuffer getSB()

setSB

public boolean setSB(java.lang.StringBuffer setTo)

paramsToString

public java.lang.String paramsToString()
params are represented as char values in a String. Returns that String


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object