//================================================================================================== // D a t a _ s t r u c t u r e Java // E x t e n s i o n // D o u b l e P r o p e r t y // By Bruno Bachelet //================================================================================================== // Copyright (c) 1999-2016 // Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net // // This file is part of the B++ Library. This library is free software; you can redistribute it // and/or modify it under the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your option) any later // version. // // This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See // the GNU Library General Public License for more details (http://www.gnu.org).
/*DESCRIPTION*/ /* This module provides a class to model a double float additional property for extendable objects. */
// Package //--------------------------------------------------------------------------------------- package bpp.data_structure.extension;
// Importation //-----------------------------------------------------------------------------------
// D o u b l e P r o p e r t y Class //------------------------------------------------------------ /*CLASS DoubleProperty */ /* Represents a double float additional property for extendable objects. It wraps a value of the primitive type <CODE>double</CODE> in an object. */ public class DoubleProperty implements Property { //---------------------------------------------------------------------------------------Attributes protected double atValue; //--------------------------------------------------------------------------------------Constructor /*METHOD DoubleProperty */ /* Builds a property with default value. */ public DoubleProperty() { atValue=0.0; } //--------------------------------------------------------------------------------------Constructor /*METHOD DoubleProperty */ /* Builds a property from a <CODE>double</CODE> value. */ public DoubleProperty(double agValue) { atValue=agValue; } //----------------------------------------------------------------------------------------Duplicate /*METHOD DoubleProperty */ /* Duplicates the property. */ public Property duplicate() { return (new DoubleProperty(atValue)); } //-----------------------------------------------------------------------------------------ToString /*METHOD DoubleProperty */ /* Returns a string that fully describes the state of the property. */ public String toString() { return (new String(""+atValue)); } //---------------------------------------------------------------------------------------FromString /*METHOD DoubleProperty */ /* Changes the state of the property according to the description provided by a given string. */ public void fromString(String agString) { atValue=Double.parseDouble(agString.trim()); } }
// End //------------------------------------------------------------------------------------------- |
|