|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectit.unimo.dbgroup.momis.tools.DistanceMap
Asymmetric Index container for Distance objects.
This class has been designed to handle Distances between objects
and provides several ways to retrieve distances.
In this implementation distances are considered asymmetrically.
This means that d(a,b, 10) could be different from (b,a, 20);
This choice allows handling of directed graphs.
| Field Summary | |
private java.util.HashMap |
_dstMap
Index on the second element of the distance. |
private java.util.HashMap |
_srcMap
Index on the first element of the distance. |
| Constructor Summary | |
DistanceMap()
Indexes a set of Distance objects. |
|
DistanceMap(Distance[] distances)
Indexes a set of Distance objects. |
|
DistanceMap(DistanceMap oldMap)
Clonation method. |
|
DistanceMap(DistanceMap oldMap,
java.util.Set preserve)
Clonation method with filter. |
|
| Method Summary | |
void |
delete(Distance distance)
Given a Distance object, looks for equivalent all Distance object (same src and dst objects) and removes them from the indexing structure. |
void |
delete(java.lang.Object src,
java.lang.Object dst)
Removes from the indexing structure all distances from the given src and the given dst. |
Distance |
get(java.lang.Object src,
java.lang.Object dst)
Given source and destination object returns the Distance object between them . |
java.util.Set |
getAllDistances()
Return a set containing ALL distances stored in this data-structure |
java.util.Set |
getEndingIn(java.lang.Object src)
Given an object returns all distances ending in it. |
java.util.Set |
getRelatedTo(java.lang.Object src)
All distances that contains the Given object. |
java.util.Set |
getSetOfDestinationElements()
Retuns a set of object that appears at least once as DESTINATION object. |
java.util.Set |
getSetOfDistances()
Retuns all stored distances as a set. |
java.util.Set |
getSetOfElements()
Retuns a set of object that appears at least once in this indexing data structure as SOURCE or as DESTINATION. |
java.util.Set |
getSetOfSourceElements()
Retuns a set of object that appears at least once as SOURCE object. |
java.util.Set |
getStartingFrom(java.lang.Object src)
Given an object returns all distances starting from it. |
static void |
main(java.lang.String[] args)
Routine used to test the class. |
void |
put(Distance distance)
Add a distance object in the indexing structure. If a distance between the given elements already exists, it is substituted whith the new object. |
protected void |
putArray(java.lang.Object[] distances)
Indexes an array of Distance objects. |
protected void |
putArrayRestricted(java.lang.Object[] distances,
java.util.Set preserve)
Indexes an array of Distance objects with filter on nodes. |
java.lang.String |
toString()
String representation. |
java.lang.String |
toStringTable()
String representation. Produces a tabular output |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private java.util.HashMap _srcMap
private java.util.HashMap _dstMap
| Constructor Detail |
public DistanceMap()
public DistanceMap(Distance[] distances)
distances - Distance instance to be indexed.public DistanceMap(DistanceMap oldMap)
public DistanceMap(DistanceMap oldMap,
java.util.Set preserve)
oldMap - the DistanceMap to copy from.preserve - the list of element to preserve.| Method Detail |
protected void putArray(java.lang.Object[] distances)
distances - array of Distance instance to be indexed.
protected void putArrayRestricted(java.lang.Object[] distances,
java.util.Set preserve)
distances - distances to insert.preserve - the list of element to preserve.public java.util.Set getAllDistances()
public void put(Distance distance)
distance - The distance element to add to this indexing
structure
public Distance get(java.lang.Object src,
java.lang.Object dst)
public java.util.Set getStartingFrom(java.lang.Object src)
public java.util.Set getEndingIn(java.lang.Object src)
public java.util.Set getRelatedTo(java.lang.Object src)
public void delete(Distance distance)
distance - The distance element to be removed from this tructure.
public void delete(java.lang.Object src,
java.lang.Object dst)
public java.util.Set getSetOfElements()
public java.util.Set getSetOfSourceElements()
public java.util.Set getSetOfDestinationElements()
public java.util.Set getSetOfDistances()
public java.lang.String toString()
public java.lang.String toStringTable()
public static void main(java.lang.String[] args)
Tests the tools.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||