// -*- c++ -*-

/*
 * Jakelib2 - General purpose C++ library
 * Copyright(C) 2001 Florian Wolff (florian@donuz.de)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: FieldPosition.h,v 1.3 2003/09/16 20:16:24 florian Exp $
 */

#ifndef INCLUDE_JAKELIB2_TEXT_FIELDPOSITION_H
# define INCLUDE_JAKELIB2_TEXT_FIELDPOSITION_H

namespace jakelib {

  namespace lang {
    class Object;
    class String;
  }

  namespace text {
    /**
     *
     * @author Alex Fabijanic <fabijanica@nucorsteel.com>(jakelib2 port)
     */
    class FieldPosition : public jakelib::lang::Object
    {
    public:

      /**
       * This method initializes a new instance of FieldPosition to
       * have the specified field id.
       *
       * @param field_id The field identifier value.
       */
      FieldPosition(jint field_id);

      /**
       * This method returns the field identifier value for this object.
       *
       * @return The field identifier.
       */
      jint getField();

      /**
       * This method returns the beginning index for this field.
       *
       * @return The beginning index.
       */
      jint getBeginIndex();

      /**
       * This method sets the beginning index of this field to
       * the specified value.
       *
       * @param begin The new beginning index.
       */
      void setBeginIndex(int begin);

      /**
       * This method returns the ending index for the field.
       *
       * @return The ending index.
       */
      jint getEndIndex();

      /**
       * This method sets the ending index of this field to
       * the specified value.
       *
       * @param end The new ending index.
       */
      void setEndIndex(jint end);

      /**
       * This method tests this object for equality against the specified object.
       * The objects will be considered equal if and only if:
       *
       * \li The specified object is not \c null.
       * \li The specified object is an instance of FieldPosition.
       * \li The specified object has the same field identifier and beginning
       * and ending index as this object.
       *
       * @param obj The object to test for equality to this object.
       * @return \c true if the specified object is equal to
       *          this object, \c  false otherwise. 
       */
      jboolean equals(jakelib::lang::Object* obj);

      /**
       * This method returns a <code>String</code> representation of this
       * object.
       *
       * @return A <code>String</code> representation of this object.
       */
       jakelib::lang::String* toString();

    private:

      /**
       * This is the field identifier value.
       */
      jint field_id;

      /**
       * This is the beginning index of the field.
       */
      jint begin;

      /**
       * This is the ending index of the field.
       */
      jint end;

      JAKELIB_DECLARE_CLASS(FieldPosition);
    };
    JAKELIB_DECLARE_ARRAY(FieldPosition);
  }
}

#endif
