public void substituteValues(Node a)
	 {
		if( a.child.size() == 0 )
		{
			if(a.isConstant())		//you dont need to put values in constants
				return;
			for(int i = 0; i<leafNodes.size(); i++)
			{
				if( leafNodes.get(i).equals(a.data) )
				{
					a.data = matches.get(i).data;
					a.child = matches.get(i).child;	//TODO:make sure this works
				}
			}
		}
		else
		{
			boolean found;
			for(int i =0; i< a.child.size(); i++)
			{
				found = false;
				for(int j = 0; j< leafNodes.size(); j++)
				{
					if( a.child.get(i).data.equals( leafNodes.get(j) ))
					{
						a.child.set(i, matches.get(j));
						found = true;
					}
				}
				if(!found)
				{
					substituteValues(a.child.get(i));
				}
			}
		}
	 }