using System; using System.Collections.Generic; using System.Text; using Sunweaver.DataPrototypes; namespace Sunweaver.Commands.Abstracts { /// /// An abstract class that handles the fizzle behavior for binary math operations /// abstract public class BinaryOperation : BasePair { protected VirtualMachine VM = null; public override void Implementation(VirtualMachine VM) { //fizzles if there aren't enough values if (VM.Stack.Count() < 2) return; long b = VM.Stack.Pop(); long a = VM.Stack.Pop(); this.VM = VM; Operation(a, b); } /// /// Child members implement this with their specifics /// /// top value on the int stack /// second to top value on the int stack public abstract void Operation(long a, long b); } }