Package 

 Class 

Tree 

Deprecated 

Index 

Help 


 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES     All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


edu.neu.ccs.evergreen.ir
Interface RelationI

All Known Implementing Classes:

Relation


public interface RelationI




Field Summary

static int

SOURCE 

           

static int

TARGET 

           

 

Method Summary

 int

firstForcedVariable(int startPosition) 

          starting at the given startPosition, get the position of the first variable forced by the relation.

 int

getMagicNumber(int variablePosition, int value) 

          Returns a magic number associated with a certain truth table column and value The magic number associated with column number 0 of the truth table and value 0 is basically a sequence of alternating 0 and 1 bits, packed together in one integer.

 int

getMask() 

           

 int

getRank() 

           

 int

getRelationNumber() 

           

 int

isForced(int variablePosition) 

          Checks if the relation forces the given variablePosition

 boolean

isIrrelevant(int variablePosition) 

          Checks if the variable at a given position is irrelevant to the internally stored relation

 int

nMap(int variablePosition) 

          NMaps one of the variables in a relation i.e.

 int

numberOfRelevantVariables() 

          Counts the number of relevantVariables in the relation

 int

ones() 

          returns the number of ones in the given relationNumber

 int

q(int s) 

           returns the number of rows in the truth table with s 1's

 int

reduce(int variablePosition, int value) 

          Reduces a relation by assigning a value to one of its variables

 int

renme(int permutationSemantics, int... permutation) 

           

 void

setRank(int rank) 

          Currently unsupported Usually converting to a higher rank is simple.

 void

setRelationNumber(int relationNumber) 

           

 int

swap(int variablePosition1, int variablePosition2) 

           

 


Field Detail

SOURCE

static final int SOURCE

See Also:

Constant Field Values


TARGET

static final int TARGET

See Also:

Constant Field Values

Method Detail

getRelationNumber

int getRelationNumber()

Returns:

an integer representing the relation number


setRelationNumber

void setRelationNumber(int relationNumber)

                       throws java.lang.IllegalArgumentException

Parameters:

relationNumber -

Throws:

java.lang.IllegalArgumentException - Thrwon if the relation number is invalid according to the rank


getRank

int getRank()

Returns:

rank of the relation


setRank

void setRank(int rank)

             throws java.lang.IllegalArgumentException

Currently unsupported Usually converting to a higher rank is simple. however converting to a lower rank might require the introduction of auxiliary variables and more than one relation might result from the operation


Parameters:

rank - sets the rank of the relation

Throws:

java.lang.IllegalArgumentException


getMagicNumber

int getMagicNumber(int variablePosition,

                   int value)

                   throws java.lang.IllegalArgumentException

Returns a magic number associated with a certain truth table column and value The magic number associated with column number 0 of the truth table and value 0 is basically a sequence of alternating 0 and 1 bits, packed together in one integer. The magic number associated with column number 0 of the truth table and value 1 is a sequence of alternating 1 and 0 bits, packed together in one integer. In general: (getMagicNumber(n,0) == ~getMagicNumber(n,1)) For column 1: magic numbers are fromed from sequences of two 0's followed by two 1's For column 2: magic numbers are formed from sequences of four 0's followed by four 1's For column 3: magic numbers are formed from sequeneces of eight 0's followed by eight 1's For column 4:magic numbers are formed from sequeneces of sixteen 0's followed by sixteen 1's There is no other possible columns as long as we are using 32 bit integers The lenght of the magic number depends on the internally stored relation rank


Parameters:

variablePosition - the position of the desired magic number

value - the value associated with the desired magic number

Returns:


Throws:

java.lang.IllegalArgumentException


getMask

int getMask()

Returns:

An integer with all of its bits set to 1. The length of the integer depends on the internally stored rank. 

the result is: 2^2^rank-1

Note: the method takes care of the case where 2^2^n is outside the integer range but 2^2^n-1 is not.


isIrrelevant

boolean isIrrelevant(int variablePosition)

                     throws java.lang.IllegalArgumentException

Checks if the variable at a given position is irrelevant to the internally stored relation


Parameters:

variablePosition - the variable to be checked

Returns:

true if the variable at vairablePosition is irrelevant otherwise returns false

Throws:

java.lang.IllegalArgumentException


numberOfRelevantVariables

int numberOfRelevantVariables()

Counts the number of relevantVariables in the relation


Returns:

The number of relevant variables in the relation


isForced

int isForced(int variablePosition)

             throws java.lang.IllegalArgumentException

Checks if the relation forces the given variablePosition


Parameters:

variablePosition - positon of the varible checked for being forced

Returns:

0 if the given relation forces the given variable to 0 1 if the given relation forces the given variable to 1 -1 given relation doesn't forces the given variable

Throws:

java.lang.IllegalArgumentException


firstForcedVariable

int firstForcedVariable(int startPosition)

                        throws java.lang.IllegalArgumentException

starting at the given startPosition, get the position of the first variable forced by the relation.


Parameters:

startPosition -

Returns:

-1 if nothing is forced the position of the first forced variable

Throws:

java.lang.IllegalArgumentException


nMap

int nMap(int variablePosition)

         throws java.lang.IllegalArgumentException

NMaps one of the variables in a relation i.e. replaces it by it's complement for example: nMapping x in Or(x,y,z) results in: or(!x,y,z)


Parameters:

relationNumber -

rank - rank of the given relation

variablePosition - the variable to be nmapped

Returns:

The number of the given relation with the specified variable nmapped

Throws:

java.lang.IllegalArgumentException


reduce

int reduce(int variablePosition,

           int value)

           throws java.lang.IllegalArgumentException

Reduces a relation by assigning a value to one of its variables


Parameters:

relationNumber -

rank -

variablePosition -

value -

Returns:


Throws:

java.lang.IllegalArgumentException


swap

int swap(int variablePosition1,

         int variablePosition2)

         throws java.lang.IllegalArgumentException

Throws:

java.lang.IllegalArgumentException


renme

int renme(int permutationSemantics,

          int... permutation)

          throws java.lang.IllegalArgumentException

Parameters:

relationNumber -

rank -

permutation -

Returns:


Throws:

java.lang.IllegalArgumentException


ones

int ones()

returns the number of ones in the given relationNumber


Parameters:

relationNumber -

rank -

Returns:



q

int q(int s)

      throws java.lang.IllegalArgumentException

Parameters:

s -

Returns:

the number of rows in the truth table with s 1's

Throws:

java.lang.IllegalArgumentException


Package 

 Class 

Tree 

Deprecated 

Index 

Help 


 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES     All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD