
net.sf.tweety.logics.ml.analysis.SumAggregator Maven / Gradle / Ivy
The newest version!
/*
* This file is part of "Tweety", a collection of Java libraries for
* logical aspects of artificial intelligence and knowledge representation.
*
* Tweety is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Copyright 2016 The Tweety Project Team
*/
package net.sf.tweety.logics.ml.analysis;
import java.util.List;
/** This aggregation function models the sum function.
* @author Matthias Thimm
*
*/
public class SumAggregator implements AggregationFunction {
private static final long serialVersionUID = -8518226177117879461L;
/* (non-Javadoc)
* @see net.sf.tweety.logics.markovlogic.analysis.AggregationFunction#aggregate(java.util.List)
*/
@Override
public double aggregate(List elements) {
Double sum = new Double(0);
for(Double elem: elements)
sum += elem;
return sum;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString(){
return "sum";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy