Package org.apache.uima.cas

Examples of org.apache.uima.cas.BooleanArrayFS


        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof BooleanArrayFS) {
      BooleanArrayFS arrayFs = (BooleanArrayFS) aSrcFs;
      int len = arrayFs.size();
      BooleanArrayFS destFS = mDestCas.createBooleanArrayFS(len);
      for (int i = 0; i < len; i++) {
        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof ArrayFS) {
      ArrayFS arrayFs = (ArrayFS) aSrcFs;
      int len = arrayFs.size();
      ArrayFS destFS = mDestCas.createArrayFS(len);
      for (int i = 0; i < len; i++) {
        FeatureStructure srcElem = arrayFs.get(i);
        if (srcElem != null) {
          FeatureStructure copyElem = copyFs(arrayFs.get(i));
          destFS.set(i, copyElem);
        }
      }
      return destFS;
    }
    assert false; // the set of array types should be exhaustive, so we should never get here
View Full Code Here


        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof BooleanArrayFS) {
      BooleanArrayFS arrayFs = (BooleanArrayFS) aSrcFs;
      int len = arrayFs.size();
      BooleanArrayFS destFS = mOriginalTgtCasView.createBooleanArrayFS(len);
      for (int i = 0; i < len; i++) {
        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof ArrayFS) {
      ArrayFS arrayFs = (ArrayFS) aSrcFs;
      int len = arrayFs.size();
      ArrayFS destFS = mOriginalTgtCasView.createArrayFS(len);
      for (int i = 0; i < len; i++) {
        FeatureStructure srcElem = arrayFs.get(i);
        if (srcElem != null) {
          FeatureStructure copyElem = copyFsInner(arrayFs.get(i));
          destFS.set(i, copyElem);
        }
      }
      return destFS;
    }
    assert false; // the set of array types should be exhaustive, so we should never get here
View Full Code Here

    assertTrue(byteArrayFS.get(1) == (byte) 16);
    assertTrue(byteArrayFS.get(2) == (byte) 64);
    assertTrue(byteArrayFS.get(3) == (byte) 128);
    assertTrue(byteArrayFS.get(4) == (byte) 255);

    BooleanArrayFS boolArrayFS = (BooleanArrayFS) fs.getFeatureValue(booleanArrayFeature);
    assertTrue(boolArrayFS.get(0));
    assertTrue(!boolArrayFS.get(1));
    assertTrue(boolArrayFS.get(2));
    assertTrue(!boolArrayFS.get(3));
    assertTrue(boolArrayFS.get(4));

    ShortArrayFS shortArrayFS = (ShortArrayFS) fs.getFeatureValue(shortArrayFeature);
    assertTrue(shortArrayFS.get(0) == Short.MAX_VALUE);
    assertTrue(shortArrayFS.get(1) == Short.MAX_VALUE - 1);
    assertTrue(shortArrayFS.get(2) == Short.MAX_VALUE - 2);
View Full Code Here

    byteArrayFS.set(1, (byte) 16);
    byteArrayFS.set(2, (byte) 64);
    byteArrayFS.set(3, (byte) 128);
    byteArrayFS.set(4, (byte) 255);

    BooleanArrayFS boolArrayFS = parmCas.createBooleanArrayFS(20);
    boolean val = false;
    for (int i = 0; i < 20; i++) {
      boolArrayFS.set(i, val = !val);
    }

    ShortArrayFS shortArrayFS = parmCas.createShortArrayFS(5);
    shortArrayFS.set(0, Short.MAX_VALUE);
    shortArrayFS.set(1, (short) (Short.MAX_VALUE - 1));
View Full Code Here

  }

  public void set(String value) {

    if (arrayFS instanceof BooleanArrayFS) {
      BooleanArrayFS array = (BooleanArrayFS) arrayFS;
      array.set(slot, Boolean.parseBoolean(value));
    } else if (arrayFS instanceof ByteArrayFS) {
      ByteArrayFS array = (ByteArrayFS) arrayFS;
      array.set(slot, Byte.parseByte(value));
    } else if (arrayFS instanceof ShortArrayFS) {
      ShortArrayFS array = (ShortArrayFS) arrayFS;
      array.set(slot, Short.parseShort(value));
    } else if (arrayFS instanceof IntArrayFS) {
      IntArrayFS array = (IntArrayFS) arrayFS;
      array.set(slot, Integer.parseInt(value));
    } else if (arrayFS instanceof LongArrayFS) {
      LongArrayFS array = (LongArrayFS) arrayFS;
      array.set(slot, Long.parseLong(value));
    } else if (arrayFS instanceof FloatArrayFS) {
      FloatArrayFS array = (FloatArrayFS) arrayFS;
      array.set(slot, Float.parseFloat(value));
    } else if (arrayFS instanceof DoubleArrayFS) {
      DoubleArrayFS array = (DoubleArrayFS) arrayFS;
      array.set(slot, Double.parseDouble(value));
    } else if (arrayFS instanceof StringArrayFS) {
      StringArrayFS array = (StringArrayFS) arrayFS;
      array.set(slot, value);
    } else {
      throw new CasEditorError("Unkown array type!");
    }
  }
View Full Code Here

  }

  public Object get() {

    if (arrayFS instanceof BooleanArrayFS) {
      BooleanArrayFS array = (BooleanArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof ByteArrayFS) {
      ByteArrayFS array = (ByteArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof ShortArrayFS) {
      ShortArrayFS array = (ShortArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof IntArrayFS) {
      IntArrayFS array = (IntArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof LongArrayFS) {
      LongArrayFS array = (LongArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof FloatArrayFS) {
      FloatArrayFS array = (FloatArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof DoubleArrayFS) {
      DoubleArrayFS array = (DoubleArrayFS) arrayFS;
      return array.get(slot);
    } else if (arrayFS instanceof StringArrayFS) {
      StringArrayFS array = (StringArrayFS) arrayFS;

      String value = array.get(slot);

      if (value == null) {
        value = "";
      }

      return value;
    } else if (arrayFS instanceof ArrayFS) {
      ArrayFS array = (ArrayFS) arrayFS;
      return array.get(slot);
    } else {
      throw new CasEditorError("Unkown array type!");
    }
  }
View Full Code Here

                  return returnFS.toString();
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_BOOLEANARRAY: {
            BooleanArrayFS returnFS = (BooleanArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_BYTEARRAY: {
            ByteArrayFS returnFS = (ByteArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_DOUBLEARRAY: {
            DoubleArrayFS returnFS = (DoubleArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_FLOATARRAY: {
            FloatArrayFS returnFS = (FloatArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               return convertToString(returnFS.toStringArray());
            }
         }
         case LowLevelCAS.TYPE_CLASS_FSARRAY: {
            ArrayFS returnFS = (ArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_INTARRAY: {
            IntArrayFS returnFS = (IntArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_LONGARRAY: {
            LongArrayFS returnFS = (LongArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_SHORTARRAY: {
            ShortArrayFS returnFS = (ShortArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         case LowLevelCAS.TYPE_CLASS_STRINGARRAY: {
            StringArrayFS returnFS = (StringArrayFS) featurePathValue.getFs();
            if (returnFS == null) {
               return null;
            } else {
               // check if we have a built-in function
               if (this.builtInFunction > NO_BUILT_IN_FUNCTION) {
                  return evaluateBuiltInFunction(returnFS);
               } else {
                  return convertToString(returnFS.toStringArray());
               }
            }
         }
         }
      }
View Full Code Here

        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof BooleanArrayFS) {
      BooleanArrayFS arrayFs = (BooleanArrayFS) aSrcFs;
      int len = arrayFs.size();
      BooleanArrayFS destFS = mDestCas.createBooleanArrayFS(len);
      for (int i = 0; i < len; i++) {
        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof ArrayFS) {
      ArrayFS arrayFs = (ArrayFS) aSrcFs;
      int len = arrayFs.size();
      ArrayFS destFS = mDestCas.createArrayFS(len);
      for (int i = 0; i < len; i++) {
        FeatureStructure srcElem = arrayFs.get(i);
        if (srcElem != null) {
          FeatureStructure copyElem = copyFsInner(arrayFs.get(i));
          destFS.set(i, copyElem);
        }
      }
      return destFS;
    }
    assert false; // the set of array types should be exhaustive, so we should never get here
View Full Code Here

        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof BooleanArrayFS) {
      BooleanArrayFS arrayFs = (BooleanArrayFS) aSrcFs;
      int len = arrayFs.size();
      BooleanArrayFS destFS = mDestCas.createBooleanArrayFS(len);
      for (int i = 0; i < len; i++) {
        destFS.set(i, arrayFs.get(i));
      }
      return destFS;
    }
    if (aSrcFs instanceof ArrayFS) {
      ArrayFS arrayFs = (ArrayFS) aSrcFs;
      int len = arrayFs.size();
      ArrayFS destFS = mDestCas.createArrayFS(len);
      for (int i = 0; i < len; i++) {
        FeatureStructure srcElem = arrayFs.get(i);
        if (srcElem != null) {
          FeatureStructure copyElem = copyFs(arrayFs.get(i));
          destFS.set(i, copyElem);
        }
      }
      return destFS;
    }
    assert false; // the set of array types should be exhaustive, so we should never get here
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.BooleanArrayFS

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.