Class DynamicScoringPreferenceAggregator<T>
- java.lang.Object
 - 
- net.sf.tweety.preferences.aggregation.DynamicScoringPreferenceAggregator<T>
 
 
- 
- Type Parameters:
 T- generic preference order type
- All Implemented Interfaces:
 DynamicPreferenceAggregator<T>
- Direct Known Subclasses:
 DynamicBordaScoringPreferenceAggregator,DynamicPluralityScoringPreferenceAggregator,DynamicVetoScoringPreferenceAggregator
public abstract class DynamicScoringPreferenceAggregator<T> extends java.lang.Object implements DynamicPreferenceAggregator<T>
This Demo-class provides a basic implementation similar to the ScoringPreferenceAggregator but dynamic aggregation instead of static- Author:
 - Bastian Wolf
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<UpdateListener<T>>_listenersThe list containing the update listenersprivate WeightVectorvThe weight vector for the aggregator given via the constructor 
- 
Constructor Summary
Constructors Constructor Description DynamicScoringPreferenceAggregator(WeightVector v)Constructor with given weight vector 
- 
Method Summary
Modifier and Type Method Description voidaddListener(UpdateListener<T> listener)adds a listener to this dynamic preference aggregatorPreferenceOrder<T>aggregate(java.util.List<PreferenceOrder<T>> input)This method aggregates the given preference orders according to the WeightVector used within constructionprivate voidfireEvent(UpdateEvent<T> event)Fires an event every time a change occurredvoidremoveListener(UpdateListener<T> listener)removes a listener from this dynamic preference aggregatorPreferenceOrder<T>update(Update<T> update, java.util.List<PreferenceOrder<T>> input)The update-method for dynamically changing the input for preference aggregationPreferenceOrder<T>update(UpdateStream<T> stream, java.util.List<PreferenceOrder<T>> input)this method extends the update-functionality with input-streams consisting of Update-elements 
 - 
 
- 
- 
Field Detail
- 
v
private WeightVector v
The weight vector for the aggregator given via the constructor 
- 
_listeners
private java.util.ArrayList<UpdateListener<T>> _listeners
The list containing the update listeners 
 - 
 
- 
Constructor Detail
- 
DynamicScoringPreferenceAggregator
public DynamicScoringPreferenceAggregator(WeightVector v)
Constructor with given weight vector- Parameters:
 v- the weight vector
 
 - 
 
- 
Method Detail
- 
aggregate
public PreferenceOrder<T> aggregate(java.util.List<PreferenceOrder<T>> input)
This method aggregates the given preference orders according to the WeightVector used within construction- Specified by:
 aggregatein interfaceDynamicPreferenceAggregator<T>- Parameters:
 input- the array of preference orders to be aggregated- Returns:
 - the final result as a preference order
 
 
- 
update
public PreferenceOrder<T> update(Update<T> update, java.util.List<PreferenceOrder<T>> input) throws java.lang.IndexOutOfBoundsException, java.lang.NullPointerException
The update-method for dynamically changing the input for preference aggregation- Specified by:
 updatein interfaceDynamicPreferenceAggregator<T>- Parameters:
 update- the update element containing the changes to be appliedinput- some input- Returns:
 - a preference order
 - Throws:
 java.lang.IndexOutOfBoundsExceptionjava.lang.NullPointerException
 
- 
update
public PreferenceOrder<T> update(UpdateStream<T> stream, java.util.List<PreferenceOrder<T>> input)
this method extends the update-functionality with input-streams consisting of Update-elements- Parameters:
 stream- the input stream with the Update-elementsinput- some input- Returns:
 - the newly aggregated preference order after all updates are applied
 
 
- 
fireEvent
private void fireEvent(UpdateEvent<T> event)
Fires an event every time a change occurred- Parameters:
 event- the update event
 
- 
addListener
public void addListener(UpdateListener<T> listener)
adds a listener to this dynamic preference aggregator- Specified by:
 addListenerin interfaceDynamicPreferenceAggregator<T>- Parameters:
 listener- an update listener
 
- 
removeListener
public void removeListener(UpdateListener<T> listener)
removes a listener from this dynamic preference aggregator- Specified by:
 removeListenerin interfaceDynamicPreferenceAggregator<T>- Parameters:
 listener- an update listener
 
 - 
 
 -