LearnTA  0.0.1
Public Member Functions | List of all members
learnta::TimedWord Class Reference

A timed word. More...

#include <timed_word.hh>

Public Member Functions

 TimedWord (const std::string &word, const std::vector< double > &durations)
 Constructor of timed words. More...
 
TimedWord operator+ (const TimedWord &another) const
 Return the concatenation of two timed words. More...
 
TimedWord operator+ (const char action)
 Return the concatenation of this timed word and an action. More...
 
TimedWord operator+ (const double duration)
 Return the concatenation of this timed word and a time elapse. More...
 
std::ostream & print (std::ostream &stream) const
 Print the timed word to the stream. More...
 
const std::string & getWord () const
 
const std::vector< double > & getDurations () const
 
std::vector< double > getAccumulatedDurations () const
 Construct and return the (tail) accumulated duration. More...
 
TimedWord getSuffix (const TimedWord &prefix) const
 
std::size_t wordSize () const
 Return the number of the actions in this timed word.
 
bool operator== (const TimedWord &another) const
 

Detailed Description

A timed word.

We represent the timed word by a sequence of events and the time elapse between each of them (not timestamps), i.e., \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} \).

Constructor & Destructor Documentation

◆ TimedWord()

learnta::TimedWord::TimedWord ( const std::string &  word,
const std::vector< double > &  durations 
)
inline

Constructor of timed words.

Note
When the given word contains unobservable actions, we absorb them

Member Function Documentation

◆ getAccumulatedDurations()

std::vector<double> learnta::TimedWord::getAccumulatedDurations ( ) const
inline

Construct and return the (tail) accumulated duration.

The accumulated duration is a vector representing \(\mathbb{T}_{i,N}\), where \(N\) is the length.

◆ getSuffix()

TimedWord learnta::TimedWord::getSuffix ( const TimedWord prefix) const
inline

@breif Return the suffix such that the concatenation with prefix is this

Precondition
prefix must be a prefix of this

◆ operator+() [1/3]

TimedWord learnta::TimedWord::operator+ ( const char  action)
inline

Return the concatenation of this timed word and an action.

Let this be \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} \) and action be \(a\). The result is \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} a 0 \).

◆ operator+() [2/3]

TimedWord learnta::TimedWord::operator+ ( const double  duration)
inline

Return the concatenation of this timed word and a time elapse.

Let this be \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} \) and duration be \(t\). The result is \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} + t\).

◆ operator+() [3/3]

TimedWord learnta::TimedWord::operator+ ( const TimedWord another) const
inline

Return the concatenation of two timed words.

Let this be \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} \) and another be \(\tau'_0 a'_1 \tau'_1 \dots \tau'_{m-1} a'_{m} \tau'_{m} \). The result is \(\tau_0 a_1 \tau_1 \dots \tau_{n-1} a_{n} \tau_{n} + \tau'_0 a'_1 \tau'_1 \dots \tau'_{m-1} a'_{m} \tau'_{m}\).

◆ print()

std::ostream& learnta::TimedWord::print ( std::ostream &  stream) const
inline

Print the timed word to the stream.

Parameters
streamThe stream to write this timed word
Returns
stream

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