com.pixelmed.dicom

## Class ContentItem

- java.lang.Object
- - com.pixelmed.dicom.ContentItem

All Implemented Interfaces:
  javax.swing.tree.TreeNode

Direct Known Subclasses:
  ContentItemWithReference, ContentItemWithValue

    public abstract class ContentItem
    extends java.lang.Object
    implements javax.swing.tree.TreeNode

An abstract class for representing a node in an internal representation of a structured reporting tree (an instance of `StructuredReport`).

The constructor is protected. Instances of specific types of content items should normally be created by using the `ContentItemFactory`.

See Also:
  `ContentItemFactory`, `ContentItemWithValue`, `ContentItemWithReference`, `StructuredReport`, `StructuredReportBrowser`

### Field Summary

Fields
`protected java.lang.String` `relationshipType`

### Constructor Summary

Constructors
`protected` `ContentItem(ContentItem p, AttributeList l)` Construct a content item for a list of attributes, and add it as a child of the specified parent.
`protected` `ContentItem(ContentItem p, java.lang.String relationshipType)` Construct a content item of a specified type and relationship, creating a new `AttributeList`, and add it as a child of the specified parent.

### Method Summary

Methods
`void` `addChild(ContentItem child)` Add a child to this content item.
`void` `addSibling(ContentItem sibling)` Add a sibling to this content item (a child to the parent of this content item).
`java.util.Enumeration` `children()` Returns the children of this node as an `Enumeration`.
`static boolean` `contentItemNameMatchesCodeValueAndCodingSchemeDesignator(ContentItem ci, java.lang.String cvWanted, java.lang.String csdWanted)` Test if the coded concept name of the content item matches the specified code value and coding scheme designator.
`abstract boolean` `contentItemNameMatchesCodeValueAndCodingSchemeDesignator(java.lang.String cvWanted, java.lang.String csdWanted)` Test if the coded concept name of the content item matches the specified code value and coding scheme designator.
`boolean` `getAllowsChildren()` Always returns true, since children may always be added.
`AttributeList` `getAttributeList()` Get the attribute list of this content item.
`javax.swing.tree.TreeNode` `getChildAt(int index)` Returns the child at the specified index.
`int` `getChildCount()` Return the number of children that this node contains.
`CodedSequenceItem` `getConceptName()` Get the Concept Name.
`java.lang.String` `getConceptNameAndValue()` Get a string representation of the concept name and the value of the concept.
`java.lang.String` `getConceptNameCodeMeaning()` Get the value of the code meaning of the Concept Name as a string, if present and applicable.
`java.lang.String` `getConceptNameCodeValue()` Get the value of the code value of the Concept Name as a string, if present and applicable.
`java.lang.String` `getConceptNameCodingSchemeDesignator()` Get the value of the coding scheme designator of the Concept Name as a string, if present and applicable.
`abstract java.lang.String` `getConceptValue()` Get a string representation of the value of the concept.
`float[]` `getGraphicData()` Get the Graphic Data of this content item, if present and applicable.
`java.lang.String` `getGraphicType()` Get the Graphic Type of this content item, if present and applicable.
`int` `getIndex(javax.swing.tree.TreeNode child)` Returns the index of the specified child from amongst this node's children, if present.
`ContentItem` `getNamedChild(CodedSequenceItem item)` Retrieve the named child as defined by its ConceptName The code meaning of the concept is ignored, and only the code value and coding scheme designator are compared in the search.
`ContentItem` `getNamedChild(java.lang.String codingSchemeDesignator, java.lang.String codeValue)` Retrieve the named child as defined by its ConceptName
`javax.swing.tree.TreeNode` `getParent()` Returns the parent node of this node.
`ContentItem` `getParentAsContentItem()` Get the parent content item of this content item.
`java.lang.String` `getReferencedContentItemIdentifier()` Get the Referenced Content Item Identifier, if present.
`int[]` `getReferencedContentItemIdentifierArray()` Get the Referenced Content Item Identifier, if present.
`java.lang.String` `getReferencedSOPClassUID()` Get the Referenced SOP Class UID of this content item, if present and applicable.
`java.lang.String` `getReferencedSOPInstanceUID()` Get the Referenced SOP Instance UID of this content item, if present and applicable.
`java.lang.String` `getRelationshipType()` Get the relationship type of this content item.
`java.lang.String` `getSingleStringValueOrNull()` Retrieve the string value of self
`static java.lang.String` `getSingleStringValueOrNullOfNamedChild(ContentItem parent, java.lang.String codingSchemeDesignator, java.lang.String codeValue)` Retrieve the string value of the named child as defined by its ConceptName
`java.lang.String` `getSingleStringValueOrNullOfNamedChild(java.lang.String codingSchemeDesignator, java.lang.String codeValue)` Retrieve the string value of the named child as defined by its ConceptName
`java.lang.String` `getValueType()` Get the value type of this content item.
`boolean` `isLeaf()` Returns true if the receiver is a leaf (has no children).

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### relationshipType

    protected java.lang.String relationshipType

### Constructor Detail

#### ContentItem

    protected ContentItem(ContentItem p,
               AttributeList l)

Construct a content item for a list of attributes, and add it as a child of the specified parent.

The constructor is protected. Instances of specific types of content items should normally be created by using the `ContentItemFactory`.

Parameters:
  `p` - the parent
  `l` - the list of attributes

#### ContentItem

    protected ContentItem(ContentItem p,
               java.lang.String relationshipType)
                   throws DicomException

Construct a content item of a specified type and relationship, creating a new `AttributeList`, and add it as a child of the specified parent.

The constructor is protected. Instances of specific types of content items should normally be created by using the `ContentItemFactory`.

Parameters:
  `p` - the parent
  `relationshipType` - added only if not null or zero length
Throws:
  `DicomException`

### Method Detail

#### getParent

    public javax.swing.tree.TreeNode getParent()

Returns the parent node of this node.

Specified by:
  `getParent` in interface `javax.swing.tree.TreeNode`
Returns:
  the parent node, or null if the root

#### getChildAt

    public javax.swing.tree.TreeNode getChildAt(int index)

Returns the child at the specified index.

Specified by:
  `getChildAt` in interface `javax.swing.tree.TreeNode`
Parameters:
  `index` - the index of the child to be returned, numbered from 0
Returns:
  the child `TreeNode` at the specified index

#### getIndex

    public int getIndex(javax.swing.tree.TreeNode child)

Returns the index of the specified child from amongst this node's children, if present.

Specified by:
  `getIndex` in interface `javax.swing.tree.TreeNode`
Parameters:
  `child` - the child to search for amongst this node's children
Returns:
  the index of the child, or -1 if not present

#### getAllowsChildren

    public boolean getAllowsChildren()

Always returns true, since children may always be added.

Specified by:
  `getAllowsChildren` in interface `javax.swing.tree.TreeNode`
Returns:
  always true

#### isLeaf

    public boolean isLeaf()

Returns true if the receiver is a leaf (has no children).

Specified by:
  `isLeaf` in interface `javax.swing.tree.TreeNode`
Returns:
  true if the receiver is a leaf

#### getChildCount

    public int getChildCount()

Return the number of children that this node contains.

Specified by:
  `getChildCount` in interface `javax.swing.tree.TreeNode`
Returns:
  the number of children, 0 if none

#### children

    public java.util.Enumeration children()

Returns the children of this node as an `Enumeration`.

Specified by:
  `children` in interface `javax.swing.tree.TreeNode`
Returns:
  the children of this node

#### addChild

    public void addChild(ContentItem child)

Add a child to this content item.

Parameters:
  `child` - the child content item to add

#### addSibling

    public void addSibling(ContentItem sibling)
                    throws DicomException

Add a sibling to this content item (a child to the parent of this content item).

Parameters:
  `sibling` - the sibling content item to add
Throws:
  `DicomException` - thrown if there is no parent

#### getParentAsContentItem

    public ContentItem getParentAsContentItem()

Get the parent content item of this content item.

This method saves the caller from having to cast the value returned from `TreeNode.getParent()`.

Returns:
  the parent content item

#### getAttributeList

    public AttributeList getAttributeList()

Get the attribute list of this content item.

Returns:
  the attribute list of this content item

#### getValueType

    public java.lang.String getValueType()

Get the value type of this content item.

Returns:
  the value type (the string used in the DICOM standard in the Value Type attribute)

#### getRelationshipType

    public java.lang.String getRelationshipType()

Get the relationship type of this content item.

Returns:
  the relationship type (the string used in the DICOM standard in the Relationship Type attribute)

#### getReferencedSOPClassUID

    public java.lang.String getReferencedSOPClassUID()

Get the Referenced SOP Class UID of this content item, if present and applicable.

Returns:
  the Referenced SOP Class UID, or null

#### getReferencedSOPInstanceUID

    public java.lang.String getReferencedSOPInstanceUID()

Get the Referenced SOP Instance UID of this content item, if present and applicable.

Returns:
  the Referenced SOP Instance UID, or null

#### getGraphicType

    public java.lang.String getGraphicType()

Get the Graphic Type of this content item, if present and applicable.

Returns:
  the Graphic Type, or null

#### getGraphicData

    public float[] getGraphicData()

Get the Graphic Data of this content item, if present and applicable.

Returns:
  the Graphic Data, or null

#### getConceptNameAndValue

    public java.lang.String getConceptNameAndValue()

Get a string representation of the concept name and the value of the concept.

The exact form of the returned string is specific to the type of ContentItem.

Returns:
  a String representation of the name and value, or an empty string

#### getConceptValue

    public abstract java.lang.String getConceptValue()

Get a string representation of the value of the concept.

The exact form of the returned string is specific to the type of ContentItem.

Returns:
  a String representation of the name and value, or an empty string

#### getConceptName

    public CodedSequenceItem getConceptName()

Get the Concept Name.

Returns:
  the Concept Name

#### getConceptNameCodeMeaning

    public java.lang.String getConceptNameCodeMeaning()

Get the value of the code meaning of the Concept Name as a string, if present and applicable.

Returns:
  the code meaning of the Concept Name, or an empty string

#### getConceptNameCodeValue

    public java.lang.String getConceptNameCodeValue()

Get the value of the code value of the Concept Name as a string, if present and applicable.

Returns:
  the code value of the Concept Name, or an empty string

#### getConceptNameCodingSchemeDesignator

    public java.lang.String getConceptNameCodingSchemeDesignator()

Get the value of the coding scheme designator of the Concept Name as a string, if present and applicable.

Returns:
  the coding scheme designator of the Concept Name, or an empty string

#### getReferencedContentItemIdentifier

    public java.lang.String getReferencedContentItemIdentifier()

Get the Referenced Content Item Identifier, if present.

Returns:
  the period (not backslash) delimited item references, or an empty string

#### getReferencedContentItemIdentifierArray

    public int[] getReferencedContentItemIdentifierArray()

Get the Referenced Content Item Identifier, if present.

Returns:
  an array of integers representing the separated components of the Referenced Content Item Identifier, including the first (root) identifier of 1, or null if none or empty

#### getNamedChild

    public ContentItem getNamedChild(java.lang.String codingSchemeDesignator,
                            java.lang.String codeValue)

Retrieve the named child as defined by its ConceptName

Parameters:
  `codingSchemeDesignator` -
  `codeValue` -
Returns:
  the (first, if multiple) named child, or null if absent

#### getNamedChild

    public ContentItem getNamedChild(CodedSequenceItem item)

Retrieve the named child as defined by its ConceptName The code meaning of the concept is ignored, and only the code value and coding scheme designator are compared in the search.

Parameters:
  `item` -
Returns:
  the (first, if multiple) named child, or null if absent

#### getSingleStringValueOrNull

    public java.lang.String getSingleStringValueOrNull()

Retrieve the string value of self

Returns:
  the value , or null if absent

#### getSingleStringValueOrNullOfNamedChild

    public java.lang.String getSingleStringValueOrNullOfNamedChild(java.lang.String codingSchemeDesignator,
                                                          java.lang.String codeValue)

Retrieve the string value of the named child as defined by its ConceptName

Parameters:
  `codingSchemeDesignator` -
  `codeValue` -
Returns:
  the value of the (first, if multiple) named child, or null if absent

#### getSingleStringValueOrNullOfNamedChild

    public static java.lang.String getSingleStringValueOrNullOfNamedChild(ContentItem parent,
                                                          java.lang.String codingSchemeDesignator,
                                                          java.lang.String codeValue)

Retrieve the string value of the named child as defined by its ConceptName

Parameters:
  `parent` -
  `codingSchemeDesignator` -
  `codeValue` -
Returns:
  the value of the (first, if multiple) named child, or null if absent

#### contentItemNameMatchesCodeValueAndCodingSchemeDesignator

    public abstract boolean contentItemNameMatchesCodeValueAndCodingSchemeDesignator(java.lang.String cvWanted,
                                                                   java.lang.String csdWanted)

Test if the coded concept name of the content item matches the specified code value and coding scheme designator. This is more robust than checking code meaning, which may have synomyms, and there is no need to also test code meaning. Does NOT follow references.

Parameters:
  `csdWanted` -
  `cvWanted` -
Returns:
  true if matches

#### contentItemNameMatchesCodeValueAndCodingSchemeDesignator

    public static boolean contentItemNameMatchesCodeValueAndCodingSchemeDesignator(ContentItem ci,
                                                                   java.lang.String cvWanted,
                                                                   java.lang.String csdWanted)

Test if the coded concept name of the content item matches the specified code value and coding scheme designator. This is more robust than checking code meaning, which may have synomyms, and there is no need to also test code meaning. Does NOT follow references.

Parameters:
  `ci` -
  `csdWanted` -
  `cvWanted` -
Returns:
  true if matches