The objective of our program is to evaluate if some expressions are true or false.
So basically in the client application here, in the main main method, we have a few callers define
us terminal expressions and we evaluate if those cards are either fast or reliable.
Let's take a look.
Before we execute this, let's take a look at the abstractions.
So we have defined here in abstract class called abstract expression, which has only one method called
interpret, which accepts a pair of tight strings.
This abstract class is implemented in two classes.
Actually, there are three classes.
So let's start first with the terminal expression class.
So this one has the interpreted method here where you verify basically if the context that we give as
a string contains the data that is used to that is used to initialize this class with.
So if yes, it will return true.
If no, it will return false.
And similarly, we have this almost the same implementation for any and all expressions.
But we basically here have two expressions that we need to evaluate.
And if both expressions are true, then two will be outputted here.
And four or basically if one of these expressions is true, then two will be outputted.
Otherwise it will be equal to two.
So basically we have end more operations here defined as expressions.
So in the client class here in in the main method, we have two terminal expressions that we defined
as being equal to two cars and is fast expression is another expression.
So either one of these two cars will be will be equal to Toyota or Lexus.
The old expression will return.
True.
So the same is applicable for reliabilities and car number three and the reliable parameter, the reliable
string will be evaluated in a single expression using anend operator, then this will be returning.
True.
So let's see this in action.
So as you can see, there is fast method, these fast expression here when interpreting the Toyota string
will output through, whereas there is reliable expression, if it will have to interpret reliable Komsomolskaya
Mazda, it will output through.
Otherwise it will output fall.
So let's let's create a new condition here to output the false statement.
So let's put here Lexus.
So as you can see, this expression here is validated as being false, so it's not valid according to
this implementation of this program.
That's it for this tutorial.
Join me in the next video where we are going to discuss about Detroiter Catherine.