Spectra
Public Member Functions | List of all members
formula Class Reference

#include <formula.h>

Public Member Functions

 formula (int id)
 
void addOperand (int)
 
std::string getContent ()
 
std::string getInitContent ()
 
bool isFullySet ()
 
bool canAddOperands ()
 
std::string printOpType ()
 
void incrementIds ()
 
int getId ()
 
State getState ()
 
const fileLocationgetStart () const
 
const fileLocationgetEnd () const
 
OpType getOperation ()
 
std::vector< int > & getOperands ()
 
std::string getPrintText ()
 
void setOperation (OpType)
 
void setContent (std::string)
 
void setPrint (std::string)
 
void setStart (const fileLocation &start)
 
void setEnd (const fileLocation &end)
 
bool operator< (const formula &other) const
 
bool operator== (const formula &other) const
 

Detailed Description

A class representing one ptLTL formula. The formula can be defined either

Constructor & Destructor Documentation

◆ formula()

formula::formula ( int  id)
explicit

A constructor setting this formula's id and initializing it's state and operation to ATOM.

Parameters
idThe UNIQUE id to be set to this formula.

Created: 10. 11. 2018 by Petra Sečkařová (xseck.nosp@m.a02@.nosp@m.stud..nosp@m.fit..nosp@m.vutbr.nosp@m..cz). Filename: formula.cpp

Description: Implementation of methods of a class representing a single ptLTL formula. A constructor setting this formula's id and initializing it's state and operation to ATOM.

Parameters
idThe UNIQUE id to be set to this formula.

Member Function Documentation

◆ addOperand()

void formula::addOperand ( int  value)

Adds new subformula id to the list of operands, updates initialization state accordingly.

Parameters
valueAn id of subformula, that is an operand to this one.

Update initialization state

Add the operand

◆ canAddOperands()

bool formula::canAddOperands ( )

Checks if any other operands can be added.

Returns
True if there can be any more operands added, false otherwise.

◆ getContent()

std::string formula::getContent ( )

Constructs a code for one step of processing of this formula in a created monitor. The returned string is based on recursive expressions for each supported operation introduced in http://www.havelund.com/Publications/sttt-tacas02.pdf

Returns
An expression constructed for recursive evaluation of this formula.

◆ getInitContent()

std::string formula::getInitContent ( )

Constructs a string for initialization of processing of this formula in a created monitor. The returned string is based on recursive expressions for each supported operation introduced in http://www.havelund.com/Publications/sttt-tacas02.pdf

Returns
An expression constructed for initialization of evaluation of this formula.

◆ incrementIds()

void formula::incrementIds ( )

A method incrementing all ids by 1. Used when after successfully parsing one formula, another one appears in a specification file, which is not connected to the previous one, so a new root formula is created. The root formula has to have id = 0, so all formulae parsed until now must increment their ids.

◆ isFullySet()

bool formula::isFullySet ( )

Checks, that the number of operands is correct or content not empty if operation == ATOM.

Returns
True if nothing is missing, false otherwise.

◆ operator<()

bool formula::operator< ( const formula other) const
inline

An < operator definition based on id's. Note that a formula is considered to be less if it's id is !GREATER!. This is used for sorting the formulae by id in DESCENDING order.

Parameters
otherThe other formula to be compared.
Returns
True if this formula's id is greater than the other's one.

◆ operator==()

bool formula::operator== ( const formula other) const
inline

An == operator definition based on id's.

Parameters
otherThe other formula to be compared.
Returns
True if this formula's id equal to the other's one.

◆ printOpType()

std::string formula::printOpType ( )

A decoder of OpType enum into a string representation.

Returns
A string representation of this formula's operation ended by one space if not ATOM.

◆ setContent()

void formula::setContent ( std::string  c)

A setter of this formula's content. Meant for ATOM formulae, won't have any useful effect for others. The passed name of state variable is given a prefix e used in enum created for generated monitor and wrapped in M.values[...] which denotes a reference to function returning its value computed as defined in specification file.

Parameters
cAn atomic expression, typically a name of a boolean variable to be set as this formula's content.

The documentation for this class was generated from the following files: