package gov.nih.nci.ncicb.cadsr.loader.util;

import java.util.List;
import java.util.ArrayList;

import gov.nih.nci.ncicb.cadsr.domain.DataElement;

public class InheritedAttributeList 
{

  private static InheritedAttributeList instance = new InheritedAttributeList();

  private List<DataElement> list = new ArrayList<DataElement>();

  private InheritedAttributeList() 
  {

  }

  public static InheritedAttributeList getInstance() 
  {
    return instance;
  }

  public void add(DataElement de) 
  {  
    list.add(de);
  }
  
  public boolean isInherited(DataElement de) 
  {
    return list.contains(de);
  }

}

@@ -89,16 +89,64 @@
 rayList;
+%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0Aimport
@@ -323,20 +323,19 @@
 private 
-List
+Map
 %3CDataEle
@@ -342,31 +342,54 @@
 ment
-%3E list = new ArrayList%3C
+, DataElement%3E map = new HashMap%3CDataElement, 
 Data
@@ -440,16 +440,9 @@
 t() 
-%0A  %7B%0A%0A  
+%7B
 %7D%0A%0A 
@@ -560,31 +560,62 @@
 t de
-) %0A  %7B  %0A    list.add(d
+, DataElement parentDe) %0A  %7B  %0A    map.put(de, parentD
 e);%0A
@@ -686,12 +686,11 @@
 urn 
-list
+map
 .con
@@ -694,16 +694,19 @@
 contains
+Key
 (de);%0A  
@@ -708,10 +708,90 @@
 );%0A  %7D%0A%0A
+  public DataElement getParent(DataElement de) %7B%0A    return map.get(de);%0A  %7D%0A  %0A
 %7D%0A

store what we inherit from