|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
rup.soif
Class AVPairs
java.lang.Object | +--rup.soif.AVPairs
- public class AVPairs
- extends java.lang.Object
- implements java.lang.Cloneable
- extends java.lang.Object
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.
- Author:
- Steven Pennebaker
Field Summary | |
protected AVPairs |
next
Next AVPair. |
static int |
NOMULTIVALUE
No multivalue value. |
java.lang.String |
value
Value. |
Constructor Summary | |
AVPairs(java.lang.String att,
java.lang.String val)
Constructs a new AVPairs instance. |
Method Summary | |
boolean |
attributeNameExists(java.lang.String s)
Check to see if an attributeName exists on the list of AVPairs, regardless of multivalue: e.g. |
java.lang.String |
attributeValue()
Return the base attribute name. |
int |
attributeValueCount(java.lang.String s)
Get number of values for an attribute, e.g. if Bob has Bob-1 and Bob-2, the answer is 2. |
java.lang.Object |
clone()
|
int |
count()
Count AVPairs. |
java.lang.String |
getAttribute()
Get the attribute for this AVPair. |
int |
getAttributeCount()
Return a unique list of attributes w/out multi value, e.g. for Bob-1, Bob-2, Jim-1, return Bob, Jim. |
int |
getAttributeIndice()
Get the attribute indice for this AVPair. |
java.lang.String |
getAttributeName()
Get the attribute name for this AVPair. |
java.lang.String[] |
getAttributes()
Return a unique list of attributes w/out multi value, e.g. for Bob-1, Bob-2, Jim-1, return Bob, Jim. |
AVPairs |
getAVPair(java.lang.String s)
Get an avpair based on the attribute. |
AVPairs |
getAVPairsByAttribute(java.lang.String s)
Clone the AVPairs w/ the specified attribute. |
AVPairs |
getAVPairsByMV(int mv)
Clone the AVPairs w/ the specified MV. |
int |
getMaxAttributeIndice()
Get the maximum multivalue value. |
AVPairs |
getSingleValuePairs()
Return the pairs of the list that are not multivalue. |
java.lang.String |
getValue(java.lang.String s)
Find a value by nonmultivalue attribute. |
java.lang.String |
getValue(java.lang.String s,
int n)
Find a value by attribute and multivalue indice. |
java.lang.String[] |
getValues(java.lang.String s)
Find values by attribute. |
void |
insertAfter(AVPairs avPair)
Insert new AVPair after this instance. |
void |
insertAfter(java.lang.String att,
java.lang.String val)
Insert new AVPair after this instance. |
java.lang.String |
multiValueAttributeValue()
Return the multivalue or full attribute name. |
int |
multiValueValue()
Return the multivalue value. |
AVPairs |
remove(AVPairs avp)
Remove AVPairs instance from list. |
AVPairs |
remove(java.lang.String att)
Remove AVPairs instance from list. |
void |
setAttribute(java.lang.String att)
Set the attribute, do the multi-value parse. |
void |
setIndices(int indice)
Sets the indice of a multivalue attribute value pair. |
boolean |
setValue(java.lang.String s,
int n,
java.lang.String v)
Set a value by attribute and multivalue indice. |
boolean |
setValue(java.lang.String s,
java.lang.String v)
Set a value by nonmultivalue attribute. |
java.lang.String |
toCGIEqualStringList(boolean quoted)
Return "a = v" string version of AVPairs list, spaced. |
java.lang.String |
toEqualString(boolean quoted)
Return "a = v" string version of AVPairs instance. |
java.lang.String |
toSOIF()
Print out SOIF attribute value pair. |
java.lang.String |
toSOIF(int mv)
Print out SOIF attribute value pair. |
static java.lang.String |
toSOIF(java.lang.String a,
java.lang.String v)
Print out SOIF attribute value pair. |
java.lang.String |
toSOIFList()
Print out SOIF attribute value pair. |
java.lang.String |
toSOIFList(int mv)
Print out SOIF attribute value pair. |
java.lang.String |
toSpacedEqualStringList(boolean quoted)
Return "a = v" string version of AVPairs list, spaced. |
java.lang.String |
toString()
|
java.lang.String |
toStringList()
Return SOIF string version of AVPairs instance list. |
AVPairs |
unduplicateValues()
Unduplicate values on the AVPairs list. |
AVPairs |
update(java.lang.String att,
java.lang.String val)
A convenience method which bundles insert(), setValue() and remove(). |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
value
public java.lang.String value
- Value.
next
protected AVPairs next
- Next AVPair.
NOMULTIVALUE
public static final int NOMULTIVALUE
- No multivalue value. This is the value that an AVPair which is not multivalue will return if asked for the multivalue.
Constructor Detail |
AVPairs
public AVPairs(java.lang.String att, java.lang.String val)
- Constructs a new AVPairs instance.
- Parameters:
att
- the attributeval
- the value
Method Detail |
setAttribute
public void setAttribute(java.lang.String att)
- Set the attribute, do the multi-value parse.
- Parameters:
att
- the attribute
setIndices
public void setIndices(int indice)
- Sets the indice of a multivalue attribute value pair.
- Parameters:
indice
- indice >= 0 or == NOMULTIVALUE- Throws:
- java.lang.IllegalArgumentException - on bad indice
clone
public java.lang.Object clone()
- Overrides:
- clone in class java.lang.Object
getAttribute
public java.lang.String getAttribute()
- Get the attribute for this AVPair.
getAttributeName
public java.lang.String getAttributeName()
- Get the attribute name for this AVPair.
getAttributeIndice
public int getAttributeIndice()
- Get the attribute indice for this AVPair. NOMULTIVALUE if no indice.
setValue
public boolean setValue(java.lang.String s, java.lang.String v)
- Set a value by nonmultivalue attribute.
Ignores case of attribute name.
- Parameters:
s
- the attributev
- the value
setValue
public boolean setValue(java.lang.String s, int n, java.lang.String v)
- Set a value by attribute and multivalue indice.
Ignores case of attribute name.
- Parameters:
s
- the attributen
- the indicev
- the value
getValue
public java.lang.String getValue(java.lang.String s)
- Find a value by nonmultivalue attribute.
Ignores case of attribute name.
- Parameters:
s
- the attribute
getValue
public java.lang.String getValue(java.lang.String s, int n)
- Find a value by attribute and multivalue indice.
Ignores case of attribute name.
- Parameters:
s
- the attributen
- the indice
getValues
public java.lang.String[] getValues(java.lang.String s)
- Find values by 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
getAttributes
public java.lang.String[] getAttributes()
- 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.
getAttributeCount
public int getAttributeCount()
- Return a unique list of attributes w/out multi value,
e.g. for Bob-1, Bob-2, Jim-1, return Bob, Jim.
attributeValueCount
public int attributeValueCount(java.lang.String s)
- 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
getMaxAttributeIndice
public int getMaxAttributeIndice()
- Get the maximum multivalue value.
attributeNameExists
public boolean attributeNameExists(java.lang.String s)
- 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
getAVPair
public AVPairs getAVPair(java.lang.String s)
- Get an avpair based on the attribute.
- Parameters:
att
- attribute
getAVPairsByMV
public AVPairs getAVPairsByMV(int mv)
- Clone the AVPairs w/ the specified MV.
- Parameters:
mv
- multivalue value
getAVPairsByAttribute
public AVPairs getAVPairsByAttribute(java.lang.String s)
- Clone the AVPairs w/ the specified attribute.
For Bob, return for Bob-1 and Bob-2.
- Parameters:
s
- attribute
unduplicateValues
public AVPairs unduplicateValues()
- Unduplicate values on the AVPairs list.
getSingleValuePairs
public AVPairs getSingleValuePairs()
- Return the pairs of the list that are not multivalue.
count
public int count()
- Count AVPairs.
insertAfter
public void insertAfter(AVPairs avPair)
- Insert new AVPair after this instance.
- Parameters:
avPair
- the new instance
insertAfter
public void insertAfter(java.lang.String att, java.lang.String val)
- Insert new AVPair after this instance.
- Parameters:
att
- attributeval
- value
remove
public AVPairs remove(AVPairs avp)
- 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(java.lang.String att)
- Remove AVPairs instance from list.
Return a pointer to corrected list.
- Parameters:
att
- attribute to nuke
update
public AVPairs update(java.lang.String att, java.lang.String val)
- 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
- attributeval
- value
attributeValue
public java.lang.String attributeValue()
- Return the base attribute name.
multiValueValue
public int multiValueValue()
- Return the multivalue value.
multiValueAttributeValue
public java.lang.String multiValueAttributeValue()
- Return the multivalue or full attribute name.
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
toStringList
public java.lang.String toStringList()
- Return SOIF string version of AVPairs instance list.
toSOIF
public static java.lang.String toSOIF(java.lang.String a, java.lang.String v)
- Print out SOIF attribute value pair.
- Parameters:
a
- attributev
- value
toSOIF
public java.lang.String toSOIF()
- Print out SOIF attribute value pair.
toSOIF
public java.lang.String toSOIF(int mv)
- Print out SOIF attribute value pair.
- Parameters:
mv
- multi-value
toSOIFList
public java.lang.String toSOIFList()
- Print out SOIF attribute value pair.
toSOIFList
public java.lang.String toSOIFList(int mv)
- Print out SOIF attribute value pair.
- Parameters:
mv
- multi-value
toEqualString
public java.lang.String toEqualString(boolean quoted)
- Return "a = v" string version of AVPairs instance.
- Parameters:
quoted
- doublequote the value if true
toSpacedEqualStringList
public java.lang.String toSpacedEqualStringList(boolean quoted)
- Return "a = v" string version of AVPairs list, spaced.
- Parameters:
quoted
- doublequote the value if true
toCGIEqualStringList
public java.lang.String toCGIEqualStringList(boolean quoted)
- Return "a = v" string version of AVPairs list, spaced.
- Parameters:
quoted
- doublequote the value if true
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |