All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.exigen.ie.constrainer.Failure Maven / Gradle / Ivy

package com.exigen.ie.constrainer;

///////////////////////////////////////////////////////////////////////////////
/*
 * Copyright Exigen Group 1998, 1999, 2000
 * 320 Amboy Ave., Metuchen, NJ, 08840, USA, www.exigengroup.com
 *
 * The copyright to the computer program(s) herein
 * is the property of Exigen Group, USA. All rights reserved.
 * The program(s) may be used and/or copied only with
 * the written permission of Exigen Group
 * or in accordance with the terms and conditions
 * stipulated in the agreement/contract under which
 * the program(s) have been supplied.
 */
///////////////////////////////////////////////////////////////////////////////


//
//: Failure.java
//
/**
 * Class Failure implements a special exception generated by Constrainer
 * when some goals/constraints fail.
 *
 * @see Goal#execute()
 */
public class Failure extends Exception
{
  private String _msg;
  private ChoicePointLabel _label = null;

  /**
   * Constructor for a Failure with no description.
   */
  public Failure()
  {
    this("");
  }

  /**
   * Constructor for a Failure with a given description.
   */
  public Failure(String s)
  {
    super(s);
    _msg = s;
    //System.out.println("FAIL: "+this);
  }

  /**
   * Constructor for a Failure with a given description and label.
   */
  public Failure(String s, ChoicePointLabel label)
  {
    super(s);
    _msg = s;
    _label = label;
    //System.out.println("FAIL: "+this);
  }

  /**
   * Sets the description of this failure.
   */
  void message(String s)
  {
    _msg = s;
  }

  /**
   * Returns the failure label.
   */
  public ChoicePointLabel label()
  {
    return _label;
  }

  /**
   * Returns the failure description.
   */
  public String toString()
  {
    return "Failure: " + _msg;
  }

  public Throwable fillInStackTrace()
  {
    return this;
  }

} // ~Failure




© 2015 - 2024 Weber Informatics LLC | Privacy Policy