public class MPropertyContainer extends Object implements Cloneable, Externalizable
Constructor and Description |
---|
MPropertyContainer()
Creates an empty property container.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears properties.
|
Object |
clone()
Clones this object.
|
boolean |
contains(MProp p)
Tests whether the container contains the specified property object.
|
void |
flatten()
Flattens hierarchically specified RDF properties.
|
MProp |
get(String key)
Gets a property object.
|
String |
getKey(int i)
Gets a property key.
|
String[] |
getKeys()
Returns the property keys.
|
Object |
getObject(String key)
Gets a property object.
|
List<MProp> |
getPropList()
Gets the list of basic properties.
|
String |
getString(String key)
Deprecated.
As of Marvin 5.7, replaced by
MPropHandler.convertToString(MPropertyContainer, String) |
String |
hierarchize()
|
boolean |
isHierarchic()
|
boolean |
isSelfReference(MProp p)
Tests whether a property is a self reference to the containing
molecule.
|
boolean |
isValid(MProp prop)
Tests whether a coordinate dependent property is still valid.
|
void |
readExternal(ObjectInput in)
Restores the property container's state.
|
void |
remove(MProp p)
Removes a property.
|
void |
replace(MProp oldp,
MProp newp)
Replaces or removes a property.
|
void |
set(String key,
MProp value)
Sets a property object.
|
void |
set(String key,
MProp value,
int opts)
Sets a property object.
|
void |
setObject(String key,
Object val)
Sets a property object.
|
void |
setString(String key,
String value)
Sets a property.
|
int |
size()
Gets the total number of properties.
|
void |
writeExternal(ObjectOutput out)
Saves the property container's state.
|
public MPropertyContainer()
public void clear()
public int size()
public String[] getKeys()
public String getKey(int i)
i
- property index@Deprecated public String getString(String key)
MPropHandler.convertToString(MPropertyContainer, String)
key
- property namepublic MProp get(String key)
key
- property namepublic void setString(String key, String value)
key
- the property namevalue
- the value or nullpublic void set(String key, MProp value)
key
- the property namevalue
- the value or nullpublic void set(String key, MProp value, int opts)
key
- the property namevalue
- the value or nullopts
- 0 or MProp.COORDDEP
public void remove(MProp p)
p
- the objectpublic void replace(MProp oldp, MProp newp)
oldp
- the old objectnewp
- the new object or null
to removepublic boolean contains(MProp p)
p
- the objectpublic boolean isValid(MProp prop)
prop
- the propertytrue
if the property is valid,
false
otherwiseMProp.COORDDEP
,
set(String, MProp, int)
public boolean isSelfReference(MProp p)
p
- the propertytrue
if the property is a self reference,
false
otherwisepublic boolean isHierarchic()
MListProp
and MHashProp
. A property list containing
names in MDL RDfile style can be made hierarchic by calling
hierarchize()
.true
if the property list contains subcollections,
false
otherwisepublic String hierarchize()
MHashProp
type property)
or null
flatten()
,
isHierarchic()
public void flatten()
hierarchize()
.isHierarchic()
public List<MProp> getPropList()
MListProp
and MHashProp
are not added to the list but
searched recursively for their basic elements.MProp
objectspublic Object getObject(String key)
key
- property namepublic void setObject(String key, Object val)
key
- the property nameval
- the value or nullpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- the stream to read data from in order to restore the objectIOException
- if I/O errors occurClassNotFoundException
- If the class for an object being
restored cannot be found.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to write the object toIOException
- Includes any I/O exceptions that may occur