it.unibo.cs.belief
Class Proposition

java.lang.Object
  extended by it.unibo.cs.belief.Proposition
All Implemented Interfaces:
java.lang.Comparable

public class Proposition
extends java.lang.Object
implements java.lang.Comparable

A subset of a frame of discernment. At the moment propositions are limited to frames with up to 31 elements, without any check.

Version:
0.1
Author:
Matteo Magnani

Field Summary
protected  java.math.BigInteger elements
          Comment for elements
private  Frame frame
          Comment for frame
 
Constructor Summary
Proposition(Frame frame)
          Creates an empty proposition over a specified frame.
Proposition(Frame frame, java.math.BigInteger elements)
           
Proposition(Frame frame, int elements)
           
Proposition(Frame frame, long elements)
          Creates a proposition over a specified frame, with the elements corresponding to the '1' bits in the input integer.
 
Method Summary
 java.lang.Object clone()
           
 int compareTo(java.lang.Object p)
           
 boolean contains(int pos)
           
 boolean equals(Proposition p)
           
 java.math.BigInteger getElements()
           
 Frame getFrame()
           
 Proposition intersect(Proposition prop)
          Intersects this proposition with another one.
 boolean intersects(Proposition prop)
          Checks if this propositions has a not null intersection with another one.
 boolean isEmpty()
          Checks if this proposition corresponds to the empty set.
 void set(int pos)
          Adds an element to this proposition (sets to 1 its characteristic function)
 void setAll()
          Adds all the elements of the frame to this proposition
 boolean subset(Proposition prop)
          Checks if this propositions is a subset of another one.
 java.lang.String toString()
          Produces a string representation of this proposition using a set notation.
 Proposition union(Proposition prop)
          Takes the union of this proposition with another one.
 void unset(int pos)
          Remove an element from this proposition (sets to 0 its characteristic function)
 void unsetAll()
          Sets this proposition to the empty set.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

frame

private Frame frame
Comment for frame


elements

protected java.math.BigInteger elements
Comment for elements

Constructor Detail

Proposition

public Proposition(Frame frame)
Creates an empty proposition over a specified frame.

Parameters:
frame - the set of elements representing the universe of the propositions corresponding to this object

Proposition

public Proposition(Frame frame,
                   long elements)
Creates a proposition over a specified frame, with the elements corresponding to the '1' bits in the input integer.

Parameters:
frame - the set of elements representing the universe of the propositions corresponding to this object
elements - a bit-array representation of this proposition

Proposition

public Proposition(Frame frame,
                   int elements)

Proposition

public Proposition(Frame frame,
                   java.math.BigInteger elements)
Method Detail

equals

public boolean equals(Proposition p)

getFrame

public Frame getFrame()

getElements

public java.math.BigInteger getElements()

set

public void set(int pos)
Adds an element to this proposition (sets to 1 its characteristic function)

Parameters:
pos - the position of the element added to this proposition

unset

public void unset(int pos)
Remove an element from this proposition (sets to 0 its characteristic function)

Parameters:
pos - the position of the element removed from this proposition

setAll

public void setAll()
Adds all the elements of the frame to this proposition


unsetAll

public void unsetAll()
Sets this proposition to the empty set.


isEmpty

public boolean isEmpty()
Checks if this proposition corresponds to the empty set.

Returns:
the boolean result of the check

intersect

public Proposition intersect(Proposition prop)
Intersects this proposition with another one.

Parameters:
prop - the proposition to be intersected with
Returns:
the intersection of the two propositions

intersects

public boolean intersects(Proposition prop)
Checks if this propositions has a not null intersection with another one.

Parameters:
prop - the propositions to be intersected with
Returns:
the result of the check

subset

public boolean subset(Proposition prop)
Checks if this propositions is a subset of another one.

Parameters:
prop -
Returns:
true if prop is a superset of this proposition.

union

public Proposition union(Proposition prop)
Takes the union of this proposition with another one.

Parameters:
prop - the proposition to take the union with
Returns:
the union of the two propositions

toString

public java.lang.String toString()
Produces a string representation of this proposition using a set notation.

Overrides:
toString in class java.lang.Object
Returns:
a comma-separated list of element names, surronded by curly braces

compareTo

public int compareTo(java.lang.Object p)
Specified by:
compareTo in interface java.lang.Comparable

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

contains

public boolean contains(int pos)