|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
edu.washington.biostr.sig.brainj3d.data.Data
public abstract class Data
The Data object contains information that is shared between all loaded
instances of the data. This acts as the logical place where the single
file is available.
When data changes in a way that makes it out of sync with the disk, then it
must send an message to its Observers. This is done automatically by
setSaved(boolean). It is also important to note that if Data that changes does
not setSaved(false), then the system will likely not save the Data.
In order to properly cache and manage data, the data expects to be told when
it is in use (addReference() and removeReference()). If you are using the
DataHandler, you do not need to worry about these calls, but if you use data
outside of a DataHandler, then it is important to properly call these methods.
| Field Summary | |
|---|---|
protected AtomicReference<FileGroup> |
file
|
static String |
SAVE_STATE_CHANGED
Send this Object when the state of saved changes. |
protected AtomicBoolean |
saved
|
| Constructor Summary | |
|---|---|
Data()
|
|
Data(FileGroup file)
|
|
| Method Summary | |
|---|---|
protected boolean |
cacheTo(File f)
Write this Data object out to disk. |
abstract boolean |
canDiskCache()
Return true if we can cache this Data or part of it to disk. |
protected void |
finalize()
|
Map<String,Object> |
getDefaultParameters(Set<Tag> metadata)
Get the default parameters for this Data. |
FileGroup |
getFile()
|
Object |
getLock()
Get the lock that this data uses to synchronize itself. |
abstract FileType |
getType()
Every piece of data has a type. |
boolean |
hasTime()
return true if this data varies with time |
boolean |
isImmutable()
Find out if this data is immutable. |
boolean |
isSaved()
|
boolean |
isSerialized()
If the data was cached, return true if it was serialized. |
protected Data |
readFrom(File f)
Read the object from the given file using the same format as cacheTo(File). |
void |
setFile(FileGroup file)
Set the name for this component. |
void |
setSaved(boolean save)
Set the saved state and send a message if it changes. |
boolean |
sharable()
If we can put the data in a central cache and reuse it for different users, return true. |
String |
toString()
|
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SAVE_STATE_CHANGED
protected AtomicBoolean saved
protected AtomicReference<FileGroup> file
| Constructor Detail |
|---|
public Data()
public Data(FileGroup file)
| Method Detail |
|---|
public abstract FileType getType()
public Object getLock()
public boolean isSaved()
public void setSaved(boolean save)
save - public boolean isImmutable()
public boolean sharable()
public abstract boolean canDiskCache()
protected boolean cacheTo(File f)
throws IOException
f -
IOException
protected Data readFrom(File f)
throws IOException,
ClassNotFoundException
f -
IOException
ClassNotFoundExceptionpublic boolean isSerialized()
public FileGroup getFile()
public void setFile(FileGroup file)
name - public String toString()
toString in class Object
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic Map<String,Object> getDefaultParameters(Set<Tag> metadata)
public boolean hasTime()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||