it.polito.elite.doseWS.include
Class SpectrumImpl

java.lang.Object
  extended byit.polito.elite.doseWS.include.SpectrumImpl
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, Spectrum

public class SpectrumImpl
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, Spectrum

A java class for representing conceptual spectra, such class encapsulates all information required in the definition of a conceptual spectra providing methods for evaluating the distance between spectra according to a similarity value defined as:

a*formSimilarity+(1-a)*energySimilarity

Since:
11/2004
Version:
1.0
Author:
Dario Bonino Alessio Bosca Federico Pescarmona Michele Debandi
See Also:
SpectrumImplTest for the corresponding test class., Serialized Form

Constructor Summary
SpectrumImpl(java.lang.String fragmentURI, java.lang.String fragmentXPath, java.lang.String author, java.lang.String type, java.util.Hashtable conceptsAndWeights)
          Constructor
 
Method Summary
 java.lang.Object clone()
          The cloner for this class
static SpectrumImpl deSerialize(java.lang.String serialized)
          The static deserializer for this class
 double dist(Spectrum sa, Spectrum sb)
          A method for evaluating the similarity between two spectra according to the similarity definition given in the class description
 boolean equals(java.lang.Object s)
          Redefinition of the equals function for the class SpectrumImpl
 java.lang.String getAuthor()
           
 java.util.Hashtable getConcepts()
           
 java.lang.String getFragmentURI()
           
 java.lang.String getFragmentXPath()
           
 java.lang.String getType()
           
 java.lang.String serialize()
          The serializer for this class
static void setDistParameters(double alpha, double qu)
          A static setter for the tune-up parameters in the similarity function
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpectrumImpl

public SpectrumImpl(java.lang.String fragmentURI,
                    java.lang.String fragmentXPath,
                    java.lang.String author,
                    java.lang.String type,
                    java.util.Hashtable conceptsAndWeights)
Constructor

Parameters:
fragmentURI - the URI of the resource that this spectrum represent
fragmentXPath - the XPath identifying the specific substructure of the resource to which this spectrum is referred
Method Detail

getFragmentURI

public java.lang.String getFragmentURI()
Specified by:
getFragmentURI in interface Spectrum
Returns:
the URI of the resource to which this spectrum is referred.

getFragmentXPath

public java.lang.String getFragmentXPath()
Specified by:
getFragmentXPath in interface Spectrum
Returns:
the XPath of the resource to which this spectrum is referred

getAuthor

public java.lang.String getAuthor()
Specified by:
getAuthor in interface Spectrum
Returns:
the name of the person or of the machine who generated this spectrum

getType

public java.lang.String getType()
Specified by:
getType in interface Spectrum
Returns:
the type of author

getConcepts

public java.util.Hashtable getConcepts()
Specified by:
getConcepts in interface Spectrum
Returns:
the concepts contained in this conceptual spectrum together with their weights, in an Hashtable object.

dist

public double dist(Spectrum sa,
                   Spectrum sb)
A method for evaluating the similarity between two spectra according to the similarity definition given in the class description

Specified by:
dist in interface Spectrum
Parameters:
sa - the first spectrum
sb - the second spectrum
Returns:
the similarity of the two spectra as a double in the range between 0 and 1

setDistParameters

public static void setDistParameters(double alpha,
                                     double qu)
A static setter for the tune-up parameters in the similarity function

Parameters:
alpha - the first parameter (a)
qu - the second parameter (b)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The cloner for this class

Specified by:
clone in interface Spectrum
Throws:
java.lang.CloneNotSupportedException

serialize

public java.lang.String serialize()
The serializer for this class

Returns:
this spectrum object serialized into a String

deSerialize

public static SpectrumImpl deSerialize(java.lang.String serialized)
The static deserializer for this class

Parameters:
serialized - the serialized spectrum
Returns:
a SpectrumImpl object corresponding to the serialized object contained in "serialized"

equals

public boolean equals(java.lang.Object s)
Redefinition of the equals function for the class SpectrumImpl