/*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
 * 
 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
 * language governing rights and limitations under the License.
 * 
 * The Original Code is the Venice Web Community System.
 * 
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 * 
 * Contributor(s): 
 */
package com.silverwrist.venice.htmlcheck;

public class MarkupData
{
  /*--------------------------------------------------------------------------------
   * Attributes
   *--------------------------------------------------------------------------------
   */

  private String m_begin_markup;
  private String m_text;
  private String m_end_markup;
  private boolean m_rescan;

  /*--------------------------------------------------------------------------------
   * Constructors
   *--------------------------------------------------------------------------------
   */

  public MarkupData(String begin_markup, String text, String end_markup)
  {
    m_begin_markup = begin_markup;
    m_text = text;
    m_end_markup = end_markup;
    m_rescan = false;

  } // end constructor

  public MarkupData(String begin_markup, String text, String end_markup, boolean rescan)
  {
    m_begin_markup = begin_markup;
    m_text = text;
    m_end_markup = end_markup;
    m_rescan = rescan;

  } // end constructor

  /*--------------------------------------------------------------------------------
   * External operations
   *--------------------------------------------------------------------------------
   */

  public String getBeginMarkup()
  {
    return m_begin_markup;

  } // end getBeginMarkup

  public String getText()
  {
    return m_text;

  } // end getText

  public boolean hasText()
  {
    return (m_text!=null) && (m_text.length()>0);

  } // end hasText

  public int getTextLength()
  {
    return (m_text==null) ? 0 : m_text.length();

  } // end getTextLength

  public String getEndMarkup()
  {
    return m_end_markup;

  } // end getEndMarkup

  public String getAll()
  {
    StringBuffer buf = new StringBuffer();
    if (m_begin_markup!=null)
      buf.append(m_begin_markup);
    if (m_text!=null)
      buf.append(m_text);
    if (m_end_markup!=null)
      buf.append(m_end_markup);
    return buf.toString();

  } // end getAll

  public boolean getRescan()
  {
    return m_rescan;

  } // end getRescan

} // end class MarkupData
