lojix/power_model/src/main/com/thesett/aima/attribute/impl/HierarchyAttribute.java
public boolean isSubCategory(HierarchyAttribute comp)
    {
        // Check that the comparator is of the same type class as this one.
        if (!comp.attributeClass.attributeClassName.equals(attributeClass.attributeClassName))
        {
            return false;
        }

        // Extract the path labels from this and the comparator.
        List<String> otherPath = comp.getPathValue();
        List<String> path = getPathValue();

        // Check that the path length of the comparator is the same as this plus one or longer.
        if (otherPath.size() <= path.size())
        {
            return false;
        }

        // Start by assuming that the paths prefixes are the same, then walk down both paths checking they are
        // the same.
        boolean subcat = true;

        for (int i = 0; i < path.size(); i++)
        {
            // Check that the labels really are equal.
            if (!otherPath.get(i).equals(path.get(i)))
            {
                subcat = false;

                break;
            }
        }

        return subcat;
    }
public boolean isSubCategory(HierarchyAttribute comp)
    {
        // Check that the comparator is of the same type class as this one.
        if (!comp.attributeClass.attributeClassName.equals(attributeClass.attributeClassName))
        {
            return false;
        }

        // Extract the path labels from this and the comparator.
        List<String> otherPath = comp.getPathValue();
        List<String> path = getPathValue();

        // Check that the path length of the comparator is the same as this plus one or longer.
        if (otherPath.size() <= path.size())
        {
            return false;
        }

        // Start by assuming that the paths prefixes are the same, then walk down both paths checking they are
        // the same.
        boolean subcat = true;

        for (int i = 0; i < path.size(); i++)
        {
            // Check that the labels really are equal.
            if (!otherPath.get(i).equals(path.get(i)))
            {
                subcat = false;

                break;
            }
        }

        return subcat;
    }
Tests if another hierarchy attribute is strict a sub-category of this one. It is a sub-category if it has the
same sequence of path labels as this one as a prefix of its whole path label.

@param  comp The hierarchy attribute to compare to.

@return True if the comparator is of the same type and is a sub-category of this one.