Subversion Repositories general

Rev

Rev 1006 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package ak.zpath;

import java.util.List;
import java.util.ArrayList;

public class PathElement
{
  public static final int OPERAND_NONE      = 0;
  public static final int OPERAND_TEXT      = 1;
  public static final int OPERAND_ATTRIBUTE = 2;
  public static final int OPERAND_VARIABLE  = 3;
  public static final int OPERAND_STRING    = 4;
  public static final int OPERATION_ASSIGN  = 5;
  public static final int OPERATION_EQUAL   = 6;
  public static final int OPERATION_APPEND  = 7;
  public static final int OPERATION_EXIST   = 8;

  private String        name;
  private boolean       isNew             = false;
  private int           index             = 0;
  private List          conditions        = new ArrayList();
  private PathCondition condition;
  private int           firstOperandType  = OPERAND_NONE;
  private String        firstOperandValue;
  private int           secondOperandType;
  private String        secondOperandValue;
  private int           operationType;

  public String getName()
  {
    return name;
  }

  public void setName(String name)
  {
    this.name = name;
  }

  public int getFirstOperandType()
  {
    return firstOperandType;
  }

  public String getFirstOperandValue()
  {
    return firstOperandValue;
  }

  public void setFirstOperand(int operandType, String value)
  {
    firstOperandType  = operandType;
    firstOperandValue = value;
  }

  public int getOperation()
  {
    return operationType;
  }

  public void setOperation(int operationType)
  {
    this.operationType = operationType;
  }

  public int getSecondOperandType()
  {
    return secondOperandType;
  }

  public String getSecondOperandValue()
  {
    return secondOperandValue;
  }

  public void setSecondOperand(int operandType, String value)
  {
    secondOperandType  = operandType;
    secondOperandValue = value;
  }

  public void validateOperands()
  {
  }

  public List getConditions()
  {
    return conditions;
  }

  public void addCondition()
  {
    condition = new PathCondition();
    conditions.add(condition);
  }

  public void setFirstCondition(int operandType, String value)
  {
    condition.setFirstOperandType(operandType);
    condition.setFirstOperandValue(value);
  }

  public void setConditionOperation(int operationType)
  {
    condition.setOperation(operationType);
  }

  public void setSecondCondition(int operandType, String value)
  {
    condition.setSecondOperandType(operandType);
    condition.setSecondOperandValue(value);
  }

  public void validateCondition()
  {
    condition.validateCondition();
  }

  public boolean getNew()
  {
    return isNew;
  }

  public void setNew()
  {
    isNew = true;
  }

  public int getIndex()
  {
    return index;
  }

  public void setIndex(int index)
  {
    this.index = index;
  }

  public String toString()
  {
    return "Element [" + name + "]";
  }
}