chemaxon.struc.sgroup
Class DataSgroup

java.lang.Object
  extended bychemaxon.struc.Sgroup
      extended bychemaxon.struc.sgroup.DataSgroup
All Implemented Interfaces:
java.io.Serializable

public class DataSgroup
extends Sgroup

Data Sgroup.

Since:
Marvin 4.0, 1/07/2005
Version:
Marvin 4.0.2, 10/31/2005
Author:
Szabolcs Csepregi Date: Jan 7, 2005
See Also:
Serialized Form

Field Summary
static int DT_FORMATTED
          Field type: formatted.
static int DT_NUMERIC
          Field type: numeric.
static int DT_TEXT
          Field type: text.
static int DT_UNSPEC
          Field type: unspecified.
 
Fields inherited from class chemaxon.struc.Sgroup
PR_ATSYMS, RA_IN_EXPAND, RA_REMOVE_EXCEPT_RU, SCN_EITHER_UNKNOWN, SCN_HEAD_TO_HEAD, SCN_HEAD_TO_TAIL, sgroupGraph, sgroupType, SORT_CHILD_PARENT, SORT_PARENT_CHILD, SST_ALTERNATING, SST_BLOCK, SST_RANDOM, ST_ANY, ST_COMPONENT, ST_COPOLYMER, ST_CROSSLINK, ST_DATA, ST_FORMULATION, ST_GENERIC, ST_MER, ST_MIXTURE, ST_MODIFICATION, ST_MONOMER, ST_MULTIPLE, ST_SRU, ST_SUPERATOM, XSTATE_C, XSTATE_NONE, XSTATE_X, XSTATE_XC
 
Constructor Summary
DataSgroup(DataSgroup sg, Molecule mol, Sgroup psg)
          Copy constructor.
DataSgroup(Molecule parent)
          Creates a Data S-group with the specified parent.
 
Method Summary
 void addDataLine(java.lang.String line)
          Adds a line to the data stored in the field.
 Sgroup cloneSgroup(Molecule mol, Sgroup psg)
          Gets a new DataSgroup instance.
 DPoint3 getAbsoluteXY()
          Gets the X and Y coordinates of the data label in the molecule's coordinate system, regardless of absolute/relative placement.
 java.lang.String getData()
          Gets the data value to be set.
 java.lang.String getDataLine(int i)
          Gets a line of data.
 int getDataLineCount()
          Gets the number of data lines.
 int getDisplayedChars()
          Gets the number of characters to be displayed(1...999 or 0 for all)
 int getDisplayedLines()
          Gets the number of lines to be displayed (0: show all)
 java.lang.String getFieldName()
          Gets the data field name.
 int getFieldType()
          Gets the field type.
 java.lang.String getLineOnScreen(int i)
          Returns the i-th row of the data sgroup label, as displayed on the screen (with tag, query operator, units etc.)
 void getObjectsMiddle(DPoint3 p)
          Calculates the middle point of the coordinates of objects this sgroup is associated to.
 void getPlacementOrigin(DPoint3 p)
          If isAbsolutePlacement is true, it returns an all-zero vector, otherwise calculates the middle point of the coordinates of objects this sgroup is associated to.
 int getPos()
          Gets the data display DASP position (0...9).
 java.lang.String getQueryCode()
          Gets the program code of the query option.
 java.lang.String getQueryOp()
          Gets the data query operator.
 java.lang.String getSubscript()
          Gets the subscript for non-superatom S-groups.
 char getTag()
          Gets the tag character for footnote display (or space if blank).
 java.lang.String getUnits()
          Gets the unit of this data field.
 double getX()
          Gets the X coordinate.
 double getY()
          Gets the Y coordinate.
 boolean hasBrackets()
          Brackets are painted if mouse runs over sgroup atoms.
 boolean isAbsolutePlacement()
          Gets whether the placement of this attached data is absolute or relative to the objects it is attached.
 boolean isDataDetached()
          Gets whether the data should be displayed close to the objects or separately (detached).
 boolean isUnitDisplayed()
          Gets whether the units string should be displayed.
 void setAbsolutePlacement(boolean b)
          Sets whether the placement of this attached data is absolute or relative to the objects it is attached.
 void setAbsoluteXY(double x, double y)
          Sets the X and Y coordinates of the data label in the molecule's coordinate system, regardless of absolute/relative placement.
 void setAbsoluteXY(DPoint3 p)
          Sets the X and Y coordinates of the data label in the molecule's coordinate system, regardless of absolute/relative placement.
 void setData(java.lang.String s)
          Sets the data value to be set.
 void setDataDetached(boolean b)
          Sets whether the data should be displayed close to the objects or separately (detached).
 void setDataLine(int i, java.lang.String line)
          Sets a line of data.
 void setDisplayedChars(int chars)
          Sets the number of characters to be displayed (1...999 or 0 for no restriction)
 void setDisplayedLines(int lines)
          Sets the number of lines to be displayed (0: show all)
 void setFieldName(java.lang.String nameP)
          Sets the data field name.
 void setFieldType(int typeP)
          Sets the field type.
 void setFieldType(java.lang.String ft)
          Sets the field type from string representation.
 void setPos(int p)
          Sets the data display DASP position (0...9).
 void setQueryCode(java.lang.String queryCodeP)
          Sets the program code for the query option.
 void setQueryOp(java.lang.String queryOpP)
          Sets the data query operator.
 void setTag(char c)
          Sets the tag character for the footnote display.
 void setUnitDisplayed(boolean b)
          Sets whether the units string should be displayed.
 void setUnits(java.lang.String unitsP)
          Sets the unit of this data field.
 void setX(double x)
          Sets the X coordinate.
 void setY(double y)
          Sets the Y coordinate.
protected  void transformByParent(CTransform3D t, boolean incg)
          Applies a transformation matrix to the Data Sgroup coordinates.
 
Methods inherited from class chemaxon.struc.Sgroup
add, addChildSgroup, areChildSgroupsVisible, cloneStructure, containsAllAtomsOf, contract, countAllAtoms, createMolecule, expand, findCrossingBonds, findSmallestSgroupContaining, findSmallestSgroupOf, getAtom, getAtomArray, getAtomCount, getAtomSymbolListAsString, getChildSgroup, getChildSgroupCount, getConnectivity, getCrossingAtoms, getParentMolecule, getParentSgroup, getSgroupGraph, getSubType, getSuperscript, getType, getXState, hasAtom, indexOf, isBracketVisible, isEmpty, isOrderedComponentSgroup, isRemovable, isVisible, removeAtom, removeAtom, removeAtom, removeBond, removeEdges, removeGroupedAtom, replaceAtom, replaceAtom, setAtom, setConnectivity, setGUIStateRecursively, setParentMolecule, setSgroupGraph, setSubscript, setSubType, setXState, setXState0, sort, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DT_UNSPEC

public static final int DT_UNSPEC
Field type: unspecified.

See Also:
Constant Field Values

DT_FORMATTED

public static final int DT_FORMATTED
Field type: formatted.

See Also:
Constant Field Values

DT_NUMERIC

public static final int DT_NUMERIC
Field type: numeric.

See Also:
Constant Field Values

DT_TEXT

public static final int DT_TEXT
Field type: text.

See Also:
Constant Field Values
Constructor Detail

DataSgroup

public DataSgroup(Molecule parent)
Creates a Data S-group with the specified parent.

Parameters:
parent - the parent molecule

DataSgroup

public DataSgroup(DataSgroup sg,
                  Molecule mol,
                  Sgroup psg)
Copy constructor.

Parameters:
sg - the S-group to copy
mol - the new parent molecule
psg - the new parent S-group or null
Since:
Marvin 4.0 1/08/2005
Method Detail

cloneSgroup

public Sgroup cloneSgroup(Molecule mol,
                          Sgroup psg)
Gets a new DataSgroup instance.

Overrides:
cloneSgroup in class Sgroup
Parameters:
mol - the new parent molecule
psg - the new parent S-group
Returns:
the new object

getFieldName

public java.lang.String getFieldName()
Gets the data field name. (V2000: the first 30 chars can only be exported.)

Returns:
The data field identifier.

setFieldName

public void setFieldName(java.lang.String nameP)
Sets the data field name. (V2000: the first 30 chars can only be exported.)

Parameters:
nameP - The data field identifier.

getFieldType

public int getFieldType()
Gets the field type.

Returns:
The type of the field.
See Also:
DT_UNSPEC, DT_FORMATTED, DT_NUMERIC, DT_TEXT

setFieldType

public void setFieldType(int typeP)
Sets the field type.

Parameters:
typeP - The type of the data field.
See Also:
DT_UNSPEC, DT_FORMATTED, DT_NUMERIC, DT_TEXT

setFieldType

public void setFieldType(java.lang.String ft)
Sets the field type from string representation.

Parameters:
ft - "F", "T" or "N"
See Also:
DT_UNSPEC, DT_FORMATTED, DT_NUMERIC, DT_TEXT

getUnits

public java.lang.String getUnits()
Gets the unit of this data field. (V2000: The first 20 characters can only be exported.)

Returns:
The unit of the data, e.g. "A^2" or "kJ/cm3"

setUnits

public void setUnits(java.lang.String unitsP)
Sets the unit of this data field. (V2000: The first 20 characters can only be exported.)

Parameters:
unitsP - The units of the data attached, e.g. "A^2" or "kJ/cm3"

getQueryCode

public java.lang.String getQueryCode()
Gets the program code of the query option.

Returns:
the string identifying a program for the query option.

setQueryCode

public void setQueryCode(java.lang.String queryCodeP)
Sets the program code for the query option.

Parameters:
queryCodeP - the string identifying a program for the query option. mQ = marvin query, MQ = MACCS-II query, IQ = ISIS query, <P>Q = program name code query

getQueryOp

public java.lang.String getQueryOp()
Gets the data query operator.

Returns:
One of the following: "<", ">", "<=", ">=", "<>", "between", "like", "contains", "=" or null if not set.

setQueryOp

public void setQueryOp(java.lang.String queryOpP)
Sets the data query operator.

Parameters:
queryOpP - One of the following: "<", ">", "<=", ">=", "<>", "between", "like", "contains", "=" or null if not set.

getX

public double getX()
Gets the X coordinate.

Returns:
The X coordinate in Angstroms.

setX

public void setX(double x)
Sets the X coordinate.

Parameters:
x - The X coordinate in Angstroms.

getY

public double getY()
Gets the Y coordinate.

Returns:
The Y coordinate in Angstroms.

setY

public void setY(double y)
Sets the Y coordinate.

Parameters:
y - The Y coordinate in Angstroms.

setAbsoluteXY

public void setAbsoluteXY(DPoint3 p)
Sets the X and Y coordinates of the data label in the molecule's coordinate system, regardless of absolute/relative placement.

Parameters:
p - the absolute coordinates.
See Also:
getX(), getY(), isAbsolutePlacement()

setAbsoluteXY

public void setAbsoluteXY(double x,
                          double y)
Sets the X and Y coordinates of the data label in the molecule's coordinate system, regardless of absolute/relative placement.

Parameters:
x - X absolute coordinate.
y - Y absolute coordinate.
See Also:
getX(), getY(), isAbsolutePlacement()

getAbsoluteXY

public DPoint3 getAbsoluteXY()
Gets the X and Y coordinates of the data label in the molecule's coordinate system, regardless of absolute/relative placement.

Returns:
the absolute coordinates.
See Also:
getX(), getY(), isAbsolutePlacement()

getPlacementOrigin

public void getPlacementOrigin(DPoint3 p)
If isAbsolutePlacement is true, it returns an all-zero vector, otherwise calculates the middle point of the coordinates of objects this sgroup is associated to.

Parameters:
p - This point will contain the calculated X and Y coordinates.
See Also:
getObjectsMiddle(chemaxon.struc.DPoint3)

getObjectsMiddle

public void getObjectsMiddle(DPoint3 p)
Calculates the middle point of the coordinates of objects this sgroup is associated to.

Parameters:
p - This point will contain the calculated X and Y coordinates.

isDataDetached

public boolean isDataDetached()
Gets whether the data should be displayed close to the objects or separately (detached).

Returns:
True if the data is detached.

setDataDetached

public void setDataDetached(boolean b)
Sets whether the data should be displayed close to the objects or separately (detached).

Parameters:
b - true if the data is detached.

isUnitDisplayed

public boolean isUnitDisplayed()
Gets whether the units string should be displayed.

Returns:
True if the units string is displayed.

setUnitDisplayed

public void setUnitDisplayed(boolean b)
Sets whether the units string should be displayed. (Default is false.)

Parameters:
b - True if the units string should be displayed.

isAbsolutePlacement

public boolean isAbsolutePlacement()
Gets whether the placement of this attached data is absolute or relative to the objects it is attached.

Returns:
true when getX() and getY() coordinates refer to absolute placement.

setAbsolutePlacement

public void setAbsolutePlacement(boolean b)
Sets whether the placement of this attached data is absolute or relative to the objects it is attached.

Parameters:
b - true when getX() and getY() coordinates should refer to absolute placement.

getDisplayedChars

public int getDisplayedChars()
Gets the number of characters to be displayed(1...999 or 0 for all)

Returns:
Gets the number of characters to display per line

setDisplayedChars

public void setDisplayedChars(int chars)
Sets the number of characters to be displayed (1...999 or 0 for no restriction)

Parameters:
chars - the number of characters to display per line

getDisplayedLines

public int getDisplayedLines()
Gets the number of lines to be displayed (0: show all)

Returns:
The number of lines to be displayed.

setDisplayedLines

public void setDisplayedLines(int lines)
Sets the number of lines to be displayed (0: show all)

Parameters:
lines - The number of lines to be displayed. 0 Means to show all.

getTag

public char getTag()
Gets the tag character for footnote display (or space if blank).

Returns:
The caracter to use in the footnote for the attached data.

setTag

public void setTag(char c)
Sets the tag character for the footnote display.

Parameters:
c - The character to use in the footnote or space to clear.

getPos

public int getPos()
Gets the data display DASP position (0...9). (MACCS)

Returns:
The above position number (1-9 or 0 if not set.)

setPos

public void setPos(int p)
Sets the data display DASP position (0...9). (MACCS)

Parameters:
p - The position number to be set (1-9) or 0 if not set.

getData

public java.lang.String getData()
Gets the data value to be set. Can be multiline: '\n' characters separate lines.

Returns:
The value of the attached data.

setData

public void setData(java.lang.String s)
Sets the data value to be set.

Parameters:
s - The value of the attached data. Can be multiline: '\n' characters separate lines.

getDataLineCount

public int getDataLineCount()
Gets the number of data lines.


getDataLine

public java.lang.String getDataLine(int i)
Gets a line of data.

Parameters:
i - line index

setDataLine

public void setDataLine(int i,
                        java.lang.String line)
Sets a line of data.

Parameters:
i - line index

addDataLine

public void addDataLine(java.lang.String line)
Adds a line to the data stored in the field.

Parameters:
line - Next line to add.

getLineOnScreen

public java.lang.String getLineOnScreen(int i)
Returns the i-th row of the data sgroup label, as displayed on the screen (with tag, query operator, units etc.)

Parameters:
i - number of line

hasBrackets

public boolean hasBrackets()
Brackets are painted if mouse runs over sgroup atoms.

Overrides:
hasBrackets in class Sgroup
Returns:
always true in the default implementation

getSubscript

public java.lang.String getSubscript()
Gets the subscript for non-superatom S-groups.

Overrides:
getSubscript in class Sgroup
Returns:
the subscript

transformByParent

protected void transformByParent(CTransform3D t,
                                 boolean incg)
Applies a transformation matrix to the Data Sgroup coordinates. (Only absolute placement.) This method is called by the parent molecule's Molecule.transform(CTransform3D, boolean) method, thus only those atom coordinates are transformed here that are not handled in MoleculeGraph.transform(CTransform3D, boolean).

Overrides:
transformByParent in class Sgroup
Parameters:
t - the transformation matrix
incg - graph invariants are changed (true) or not (false)
Since:
Marvin 4.0.2, 10/26/2005