public class CASAFilePropertiesMap extends PropertiesMapXML
CASAFilePropertiesMap
is an extension of PropertiesMapXML
that can write to a CASAFile
and can keep the data in the file current with every change of the properties. Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
CASAFile
Modifier and Type | Field and Description |
---|---|
private CASAFile |
file
The CASAFile that we are writing these properties to.
|
private boolean |
initializing
Determines whther the file has been initialized to what we beleive to be a
correct value.
|
private boolean |
keepFileUpdated
Determines whether the properties are automatically written when they are
changed.
|
static String |
PROPERTIES_ENTRY_NAME
The designated index node name for the properties.
|
BOOLEAN_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INTEGER_TYPE, LONG_TYPE, modified, PROPERTY_TYPE, STRING_TYPE
Constructor and Description |
---|
CASAFilePropertiesMap(CASAFile file)
Creates a new instance of the
CASAFilePropertiesMap . |
CASAFilePropertiesMap(CASAFile file,
PropertiesMap map)
Creates a new instance of the
CASAFilePropertiesMap from
another PropertiesMap . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Compares the specified
Object with this
CASAFilePropertiesMap for equality. |
boolean |
getKeepFileUpdated()
Returns whether this object is set to keep the file updated with every property change.
|
void |
setKeepFileUpdated(boolean keepUpdated)
Sets whether this object is to keep the file updated with every property change.
|
protected void |
setModified()
Called when the XML is modified for any reason.
|
void |
writeProperties()
Writes the propreties to the CASAFile.
|
clone, isModified, read, read, read, removeProperty, resetModified, setAllProperties, setBoolean, setDouble, setFloat, setInteger, setLong, setProperty, setString, toString, write, write
clearProperties, getBoolean, getByte, getChar, getDouble, getFloat, getInteger, getLong, getProperties, getProperty, getShort, getString, getType, hasProperty, keySet, setByte, setChar, setShort
public static String PROPERTIES_ENTRY_NAME
private CASAFile file
private boolean initializing
true
if the file has not been set yet;
false
otherwise.private boolean keepFileUpdated
public CASAFilePropertiesMap(CASAFile file)
CASAFilePropertiesMap
. The
properties are read from the CASAFile
in XML form and then
converted to the map form.file
- The CASAFile
that the properties will be
initially read from, and then written to as the properties are
modified.public CASAFilePropertiesMap(CASAFile file, PropertiesMap map)
CASAFilePropertiesMap
from
another PropertiesMap
. Initializes the map of the
properties to a clone of the map of the given PropertiesMap
unless it is null
. If it is null
, it
initializes the map of the properties to an empty Hashtable
.
It then initializes the XML version to match and finally writes it to the
given CASAFile
.file
- The CASAFile
that the properties will be written
to as the properties are modified.map
- A PropertiesMap
that will be used to initialize
the new object if non- null
.public void writeProperties()
public void setKeepFileUpdated(boolean keepUpdated)
keepUpdated
- true
if the object is set to keep the file updated with every property change; false
otherwise.public boolean getKeepFileUpdated()
true
if the object is set to keep the file updated with every property change; false
otherwise.protected void setModified()
keepFileUpdated
is set.setModified
in class PropertiesMapXML
public boolean equals(Object object)
Object
with this
CASAFilePropertiesMap
for equality. The two are equal if the
Object
is an instance of PropertiesMap
and
all of their properties are equal, and furthermore, if the
Object
is an instance of CASAFilePropertiesMap
,
they must both use the same CASAFile
.equals
in class PropertiesMap
object
- The Object
to be compared for equality with
this CASAFilePropertiesMap
.true
if the specified Object
is equal
to this CASAFilePropertiesMap
;false
otherwise.