com.aliasi.cluster.LeafDendrogram Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aliasi-lingpipe Show documentation
Show all versions of aliasi-lingpipe Show documentation
This is the original Lingpipe:
http://alias-i.com/lingpipe/web/download.html
There were not made any changes to the source code.
/*
* LingPipe v. 4.1.0
* Copyright (C) 2003-2011 Alias-i
*
* This program is licensed under the Alias-i Royalty Free License
* Version 1 WITHOUT ANY WARRANTY, without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Alias-i
* Royalty Free License Version 1 for more details.
*
* You should have received a copy of the Alias-i Royalty Free License
* Version 1 along with this program; if not, visit
* http://alias-i.com/lingpipe/licenses/lingpipe-license-1.txt or contact
* Alias-i, Inc. at 181 North 11th Street, Suite 401, Brooklyn, NY 11211,
* +1 (718) 290-9170.
*/
package com.aliasi.cluster;
import com.aliasi.util.BoundedPriorityQueue;
import com.aliasi.util.Distance;
import com.aliasi.util.SmallSet;
import java.util.Collection;
import java.util.Set;
/**
* A LeafDendrogram
represents a dendrogram consisting
* of a single object with link cost of 0.0.
*
* @author Bob Carpenter
* @version 4.0.0
* @since LingPipe2.0
* @param the type of objects being clustered
*/
public class LeafDendrogram extends Dendrogram {
private final E mObject;
/**
* Construct a leaf dendrogram containing the specified object.
*
* @param object Object contained in the constructed dendrogram.
*/
public LeafDendrogram(E object) {
mObject = object;
}
/**
* Returns 0.0
, the cost of a leaf dendrogram.
*
* @return 0.0.
*/
@Override
public double score() {
return 0.0;
}
/**
* Return the single object underlying this leaf dendrogram.
*
* @return The object underlying this leaf dendrogram.
*/
public E object() {
return mObject;
}
/**
* Returns 1
, the size of a leaf dendrogram.
*
* @return 1
.
*/
@Override
public int size() {
return 1;
}
/**
* Returns the singleton member of this dendrogram.
*
* @return The singleton member of this dendrogram.
*/
@Override
public Set memberSet() {
return SmallSet.create(mObject);
}
@Override
void split(Collection> resultSet,
BoundedPriorityQueue> queue) {
resultSet.add(this.memberSet());
}
@Override
int copheneticCorrelation(int i, double[] xs, double[] ys,
Distance super E> distance) {
return i;
}
@Override
void addMembers(Set set) {
set.add(mObject);
}
@Override
void toString(StringBuilder sb, int depth) {
sb.append(mObject);
}
@Override
void prettyPrint(StringBuilder sb, int depth) {
indent(sb,depth);
sb.append(mObject);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy