Package moss

Class FreeTypeMgr

java.lang.Object
moss.TypeMgr
moss.FreeTypeMgr
All Implemented Interfaces:
Serializable

public class FreeTypeMgr extends TypeMgr
Class for a node or edge type map.
Since:
2007.06.20
See Also:
  • Constructor Details

    • FreeTypeMgr

      public FreeTypeMgr()
      Create a type map.
      Since:
      2007.06.20 (Christian Borgelt)
  • Method Details

    • isFixed

      public boolean isFixed()
      Check whether a type manager is fixed (is not extendable).
      Specified by:
      isFixed in class TypeMgr
      Returns:
      false, because new types can be added
      Since:
      2009.08.13 (Christian Borgelt)
    • getTypeCount

      public int getTypeCount()
      Get the number of managed types.
      Specified by:
      getTypeCount in class TypeMgr
      Returns:
      the number of types in this type manager
      Since:
      2020.10.16 (Christian Borgelt)
    • clear

      public void clear()
      Clear the type map (remove all types).
      Since:
      2007.06.20 (Christian Borgelt)
    • size

      public int size()
      Get the current number of types.
      Returns:
      the current number of types
      Since:
      2007.06.20 (Christian Borgelt)
    • add

      public int add(String name)
      Add a type to the type map.

      If the name is already present, no new mapping is added, but the code already associated with the name is returned, thus automatically avoiding duplicate entries.

      Specified by:
      add in class TypeMgr
      Parameters:
      name - the name of the type
      Returns:
      the code of the type
      Since:
      2007.06.20 (Christian Borgelt)
      See Also:
    • getCode

      public int getCode(String name)
      Map a type name to the corresponding type code.
      Specified by:
      getCode in class TypeMgr
      Parameters:
      name - the name of the type
      Returns:
      the code of the type or -1 if the name does not exist in the type map
      Since:
      2007.06.20 (Christian Borgelt)
    • getName

      public String getName(int code)
      Map a type code to the corresponding type name.
      Specified by:
      getName in class TypeMgr
      Parameters:
      code - the code of the type
      Returns:
      the name of the type
      Since:
      2007.06.20 (Christian Borgelt)