org.apache.uima.cas.CAS.getLowLevelCAS()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.apache.uima.cas.CAS.getLowLevelCAS()方法的一些代码示例,展示了CAS.getLowLevelCAS()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CAS.getLowLevelCAS()方法的具体详情如下:
包路径:org.apache.uima.cas.CAS
类名称:CAS
方法名:getLowLevelCAS

CAS.getLowLevelCAS介绍

[英]Get an instance of the low-level CAS. Low-level and regular CAS can be used in parallel, all data is always contained in both.

Note: This is for internal use.
[中]

代码示例

代码示例来源:origin: webanno/webanno

public static <T extends FeatureStructure> T selectByAddr(CAS aCas, Class<T> aType,
    int aAddress)
{
  return aType.cast(aCas.getLowLevelCAS().ll_getFSForRef(aAddress));
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation

public static <T extends FeatureStructure> T selectByAddr(CAS aCas, Class<T> aType,
    int aAddress)
{
  return aType.cast(aCas.getLowLevelCAS().ll_getFSForRef(aAddress));
}

代码示例来源:origin: apache/uima-uimaj

/**
 * Gets the named view; if the view doesn't exist it will be created.
 */
private static CASImpl getOrCreateView(CAS aCas, String aViewName) {
 //TODO: there should be some way to do this without the try...catch
 try { // throws if view doesn't exist
  return (CASImpl) aCas.getView(aViewName).getLowLevelCAS(); 
 }
 catch(CASRuntimeException e) {
  //create the view
  return (CASImpl) aCas.createView(aViewName).getLowLevelCAS(); 
 }
}

代码示例来源:origin: apache/uima-uimaj

public String getValueAsString(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   return ll_getValueAsString(llCas.ll_getFSRef(fs), llCas);
 } else {
   return null;
 }
}

代码示例来源:origin: webanno/webanno

public static Set<FeatureStructure> collectIndexed(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>(Comparator.comparingInt(llcas::ll_getFSRef));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fses::add);
  return fses;
}

代码示例来源:origin: webanno/webanno

public static Set<FeatureStructure> collectReachable(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>(Comparator.comparingInt(llcas::ll_getFSRef));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> collect(fses, fs));
  return fses;
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.testing-asl

public static Set<FeatureStructure> collectIndexed(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1)
      - llcas.ll_getFSRef(fs2));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> fses.add(fs));
  return fses;
}

代码示例来源:origin: apache/uima-uimaj

public Type getType(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if (featurePathValue != null) {
    return featurePathValue.getFeatureType();
   }
 }
 return null;
}

代码示例来源:origin: dkpro/dkpro-core

public static Set<FeatureStructure> collectIndexed(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1)
      - llcas.ll_getFSRef(fs2));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> fses.add(fs));
  return fses;
}

代码示例来源:origin: apache/uima-uimaj

public Float getFloatValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_FLOAT)) {
    return featurePathValue.getFloatValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public Byte getByteValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_BYTE)) {
    return featurePathValue.getByteValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public Double getDoubleValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_DOUBLE)) {
    return featurePathValue.getDoubleValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public Integer getIntValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_INT)) {
    return featurePathValue.getIntValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public Short getShortValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_SHORT)) {
    return featurePathValue.getShortValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public FeatureStructure find(FeatureStructure fs) {
 LowLevelCAS llc = fs.getCAS().getLowLevelCAS();
 final int addr = llc.ll_getFSRef(fs);
 final int resultAddr = this.tree.getKeyForNode(this.tree.findKey(addr));
 if (resultAddr > 0) {
  return llc.ll_getFSForRef(resultAddr);
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public Boolean getBooleanValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_BOOLEAN)) {
    return featurePathValue.getBooleanValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public String getStringValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_STRING)) {
    return featurePathValue.getStringValue();
   }
 }
 return null;
}

代码示例来源:origin: apache/uima-uimaj

public Long getLongValue(FeatureStructure fs) {
 if (fs != null) {
   LowLevelCAS llCas = fs.getCAS().getLowLevelCAS();
   FeaturePathValue featurePathValue = getValue(llCas.ll_getFSRef(fs),
      llCas);
   if ((featurePathValue != null)
      && (featurePathValue.getTypeClass() == LowLevelCAS.TYPE_CLASS_LONG)) {
    return featurePathValue.getLongValue();
   }
 }
 return null;
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.testing-asl

public static Set<FeatureStructure> collectReachable(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1)
      - llcas.ll_getFSRef(fs2));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> collect(fses, fs));
  return fses;
}

代码示例来源:origin: dkpro/dkpro-core

public static Set<FeatureStructure> collectReachable(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1)
      - llcas.ll_getFSRef(fs2));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> collect(fses, fs));
  return fses;
}

相关文章