artisynth.core.modelbase
Class NameRange

java.lang.Object
  extended by maspack.util.RangeBase
      extended by artisynth.core.modelbase.NameRange
All Implemented Interfaces:
java.lang.Cloneable, Clonable, Range, Scannable

public class NameRange
extends RangeBase

Performs checks to see if a name for a ModelComponent is valid. The main criteria are that (a) the name does not contain invalid characters, and (b) the name is unique among the component's siblings in the component hierarchy. Enforcement of the second criteria depends on static settings in ModelComponentBase.


Field Summary
 
Fields inherited from interface maspack.util.Range
IllegalValue
 
Constructor Summary
NameRange()
           
NameRange(ModelComponent comp)
           
NameRange(ModelComponent comp, CompositeComponent parent)
           
 
Method Summary
 boolean isValid(java.lang.Object obj, StringHolder errMsg)
          Returns true if the specified object is valid for this Range, and false otherwise.
 java.lang.String makeValid(java.lang.Object obj)
          Returns the valid name (passes isValid(Object, StringHolder)).
 
Methods inherited from class maspack.util.RangeBase
clone, intersect, isEmpty, isWritable, scan, setError, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameRange

public NameRange()

NameRange

public NameRange(ModelComponent comp)

NameRange

public NameRange(ModelComponent comp,
                 CompositeComponent parent)
Method Detail

makeValid

public java.lang.String makeValid(java.lang.Object obj)
Returns the valid name (passes isValid(Object, StringHolder)).

Specified by:
makeValid in interface Range
Overrides:
makeValid in class RangeBase
Parameters:
obj - object to be projected
Returns:
original obj if within range, or a projected object, or null.

isValid

public boolean isValid(java.lang.Object obj,
                       StringHolder errMsg)
Description copied from class: RangeBase
Returns true if the specified object is valid for this Range, and false otherwise. If the object is not valid, and errMsg is not null, then errMsg.value should be set to a message describing why the object is not valid.

Specified by:
isValid in interface Range
Specified by:
isValid in class RangeBase
Parameters:
obj - Object to be testes
errMsg - Optional handle for storing error message
Returns:
true if the object is valid