Package gate.util

Examples of gate.util.GateRuntimeException


    } else {
      nameaddition = "_" + nameaddition;
    }
    Controller ctl = ctx.getController();
    if (ctl == null) {
      throw new GateRuntimeException(
          "Controller is null - cannot retrieve the ActionContext PrintStream");
    }
    PrintStream ps = (PrintStream) ctl.getFeatures().get("$$logstream"+nameaddition);
    if (ps == null) {
      throw new GateRuntimeException("No log outstream found!");
    }
    return ps;
  }
View Full Code Here


    try {
      fos = new FileOutputStream(outfile);
    } catch (Exception ex) {
      ctx.endPhase();
      throw new GateRuntimeException("Exception trying to open File stream to "
          + outfile, ex);
    }
    try {
      log = new PrintStream(fos);
    } catch (Exception ex) {
      ctx.endPhase();
      try {
        fos.close();
      } catch (IOException ex1) {
        // ignore
      }
      throw new GateRuntimeException(
          "Exception trying to open PrintStream for " + outfile, ex);
    }
    ctx.getController().getFeatures().put("$$logstream" + nameaddition, log);
    return log;
  }
View Full Code Here

    } else {
      nameaddition = "_" + nameaddition;
    }
    Controller ctl = ctx.getController();
    if (ctl == null) {
      throw new GateRuntimeException(
          "Controller is null - cannot set the ActionContext PrintStream");
    }
    ctl.getFeatures().put("$$logstream"+nameaddition, ps);
  }
View Full Code Here

    } else {
      nameaddition = "_" + nameaddition;
    }
    Controller ctl = ctx.getController();
    if (ctl == null) {
      throw new GateRuntimeException(
          "Controller is null - cannot set the ActionContext PrintStream");
    }
    ctl.getFeatures().remove("$$logstream" + nameaddition);
  }
View Full Code Here

    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (Annotation ann : covered) {
      String str = (String) ann.getFeatures().get(feature);
      if (str == null) {
        throw new GateRuntimeException("No feature " + feature
            + " for a contained annotation of type " + type);
      }
      if (first) {
        first = false;
      } else {
View Full Code Here

   */
  public static FeatureMap getParameters(ActionContext ctx) {
    if(ctx instanceof ExtendedActionContext) {
      return ((ExtendedActionContext)ctx).getParameters();
    } else {
      throw new GateRuntimeException("ActionContext is not an ExtendedActionContext");
    }
  }
View Full Code Here

        return fm.get(name);
      } else {
        return null;
      }
    } else {
      throw new GateRuntimeException("ActionContext is not an ExtendedActionContext");
    }
  }
View Full Code Here

    PrintStream ps;
    try {
      fos = new FileOutputStream(outfile);
    } catch (Exception ex) {
      ctx.endPhase();
      throw new GateRuntimeException("Exception trying to open File stream to "
          + outfile, ex);
    }
    try {
      ps = new PrintStream(fos);
    } catch (Exception ex) {
      ctx.endPhase();
      try {
        fos.close();
      } catch (IOException ex1) {
        // ignore
      }
      throw new GateRuntimeException(
          "Exception trying to open PrintStream for " + outfile, ex);
    }
    ctx.getController().getFeatures().put("$$fileprintstream:" + outFilePath, ps);
    return ps;
  }
View Full Code Here

        valueRefsCur.get(referenceName).add(featureValue);
      }
      return ret;
    } else {
      // this should never occur as we check and set the operator in setValue
      throw new GateRuntimeException("Operator not (yet) supported");
    }
  }
View Full Code Here

  }
  public void setValue(Object value) {
    this.value = value;
    //System.out.println("setValue for "+value);
    if(!(value instanceof Constraint)) {
      throw new GateRuntimeException("Not a constraint: "+value);
    }
    Constraint constraint = (Constraint)value;
    if(constraint.isNegated()) {
      throw new GateRuntimeException("Constraint must not be negated: "+constraint);
    }
    if(constraint.getAttributeSeq().size() != 1) {
      throw new GateRuntimeException("Constraint must have one predicate: "+constraint);
    }
    String annType = constraint.getAnnotType();
    //System.out.println("Annotation type is "+annType);
    ConstraintPredicate pred = constraint.getAttributeSeq().get(0);
    String op = pred.getOperator();
    //System.out.println("Operator is "+op);
    if(op.equals("!~")) {
      operator = OPERATOR_RESET;
    } else if(op.equals("!=~")) {
      operator = OPERATOR_CLEAR;
    } else if(op.equals("==")) {
      operator = OPERATOR_EQUALS;
    } else {
      //System.err.println("Operator is "+op+" but must be one of !=~ (reset), ==, or !=");
      throw new GateRuntimeException("Constraint operator must be !~ (reset),  !=~ (clear), or == (equal to ref)");
    }
    //System.out.println("setValue op is "+op);
    Object predObj = pred.getValue();
    //if(!(predObj instanceof String)) {
    //  throw new GateRuntimeException("Value of predicate must be a string: "+predObj+" not a "+predObj.getClass());
View Full Code Here

TOP

Related Classes of gate.util.GateRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.