AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.example.expr.Power Class Reference

binary power operator: A^B (also A**B) More...

+ Inheritance diagram for aud.example.expr.Power:
+ Collaboration diagram for aud.example.expr.Power:

Public Member Functions

 Power ()
 create operation More...
 
double getValue ()
 get value More...
 
Type getType ()
 Get type identifier. More...
 
Power clone ()
 Get a copy: a new AtomicExpression of same type/content. More...
 
String toString ()
 
- Public Member Functions inherited from aud.example.expr.AtomicExpression
boolean isOperator ()
 node represents operator More...
 
boolean isTerminal ()
 node represents number or symbol More...
 
abstract Type getType ()
 Get type identifier. More...
 
AtomicExpression clone ()
 Get a copy: a new AtomicExpression of same type/content. More...
 
abstract double getValue ()
 get value More...
 

Additional Inherited Members

- Protected Attributes inherited from aud.example.expr.AtomicExpression
ExpressionTree node_ = null
 uplink reference to node: node_.getData()==this @endiliteral
More...
 

Detailed Description

binary power operator: A^B (also A**B)

Definition at line 6 of file Power.java.

Constructor & Destructor Documentation

◆ Power()

create operation

Definition at line 8 of file Power.java.

8{}

Referenced by aud.example.expr.Power.clone().

+ Here is the caller graph for this function:

Member Function Documentation

◆ clone()

Power aud.example.expr.Power.clone ( )

Get a copy: a new AtomicExpression of same type/content.

Reimplemented from aud.example.expr.AtomicExpression.

Definition at line 17 of file Power.java.

17{ return new Power(); }
Power()
create operation
Definition: Power.java:8

References aud.example.expr.Power.Power().

+ Here is the call graph for this function:

◆ getType()

Type aud.example.expr.Power.getType ( )

Get type identifier.

Reimplemented from aud.example.expr.AtomicExpression.

Definition at line 16 of file Power.java.

16{ return Type.OpPower; }

References aud.example.expr.AtomicExpression.Type.OpPower.

◆ getValue()

double aud.example.expr.Power.getValue ( )

get value

Exceptions
UnsupportedOperationExceptionif value cannot be determined

Reimplemented from aud.example.expr.AtomicExpression.

Definition at line 10 of file Power.java.

10 {
11 ExpressionTree left =(ExpressionTree) node_.getLeft();
12 ExpressionTree right=(ExpressionTree) node_.getRight();
13 return
14 Math.pow(left.getData().getValue(),right.getData().getValue());
15 }
BinaryTree< T > getLeft()
get left child or null
Definition: BinaryTree.java:86
BinaryTree< T > getRight()
get right child or null)
Definition: BinaryTree.java:88
ExpressionTree node_
uplink reference to node: node_.getData()==this @endiliteral

References aud.BinaryTree< T >.getData(), aud.BinaryTree< T >.getLeft(), aud.BinaryTree< T >.getRight(), and aud.example.expr.AtomicExpression.node_.

+ Here is the call graph for this function:

◆ toString()

String aud.example.expr.Power.toString ( )

Definition at line 18 of file Power.java.

18{ return "**"; }

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