# Qualified "To One"-Association

    /**
     * <pre>
     *           +-----+                 1
     * LeftClass | key +------------------- RightClass
     *           +-----+         rightrole
     * </pre>
     */

Attribute
`private FHashMap rightRoles;` or `private FTreeMap rightRoles;`

Access Methods Summary
`public boolean` | `hasInRightRoles (RightClass value)`
`public boolean` | `hasInRightRoles (KeyType key, RightClass value)`
`public boolean` | `hasKeyInRightRoles (KeyType key)`
`public Iterator` | `iteratorOfRightRoles ()`
`public Iterator` | `keysOfRightRoles ()`
`public Iterator` | `entriesOfRightRoles ()`
`public int` | `sizeOfRightRoles ()`
`public RightClass` | `getFromRightRoles (KeyType key)`
`public boolean` | `addToRightRoles (KeyType key, RightClass value)`
`public boolean` | `addToRightRoles (Map.Entry entry)`
`public boolean` | `removeFromRightRoles (RightClass value)`
`public boolean` | `removeFromRightRoles (KeyType key, RightClass value)`
`public boolean` | `removeKeyFromRightRoles (KeyType key)`
`public void` | `removeAllFromRightRoles ()`

Access Methods

    public boolean hasInRightRoles (RightClass value)
    {return ((this.rightRoles != null) &&
            (value != null) &&
            this.rightRoles.containsValue (value));
    }

    public boolean hasInRightRoles (KeyType key, RightClass value)
    {return ((this.rightRoles != null) &&
            (value != null) && (key != null) &&
            (this.rightRoles.get (key) == value));
    }

    public boolean hasKeyInRightRoles (KeyType key)
    {return ((this.rightRoles != null) &&
            (key != null) &&
            this.rightRoles.containsKey (key));
    }

    public Iterator iteratorOfRightRoles ()
    {return ((this.rightRoles == null)
            ? FEmptyIterator.get ()
            : this.rightRoles.values ().iterator ());
    }

    public Iterator keysOfRightRoles ()
    {return ((this.rightRoles == null)
            ? FEmptyIterator.get ()
            : this.rightRoles.keySet ().iterator ());
    }

    public Iterator entriesOfRightRoles ()
    {return ((this.rightRoles == null)
            ? FEmptyIterator.get ()
            : this.rightRoles.entrySet ().iterator ());
    }

    public int sizeOfRightRoles ()
    {return ((this.rightRoles == null)
            ? 0
            : this.rightRoles.size ());
    }

    public RightClass getFromRightRoles (KeyType key)
    {return (((this.rightRoles == null) || (key == null))
            ? null
            : (RightClass) this.rightRoles.get (key));
    }

    public boolean addToRightRoles (KeyType key, RightClass value)
    {boolean changed = false;
    if ((value != null) && (key != null))
    {
       if (this.rightRoles == null)
       {
          this.rightRoles = new FHashSet ($CONSTRUCTORPARAM$); // or FTreeMap
       }
       RightClass oldValue = (RightClass) this.rightRoles.put (key, value);
       if (oldValue != value)
       {
          if (oldValue != null)
          {
             oldValue.<method to remove>;
          }
          value.<method to insert>;
          changed = true;
       }
    }
    return changed;
    }

    public boolean addToRightRoles (Map.Entry entry)
    {return addToRightRoles ((KeyType) entry.getKey (), (RightClass) entry.getValue ());
    }

    public boolean removeFromRightRoles (RightClass value)
    {boolean changed = false;
    if ((this.rightRoles != null) && (value != null))
    {
       Iterator iter = this.entriesOfRightRoles ();
       Map.Entry entry;
       while (iter.hasNext ())
       {
          entry = (Map.Entry) iter.next ();
          if (entry.getValue () == value)
          {
             changed = changed || this.removeFromRightRoles ((KeyType) entry.getKey (), value);
          }
       }
    }
    return changed;
    }

    public boolean removeFromRightRoles (KeyType key, RightClass value)
    {boolean changed = false;
    if ((this.rightRoles != null) && (value != null) && (key != null))
    {
       RightClass oldValue = (RightClass) this.rightRoles.get (key);
       if (oldValue == value)
       {
          this.rightRoles.remove (key);
          value.<method to remove>;
          changed = true;
       }
    }
    return changed;
    }

    public boolean removeKeyFromRightRoles (KeyType key)
    {boolean changed = false;
    if ((this.rightRoles != null) && (key != null))
    {
       RightClass tmpValue = (RightClass) this.rightRoles.get (key);
       if (tmpValue != null)
       {
          this.rightRoles.remove (key);
          tmpValue.<method to remove>;
          changed = true;
       }
    }
    return changed;
    }

    public void removeAllFromRightRoles ()
    {Iterator iter = entriesOfRightRoles ();
    Map.Entry entry;
    while (iter.hasNext ())
    {
       entry = (Map.Entry) iter.next ();
       removeFromRightRoles ((KeyType) entry.getKey (), (RightClass) entry.getValue ());
    }
    }