org.mars_sim.msp.simulation.malfunction
Class MalfunctionFactory

java.lang.Object
  extended by org.mars_sim.msp.simulation.malfunction.MalfunctionFactory
All Implemented Interfaces:
java.io.Serializable

public final class MalfunctionFactory
extends java.lang.Object
implements java.io.Serializable

This class is a factory for Malfunction objects.

See Also:
Serialized Form

Constructor Summary
MalfunctionFactory(MalfunctionConfig config)
          Constructs a MalfunctionFactory object.
 
Method Summary
static java.util.Collection<Malfunctionable> getAssociatedMalfunctionables(Settlement settlement)
          Gets all malfunctionables associated with a settlement.
 Malfunction getMalfunction(java.util.Collection<java.lang.String> scope)
          Gets a randomly-picked malfunction for a given unit scope.
static java.util.Collection<Malfunctionable> getMalfunctionables(Malfunctionable entity)
          Gets a collection of malfunctionable entities local to the given malfunctionable entity.
static java.util.Collection<Malfunctionable> getMalfunctionables(Person person)
          Gets a collection of malfunctionable entities local to the given person.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MalfunctionFactory

public MalfunctionFactory(MalfunctionConfig config)
                   throws java.lang.Exception
Constructs a MalfunctionFactory object.

Parameters:
config - malfunction configuration DOM document.
Throws:
java.lang.Exception - when malfunction list could not be found.
Method Detail

getMalfunction

public Malfunction getMalfunction(java.util.Collection<java.lang.String> scope)
Gets a randomly-picked malfunction for a given unit scope.

Parameters:
scope - a collection of scope strings defining the unit.
Returns:
a randomly-picked malfunction or null if there are none available.

getMalfunctionables

public static java.util.Collection<Malfunctionable> getMalfunctionables(Person person)
Gets a collection of malfunctionable entities local to the given person.

Returns:
collection iterator

getMalfunctionables

public static java.util.Collection<Malfunctionable> getMalfunctionables(Malfunctionable entity)
Gets a collection of malfunctionable entities local to the given malfunctionable entity.

Returns:
collection iterator

getAssociatedMalfunctionables

public static java.util.Collection<Malfunctionable> getAssociatedMalfunctionables(Settlement settlement)
Gets all malfunctionables associated with a settlement.

Parameters:
settlement - the settlement.
Returns:
collection of malfunctionables.