simAuxLibrary
Class Relation

java.lang.Object
  extended bysimAuxLibrary.Relation
All Implemented Interfaces:
java.lang.Cloneable

public class Relation
extends java.lang.Object
implements java.lang.Cloneable

Library simAuxLibrary, Class Relation

Copyright by Klaus Hufschlag 2004,2005,2006

This file is part of the Generic Classifier Library. The Generic Classifier Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Generic Classifier Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the Generic Classifier Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Version:
1.4
Author:
Klaus Hufschlag

Constructor Summary
Relation()
          Standardconstructor, creates an empty instance.
 
Method Summary
 void add(Relation r)
          add adds the entire oder of another relation to the Instance.
 void addRel(java.lang.Object parent, java.lang.Object child)
          addRel method for adding a new parent-child relation.
 boolean checkRel(java.lang.Object parent, java.lang.Object child)
          checkRel checks whether there is a (direct or indirect) relation between the objects
 java.lang.Object clone()
           
 void delRel(java.lang.Object parent, java.lang.Object child)
          delRel, method to remove a given relation, specified by parent and child
 java.util.ArrayList getChildren(java.lang.Object parent)
          getChildren method return all direct child Objects.
 java.util.ArrayList getParents(java.lang.Object child)
          getParents method returns all direct parent Objects.
 void remove()
          remove method to remove all relations.
 void remove(java.lang.Object o)
          remove method to remove an Object of all relations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Relation

public Relation()
Standardconstructor, creates an empty instance.

Method Detail

addRel

public void addRel(java.lang.Object parent,
                   java.lang.Object child)
addRel method for adding a new parent-child relation.

Parameters:
parent - parent to set
child - child to set

delRel

public void delRel(java.lang.Object parent,
                   java.lang.Object child)
delRel, method to remove a given relation, specified by parent and child

Parameters:
parent - parent to specify relation
child - child to specifiy relation

remove

public void remove(java.lang.Object o)
remove method to remove an Object of all relations.

Parameters:
o - Object to remove

remove

public void remove()
remove method to remove all relations.


getParents

public java.util.ArrayList getParents(java.lang.Object child)
getParents method returns all direct parent Objects.

Parameters:
child - child to find parents
Returns:
parent-Objects

getChildren

public java.util.ArrayList getChildren(java.lang.Object parent)
getChildren method return all direct child Objects.

Parameters:
parent - to find children
Returns:
child-Objects

checkRel

public boolean checkRel(java.lang.Object parent,
                        java.lang.Object child)
checkRel checks whether there is a (direct or indirect) relation between the objects

Parameters:
parent - Object to be checked for being superordinate
child - Object to be checked for being subordinate
Returns:
true, if relation exists

add

public void add(Relation r)
add adds the entire oder of another relation to the Instance. (Should only be used with special care as otherwise side-effect may occur.)

Parameters:
r - Relation to integrate

clone

public java.lang.Object clone()