## org.eclipse.emf.validation.model
Class Category

    java.lang.Object
      org.eclipse.emf.validation.model.Category

All Implemented Interfaces:
  Comparable<Category>

    public class Category

extends Object
implements Comparable<Category>

A constraint category, defining a hierarchical organization of constraints. Categories can be individually and separately (no dependency on the hierarchy) enabled or disabled by the user. Enablement indicates whether the constraints in the category should be applied to the user's models.

Categories are naturally sorted by `name` for display purposes.

This class is intended to be used by clients of the validation framework.

Method Summary
`void` `addConstraint(IConstraintDescriptor constraint)` Adds a constraint to me.
`int` `compareTo(Category other)`
`boolean` `equals(Object other)`
`Category` `getChild(String childId)` Obtains the child category of mine that has the specified `childId`.
`SortedSet<Category>` `getChildren()` Obtains my children.
`Set<IConstraintDescriptor>` `getConstraints()` Obtains my constraints.
`Category` `getDescendent(String descendentPath)` Obtains the descendent category of mine that has the specified `descendentPath` relative to my path.
`String` `getDescription()` Obtains a string which (briefly) describes my purpose to the user.
`String` `getId()` Obtains my ID, which is unique within my parent's ID (or just unique within the global namespace if I have no parent).
`String` `getName()` Obtains my user-presentable name.
`Category` `getParent()` Obtains my parent category, or `null` if I am a top-level category.
`String` `getPath()` Obtains my path, which is my fully-qualified slash-separated ID that is unique within the global namespace.
`String` `getQualifiedName()` Obtains my qualified name, which includes my ancestors' names separated by slashes.
`int` `hashCode()`
`boolean` `isMandatory()` Queries whether I am a mandatory category, which the user may not deselect.
`void` `removeConstraint(IConstraintDescriptor constraint)` Removes a constraint from me.
`void` `setDescription(String description)` Sets my localized description.
`void` `setMandatory(boolean b)` Sets whether I am mandatory.
`void` `setName(String name)` Sets my localized name.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### getId

    public final String getId()

  Obtains my ID, which is unique within my parent's ID (or just unique within the global namespace if I have no parent).

  Returns:
    my ID

### getPath

    public final String getPath()

  Obtains my path, which is my fully-qualified slash-separated ID that is unique within the global namespace.

  Returns:
    my unique path

### getName

    public final String getName()

  Obtains my user-presentable name.

  Returns:
    my name

### getQualifiedName

    public final String getQualifiedName()

  Obtains my qualified name, which includes my ancestors' names separated by slashes.

  Returns:
    my qualified name

### getDescription

    public String getDescription()

  Obtains a string which (briefly) describes my purpose to the user.

  Returns:
    my description

### getConstraints

    public Set<IConstraintDescriptor> getConstraints()

  Obtains my constraints.

  Returns:
    the `IConstraintDescriptor`s that are members of me as an unmodifiable set

### addConstraint

    public void addConstraint(IConstraintDescriptor constraint)

  Adds a constraint to me.

  Parameters:
    `constraint` - my constraint

### removeConstraint

    public void removeConstraint(IConstraintDescriptor constraint)

  Removes a constraint from me.

  Parameters:
    `constraint` - a constraint

### getParent

    public Category getParent()

  Obtains my parent category, or `null` if I am a top-level category.

  Returns:
    my parent, if I have one

### getChildren

    public SortedSet<Category> getChildren()

  Obtains my children.

  Returns:
    an unmodifiable set of the `Category`s that are my children, sorted by `name`. May be an empty set

### getChild

    public Category getChild(String childId)

  Obtains the child category of mine that has the specified `childId`.

  Parameters:
    `childId` - the ID to find
  Returns:
    the matching category, or `null` if not found

### getDescendent

    public Category getDescendent(String descendentPath)

  Obtains the descendent category of mine that has the specified `descendentPath` relative to my path.

  Parameters:
    `descendentPath` - the relative path to find
  Returns:
    the matching category, or `null` if not found
  See Also:
    `getPath()`

### setName

    public final void setName(String name)

  Sets my localized name.

  Parameters:
    `name` - my name (may not be `null`)

### setDescription

    public void setDescription(String description)

  Sets my localized description.

  Parameters:
    `description` - my description

### isMandatory

    public boolean isMandatory()

  Queries whether I am a mandatory category, which the user may not deselect.

  Returns:
    whether I am mandatory

### setMandatory

    public void setMandatory(boolean b)

  Sets whether I am mandatory. If I am mandatory, then I change my state to enabled if it wasn't already.

  Parameters:
    `b` - whether I am mandatory

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object other)

  Overrides:
    `equals` in class `Object`

### compareTo

    public int compareTo(Category other)

  Specified by:
    `compareTo` in interface `Comparable<Category>`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.