public static Collection<PrefixPropertySet> prefixPropertySets(Set<Property> properties, Path prefix)
{
Collection<PrefixPropertySet> result = new ArrayList<PrefixPropertySet>();
Property[] array = (Property[]) properties.toArray(new Property[properties.size()]);
Part part = null;
int start = 0;
for (int i = 0; i < array.length; i++)
{
Part firstPartAfterPrefix = array[i].getPath().firstPartAfterPrefix(prefix);
if (part != null && !firstPartAfterPrefix.equals(part))
{
// if the first part has changed then add a new set
PrefixPropertySet ppf = createPrefixSubset(prefix, array, part, start, i);
result.add(ppf);
start = i;