Package org.apache.uima.cas.impl
Class LinearTypeOrderBuilderImpl
- java.lang.Object
-
- org.apache.uima.cas.impl.LinearTypeOrderBuilderImpl
-
- All Implemented Interfaces:
LinearTypeOrderBuilder
public class LinearTypeOrderBuilderImpl extends java.lang.Object implements LinearTypeOrderBuilder
Implementation of theLinearTypeOrderBuilder
interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
LinearTypeOrderBuilderImpl.Graph
private class
LinearTypeOrderBuilderImpl.Node
static class
LinearTypeOrderBuilderImpl.TotalTypeOrder
An implementation of theLinearTypeOrder
interface.
-
Field Summary
Fields Modifier and Type Field Description private LinearTypeOrderBuilderImpl.Graph
order
private TypeSystem
ts
-
Constructor Summary
Constructors Constructor Description LinearTypeOrderBuilderImpl(TypeSystem ts)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String[] types)
Add pairs types[i] < types[i+1], for each i < (types.length-1), to the partial sort order.private boolean
add(java.lang.String s1, java.lang.String s2)
private void
addInheritanceTypes()
static LinearTypeOrder
createTypeOrder(int[] typeList, TypeSystem ts)
The constructor for the total type order, called by the other constructor and also when doing a cas complete deserialization, or just deserializing the type system/index defsLinearTypeOrder
getOrder()
Return a total order of the type names added earlier that is consistent with the pre-order defined through calls to add().
-
-
-
Field Detail
-
order
private LinearTypeOrderBuilderImpl.Graph order
-
ts
private TypeSystem ts
-
-
Constructor Detail
-
LinearTypeOrderBuilderImpl
public LinearTypeOrderBuilderImpl(TypeSystem ts)
-
-
Method Detail
-
createTypeOrder
public static LinearTypeOrder createTypeOrder(int[] typeList, TypeSystem ts)
The constructor for the total type order, called by the other constructor and also when doing a cas complete deserialization, or just deserializing the type system/index defs- Parameters:
typeList
- -ts
- -- Returns:
- -
-
add
public void add(java.lang.String[] types) throws CASException
Description copied from interface:LinearTypeOrderBuilder
Add pairs types[i] < types[i+1], for each i < (types.length-1), to the partial sort order. This method can be called as often as desired. It will throw an exception if the pairs could not be successfully added to the relation. A pair can not be added if the resulting relation is no longer a partial order. If you need to know exactly which pair fails, always call add() with a two-element array.- Specified by:
add
in interfaceLinearTypeOrderBuilder
- Parameters:
types
- types to add- Throws:
CASException
- When adding pairs would make order inconsistent.
-
add
private boolean add(java.lang.String s1, java.lang.String s2)
-
addInheritanceTypes
private void addInheritanceTypes()
-
getOrder
public LinearTypeOrder getOrder() throws CASException
Description copied from interface:LinearTypeOrderBuilder
Return a total order of the type names added earlier that is consistent with the pre-order defined through calls to add().- Specified by:
getOrder
in interfaceLinearTypeOrderBuilder
- Returns:
- An array of Strings in ascending order.
- Throws:
CASException
- if any error
-
-