File: DistanceInstance.java

package info (click to toggle)
libsecondstring-java 0.1~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 764 kB
  • sloc: java: 9,592; xml: 114; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 798 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.wcohen.ss.api;

import java.util.*;

/**
 * An 'instance' for a StringDistance, analogous to an 'instance' for
 * a classification learner.  Consists of a pair of StringWrappers,
 * a distance, and some labeling information.
 */

public interface DistanceInstance 
{
	public StringWrapper getA();
	public StringWrapper getB();
	public boolean isCorrect();
	public double getDistance();
	public void setDistance(double distance);

	public static final Comparator INCREASING_DISTANCE = new Comparator() {
			public int compare(Object o1,Object o2) {
				DistanceInstance a = (DistanceInstance)o1;
				DistanceInstance b = (DistanceInstance)o2;
				if (a.getDistance() > b.getDistance()) return -1;
				else if (a.getDistance() < b.getDistance()) return +1;
				else return 0;
			}
		};
}