netkit.classifiers.aggregators
Class AggregatorFactory

java.lang.Object
  extended by netkit.util.Factory<Aggregator>
      extended by netkit.classifiers.aggregators.AggregatorFactory

public final class AggregatorFactory
extends Factory<Aggregator>

This Factory class is a singleton class which creates Aggregators. It relies on the aggregator.properties file and on reflection to do this job. It is final and provides the logic based on whether an aggregator is by value or general. Any new aggregators should subclass AggregatorImp or AggregatorByValueImp and should then be added to the aggretator.properties file.

Author:
Sofus A. Macskassy (sofmac@gmail.com)
See Also:
AggregatorByValueImp, AggregatorImp, Factory

Method Summary
 boolean canAggregate(java.lang.String name, Attribute attrib)
          Checks if the fully specified classname is an aggregator that can aggregate a given attribute.
 Aggregator get(java.lang.String name)
          Get an instance of the fully named aggregator.
 Aggregator get(java.lang.String name, Configuration defaultConf)
          Get an instance of the fully named aggregator using a given Configuration map.
 Aggregator get(java.lang.String name, EdgeType[] edgeTypes, Attribute attribute)
          This is not yet supported.
 Aggregator get(java.lang.String name, EdgeType[] edgeTypes, Attribute attribute, Configuration defaultConf)
          This is not yet supported.
 Aggregator get(java.lang.String name, EdgeType[] edgeTypes, Attribute attribute, double value)
          This is not yet supported.
 Aggregator get(java.lang.String name, EdgeType[] edgeTypes, Attribute attribute, double value, Configuration defaultConf)
          This is not yet supported.
 Aggregator get(java.lang.String name, EdgeType edgeType, Attribute attribute)
          Get an instance of the named general attribute aggregator for the given relation and attribute.
 Aggregator get(java.lang.String name, EdgeType edgeType, Attribute attribute, Configuration defaultConf)
          Get an instance of the named general attribute aggregator for the given relation and attribute.
 Aggregator get(java.lang.String name, EdgeType edgeType, Attribute attribute, double value)
          Get an instance of the named attribute aggregator-by-value for the given relation, attribute and value.
 Aggregator get(java.lang.String name, EdgeType edgeType, Attribute attribute, double value, Configuration defaultConf)
          Get an instance of the named attribute aggregator-by-value for the given relation, attribute and value.
static AggregatorFactory getInstance()
          Getter method to get the singleton AggregatorFactory class.
 boolean isByValue(java.lang.String name)
          Checks to see if the aggregator by the given name is an instance of AggregatorByValue
 
Methods inherited from class netkit.util.Factory
getClassName, getConfig, getValidNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AggregatorFactory getInstance()
Getter method to get the singleton AggregatorFactory class.

Returns:
the singleton AggregatorFactory class.

isByValue

public boolean isByValue(java.lang.String name)
Checks to see if the aggregator by the given name is an instance of AggregatorByValue

Parameters:
name - Name of the aggregator whose value to check. This is a fully specified class name.
Returns:
true if the fully named class implements the AggregatorByValue interface
See Also:
AggregatorByValue

canAggregate

public boolean canAggregate(java.lang.String name,
                            Attribute attrib)
Checks if the fully specified classname is an aggregator that can aggregate a given attribute. For example, a numeric aggregator such as 'Max value' cannot aggregate on categorical attributes that take on values such as 'blue' and 'red'.

Parameters:
name - The fully specified class name of an aggregator whose capabilities are being checked
attrib - The attribute that we want to aggregate with the named aggregator
Returns:
true if the named aggregator can aggregate the given attribute

get

public Aggregator get(java.lang.String name)
Get an instance of the fully named aggregator. This method is needed to adhere to the Factory API. However, it makes no sense for this factory and always thorws an IllegalArgumentException.

Overrides:
get in class Factory<Aggregator>
Parameters:
name - The fully specificed name of an aggregator.
Returns:
nothing. This always throws an exception.
Throws:
java.lang.IllegalArgumentException - Is always thrown

get

public Aggregator get(java.lang.String name,
                      Configuration defaultConf)
Get an instance of the fully named aggregator using a given Configuration map. This method is needed to adhere to the Factory API. However, it makes no sense for this factory and always thorws an IllegalArgumentException.

Overrides:
get in class Factory<Aggregator>
Parameters:
name - The fully specificed name of an aggregator.
defaultConf - A default configuration to use
Returns:
nothing. This always throws an exception.
Throws:
java.lang.IllegalArgumentException - Is always thrown

get

public Aggregator get(java.lang.String name,
                      EdgeType edgeType,
                      Attribute attribute)
Get an instance of the named general attribute aggregator for the given relation and attribute. Note that this does not verify if the aggregator can in fact aggregate this attribute and will throw an exception if this there are any such problems. Please use the 'canAggregate' method to check before callings this method.

Parameters:
name - The fully specified name of an aggregator
edgeType - The name of a relationship used to find neighbors
attribute - The attribute to aggregate on
Returns:
A new instance of the named aggregator
Throws:
java.lang.RuntimeException - If the named aggregator is not found in the aggregator.properties file or if there are any trouble instantiating the aggregator (such as the fact that it cannot aggregate the given attribute)
See Also:
Aggregator, canAggregate(String, netkit.graph.Attribute)

get

public Aggregator get(java.lang.String name,
                      EdgeType edgeType,
                      Attribute attribute,
                      Configuration defaultConf)
Get an instance of the named general attribute aggregator for the given relation and attribute. Note that this does not verify if the aggregator can in fact aggregate this attribute and will throw an exception if this there are any such problems. Please use the 'canAggregate' method to check before callings this method.

Parameters:
name - The fully specified name of an aggregator
edgeType - The name of a relationship used to find neighbors
attribute - The attribute to aggregate on
defaultConf - The default configuration to fall back on in case nothing appropriate is found in the 'aggregator.properties' file.
Returns:
A new instance of the named aggregator
Throws:
java.lang.RuntimeException - If the named aggregator is not found in the aggregator.properties file or if there are any trouble instantiating the aggregator (such as the fact that it cannot aggregate the given attribute)
See Also:
Aggregator, canAggregate(String, netkit.graph.Attribute)

get

public Aggregator get(java.lang.String name,
                      EdgeType edgeType,
                      Attribute attribute,
                      double value)
Get an instance of the named attribute aggregator-by-value for the given relation, attribute and value. Note that this does not verify if the aggregator can in fact aggregate this attribute and will throw an exception if this there are any such problems. Please use the 'canAggregate' method to check before callings this method.

Parameters:
name - The fully specified name of an aggregator (which should be of type AggregatorByValue)
edgeType - The name of a relationship used to find neighbors
attribute - The attribute to aggregate on
value - The double value representing the value of the attribute to aggregate on (e.g., 'aquavit')
Returns:
A new instance of the named aggregator
Throws:
java.lang.RuntimeException - If the named aggregator is not found in the aggregator.properties file or if there are any trouble instantiating the aggregator (such as the fact that it cannot aggregate the given attribute)
See Also:
AggregatorByValue, canAggregate(String, netkit.graph.Attribute)

get

public Aggregator get(java.lang.String name,
                      EdgeType edgeType,
                      Attribute attribute,
                      double value,
                      Configuration defaultConf)
Get an instance of the named attribute aggregator-by-value for the given relation, attribute and value. Note that this does not verify if the aggregator can in fact aggregate this attribute and will throw an exception if this there are any such problems. Please use the 'canAggregate' method to check before callings this method.

Parameters:
name - The fully specified name of an aggregator (which should be of type AggregatorByValue)
edgeType - The name of a relationship used to find neighbors
attribute - The attribute to aggregate on
value - The double value representing the value of the attribute to aggregate on (e.g., 'aquavit')
defaultConf - The default configuration to fall back on in case nothing appropriate is found in the 'aggregator.properties' file.
Returns:
A new instance of the named aggregator
Throws:
java.lang.RuntimeException - If the named aggregator is not found in the aggregator.properties file or if there are any trouble instantiating the aggregator (such as the fact that it cannot aggregate the given attribute)
See Also:
AggregatorByValue, canAggregate(String, netkit.graph.Attribute)

get

public Aggregator get(java.lang.String name,
                      EdgeType[] edgeTypes,
                      Attribute attribute)
This is not yet supported.

Parameters:
name -
edgeTypes -
attribute -
Returns:
Throws:
java.lang.UnsupportedOperationException - is always thrown

get

public Aggregator get(java.lang.String name,
                      EdgeType[] edgeTypes,
                      Attribute attribute,
                      Configuration defaultConf)
This is not yet supported.

Parameters:
name -
edgeTypes -
attribute -
Returns:
Throws:
java.lang.UnsupportedOperationException - is always thrown

get

public Aggregator get(java.lang.String name,
                      EdgeType[] edgeTypes,
                      Attribute attribute,
                      double value)
This is not yet supported.

Parameters:
name -
edgeTypes -
attribute -
Returns:
Throws:
java.lang.UnsupportedOperationException - is always thrown

get

public Aggregator get(java.lang.String name,
                      EdgeType[] edgeTypes,
                      Attribute attribute,
                      double value,
                      Configuration defaultConf)
This is not yet supported.

Parameters:
name -
edgeTypes -
attribute -
Returns:
Throws:
java.lang.UnsupportedOperationException - is always thrown