Documentation ¶
Overview ¶
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 Unknown <applicant@airwallex.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStackTooSmall = errors.New("expected at least 2 items in the stack")
ErrStackTooSmall is raised when the stack has too little items.
Functions ¶
This section is empty.
Types ¶
type AdditionOperator ¶
type AdditionOperator struct {
ArithmeticOperator
}
AdditionOperator is an implementation of the operator.Operator interface which performs the addition of the last 2 numbers on the stack.
func NewAdditionOperator ¶
func NewAdditionOperator() AdditionOperator
NewAdditionOperator creates a new instance of the AdditionOperator
func (AdditionOperator) Identifier ¶
func (o AdditionOperator) Identifier() string
Identifier returns the operation a user can input whilst performing arithmetic operations on the stack
type ArithmeticOperator ¶
type ArithmeticOperator struct{}
ArithmeticOperator is a base struct which implements some helper functions to perform common operations on the stack. FYI: This is only here to demonstrate inheritance in Golang since the implementation is so simple, the Get method should just be a private method in this package
func NewArithmeticOperator ¶
func NewArithmeticOperator() ArithmeticOperator
NewArithmeticOperator creates a new base implementation for the arithmetic operator
type ClearOperator ¶
type ClearOperator struct{}
ClearOperator provides a simple interface to pop the last value of the stack.
func NewClearOperator ¶
func NewClearOperator() ClearOperator
NewClearOperator creates a new ClearOperator instance
func (ClearOperator) Identifier ¶
func (o ClearOperator) Identifier() string
Identifier returns the operation a user can input whilst performing operations on the stack.
type DivisionOperator ¶
type DivisionOperator struct {
ArithmeticOperator
}
DivisionOperator is an implementation of the operator.Operator interface which performs the division of the last 2 numbers on the stack.
func NewDivisionOperator ¶
func NewDivisionOperator() DivisionOperator
NewDivisionOperator is a factory method to construct a new DisivionOperator instance.
func (DivisionOperator) Identifier ¶
func (o DivisionOperator) Identifier() string
Identifier returns the operation a user can input whilst performing arithmetic operations on the stack
type MultiplicationOperator ¶
type MultiplicationOperator struct {
ArithmeticOperator
}
MultiplicationOperator provides a simple interface to compute the multiple of the last two values on the stack.
func NewMultiplicationOperator ¶
func NewMultiplicationOperator() MultiplicationOperator
NewMultiplicationOperator is a factory method to instantiate a new MultiplicationOperator with a default ArtithmeticOperator.
func (MultiplicationOperator) Identifier ¶
func (o MultiplicationOperator) Identifier() string
Identifier returns the operation a user can input whilst performing arithmetic operations on the stack.
type Operator ¶
Operator defines the common interface for any operator. It provides the functionality to operate a command on a stack, allowing the operator to pop and push items from the stack.
type SinOperator ¶
type SinOperator struct{}
SqrtOperator provides a simple interface to compute the sinoid value of the last value on the stack
func NewSinOperator ¶
func NewSinOperator() SinOperator
NewSinOperator is a factory method to instantiate a new SinOperator.
func (SinOperator) Identifier ¶
func (o SinOperator) Identifier() string
Identifier returns the operation a user can input whilst performing arithmetic operations on the stack.
type SqrtOperator ¶
type SqrtOperator struct{}
SqrtOperator provides a simple interface to compute the square root of the last value on the stack
func NewSqrtOperator ¶
func NewSqrtOperator() SqrtOperator
NewSubtractionOperator is a factory method to instantiate a new SqrtOperator
func (SqrtOperator) Identifier ¶
func (o SqrtOperator) Identifier() string
Identifier returns the operation a user can input whilst performing arithmetic operations on the stack
type SubtractionOperator ¶
type SubtractionOperator struct {
ArithmeticOperator
}
SubtractionOperator provides a simple interface to compute two numbers in the stack.
func NewSubtractionOperator ¶
func NewSubtractionOperator() SubtractionOperator
NewSubtractionOperator is a factory method to instantiate a new SubtractionOperator seeded with a default ArithmeticOpertor.
func (SubtractionOperator) Identifier ¶
func (o SubtractionOperator) Identifier() string
Identifier returns the operation a user can input whilst performing arithmetic operations on the stack
type UndoOperator ¶
type UndoOperator struct{}
UndoOperator provides a simple interface to pop the last value of the stack.
func NewUndoOperator ¶
func NewUndoOperator() UndoOperator
NewUndoOperator creates a new UndoOperator instance
func (UndoOperator) Identifier ¶
func (o UndoOperator) Identifier() string
Identifier returns the operation a user can input whilst performing operations on the stack.