Package org.apache.uima.jcas.cas

Examples of org.apache.uima.jcas.cas.EmptyStringList


  public void testGetNthStringList() throws Exception {
    try {
      NonEmptyStringList stringList1 = new NonEmptyStringList(jcas);
      stringList1.setHead("2");
      stringList1.setTail(new EmptyStringList(jcas));
      NonEmptyStringList stringList = new NonEmptyStringList(jcas);
      stringList.setHead("1");
      stringList.setTail(stringList1);
      EmptyStringList emptyFsList = new EmptyStringList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here


  public void testGetNthStringList() throws Exception {
    try {
      NonEmptyStringList stringList1 = new NonEmptyStringList(jcas);
      stringList1.setHead("2");
      stringList1.setTail(new EmptyStringList(jcas));
      NonEmptyStringList stringList = new NonEmptyStringList(jcas);
      stringList.setHead("1");
      stringList.setTail(stringList1);
      EmptyStringList emptyFsList = new EmptyStringList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

    return list;
  }

  public static StringList createStringList(JCas aJCas, Collection<String> aCollection) {
    if (aCollection.isEmpty()) {
      return new EmptyStringList(aJCas);
    }

    NonEmptyStringList head = new NonEmptyStringList(aJCas);
    NonEmptyStringList list = head;
    Iterator<String> i = aCollection.iterator();
    while (i.hasNext()) {
      head.setHead(i.next());
      if (i.hasNext()) {
        head.setTail(new NonEmptyStringList(aJCas));
        head = (NonEmptyStringList) head.getTail();
      } else {
        head.setTail(new EmptyStringList(aJCas));
      }
    }

    return list;
  }
View Full Code Here

  public void testGetNthStringList() throws Exception {
    try {
      NonEmptyStringList stringList1 = new NonEmptyStringList(jcas);
      stringList1.setHead("2");
      stringList1.setTail(new EmptyStringList(jcas));
      NonEmptyStringList stringList = new NonEmptyStringList(jcas);
      stringList.setHead("1");
      stringList.setTail(stringList1);
      EmptyStringList emptyFsList = new EmptyStringList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

  public void testGetNthStringList() throws Exception {
    try {
      NonEmptyStringList stringList1 = new NonEmptyStringList(jcas);
      stringList1.setHead("2");
      stringList1.setTail(new EmptyStringList(jcas));
      NonEmptyStringList stringList = new NonEmptyStringList(jcas);
      stringList.setHead("1");
      stringList.setTail(stringList1);
      EmptyStringList emptyFsList = new EmptyStringList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

  public void testGetNthStringList() throws Exception {
    try {
      NonEmptyStringList stringList1 = new NonEmptyStringList(jcas);
      stringList1.setHead("2");
      stringList1.setTail(new EmptyStringList(jcas));
      NonEmptyStringList stringList = new NonEmptyStringList(jcas);
      stringList.setHead("1");
      stringList.setTail(stringList1);
      EmptyStringList emptyFsList = new EmptyStringList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

  public void testGetNthStringList() throws Exception {
    try {
      NonEmptyStringList stringList1 = new NonEmptyStringList(jcas);
      stringList1.setHead("2");
      stringList1.setTail(new EmptyStringList(jcas));
      NonEmptyStringList stringList = new NonEmptyStringList(jcas);
      stringList.setHead("1");
      stringList.setTail(stringList1);
      EmptyStringList emptyFsList = new EmptyStringList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

    return list;
  }

  public static StringList createStringList(JCas aJCas, Collection<String> aCollection) {
    if (aCollection.isEmpty()) {
      return new EmptyStringList(aJCas);
    }

    NonEmptyStringList head = new NonEmptyStringList(aJCas);
    NonEmptyStringList list = head;
    Iterator<String> i = aCollection.iterator();
    while (i.hasNext()) {
      head.setHead(i.next());
      if (i.hasNext()) {
        head.setTail(new NonEmptyStringList(aJCas));
        head = (NonEmptyStringList) head.getTail();
      } else {
        head.setTail(new EmptyStringList(aJCas));
      }
    }

    return list;
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.jcas.cas.EmptyStringList

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.