com.kuka.nav.fleet.graph.properties
Class DefaultPropertyHolder

java.lang.Object
  extended by com.kuka.nav.fleet.graph.properties.DefaultPropertyHolder
All Implemented Interfaces:
PropertyHolder, Serializable, Cloneable

public class DefaultPropertyHolder
extends Object
implements PropertyHolder, Cloneable

Abstract base class for all property holders.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.kuka.nav.fleet.graph.properties.PropertyHolder
ROBOTTYPEALL
 
Constructor Summary
DefaultPropertyHolder()
          Constructs a new, empty property holder.
 
Method Summary
 PropertyHolder add(Integer robotTypeId, Property property)
          Adds the given property to this property holder.
 PropertyHolder add(Property property)
          Adds the given property to this property holder.
 PropertyHolder addAll(Collection<com.kuka.util.Pair<Integer,Property>> entries)
          Adds a number of property entries to this property holder.
 void addPropertyHolderListener(PropertyHolderListener listener)
          Adds the given listener.
 Object clone()
          Clones the property holder (method is protected in Object)
<T extends Property>
boolean
containsAny(Class<T> propertyType)
          Checks if for any robot type the given property type exists.
 Collection<com.kuka.util.Pair<Integer,Property>> entries()
           
 boolean equals(Object o)
           
 void firePropertyHolderChanged()
          Notifies all contained listeners that this property holder has changed.
<T extends Property>
T
get(Class<T> propertyType)
          Returns the value of the property with the specified type or null if it does not exist.
<T extends Property>
T
get(Integer robotTypeId, Class<T> propertyType)
          If the property of the specified type is associated to the given robot type or all robot types, the value of this property is returned.
 Collection<Property> getAll()
           
 Collection<Property> getAll(Integer robotTypeId)
           
 Integer getCorrespondingRobotType(Property property)
          Returns the corresponding robot type id.
<T extends Property>
T
getSpecific(Integer robotTypeId, Class<T> propertyType)
          If the property of the specified type is associated to the given robot type, the value of this property is returned.
<T extends Property>
T
getSuperProperty(Integer robotTypeId, Class<T> superPropertyType)
          Checks whether the property holder has a property for the given robot type that is a subclass of the given super property type.
 int hashCode()
           
 PropertyHolder remove(Class<? extends Property> propertyType)
          Removes the property from this property holder.
 PropertyHolder remove(Integer robotTypeId, Class<? extends Property> propertyType)
          Removes the property associated with the given robot type from this property holder.
 PropertyHolder removeAny(Class<? extends Property> propertyType)
          Removes the properties associated with any robot type from this property holder and returns it.
 void removePropertyHolderListener(PropertyHolderListener listener)
          Removes the given listener.
 String toString()
           
 Collection<Property> values()
           
<T extends Property>
Collection<T>
values(Class<T> propertyType)
          Returns a collection of all properties of the given type.
 Collection<Property> values(Integer robotTypeId)
          Returns a collection of all properties for the given robot type.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultPropertyHolder

public DefaultPropertyHolder()
Constructs a new, empty property holder.

Method Detail

add

public PropertyHolder add(Property property)
Description copied from interface: PropertyHolder
Adds the given property to this property holder. If the holder previously contained the given property, the old property value is replaced. The property is not associated with any robot type.

Specified by:
add in interface PropertyHolder
Parameters:
property - The property to add.
Returns:
this property holder

add

public PropertyHolder add(Integer robotTypeId,
                          Property property)
Description copied from interface: PropertyHolder
Adds the given property to this property holder. If the holder previously contained the given property, the old property value is replaced. The property is associated with the given robot type.

Specified by:
add in interface PropertyHolder
Parameters:
robotTypeId - the robot type identifier
property - the property to add
Returns:
this property holder

addAll

public PropertyHolder addAll(Collection<com.kuka.util.Pair<Integer,Property>> entries)
Description copied from interface: PropertyHolder
Adds a number of property entries to this property holder.

Specified by:
addAll in interface PropertyHolder
Parameters:
entries - a collection of entries of property and associated robot type id
Returns:
this property holder

remove

public PropertyHolder remove(Class<? extends Property> propertyType)
Description copied from interface: PropertyHolder
Removes the property from this property holder. Then returns this property holder.

Specified by:
remove in interface PropertyHolder
Parameters:
propertyType - The property type to remove.
Returns:
this property holder

remove

public PropertyHolder remove(Integer robotTypeId,
                             Class<? extends Property> propertyType)
Description copied from interface: PropertyHolder
Removes the property associated with the given robot type from this property holder. Then returns this property holder.

Specified by:
remove in interface PropertyHolder
Parameters:
robotTypeId - the robot
propertyType - The property type to remove.
Returns:
this property holder

removeAny

public PropertyHolder removeAny(Class<? extends Property> propertyType)
Description copied from interface: PropertyHolder
Removes the properties associated with any robot type from this property holder and returns it.

Specified by:
removeAny in interface PropertyHolder
Parameters:
propertyType - The property type to remove.
Returns:
this property holder

get

public <T extends Property> T get(Class<T> propertyType)
Description copied from interface: PropertyHolder
Returns the value of the property with the specified type or null if it does not exist.

Specified by:
get in interface PropertyHolder
Type Parameters:
T - the type of the property
Parameters:
propertyType - The type of the property.
Returns:
The value of the property.

get

public <T extends Property> T get(Integer robotTypeId,
                                  Class<T> propertyType)
Description copied from interface: PropertyHolder
If the property of the specified type is associated to the given robot type or all robot types, the value of this property is returned. Otherwise, null is returned.

Specified by:
get in interface PropertyHolder
Type Parameters:
T - the type of the property
Parameters:
robotTypeId - the robot type id
propertyType - The type of the property.
Returns:
The value of the property.

getSpecific

public <T extends Property> T getSpecific(Integer robotTypeId,
                                          Class<T> propertyType)
Description copied from interface: PropertyHolder
If the property of the specified type is associated to the given robot type, the value of this property is returned. Otherwise, null is returned.

Specified by:
getSpecific in interface PropertyHolder
Type Parameters:
T - the type of the property
Parameters:
robotTypeId - the robot type id
propertyType - The type of the property.
Returns:
The value of the property.

getAll

public Collection<Property> getAll()
Specified by:
getAll in interface PropertyHolder
Returns:
A collection of all properties not associated to a specific robot type.

getAll

public Collection<Property> getAll(Integer robotTypeId)
Specified by:
getAll in interface PropertyHolder
Parameters:
robotTypeId - a robot type id
Returns:
A collection of all properties associated to the given robot type.

getSuperProperty

public <T extends Property> T getSuperProperty(Integer robotTypeId,
                                               Class<T> superPropertyType)
Description copied from interface: PropertyHolder
Checks whether the property holder has a property for the given robot type that is a subclass of the given super property type. The first such property is cast to the given super property class and returned. If no such property exists, null is returned.

Specified by:
getSuperProperty in interface PropertyHolder
Type Parameters:
T - the type of the super property.
Parameters:
robotTypeId - the robot type id.
superPropertyType - the super property.
Returns:
the property.

values

public Collection<Property> values()
Specified by:
values in interface PropertyHolder
Returns:
A collection of all properties.

values

public <T extends Property> Collection<T> values(Class<T> propertyType)
Description copied from interface: PropertyHolder
Returns a collection of all properties of the given type.

Specified by:
values in interface PropertyHolder
Type Parameters:
T - the type of the property
Parameters:
propertyType - the property type
Returns:
a collection of all properties of the given type

values

public Collection<Property> values(Integer robotTypeId)
Description copied from interface: PropertyHolder
Returns a collection of all properties for the given robot type.

Specified by:
values in interface PropertyHolder
Parameters:
robotTypeId - a robot type id
Returns:
a collection of all properties for the given robot type

entries

public Collection<com.kuka.util.Pair<Integer,Property>> entries()
Specified by:
entries in interface PropertyHolder
Returns:
A collection with robot types for which properties are defined.

getCorrespondingRobotType

public Integer getCorrespondingRobotType(Property property)
Description copied from interface: PropertyHolder
Returns the corresponding robot type id. Compares the properties by reference.

Specified by:
getCorrespondingRobotType in interface PropertyHolder
Parameters:
property - the property
Returns:
the robot type id

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

containsAny

public <T extends Property> boolean containsAny(Class<T> propertyType)
Description copied from interface: PropertyHolder
Checks if for any robot type the given property type exists.

Specified by:
containsAny in interface PropertyHolder
Type Parameters:
T - the type of the property
Parameters:
propertyType - the property type
Returns:
true if for any robot type the given property type exists, false otherwise

addPropertyHolderListener

public void addPropertyHolderListener(PropertyHolderListener listener)
Description copied from interface: PropertyHolder
Adds the given listener.

Specified by:
addPropertyHolderListener in interface PropertyHolder
Parameters:
listener - the listener to add

removePropertyHolderListener

public void removePropertyHolderListener(PropertyHolderListener listener)
Description copied from interface: PropertyHolder
Removes the given listener.

Specified by:
removePropertyHolderListener in interface PropertyHolder
Parameters:
listener - the listener to remove

firePropertyHolderChanged

public void firePropertyHolderChanged()
Description copied from interface: PropertyHolder
Notifies all contained listeners that this property holder has changed.

Specified by:
firePropertyHolderChanged in interface PropertyHolder

clone

public Object clone()
Description copied from interface: PropertyHolder
Clones the property holder (method is protected in Object)

Specified by:
clone in interface PropertyHolder
Overrides:
clone in class Object
Returns:
clone of property holder


Copyright © 2019. All rights reserved.