|
SmartFrog 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
org.smartfrog.sfcore.common.OrderedHashtable
org.smartfrog.sfcore.common.ContextImpl
public class ContextImpl
Implements the context interface. This implementation relies on the OrderedHashtable class in the Utilities, but another class can be used. The important thing for any implementation is the fact that the order in which entries are added to the context should be maintained even through the enumeration returning methods.
| Field Summary |
|---|
| Fields inherited from class org.smartfrog.sfcore.common.OrderedHashtable |
|---|
initCap, keysInc, loadFac, orderedKeys |
| Constructor Summary | |
|---|---|
ContextImpl()
Creates an empty context with default capacity. |
|
ContextImpl(int cap,
float load)
Constructs a context with initial capacity and a load trigger for expansion. |
|
| Method Summary | |
|---|---|
static java.lang.String |
getBasicValueFor(java.lang.Object obj)
Gets a given value in its String form. |
java.lang.Object |
keyFor(java.lang.Object value)
Returns the first key for which the value is the given one. |
java.lang.Object |
sfAddAttribute(java.lang.Object name,
java.lang.Object value)
Adds an attribute to this context under given name. |
java.lang.Object |
sfAttributeFor(java.lang.Object value)
Returns the first attribute which has a particular value in the table. |
java.lang.Object |
sfAttributeKeyFor(java.lang.Object value)
Returns the attribute key given a value. |
java.util.Iterator |
sfAttributes()
Returns an ordered iterator over the attribute names in the context. |
boolean |
sfContainsAttribute(java.lang.Object attribute)
Returns true if the context contains attribute. |
boolean |
sfContainsValue(java.lang.Object value)
Returns true if the context contains value. |
java.lang.Object |
sfRemoveAttribute(java.lang.Object name)
Removes an attribute from this context. |
java.lang.Object |
sfReplaceAttribute(java.lang.Object name,
java.lang.Object value)
Replace named attribute in context. |
java.lang.Object |
sfResolveAttribute(java.lang.Object name)
Find an attribute in this context. |
java.util.Iterator |
sfValues()
Returns an ordered iterator over the values in the context. |
protected static void |
tabPad(java.io.Writer ps,
int amount)
Internal method to pad out a writer. |
java.lang.String |
toString()
Returns a string representation of the component. |
protected static void |
writeBasicValueOn(java.io.Writer ps,
int indent,
java.lang.Object value)
Writes a given value on a writer. |
protected void |
writeContextOn(java.io.Writer ps,
int indent,
java.util.Enumeration keys)
Writes the context on a writer. |
protected void |
writeKeyOn(java.io.Writer ps,
int indent,
java.lang.Object key)
Writes given attribute key on a writer. |
void |
writeOn(java.io.Writer ps)
Writes this component description on a writer. |
void |
writeOn(java.io.Writer ps,
int indent)
Writes this component description on a writer. |
protected void |
writeValueOn(java.io.Writer ps,
int indent,
java.lang.Object value)
Writes a given value on a writer. |
| Methods inherited from class org.smartfrog.sfcore.common.OrderedHashtable |
|---|
clear, clone, copy, elements, keys, orderedAttributes, orderedValues, primPut, put, remove, remove, rename |
| Methods inherited from class java.util.Hashtable |
|---|
contains, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, rehash, size, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.smartfrog.sfcore.common.Context |
|---|
clone, contains, containsKey, elements, get, isEmpty, keys, put, remove, rename, size |
| Methods inherited from interface org.smartfrog.sfcore.common.Copying |
|---|
copy |
| Constructor Detail |
|---|
public ContextImpl()
public ContextImpl(int cap,
float load)
cap - initial capacityload - load capacity trigger| Method Detail |
|---|
public java.lang.Object keyFor(java.lang.Object value)
keyFor in interface Contextvalue - value to look up
public java.lang.Object sfAttributeFor(java.lang.Object value)
sfAttributeFor in interface Contextvalue - value to find in table
public boolean sfContainsValue(java.lang.Object value)
sfContainsValue in interface Contextvalue - object to check
public boolean sfContainsAttribute(java.lang.Object attribute)
sfContainsAttribute in interface Contextattribute - to check
public java.util.Iterator sfAttributes()
sfAttributes in interface Contextpublic java.util.Iterator sfValues()
sfValues in interface Context
public java.lang.Object sfResolveAttribute(java.lang.Object name)
throws SmartFrogContextException
sfResolveAttribute in interface Contextname - attribute key to resolve
SmartFrogContextException - failed to find attribute
public java.lang.Object sfAddAttribute(java.lang.Object name,
java.lang.Object value)
throws SmartFrogContextException
sfAddAttribute in interface Contextname - name of attributevalue - value of attribute
SmartFrogContextException - when name or value are null or name already used
public java.lang.Object sfRemoveAttribute(java.lang.Object name)
throws SmartFrogContextException
sfRemoveAttribute in interface Contextname - of attribute to be removed
SmartFrogContextException - when name is null
public java.lang.Object sfReplaceAttribute(java.lang.Object name,
java.lang.Object value)
throws SmartFrogContextException
sfReplaceAttribute in interface Contextname - of attribute to replacevalue - value to add or replace
SmartFrogContextException - when name or value are nullpublic java.lang.Object sfAttributeKeyFor(java.lang.Object value)
sfAttributeKeyFor in interface Contextvalue - value to look up key for
public java.lang.String toString()
toString in interface ContexttoString in class java.util.Hashtable
public void writeOn(java.io.Writer ps)
throws java.io.IOException
writeOn in interface PrettyPrintingps - writer to write on
java.io.IOException - failure while writing
public void writeOn(java.io.Writer ps,
int indent)
throws java.io.IOException
writeOn in interface PrettyPrintingps - writer to write onindent - the indent to use for printing offset
java.io.IOException - failure while writing
protected void writeContextOn(java.io.Writer ps,
int indent,
java.util.Enumeration keys)
throws java.io.IOException
ps - writer to write onindent - levelkeys - enumeation over the keys of the context to write out
java.io.IOException - failure while writing
protected void writeKeyOn(java.io.Writer ps,
int indent,
java.lang.Object key)
throws java.io.IOException
ps - writer to write onindent - indent levelkey - key to stringify
java.io.IOException - failure while writing
protected void writeValueOn(java.io.Writer ps,
int indent,
java.lang.Object value)
throws java.io.IOException
ps - writer to write onindent - indent levelvalue - value to stringify
java.io.IOException - failure while writing
protected static void writeBasicValueOn(java.io.Writer ps,
int indent,
java.lang.Object value)
throws java.io.IOException
ps - writer to write onindent - indent levelvalue - value to stringify
java.io.IOException - failure while writing
public static java.lang.String getBasicValueFor(java.lang.Object obj)
throws java.io.IOException
obj - Object to be given in String form
java.io.IOException - failure while writing
protected static void tabPad(java.io.Writer ps,
int amount)
throws java.io.IOException
ps - writer to tab toamount - amount to tab
java.io.IOException - failure while writing
|
SmartFrog CORE 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||