Package gate.util

Examples of gate.util.GateRuntimeException


    fireStatusChanged("IndirectLanguageAnalyserPR processing: "
            + getDocument().getName());


    if (!(document instanceof DocumentImpl)) {
      throw new GateRuntimeException("Can only handle DocumentImpl not " +
          document.getClass());
    }
    String newText = annotatedDocumentTransformer.getStringForDocument(
            getDocument(), inputAnnotationSetName);
    FeatureMap theparms = Factory.newFeatureMap();
    theparms.put("encoding", ((DocumentImpl) document).getEncoding());
    theparms.put("stringContent", newText);
    FeatureMap thefeats = Factory.newFeatureMap();
    FeatureMap docfeats = document.getFeatures();
    thefeats.putAll(docfeats);

    String theName = document.getName();
    // create a copy of the current document
    Document newDoc;
    try {
      newDoc = (Document) Factory.createResource(
              "gate.corpora.DocumentImpl",
              theparms,
              thefeats,
              theName+"_virtual");
    } catch (ResourceInstantiationException ex) {
      throw new GateRuntimeException(ex);
    }

    doExecute(newDoc);

    List<String> effectiveMapFromAnnsetNames = new ArrayList<String>();
View Full Code Here


  @Optional
  @CreoleParameter(
    comment = "The URL of the directory where to generate the grammar file (default: system temp dir)")
  public void setGeneratedJapeDirUrl(URL url) {
    if(url != null && !url.getProtocol().startsWith("file:")) {
      throw new GateRuntimeException("generatedJapeDirUrl parameter must be a file URL not "+url.getProtocol());
    }
    generatedJapeDirUrl = url;
  }
View Full Code Here

  @Optional
  @CreoleParameter(
    comment = "The URL of the directory where to generate the grammar file (default: system temp dir)")
  public void setGeneratedJapeDirUrl(URL url) {
    if(url != null && !url.getProtocol().startsWith("file:")) {
      throw new GateRuntimeException("generatedJapeDirUrl parameter must be a file URL not "+url.getProtocol());
    }
    generatedJapeDirUrl = url;
  }
View Full Code Here

   */
  public static AnnotationSet getBindings(Map<String, AnnotationSet> bindings,
      String bindingName) {
    AnnotationSet set = bindings.get(bindingName);
    if (set == null) {
      throw new GateRuntimeException("No bindings named " + bindingName);
    }
    return new ImmutableAnnotationSetImpl(set.getDocument(), set) {
      private static final long serialVersionUID = -6703131102439043539L;
    };
  }
View Full Code Here

   */
  public static AnnotationSet getAnnsForType(AnnotationSet annset,
      String typeName) {
    AnnotationSet set = annset.get(typeName);
    if (set == null) {
      throw new GateRuntimeException("Got a null set for type " + typeName);
    }
    return new ImmutableAnnotationSetImpl(annset.getDocument(), set) {
      private static final long serialVersionUID = -6703131102439043539L;
    };
  }
View Full Code Here

   * @return
   */
  public static Annotation getLongestAnn(AnnotationSet annset) {
    Annotation ann = null;
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    for (Annotation a : annset) {
      if (ann == null) {
        ann = a;
      } else if (Utils.length(a) > Utils.length(ann)) {
View Full Code Here

   *
   */
  public static Annotation getLongestLeftmostAnn(AnnotationSet annset) {
    Annotation ann = null;
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int offset = Integer.MAX_VALUE;
    for (Annotation a : annset) {
      if (startOffset(a) < offset) {
        offset = startOffset(a);
View Full Code Here

   * @return
   */
  public static Annotation getLongestRightmostAnn(AnnotationSet annset) {
    Annotation ann = null;
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int offset = 0;
    for (Annotation a : annset) {
      if (startOffset(a) > offset) {
        offset = startOffset(a);
View Full Code Here

   * @return
   */
  public static AnnotationSet getLeftmostAnns(AnnotationSet annset) {
    List<Annotation> anns = new LinkedList<Annotation>();
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int offset = Integer.MAX_VALUE;
    for (Annotation a : annset) {
      if (a.getStartNode().getOffset().intValue() < offset) {
        offset = startOffset(a);
View Full Code Here

   * @return
   */
  public static AnnotationSet getRightmostAnns(AnnotationSet annset) {
    List<Annotation> anns = new LinkedList<Annotation>();
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int offset = 0;
    for (Annotation a : annset) {
      if (startOffset(a) > offset) {
        offset = startOffset(a);
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.