VennDrawing
Class SetLabel

java.lang.Object
  extended by VennDrawing.SetLabel
All Implemented Interfaces:
java.lang.Comparable<SetLabel>

 class SetLabel
extends java.lang.Object
implements java.lang.Comparable<SetLabel>

An object representing a label of a Set region.

This class of objects is used to represent a simple label of a set region to
be put into the priority queue VennDiagram.labelQueue .

Copyright: Copyright (c) 2008

Company: Bangladesh University of engineering and technology


Field Summary
(package private)  int bitCount
          Keeps the Number of 1's in the binary representation of the value label.
(package private)  int labelValue
          The label as an Ineteger Value
 
Constructor Summary
SetLabel(int labelValue)
          Constructor for the class.
 
Method Summary
 int compareTo(SetLabel s)
          Used to set the property of the priority queue as to Always dequeue the setLabel having the highest bitCount.
 int countBits(int x)
          Returns how many 1's in the number Like in '3' it contains 2 "1"s in the binary value.
 int getBitCount()
          Returns bitCount
 int getLabelValue()
          Returns labelValue
 java.lang.String toString()
          Returns the String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

labelValue

int labelValue
The label as an Ineteger Value


bitCount

int bitCount
Keeps the Number of 1's in the binary representation of the value label.

Constructor Detail

SetLabel

public SetLabel(int labelValue)
Constructor for the class.

Parameters:
labelValue - value of the label as Integer.
Method Detail

countBits

public int countBits(int x)
Returns how many 1's in the number Like in '3' it contains 2 "1"s in the binary value.

Parameters:
x - the value which's number of 1s in binary representation to be checked.
Returns:
number of bits in integer "x"

getLabelValue

public int getLabelValue()
Returns labelValue

Returns:
The label value as an integer.

getBitCount

public int getBitCount()
Returns bitCount

Returns:
The number of 1's in the labelValue in the binary representation.

compareTo

public int compareTo(SetLabel s)
Used to set the property of the priority queue as to Always dequeue the setLabel having the highest bitCount.

Specified by:
compareTo in interface java.lang.Comparable<SetLabel>

toString

public java.lang.String toString()
Returns the String representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
String as format:
(label) (bitCount)