package com.xagasoft.gats; import java.io.InputStream; import java.io.OutputStream; /** * Represents a boolean value. This is probably the simplest of all Gats * objects. It can be true or false. */ public class GatsBoolean extends GatsObject { private boolean bValue = false; /** * Construct a new GatsBoolean, the default value is false. */ public GatsBoolean() { } /** * Construct a new GatsBoolean, specify the value.; */ public GatsBoolean( boolean bValue ) { this.bValue = bValue; } /** * Get the current value, either true or false. */ public boolean getValue() { return bValue; } /** * Set the value. */ public void setValue( boolean bValue ) { this.bValue = bValue; } public int getType() { return GatsObject.BOOLEAN; } public String toString() { return "" + bValue; } void read( InputStream is, char cType ) throws java.io.IOException { if( cType == '0' ) bValue = false; else if( cType == '1' ) bValue = true; } void write( OutputStream os ) throws java.io.IOException { if( bValue ) os.write( (int)'1' ); else os.write( (int)'0' ); } };