package basics.collections.index;

import basics.unexpected.Failure;

/**
 * Intended to store exactly one sign which can never be changed!
 * @author ks
 */
public class Sign
{
public final String sign;

public Sign(String input, int x)
{
   try
   {
      sign = input.substring(x, x + 1);
   }
   catch(Throwable t)
   {
      throw new Failure("Invalid sign, length must be 1!");
   }
}

public Sign(String s)
{
   try
   {
      if(s.length() != 1)
         throw new Failure("Invalid sign, length must be 1!");
      sign = s;
   }
   catch(Throwable t)
   {
      throw new Failure("Invalid sign, length must be 1!");
   }
}
}
