| 1 |
/* Coded Value Interface */ |
| 2 |
|
| 3 |
package DICOM.SR; |
| 4 |
|
| 5 |
import java.util.Vector; |
| 6 |
import DICOM.DICOMWrapper; |
| 7 |
|
| 8 |
public class ContentItem{ |
| 9 |
|
| 10 |
private String ValueType; |
| 11 |
private String RelationshipType; |
| 12 |
private boolean fIsLeaf; |
| 13 |
private int NestLevel; |
| 14 |
private Vector ContentItemVector; |
| 15 |
//private long fDCMObject; |
| 16 |
private DICOM.DICOMWrapper mDICOMWrapper; |
| 17 |
|
| 18 |
public ContentItem(String valueType, String relationshipType) { |
| 19 |
ValueType = new String(valueType); |
| 20 |
RelationshipType = new String(relationshipType); |
| 21 |
fIsLeaf = true; |
| 22 |
NestLevel = 1; |
| 23 |
//fDCMObject = 0; |
| 24 |
} |
| 25 |
|
| 26 |
public String getValueType() { |
| 27 |
return ValueType; |
| 28 |
} |
| 29 |
public String getRelationshipType() { |
| 30 |
return RelationshipType; |
| 31 |
} |
| 32 |
public boolean isLeaf() { |
| 33 |
return fIsLeaf; |
| 34 |
} |
| 35 |
public int nestLevel( ) { |
| 36 |
return NestLevel; |
| 37 |
} |
| 38 |
public Vector contentItemVector( ) { |
| 39 |
return ContentItemVector; |
| 40 |
} |
| 41 |
public String getString(int tag) { |
| 42 |
return mDICOMWrapper.getString(tag); |
| 43 |
} |
| 44 |
public String getString(int seqTag, int tag, int item) { |
| 45 |
return mDICOMWrapper.getString(seqTag, tag, item); |
| 46 |
} |
| 47 |
public DICOM.DICOMWrapper wrapper() { |
| 48 |
return mDICOMWrapper; |
| 49 |
} |
| 50 |
|
| 51 |
public void valueType(String s) { |
| 52 |
ValueType = new String(s); |
| 53 |
} |
| 54 |
public void relationshipType(String s) { |
| 55 |
RelationshipType = new String(s); |
| 56 |
} |
| 57 |
public void addVectorItem(ContentItem item, int index) { |
| 58 |
if (fIsLeaf) { |
| 59 |
fIsLeaf = false; |
| 60 |
ContentItemVector = new Vector(1, 1); |
| 61 |
mDICOMWrapper.addSequence(0x0040a730); |
| 62 |
} |
| 63 |
ContentItemVector.insertElementAt(item, index); |
| 64 |
mDICOMWrapper.addToSequence(0x0040a730, index, item.wrapper()); |
| 65 |
} |
| 66 |
public void addVectorItem(ContentItem item) { |
| 67 |
if (fIsLeaf) { |
| 68 |
fIsLeaf = false; |
| 69 |
ContentItemVector = new Vector(1, 1); |
| 70 |
mDICOMWrapper.addSequence(0x0040a730); |
| 71 |
} |
| 72 |
ContentItemVector.addElement(item); |
| 73 |
mDICOMWrapper.addToSequence(0x0040a730, 0, item.wrapper()); |
| 74 |
} |
| 75 |
public void nestLevel(int i) { |
| 76 |
NestLevel = i; |
| 77 |
} |
| 78 |
public void objectReference(long objRef) { |
| 79 |
//fDCMObject = objRef; |
| 80 |
mDICOMWrapper = new DICOM.DICOMWrapper(objRef); |
| 81 |
} |
| 82 |
public void setWrapper(DICOM.DICOMWrapper w) { |
| 83 |
//fDCMObject = objRef; |
| 84 |
mDICOMWrapper = w; |
| 85 |
} |
| 86 |
|
| 87 |
public void dumpState() { |
| 88 |
int i; |
| 89 |
for (i = 0; i < NestLevel; i++) |
| 90 |
System.out.print(" "); |
| 91 |
|
| 92 |
System.out.println(NestLevel + " : " + ValueType + " : " + RelationshipType); |
| 93 |
if (!fIsLeaf) { |
| 94 |
int count = ContentItemVector.size(); |
| 95 |
for (i = 0; i < count; i++) { |
| 96 |
ContentItem item = (ContentItem)ContentItemVector.elementAt(i); |
| 97 |
item.dumpState(); |
| 98 |
} |
| 99 |
} |
| 100 |
} |
| 101 |
} |