VennDrawing
Class RSet

java.lang.Object
  extended by VennDrawing.RSet

 class RSet
extends java.lang.Object

A class representing a set object

This class object represents a set which can have only string values as members.

Copyright: Copyright (c) 2008

Company: Bangladesh University of engineering and technology


Field Summary
(package private)  int id
          Id of the set.
(package private)  java.util.LinkedList<java.lang.String> list
          A list containing all members as Strings
(package private)  java.lang.String name
          For better usability done as 0 id having name "A"
 
Constructor Summary
RSet()
          Constructor without id.
RSet(int id)
          Constructor setting id
 
Method Summary
 void add(java.lang.String member)
          Adds a single member to its list.
 void add(java.lang.String[] member)
          Addes array of String to the list
 boolean contains(java.lang.String member)
          Checks whether a member belongs to this set.
 java.util.LinkedList<java.lang.String> getList()
          Returns The list f the set
 RSet setIntersection(RSet set)
          Performs setIntersection
 RSet setIntersection(RSet set, int id)
          Performs setIntersection
 RSet setMinus(RSet set)
          Performs setMinus
 RSet setMinus(RSet set, int id)
          Performs setMinus
 RSet setUnion(RSet set)
          Performs setUnion
 RSet setUnion(RSet set, int id)
          Performs setUnion
 java.lang.String toString()
          String representation of this obejct
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

int id
Id of the set.


name

java.lang.String name
For better usability done as 0 id having name "A"


list

java.util.LinkedList<java.lang.String> list
A list containing all members as Strings

Constructor Detail

RSet

public RSet(int id)
Constructor setting id

Parameters:
id - id of the set

RSet

public RSet()
Constructor without id. It initializes id with 0.

Method Detail

add

public void add(java.lang.String member)
Adds a single member to its list.


add

public void add(java.lang.String[] member)
Addes array of String to the list

Parameters:
member - array of members

contains

public boolean contains(java.lang.String member)
Checks whether a member belongs to this set.

Parameters:
member - the string which is checked whether belongs to the set.
Returns:
True if the member string belongs to the set else false is returned.

getList

public java.util.LinkedList<java.lang.String> getList()
Returns The list f the set

Returns:
LinkedList of this set

setUnion

public RSet setUnion(RSet set,
                     int id)
Performs setUnion

Parameters:
set - the union done with this set and "set" param
id - the id of the new set produced
Returns:
a set having the union set having id "id"

setUnion

public RSet setUnion(RSet set)
Performs setUnion

Parameters:
set - the union done with this set and "set" param
Returns:
a set having the union set having id "0"

setIntersection

public RSet setIntersection(RSet set,
                            int id)
Performs setIntersection

Parameters:
set - the intersection done with this set and "set" param
id - the id of the new set produced
Returns:
a set having the Intersection set having id "id"

setIntersection

public RSet setIntersection(RSet set)
Performs setIntersection

Parameters:
set - the intersection done with this set and "set" param
Returns:
a set having the Intersection set having id "0"

setMinus

public RSet setMinus(RSet set)
Performs setMinus

Parameters:
set - the setMinus done with this set and "set" param id the id of the new set produced
Returns:
a set having the setMinus set having id "0"

setMinus

public RSet setMinus(RSet set,
                     int id)
Performs setMinus

Parameters:
set - the setMinus done with this set and "set" param
id - the id of the new set produced
Returns:
a set having the setMinus set having id "id"

toString

public java.lang.String toString()
String representation of this obejct

Overrides:
toString in class java.lang.Object
Returns:
A string with the format :
{ (member0), ... ..., (member m-1)}