infomat.vectorspace
Class IObjectGroup

java.lang.Object
  extended by infomat.vectorspace.IObject
      extended by infomat.vectorspace.IObjectGroup
All Implemented Interfaces:
IVectorIndex
Direct Known Subclasses:
ILabel, IObjectGrouping, IObjectSet

public class IObjectGroup
extends IObject

A IObjectGroup is a set of IObject:s.


Nested Class Summary
private  class IObjectGroup.IObjectComparator
          A private class that is used to order the IObjects.
private  class IObjectGroup.MapEntryComparator
          A private class that is used to order the MapEntry:s.
 
Field Summary
static int maxIdSoFar
           
 java.util.HashMap<IObject,java.lang.Integer> objectOrderIndexMap
           
(package private)  java.util.HashMap<IObject,java.lang.Float> objectOrderValueMap
           
(package private)  java.util.Vector<IObject> ordered
           
 
Constructor Summary
  IObjectGroup(IObjectGroup iog)
          Copy constructor.
  IObjectGroup(java.lang.String name)
           
  IObjectGroup(java.lang.String name, int id)
           
protected IObjectGroup(java.lang.String name, int kind, int id)
          Used by IObjectGrouping and IObjectSet.
 
Method Summary
 void add(IObject co)
          Adds a new IObject at the next place.
 void add(IObject co, float orderValue)
          Adds a new IObject in the place the value implicates.
 void addAll(IVector<IObject> ivec)
           
 void addAll(java.util.Vector<IObject> iobjects)
          Adds all the IObject:s at the end.
 boolean contains(IObject co)
          Returns true when the IObjectGroup contains the IObject.
 boolean containsPrecisely(java.util.Vector<IObject> objs)
          Returns true if the IObjectGroup contains these IObject:s and no other.
 IObject getIObjectAt(int i)
          Returns the IObject at the i:the place according to the ordering.
 int getIObjectOrderIndex(IObject co)
          Returns the order number of the IObject.
 IVector<IObject> getIVector()
           
 java.lang.String getName()
          Returns the name of thie IObjectGroup.
 java.util.HashMap<IObject,java.lang.Float> getObjectOrderValueMap()
          Returns a HashMap with the objects mapped to the values that are the basis for the ordering.
 java.util.Vector<IObject> getOrdered()
          Returns a vector of the ordered IObjects.
 java.util.Vector<java.util.Map.Entry<IObject,java.lang.Float>> getSortedObjectOrderValueVector()
          Returns a sorted centroid vector
 IObjectGroup notIn(IObjectGroup group)
          Returns a IObjectGroup with the IObject:s in this that is not in the specified IObjectGroup.
 int numberOfIObjects()
          Returns the number of IObjects in the IObjectGroup.
 int numberOfSharedIObjects(IObjectGroup iog)
          Returns the number of IObjects that are shared between the this and another IObjectGroup.
 void randomOrder()
          Reorders the IObjects randomly.
 void remove(IObject co)
          Removes the IObject.
 void remove(IVector<IObject> ivec)
           
 void removeAll()
           
 java.util.Vector<IObject> removeObjectsNotIn(IObjectGroup group)
          Removes IObject:s that are not in the given IObjectGroup.
 void setIVector(IVector<IObject> vec)
          Sets this group to contain the IObject:s in the specified IVector.
 void setName(java.lang.String name)
           
 void sortInCurrentVectorOrderWithInvertedOrderNumberAsValue()
           
 void sortInOrderValueOrder()
          Sorts the IObjects in the vector "ordered" according to the values they have.
 IObjectGroup subGroup(int from, int to)
           
 IObjectGroup subGroup(IObject fromObject, IObject toObject)
          Returns the part of the group that starts with fromObject and ends with toObject, in the same order as this group.
 
Methods inherited from class infomat.vectorspace.IObject
getAmbiguous, getAmbiguousString, getID, getKind, getLargestCommonLocation, getLocation, getString, setAmbiguous, setString, stringCompareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxIdSoFar

public static int maxIdSoFar

ordered

java.util.Vector<IObject> ordered

objectOrderIndexMap

public java.util.HashMap<IObject,java.lang.Integer> objectOrderIndexMap

objectOrderValueMap

java.util.HashMap<IObject,java.lang.Float> objectOrderValueMap
Constructor Detail

IObjectGroup

public IObjectGroup(java.lang.String name)

IObjectGroup

public IObjectGroup(java.lang.String name,
                    int id)

IObjectGroup

protected IObjectGroup(java.lang.String name,
                       int kind,
                       int id)
Used by IObjectGrouping and IObjectSet.


IObjectGroup

public IObjectGroup(IObjectGroup iog)
Copy constructor. Makes new instances of everything, but the IObject:s, which are the same. Gives the new IObjectGroup the same name, but a different id.

Method Detail

subGroup

public IObjectGroup subGroup(IObject fromObject,
                             IObject toObject)
Returns the part of the group that starts with fromObject and ends with toObject, in the same order as this group. If fromObject lies after toObject they are inverted - that is the method always returns a group ordered in the same way as the original.


subGroup

public IObjectGroup subGroup(int from,
                             int to)

add

public void add(IObject co,
                float orderValue)
Adds a new IObject in the place the value implicates. For the object to get the right place the group has to be sorted through sortInOrderValueOrder().


add

public void add(IObject co)
Adds a new IObject at the next place.


addAll

public void addAll(java.util.Vector<IObject> iobjects)
Adds all the IObject:s at the end.


addAll

public void addAll(IVector<IObject> ivec)

randomOrder

public void randomOrder()
Reorders the IObjects randomly.


remove

public void remove(IObject co)
Removes the IObject.


remove

public void remove(IVector<IObject> ivec)

removeAll

public void removeAll()

removeObjectsNotIn

public java.util.Vector<IObject> removeObjectsNotIn(IObjectGroup group)
Removes IObject:s that are not in the given IObjectGroup. Does not check for the opposite: objects that are in this, but not in the given.


notIn

public IObjectGroup notIn(IObjectGroup group)
Returns a IObjectGroup with the IObject:s in this that is not in the specified IObjectGroup.


contains

public boolean contains(IObject co)
Returns true when the IObjectGroup contains the IObject. False otherwise.


containsPrecisely

public boolean containsPrecisely(java.util.Vector<IObject> objs)
Returns true if the IObjectGroup contains these IObject:s and no other.


numberOfIObjects

public int numberOfIObjects()
Returns the number of IObjects in the IObjectGroup.


getName

public java.lang.String getName()
Returns the name of thie IObjectGroup.


setName

public void setName(java.lang.String name)

getIObjectAt

public IObject getIObjectAt(int i)
Returns the IObject at the i:the place according to the ordering.

See Also:
sortInOrderValueOrder()

getIObjectOrderIndex

public int getIObjectOrderIndex(IObject co)
Returns the order number of the IObject. If it is not present -1 is returned.

See Also:
sortInOrderValueOrder()

getOrdered

public java.util.Vector<IObject> getOrdered()
Returns a vector of the ordered IObjects.

See Also:
sortInOrderValueOrder()

getIVector

public IVector<IObject> getIVector()

setIVector

public void setIVector(IVector<IObject> vec)
Sets this group to contain the IObject:s in the specified IVector. Use with caution!


getObjectOrderValueMap

public java.util.HashMap<IObject,java.lang.Float> getObjectOrderValueMap()
Returns a HashMap with the objects mapped to the values that are the basis for the ordering.

Returns:
a HashMap

getSortedObjectOrderValueVector

public java.util.Vector<java.util.Map.Entry<IObject,java.lang.Float>> getSortedObjectOrderValueVector()
Returns a sorted centroid vector


sortInCurrentVectorOrderWithInvertedOrderNumberAsValue

public void sortInCurrentVectorOrderWithInvertedOrderNumberAsValue()

sortInOrderValueOrder

public void sortInOrderValueOrder()
Sorts the IObjects in the vector "ordered" according to the values they have.


numberOfSharedIObjects

public int numberOfSharedIObjects(IObjectGroup iog)
Returns the number of IObjects that are shared between the this and another IObjectGroup.