001 /** 002 * WeightedRelation.java 003 * jCOLIBRI2 framework. 004 * @author Juan A. Recio-García. 005 * GAIA - Group for Artificial Intelligence Applications 006 * http://gaia.fdi.ucm.es 007 * 15/06/2007 008 */ 009 package jcolibri.extensions.textual.IE.representation.info; 010 011 import jcolibri.extensions.textual.IE.representation.Token; 012 013 /** 014 * <p> 015 * This class represents a weighted relation between two tokens. 016 * </p> 017 * <p> 018 * First version developed at: Robert Gordon University - Aberdeen & Facultad Informática, 019 * Universidad Complutense de Madrid (GAIA) 020 * </p> 021 * 022 * @author Juan Antonio Recio García 023 * @version 2.0 024 */ 025 public class WeightedRelation { 026 027 Token _origin; 028 029 Token _destination; 030 031 double _weight; 032 033 /** 034 * Constructor 035 * 036 * @param origin 037 * Origin Token 038 * @param destination 039 * Destination Token 040 * @param weight 041 * Relation weight [0..1] 042 */ 043 public WeightedRelation(Token origin, Token destination, double weight) { 044 _origin = origin; 045 _destination = destination; 046 _weight = weight; 047 } 048 049 /** 050 * Returns the origin token. 051 */ 052 public Token getOrigin() { 053 return _origin; 054 } 055 056 /** 057 * Returns the destination token. 058 */ 059 public Token getDestination() { 060 return _destination; 061 } 062 063 /** 064 * Returns the relation weight. 065 */ 066 public double getWeight() { 067 return _weight; 068 } 069 070 /* 071 * (non-Javadoc) 072 * 073 * @see java.lang.Object#toString() 074 */ 075 public String toString() { 076 String res = "Relation: "; 077 res += _origin + " --" + _weight + "--> " + _destination; 078 return res; 079 } 080 }