com.azalient.api.file.record
Class AbstractStoreRecordRenamable

java.lang.Object
  extended by com.azalient.api.file.record.TypeObject
      extended by com.azalient.api.file.record.ReaderUtilities
          extended by com.azalient.api.file.record.AbstractRecordR
              extended by com.azalient.api.file.record.AbstractRecordRW
                  extended by com.azalient.api.file.record.AbstractStoreRecordRenamable
All Implemented Interfaces:
IRecord, RecordR, RecordRW, RecordW, SortableData, StoreRecordRW
Direct Known Subclasses:
AbstractStoreRecordRenamableNumeric

public abstract class AbstractStoreRecordRenamable
extends AbstractRecordRW
implements StoreRecordRW

Not all records can be renamed, but records of this type can be. For example, records that have indirect names (liek a Lane, whose name is derived from its Link) cannot be renamed directly, you must rename the link and the Lane will inherit that.


Field Summary
 
Fields inherited from interface com.azalient.api.a.tables.IRecord
DELETED, KEY_SEP, KEY_SEP_CHAR
 
Constructor Summary
AbstractStoreRecordRenamable(IStore aStore, String aName)
          Create a record that can be renamed
 
Method Summary
 boolean canRename()
          Returns true if this record can be renamed.
 String indirectName()
           
 String name()
          This is a string representation of the key field(s), used as a key for looking up the object in the Store.
 void rename(String newName)
          Rename this record, if that is possible.
 IStore store()
          The store to which this record belongs.
 void store(IStore s)
          Return a reference to the store
 String toString()
           
 
Methods inherited from class com.azalient.api.file.record.AbstractRecordRW
extraGet, extraGetB, extraGetD, extraGetI, extraGetS, extraGetT, get, isVolatile, set
 
Methods inherited from class com.azalient.api.file.record.AbstractRecordR
extraCols, extraSet, finished, isApplicable, isEditable
 
Methods inherited from class com.azalient.api.file.record.TypeObject
b, c, d, equals, equals, equalsEW, f, i, keyString, keyString, nameFromKeyString, rowKeysFromKeyString, s, t, t
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.azalient.api.file.RecordR
extraSet, finished, isApplicable, isEditable, set
 
Methods inherited from interface com.azalient.api.file.RecordW
extraCols, extraGet, extraGetB, extraGetD, extraGetI, extraGetS, extraGetT, get, isVolatile
 

Constructor Detail

AbstractStoreRecordRenamable

public AbstractStoreRecordRenamable(IStore aStore,
                                    String aName)
Create a record that can be renamed

Parameters:
aStore - The reference to a store is used to rehash the object in the store if it is renamed, but this store reference is optional - sometimes, objects of this type may be added to an array list rather than a store, in which case no rehashing is necessary.
aName - The initial name of the object which should be something that can be changed, not something that depends on other objects, like a turn depending on its constituent links.
Method Detail

store

public IStore store()
Description copied from interface: StoreRecordRW
The store to which this record belongs. This many be null in some cases.

Specified by:
store in interface StoreRecordRW

name

public String name()
Description copied from interface: IRecord
This is a string representation of the key field(s), used as a key for looking up the object in the Store.
If there is more than one key field, the string representation of the key fields are concatenated, separated by KEY_SEP.
See TypeObject.keyString(Object[])

If there are multiple key fields, the get() function should not return the concatenated name, but the name function must be defined in the object so that the lookup function can use it.

Specified by:
name in interface IRecord

toString

public String toString()
Overrides:
toString in class AbstractRecordR

canRename

public boolean canRename()
Description copied from interface: StoreRecordRW
Returns true if this record can be renamed. Renaming must update the hash table, as all records are indexed by their name. Some types of record have indirect names, based on associated objects, and cannot be renamed directly.

Specified by:
canRename in interface StoreRecordRW

rename

public void rename(String newName)
Description copied from interface: StoreRecordRW
Rename this record, if that is possible. If it is not possible an error will be generated, so if you are not sure, check first using StoreRecordRW.canRename()

Specified by:
rename in interface StoreRecordRW

indirectName

public String indirectName()

store

public void store(IStore s)
Return a reference to the store