com.mxgraph.view

## Class mxMultiplicity

- java.lang.Object
- - com.mxgraph.view.mxMultiplicity

-     public class mxMultiplicity
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `attr` Optional string that specifies the attributename to be passed to mxCell.is to check if the rule applies to a cell.
    `protected java.lang.String` | `countError` Holds the localized error message to be displayed if the number of connections for which the rule applies is smaller than min or greater than max.
    `protected java.lang.String` | `max` Defines the maximum number of connections for which this rule applies.
    `protected int` | `min` Defines the minimum number of connections for which this rule applies.
    `protected boolean` | `source` Boolean that specifies if the rule is applied to the source or target terminal of an edge.
    `protected java.lang.String` | `type` Defines the type of the source or target terminal.
    `protected java.lang.String` | `typeError` Holds the localized error message to be displayed if the type of the neighbor for a connection does not match the rule.
    `protected java.util.Collection<java.lang.String>` | `validNeighbors` Holds an array of strings that specify the type of neighbor for which this rule applies.
    `protected boolean` | `validNeighborsAllowed` Boolean indicating if the list of validNeighbors are those that are allowed for this rule or those that are not allowed for this rule.
    `protected java.lang.String` | `value` Optional string that specifies the value of the attribute to be passed to mxCell.is to check if the rule applies to a cell.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxMultiplicity(boolean source, java.lang.String type, java.lang.String attr, java.lang.String value, int min, java.lang.String max, java.util.Collection<java.lang.String> validNeighbors, java.lang.String countError, java.lang.String typeError, boolean validNeighborsAllowed)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `check(mxGraph graph, java.lang.Object edge, java.lang.Object source, java.lang.Object target, int sourceOut, int targetIn)` Function: check Checks the multiplicity for the given arguments and returns the error for the given connection or null if the multiplicity does not apply.
    `boolean` | `checkNeighbors(mxGraph graph, java.lang.Object edge, java.lang.Object source, java.lang.Object target)` Checks the type of the given value.
    `boolean` | `checkTerminal(mxGraph graph, java.lang.Object terminal, java.lang.Object edge)` Checks the type of the given value.
    `boolean` | `checkType(mxGraph graph, java.lang.Object value, java.lang.String type)` Checks the type of the given value.
    `boolean` | `checkType(mxGraph graph, java.lang.Object value, java.lang.String type, java.lang.String attr, java.lang.String attrValue)` Checks the type of the given value.
    `int` | `getMaxValue()` Returns the numeric value of max.
    `boolean` | `isUnlimited()` Returns true if max is "n" (unlimited).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### type

          protected java.lang.String type

      Defines the type of the source or target terminal. The type is a string passed to mxUtils.isNode together with the source or target vertex value as the first argument.

    - #### attr

          protected java.lang.String attr

      Optional string that specifies the attributename to be passed to mxCell.is to check if the rule applies to a cell.

    - #### value

          protected java.lang.String value

      Optional string that specifies the value of the attribute to be passed to mxCell.is to check if the rule applies to a cell.

    - #### source

          protected boolean source

      Boolean that specifies if the rule is applied to the source or target terminal of an edge.

    - #### min

          protected int min

      Defines the minimum number of connections for which this rule applies. Default is 0.

    - #### max

          protected java.lang.String max

      Defines the maximum number of connections for which this rule applies. A value of 'n' means unlimited times. Default is 'n'.

    - #### validNeighbors

          protected java.util.Collection<java.lang.String> validNeighbors

      Holds an array of strings that specify the type of neighbor for which this rule applies. The strings are used in mxCell.is on the opposite terminal to check if the rule applies to the connection.

    - #### validNeighborsAllowed

          protected boolean validNeighborsAllowed

      Boolean indicating if the list of validNeighbors are those that are allowed for this rule or those that are not allowed for this rule.

    - #### countError

          protected java.lang.String countError

      Holds the localized error message to be displayed if the number of connections for which the rule applies is smaller than min or greater than max.

    - #### typeError

          protected java.lang.String typeError

      Holds the localized error message to be displayed if the type of the neighbor for a connection does not match the rule.

  - ### Constructor Detail

    - #### mxMultiplicity

          public mxMultiplicity(boolean source,
                        java.lang.String type,
                        java.lang.String attr,
                        java.lang.String value,
                        int min,
                        java.lang.String max,
                        java.util.Collection<java.lang.String> validNeighbors,
                        java.lang.String countError,
                        java.lang.String typeError,
                        boolean validNeighborsAllowed)

  - ### Method Detail

    - #### check

          public java.lang.String check(mxGraph graph,
                               java.lang.Object edge,
                               java.lang.Object source,
                               java.lang.Object target,
                               int sourceOut,
                               int targetIn)

      Function: check Checks the multiplicity for the given arguments and returns the error for the given connection or null if the multiplicity does not apply. Parameters: graph - Reference to the enclosing graph instance. edge - Cell that represents the edge to validate. source - Cell that represents the source terminal. target - Cell that represents the target terminal. sourceOut - Number of outgoing edges from the source terminal. targetIn - Number of incoming edges for the target terminal.

    - #### checkNeighbors

          public boolean checkNeighbors(mxGraph graph,
                               java.lang.Object edge,
                               java.lang.Object source,
                               java.lang.Object target)

      Checks the type of the given value.

    - #### checkTerminal

          public boolean checkTerminal(mxGraph graph,
                              java.lang.Object terminal,
                              java.lang.Object edge)

      Checks the type of the given value.

    - #### checkType

          public boolean checkType(mxGraph graph,
                          java.lang.Object value,
                          java.lang.String type)

      Checks the type of the given value.

    - #### checkType

          public boolean checkType(mxGraph graph,
                          java.lang.Object value,
                          java.lang.String type,
                          java.lang.String attr,
                          java.lang.String attrValue)

      Checks the type of the given value.

    - #### isUnlimited

          public boolean isUnlimited()

      Returns true if max is "n" (unlimited).

    - #### getMaxValue

          public int getMaxValue()

      Returns the numeric value of max.

Copyright (c) 2010 Gaudenz Alder. All rights reserved.