if ( callIDs.length == 0 ) throw new IllegalArgumentException("Must be at least 1 callID"); if ( callIDs.length != callFractions.length ) throw new IllegalArgumentException("Length of callIDs and callFractions arrays should be the same");    ArrayList rootIDs = new ArrayList(); for ( int i = 0; i < callIDs.length; ++i ) { CallID id = callIDs[i];   if ( id != null && id.getParentRCCKey() == -1 ) { rootIDs.add(id); } }  if ( rootIDs.size() != 1 ) { throw new IllegalArgumentException("Must be exactly 1 root callID"); }  rootCallID = (CallID)rootIDs.get(0); this.callIDs = callIDs; this.callFractions = callFractions;  rootCall = new CallImpl(rootCallID);  int numRCCs = this.callIDs.length; parentRCCKeys = new int[numRCCs]; childRCCKeys = new IntStack[numRCCs];  for ( int i = 0; i < this.callIDs.length; ++i ) { CallID id = this.callIDs[i];  if ( id != null ) { int key = id.getKey(); int parentKey = id.getParentRCCKey(); parentRCCKeys[id.getKey()] = parentKey; if ( parentKey != -1 ) { if ( childRCCKeys[parentKey] == null ) childRCCKeys[parentKey] = new IntStack(); childRCCKeys[parentKey].push(key); } } }  for ( int i = 0; i < childRCCKeys.length; ++i ) { if ( childRCCKeys[i] != null ) childRCCKeys[i].trimToSize(); }
this((CallID[])callIDs.toArray(new CallID[0]), callFractions);
	public CallGraph(CallID[] callIDs, double[] callFractions)	{		if ( callIDs.length == 0 )			throw new IllegalArgumentException("Must be at least 1 callID");		if ( callIDs.length != callFractions.length )			throw new IllegalArgumentException("Length of callIDs and callFractions arrays should be the same");		// Compute the total time spent by all the top-level functions		// Look for a unique top-level callID		ArrayList rootIDs = new ArrayList();		for ( int i = 0; i < callIDs.length; ++i )		{			CallID id = callIDs[i];			//System.out.println("index: " + i);			//if (id != null) System.out.println("Parent: " + String.valueOf(id.getParentRCCKey()));			if ( id != null && id.getParentRCCKey() == -1 )			{				rootIDs.add(id);			}		}		if ( rootIDs.size() != 1 )		{			throw new IllegalArgumentException("Must be exactly 1 root callID");		}				rootCallID = (CallID)rootIDs.get(0);		this.callIDs = callIDs;		this.callFractions = callFractions;		rootCall = new CallImpl(rootCallID);				int numRCCs = this.callIDs.length;		parentRCCKeys = new int[numRCCs];		childRCCKeys = new IntStack[numRCCs];				for ( int i = 0; i < this.callIDs.length; ++i )		{			CallID id = this.callIDs[i];			// Gaps in the callIDs array are filled in later by proxy calls			if ( id != null )			{				int key = id.getKey();				int parentKey = id.getParentRCCKey();				parentRCCKeys[id.getKey()] = parentKey;				if ( parentKey != -1 )				{					if ( childRCCKeys[parentKey] == null )						childRCCKeys[parentKey] = new IntStack();					childRCCKeys[parentKey].push(key);				}			}		}				for ( int i = 0; i < childRCCKeys.length; ++i )		{			if ( childRCCKeys[i] != null )				childRCCKeys[i].trimToSize();		}	}