All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kieker.analysis.generic.clustering.mtree.ComposedSplitFunction Maven / Gradle / Ivy

The newest version!
/***************************************************************************
 * Copyright (c) 2012-2013 Eduardo R. D'Avila (https://github.com/erdavila)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ***************************************************************************/
package kieker.analysis.generic.clustering.mtree;

import java.util.Set;

import kieker.analysis.generic.clustering.mtree.utils.Pair;

/**
 * A {@linkplain ISplitFunction split function} that is defined by composing
 * a {@linkplain IPromotionFunction promotion function} and a
 * {@linkplain IPartitionFunction partition function}.
 *
 * @param 
 *            The type of the data objects.
 *
 * @author Eduardo R. D'Avila
 * @since 2.0.0
 */
public class ComposedSplitFunction implements ISplitFunction {

	private final IPromotionFunction promotionFunction;
	private final IPartitionFunction partitionFunction;

	/**
	 * The constructor of a {@link ISplitFunction} composed by a
	 * {@link IPromotionFunction} and a {@link IPartitionFunction}.
	 *
	 * @param promotionFunction
	 *            promotion function
	 * @param partitionFunction
	 *            partition function
	 */
	public ComposedSplitFunction(
			final IPromotionFunction promotionFunction,
			final IPartitionFunction partitionFunction) {
		this.promotionFunction = promotionFunction;
		this.partitionFunction = partitionFunction;
	}

	@Override
	public SplitResult process(final Set dataSet, final IDistanceFunction distanceFunction) {
		final Pair promoted = this.promotionFunction.process(dataSet, distanceFunction);
		final Pair> partitions = this.partitionFunction.process(promoted, dataSet, distanceFunction);
		return new SplitResult<>(promoted, partitions);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy