infomat.vectorspace
Class IObjectGrouping

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

public class IObjectGrouping
extends IObjectGroup

A IObjectGrouping is a set of IObjectGroup:s. It is ordered in a Vector. The order is deemed important. OBS. A IObjectGrouping is only implicitely connected to an IObjectSet. If the IObjectSet is altered this is not reflected in the IObjectGrouping.


Field Summary
static int groupingMaxIdSoFar
           
(package private)  java.util.Vector<IObjectGroup> groupOrdered
           
 
Fields inherited from class infomat.vectorspace.IObjectGroup
maxIdSoFar, objectOrderIndexMap, objectOrderValueMap, ordered
 
Constructor Summary
IObjectGrouping(IObjectGrouping ioging)
          Copy constructor.
IObjectGrouping(java.lang.String groupingName)
           
IObjectGrouping(java.lang.String groupingName, int groupingId)
           
 
Method Summary
 void add(IObjectGroup cog)
          Adds a IObjectGroup at the next place.
 void addAllGroups(java.util.Vector<IObjectGroup> vec)
          Adds all IObjectGroup:s at the next places.
 boolean contains(IObjectGroup group)
           
 boolean containsIObjectGroup(IObjectGroup iog)
          Returns true if this IObjectGrouping contains the IObjectGroup.
 java.util.Vector<IObject> getGroupingVector()
          Returns a vector of all the IObjects contained in this IObjectGrouping in the order suggested by the ordering of the IObjectGroup:s and their internal order.
 java.util.Vector<java.lang.Integer> getGroupLimitsForIntervall(int from, int to)
          Returns a vector with integers that indicate where the boundaries for the IObjectsGroups are in the entire ordered vector "groupOrdered".
 java.util.Vector<IObjectGroup> getGroups()
          Returns the ordered IObjectGroup:s in a vector.
 java.util.Vector<IObjectGroup> getGroupsForIntervall(int from, int to)
          Returns a vector of IObjectGroups that lie within the intervall given.
 IObjectGroup inWhichIObjectGroup(IObject co)
          Returns the IObjectGroup in this IObjectGrouping that contains this IObject.
 int inWhichIObjectGroupOrdered(IObject co)
          Returns the number of the IObjectGroup in this IObjectGrouping that contains this IObject.
 int numberOfIObjectGroups()
          Returns the the number of IObjectGroup:s in the IObjectGrouping.
 void printGroupNamesAndSizes()
          For debugging purposes.
 void printGroupSizes()
          For debugging purposes.
 void printGroupsObjects(int numberOfObjects)
          For debugging purposes.
 void purgeGroupingToGroup(IObjectGroup group)
          Removes IObject:s are not in the IObjectGroup.
 java.util.Vector<IObject> remove(int from, int to)
          Removes and returns the IObjects in the range given, the range within the vector "ordered".
 void remove(IObject co)
          Removes the IObject from all the IObjectGroup:s of the grouping.
 void remove(IObjectGroup cog)
          Removes a IObjectGroup.
 void remove(IVector<IObject> ivec)
           
protected  void removeAllGroups()
          Removes all IObjectGroups.
 void removeEmptyGroups()
          Removes all empty IObjectGroup:s.
 java.util.Vector<IObject> removeObjectsNotIn(IObjectGroup group)
          Removes IObject:s that are not in the given IObjectGroup.
 void reorder(int[] mapping)
          Reorders the groups according to a mapping in the form of an int array.
 void setGroups(java.util.Vector<IObjectGroup> iog)
          Removes all groups and adds the vector.
 void sort()
          Sorts all IObjectGroup:s in their internal order and sorts the IObject:s in that order in the "ordered" vector.
 
Methods inherited from class infomat.vectorspace.IObjectGroup
add, add, addAll, addAll, contains, containsPrecisely, getIObjectAt, getIObjectOrderIndex, getIVector, getName, getObjectOrderValueMap, getOrdered, getSortedObjectOrderValueVector, notIn, numberOfIObjects, numberOfSharedIObjects, randomOrder, removeAll, setIVector, setName, sortInCurrentVectorOrderWithInvertedOrderNumberAsValue, sortInOrderValueOrder, subGroup, subGroup
 
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

groupingMaxIdSoFar

public static int groupingMaxIdSoFar

groupOrdered

java.util.Vector<IObjectGroup> groupOrdered
Constructor Detail

IObjectGrouping

public IObjectGrouping(java.lang.String groupingName,
                       int groupingId)

IObjectGrouping

public IObjectGrouping(java.lang.String groupingName)

IObjectGrouping

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

Method Detail

add

public void add(IObjectGroup cog)
Adds a IObjectGroup at the next place.


addAllGroups

public void addAllGroups(java.util.Vector<IObjectGroup> vec)
Adds all IObjectGroup:s at the next places.


remove

public void remove(IObjectGroup cog)
Removes a IObjectGroup.


removeAllGroups

protected void removeAllGroups()
Removes all IObjectGroups.


removeEmptyGroups

public void removeEmptyGroups()
Removes all empty IObjectGroup:s. Some algorithms may produce empty groups. The interface does not handle empty groups.


remove

public void remove(IObject co)
Removes the IObject from all the IObjectGroup:s of the grouping. If any of these becomes empty they are removed.

Overrides:
remove in class IObjectGroup

remove

public void remove(IVector<IObject> ivec)
Overrides:
remove in class IObjectGroup

getGroups

public java.util.Vector<IObjectGroup> getGroups()
Returns the ordered IObjectGroup:s in a vector.


contains

public boolean contains(IObjectGroup group)

setGroups

public void setGroups(java.util.Vector<IObjectGroup> iog)
Removes all groups and adds the vector. Use this method with caution! All groups are removed!!


reorder

public void reorder(int[] mapping)
Reorders the groups according to a mapping in the form of an int array. Does not do any check of the mapping.


numberOfIObjectGroups

public int numberOfIObjectGroups()
Returns the the number of IObjectGroup:s in the IObjectGrouping.


getGroupingVector

public java.util.Vector<IObject> getGroupingVector()
Returns a vector of all the IObjects contained in this IObjectGrouping in the order suggested by the ordering of the IObjectGroup:s and their internal order.


inWhichIObjectGroup

public IObjectGroup inWhichIObjectGroup(IObject co)
Returns the IObjectGroup in this IObjectGrouping that contains this IObject.


inWhichIObjectGroupOrdered

public int inWhichIObjectGroupOrdered(IObject co)
Returns the number of the IObjectGroup in this IObjectGrouping that contains this IObject.


containsIObjectGroup

public boolean containsIObjectGroup(IObjectGroup iog)
Returns true if this IObjectGrouping contains the IObjectGroup.


sort

public void sort()
Sorts all IObjectGroup:s in their internal order and sorts the IObject:s in that order in the "ordered" vector.

See Also:
IObjectGroup.sortInOrderValueOrder()

remove

public java.util.Vector<IObject> remove(int from,
                                        int to)
Removes and returns the IObjects in the range given, the range within the vector "ordered".


purgeGroupingToGroup

public void purgeGroupingToGroup(IObjectGroup group)
Removes IObject:s are not in the IObjectGroup. Called by IObjectSet#prugeGroupingstoSet.

See Also:
IMatrixFilter, IObjectSet#prugeGroupingsToSet()

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.

Overrides:
removeObjectsNotIn in class IObjectGroup

getGroupLimitsForIntervall

public java.util.Vector<java.lang.Integer> getGroupLimitsForIntervall(int from,
                                                                      int to)
Returns a vector with integers that indicate where the boundaries for the IObjectsGroups are in the entire ordered vector "groupOrdered". The next integer is the first in the next group. Used in SparsePictureConstructor.

See Also:
SparsePictureConstructor

getGroupsForIntervall

public java.util.Vector<IObjectGroup> getGroupsForIntervall(int from,
                                                            int to)
Returns a vector of IObjectGroups that lie within the intervall given. The intervall is within the ordered vector "groupOrdered". Used in SparsePictureConstructor together with #getGroupLimitsForIntervall.

See Also:
SparsePictureConstructor

printGroupsObjects

public void printGroupsObjects(int numberOfObjects)
For debugging purposes.


printGroupNamesAndSizes

public void printGroupNamesAndSizes()
For debugging purposes.


printGroupSizes

public void printGroupSizes()
For debugging purposes.