1   package com.stateofflow.eclipse.metrics.builder.list;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import org.eclipse.jdt.core.ICompilationUnit;
7   import org.eclipse.jdt.core.JavaModelException;
8   
9   public final class CompilationUnitList {
10  
11      private final List<ICompilationUnit> compilationUnits = new ArrayList<ICompilationUnit>();
12  
13      public void addCompilationUnit(final ICompilationUnit compilationUnit) throws JavaModelException {
14          if (compilationUnit.isStructureKnown() && compilationUnit.isConsistent()) {
15              compilationUnits.add(compilationUnit);
16          }
17      }
18  
19      public ICompilationUnit get(final int index) {
20          return compilationUnits.get(index);
21      }
22  
23      public int size() {
24          return compilationUnits.size();
25      }
26  }
27