From 4fadf17e23676117a02075ea56a2cda85eb6d32b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 21 Apr 2011 18:21:10 +0000 Subject: Boolean is in. --- java/com/xagasoft/gats/GatsBoolean.java | 35 +++++++++++++++++++++++++++++++++ java/com/xagasoft/gats/GatsInteger.java | 5 +++++ java/com/xagasoft/gats/GatsObject.java | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) (limited to 'java/com/xagasoft/gats') diff --git a/java/com/xagasoft/gats/GatsBoolean.java b/java/com/xagasoft/gats/GatsBoolean.java index ec66a5a..8b0ec52 100644 --- a/java/com/xagasoft/gats/GatsBoolean.java +++ b/java/com/xagasoft/gats/GatsBoolean.java @@ -5,17 +5,52 @@ import java.io.OutputStream; public class GatsBoolean extends GatsObject { + private boolean bValue = false; + + public GatsBoolean() + { + } + + public GatsBoolean( boolean bValue ) + { + this.bValue = bValue; + } + + public boolean getValue() + { + return bValue; + } + + public void setValue( boolean bValue ) + { + this.bValue = bValue; + } + public int getType() { return GatsObject.BOOLEAN; } + public String toString() + { + return "" + bValue; + } + public void read( InputStream is, char cType ) throws java.io.IOException { + if( cType == '0' ) + bValue = false; + else if( cType == '1' ) + bValue = true; } public void write( OutputStream os ) throws java.io.IOException { + if( bValue ) + os.write( (int)'0' ); + else + os.write( (int)'1' ); + } }; diff --git a/java/com/xagasoft/gats/GatsInteger.java b/java/com/xagasoft/gats/GatsInteger.java index 1093ab2..139e8ab 100644 --- a/java/com/xagasoft/gats/GatsInteger.java +++ b/java/com/xagasoft/gats/GatsInteger.java @@ -26,6 +26,11 @@ public class GatsInteger extends GatsObject this.iValue = iValue; } + public String toString() + { + return "" + iValue; + } + public int getType() { return GatsObject.INTEGER; diff --git a/java/com/xagasoft/gats/GatsObject.java b/java/com/xagasoft/gats/GatsObject.java index 1538c93..97c9c12 100644 --- a/java/com/xagasoft/gats/GatsObject.java +++ b/java/com/xagasoft/gats/GatsObject.java @@ -33,7 +33,7 @@ public abstract class GatsObject case '0': case '1': - // goRet = new GatsBoolean(); + goRet = new GatsBoolean(); break; case 'l': -- cgit v1.2.3