public static PeanoNumber of(PeanoNumber aPeanoNumber)
		{ 
//			System.Console.WriteLine("executing of"); 
			PeanoNumber tPNum = new Succ();
			tPNum.setPred(aPeanoNumber);
			return tPNum;
		}
Example #2
0
        public virtual PeanoNumber addPeanoNumber(PeanoNumber aPeanoNumber)
        {
            PeanoNumber subTotal;

            subTotal = this.pred.addPeanoNumber(aPeanoNumber);
            return(subTotal.succ());
        }
Example #3
0
        public static PeanoNumber of(PeanoNumber aPeanoNumber)
        {
//			System.Console.WriteLine("executing of");
            PeanoNumber tPNum = new Succ();

            tPNum.setPred(aPeanoNumber);
            return(tPNum);
        }
Example #4
0
        public static PeanoNumber fromInteger(int num)
        {
//			System.Console.WriteLine("fromInteger({0})", num);
            if (num == 0)
            {
//				System.Console.WriteLine("zero");
                return(new Zero());
            }
            else
            {
//				System.Console.WriteLine("entering recursive call");
                PeanoNumber tPNum = PeanoNumber.fromInteger(num - 1);
                return(of(tPNum));
            }
        }
Example #5
0
        public static void Main()
        {
            PeanoNumber pNum = PeanoNumber.fromInteger(2);

            System.Console.WriteLine("PeanoNumber set to 2");
            pNum.print();
            System.Console.WriteLine("");

            PeanoNumber tNum = PeanoNumber.fromInteger(1);

            System.Console.WriteLine("PeanoNumber set to 1");
            tNum.print();
            System.Console.WriteLine("");
            System.Console.WriteLine("add 2 and 1");
            PeanoNumber total = pNum + tNum;

            total.print();
            System.Console.WriteLine("");
        }
Example #6
0
 public override PeanoNumber addPeanoNumber(PeanoNumber aPeanoNumber)
 {
     return(aPeanoNumber);
 }
Example #7
0
 public Succ(PeanoNumber aPeanoNumber)
 {
     pred = aPeanoNumber;
 }
Example #8
0
        public void setPred(PeanoNumber aPeanoNumber)

        {
            this.pred = aPeanoNumber;
        }
	public Succ(PeanoNumber aPeanoNumber)
	{
		pred = aPeanoNumber;
		
	}
	public void setPred(PeanoNumber aPeanoNumber)
		
	{
		this.pred = aPeanoNumber;
	}
	public virtual PeanoNumber addPeanoNumber(PeanoNumber aPeanoNumber)
	{
		PeanoNumber subTotal;
		subTotal = this.pred.addPeanoNumber(aPeanoNumber);
		return subTotal.succ();
	}
	public override PeanoNumber addPeanoNumber(PeanoNumber aPeanoNumber)
	{
		return aPeanoNumber;
	}