# Qualified "To Many"-Association

    /**
     * <pre>
     *           +-----+                 n
     * LeftClass | key +------------------- RightClass
     *           +-----+        rightRoles
     * </pre>
     */

Attribute
`private FDuplicatedHashMap rightRoles;` or `private FDuplicatedTreeMap 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` | `iteratorOfRightRoles (KeyType key)`
`public Iterator` | `keysOfRightRoles ()`
`public Iterator` | `entriesOfRightRoles ()`
`public int` | `sizeOfRightRoles ()`
`public int` | `sizeOfRightRoles (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.containsEntry (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 iteratorOfRightRoles (KeyType key)
    {return ((this.rightRoles == null)
            ? FEmptyIterator.get ()
            : FCollections.iterator (this.rightRoles.values (key)));
    }

    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 int sizeOfRightRoles (KeyType key)
    {return ((this.rightRoles == null)
            ? 0
            : this.rightRoles.size (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 FDuplicatedTreeMap
       }
       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))
    {
       Collection tmpCol = (Collection) this.rightRoles.remove (key);
       if (tmpCol != null)
       {
          RightClass tmpValue;
          Iterator iter = tmpCol.iterator ();
          while (iter.hasNext ())
          {
             tmpValue = (RightClass) iter.next ();
             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 ());
    }
    }