| java.lang.Object soif.AVPairs
AVPairs | public class AVPairs implements Cloneable(Code) | | A class to handle attribute/value pairs.
A SOIF attribute name may be multi-valued. For example,
attributes "author-1" and "author-2" are treated as seperate
instances of a single attribute, allowing the attribute
to have more than one value.
|
Method Summary | |
public boolean | attributeNameExists(String s) Check to see if an attributeName exists on the list of
AVPairs, regardless of multivalue: e.g. | public String | attributeValue() Return the base attribute name. | public int | attributeValueCount(String s) Get number of values for an attribute, e.g. | public int | count() Count AVPairs. | public AVPairs | getAVPair(String s) Get an avpair based on the attribute. | public AVPairs | getAVPairsByAttribute(String s) Clone the AVPairs w/ the specified attribute. | public AVPairs | getAVPairsByMV(int mv) Clone the AVPairs w/ the specified MV. | public String | getAttribute() Get the attribute for this AVPair. | public int | getAttributeCount() Return a unique list of attributes w/out multi value,
e.g. | public int | getAttributeIndex() Get the attribute index for this AVPair. | public String | getAttributeName() Get the attribute name for this AVPair. | public String[] | getAttributes() Return a unique list of attributes w/out multi value,
e.g. | public int | getMaxAttributeIndex() Get the maximum multivalue value. | public AVPairs | getSingleValuePairs() Return the pairs of the list that are not multivalue. | public String | getValue() Return the value of a single AVPair (head of list). | public String | getValue(String s) Find the value of a non-multivalue attribute. | public String | getValue(String s, int n) Find the value of a multivalue attribute by index. | public String[] | getValues(String s) Find all values of an attribute. | public void | insertAfter(AVPairs avPair) Insert new AVPair after this instance. | public void | insertAfter(String att, String val) Insert new AVPair after this instance. | public boolean | isMV() | public AVPairs | remove(AVPairs avp) Remove AVPairs instance from list. | public AVPairs | remove(String att) Remove AVPairs instance from list. | public void | setAttribute(String att) Set the attribute, do the multi-value parse. | public void | setIndices(int index) Sets the index of a multivalue attribute value pair. | public boolean | setValue(String s, String v) Set the value of a non-multivalue attribute. | public boolean | setValue(String s, int n, String v) Set the value of a multivalue attribute by index. | public String | toCGIEqualStringList(boolean quoted) Return "a = v" string version of AVPairs list, spaced. | public String | toEqualString(boolean quoted) Return "a = v" string version of AVPairs instance. | public static String | toSOIF(String a, String v) Print out SOIF attribute value pair. | public String | toSOIF() Print out SOIF attribute value pair. | public String | toSOIF(int mv) Print out SOIF attribute value pair. | public String | toSOIFList() Print out SOIF attribute value pair. | public String | toSOIFList(int mv) Print out SOIF attribute value pair. | public String | toSpacedEqualStringList(boolean quoted) Return "a = v" string version of AVPairs list, spaced. | public String | toString() | public String | toStringList() Return SOIF string version of AVPairs instance list. | public AVPairs | unduplicateValues() Unduplicate values on the AVPairs list. | public AVPairs | update(String att, String val) A convenience method which bundles insert(),
setValue() and remove(). |
NOMULTIVALUE | final public static int NOMULTIVALUE(Code) | | No multivalue value.
This is the value that an AVPair which is not multivalue
will return if asked for its multivalue index.
|
AVPairs | public AVPairs(String att, String val)(Code) | | Constructs a new AVPairs instance.
Parameters: att - the attribute Parameters: val - the value |
attributeNameExists | public boolean attributeNameExists(String s)(Code) | | Check to see if an attributeName exists on the list of
AVPairs, regardless of multivalue: e.g. Bob == Bob-1.
Ignores case of attribute name.
Parameters: s - the attribute |
attributeValue | public String attributeValue()(Code) | | Return the base attribute name.
|
attributeValueCount | public int attributeValueCount(String s)(Code) | | Get number of values for an attribute, e.g. if Bob has
Bob-1 and Bob-2, the answer is 2.
Ignores case of attribute name.
Parameters: s - the attribute |
count | public int count()(Code) | | Count AVPairs.
|
getAVPair | public AVPairs getAVPair(String s)(Code) | | Get an avpair based on the attribute.
Parameters: att - attribute |
getAVPairsByAttribute | public AVPairs getAVPairsByAttribute(String s)(Code) | | Clone the AVPairs w/ the specified attribute.
For Bob, return for Bob-1 and Bob-2.
Parameters: s - attribute |
getAVPairsByMV | public AVPairs getAVPairsByMV(int mv)(Code) | | Clone the AVPairs w/ the specified MV.
Parameters: mv - multivalue value |
getAttribute | public String getAttribute()(Code) | | Get the attribute for this AVPair.
|
getAttributeCount | public int getAttributeCount()(Code) | | Return a unique list of attributes w/out multi value,
e.g. for Bob-1, Bob-2, Jim-1, return Bob, Jim.
|
getAttributeIndex | public int getAttributeIndex()(Code) | | Get the attribute index for this AVPair. NOMULTIVALUE if no index.
|
getAttributeName | public String getAttributeName()(Code) | | Get the attribute name for this AVPair.
|
getAttributes | public String[] getAttributes()(Code) | | Return a unique list of attributes w/out multi value,
e.g. for Bob-1, Bob-2, Jim-1, return Bob, Jim.
Ignores case of attribute name.
|
getMaxAttributeIndex | public int getMaxAttributeIndex()(Code) | | Get the maximum multivalue value.
|
getSingleValuePairs | public AVPairs getSingleValuePairs()(Code) | | Return the pairs of the list that are not multivalue.
|
getValue | public String getValue()(Code) | | Return the value of a single AVPair (head of list).
Parameters: s - the attribute |
getValue | public String getValue(String s)(Code) | | Find the value of a non-multivalue attribute.
Ignores case of attribute name.
Parameters: s - the attribute |
getValue | public String getValue(String s, int n)(Code) | | Find the value of a multivalue attribute by index.
Ignores case of attribute name.
Parameters: s - the attribute Parameters: n - the index |
getValues | public String[] getValues(String s)(Code) | | Find all values of an attribute. Return an array of strings for
multiple values for an attribute, e.g., for Bob, return
values for Bob-1 and Bob-2.
Ignores case of attribute name.
Parameters: s - the attribute |
insertAfter | public void insertAfter(AVPairs avPair)(Code) | | Insert new AVPair after this instance.
Parameters: avPair - the new instance |
insertAfter | public void insertAfter(String att, String val)(Code) | | Insert new AVPair after this instance.
Parameters: att - attribute Parameters: val - value |
isMV | public boolean isMV()(Code) | | Is this avp multi-valued?
|
remove | public AVPairs remove(AVPairs avp)(Code) | | Remove AVPairs instance from list.
Return a pointer to corrected list.
The method is silent if it finds
nothing to remove.
Parameters: avp - node to nuke |
remove | public AVPairs remove(String att)(Code) | | Remove AVPairs instance from list.
Return a pointer to corrected list.
Parameters: att - attribute to nuke |
setAttribute | public void setAttribute(String att)(Code) | | Set the attribute, do the multi-value parse.
Parameters: att - the attribute |
setIndices | public void setIndices(int index)(Code) | | Sets the index of a multivalue attribute value pair.
Parameters: index - index >= 0 or == NOMULTIVALUE exception: IllegalArgumentException - on bad index |
setValue | public boolean setValue(String s, String v)(Code) | | Set the value of a non-multivalue attribute.
Ignores case of attribute name.
Parameters: s - the attribute Parameters: v - the value |
setValue | public boolean setValue(String s, int n, String v)(Code) | | Set the value of a multivalue attribute by index.
Ignores case of attribute name.
Parameters: s - the attribute Parameters: n - the index Parameters: v - the value |
toCGIEqualStringList | public String toCGIEqualStringList(boolean quoted)(Code) | | Return "a = v" string version of AVPairs list, spaced.
Parameters: quoted - doublequote the value if true |
toEqualString | public String toEqualString(boolean quoted)(Code) | | Return "a = v" string version of AVPairs instance.
Parameters: quoted - doublequote the value if true |
toSOIF | public static String toSOIF(String a, String v)(Code) | | Print out SOIF attribute value pair.
Parameters: a - attribute Parameters: v - value |
toSOIF | public String toSOIF()(Code) | | Print out SOIF attribute value pair.
|
toSOIF | public String toSOIF(int mv)(Code) | | Print out SOIF attribute value pair.
Parameters: mv - multi-value |
toSOIFList | public String toSOIFList()(Code) | | Print out SOIF attribute value pair.
|
toSOIFList | public String toSOIFList(int mv)(Code) | | Print out SOIF attribute value pair.
Parameters: mv - multi-value |
toSpacedEqualStringList | public String toSpacedEqualStringList(boolean quoted)(Code) | | Return "a = v" string version of AVPairs list, spaced.
Parameters: quoted - doublequote the value if true |
toStringList | public String toStringList()(Code) | | Return SOIF string version of AVPairs instance list.
|
unduplicateValues | public AVPairs unduplicateValues()(Code) | | Unduplicate values on the AVPairs list.
|
update | public AVPairs update(String att, String val)(Code) | | A convenience method which bundles insert(),
setValue() and remove().
If the proposed value is length 0, remove() is called.
Otherwise, setValue() is called.
If setValue() fails, insertAfter() is called.
Parameters: att - attribute Parameters: val - value |
|
|