public abstract class AlignmentUtil extends Object
Constructor and Description |
---|
AlignmentUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addValues(Group group,
List<ChildContext> path,
com.google.common.collect.Multiset<Object> collectedValues,
boolean onlyValues)
Add the values found on the given path to the given set.
|
static boolean |
associatedWith(EntityDefinition entity,
Cell cell,
boolean allowInheritance,
boolean orChildren)
Checks whether the given entity (or one of its children) is associated
with the given cell (considering inheritance).
|
static EntityDefinition |
createEntity(Path<Definition<?>> path,
SchemaSpaceID schemaSpace,
Filter filter)
Create an entity definition from a definition path.
|
static EntityDefinition |
createEntity(TypeDefinition type,
List<ChildContext> path,
SchemaSpaceID schemaSpace,
Filter filter)
Create an entity definition from a type and a child path.
|
static EntityDefinition |
deriveEntity(EntityDefinition entity,
int pathLength)
Derive an entity definition from the given one but with a maximum path
length.
|
static boolean |
entityOrChildContained(EntityDefinition entity,
Iterable<? extends Entity> candidates)
Determines if the given entity definition or one of its children is
contained in the given entity candidates.
|
static boolean |
entityOrChildMapped(EntityDefinition entity,
Alignment alignment)
States if the given entity definition or one of its children is mapped in
the given alignment.
|
static EntityDefinition |
getAllDefaultEntity(EntityDefinition entity)
Get the entity definition based on the given entity definition with the
default instance context for each path entry.
|
static EntityDefinition |
getChild(EntityDefinition entity,
QName childName)
Get the default child of the given entity.
|
static Condition |
getContextCondition(EntityDefinition candidate)
Get the context condition of the given entity definition.
|
static Integer |
getContextIndex(EntityDefinition candidate)
Get the context index of the given entity definition.
|
static Integer |
getContextName(EntityDefinition candidate)
Get the context name of the given entity definition.
|
static String |
getContextText(EntityDefinition entityDef)
Get a text representation for the entity definition context.
|
static EntityDefinition |
getDefaultEntity(EntityDefinition entity)
Get the entity definition with the default instance context which is a
sibling to (or the same as) the given entity definition.
|
static String |
getFilterText(Filter filter)
Get the text to display for a filter.
|
static EntityDefinition |
getParent(EntityDefinition entity)
Get the parent entity definition for the given entity definition.
|
static TypeEntityDefinition |
getTypeEntity(EntityDefinition entityDef)
Get the type entity definition of the given entity definition.
|
static com.google.common.collect.Multiset<Object> |
getValues(Instance instance,
PropertyEntityDefinition definition,
boolean onlyValues)
Returns the values of the given instance which match the given property
entity definition.
|
static boolean |
hasTypeRelation(Alignment alignment)
Determines if the given alignment has any type relations.
|
static boolean |
hasTypeRelation(Alignment alignment,
TypeEntityDefinition sourceType,
TypeEntityDefinition targetType)
Determines if the given alignment contains a relation between the given
types.
|
static boolean |
isAugmentation(Cell cell)
Determines if the given cell is an augmentation.
|
static boolean |
isDefaultEntity(EntityDefinition entity)
Determines if the given entity is a default entity.
|
static boolean |
isParent(EntityDefinition parent,
EntityDefinition child)
Determines if a given entity definition is a parent of another entity
definition or if both are equal.
|
static boolean |
isTypeCell(Cell cell)
Determines if the given cell is a type cell.
|
static boolean |
matchCondition(Condition condition,
Object value,
Object parent)
Match a property condition against a property value.
|
static Cell |
reparentCell(Cell propertyCell,
Cell typeCell,
boolean strict)
Returns a cell like the given property cell with all source and target
types matching those off the given type cell.
If the types already match they are unchanged. |
public static boolean isTypeCell(Cell cell)
cell
- the cellpublic static boolean hasTypeRelation(Alignment alignment)
alignment
- the alignmentpublic static boolean hasTypeRelation(Alignment alignment, TypeEntityDefinition sourceType, TypeEntityDefinition targetType)
alignment
- the alignmentsourceType
- the source type, may be null
for any
source typetargetType
- the target type, may be null
for any
target typepublic static boolean isAugmentation(Cell cell)
cell
- the cellpublic static EntityDefinition getParent(EntityDefinition entity)
entity
- the entity definitionnull
if it has no
parentpublic static EntityDefinition getChild(EntityDefinition entity, QName childName)
entity
- the parent entitychildName
- the child namenull
if no child with the given
name existspublic static EntityDefinition createEntity(TypeDefinition type, List<ChildContext> path, SchemaSpaceID schemaSpace, Filter filter)
type
- the path parentpath
- the child pathschemaSpace
- the associated schema spacefilter
- the entity filter on the type, may be null
public static EntityDefinition createEntity(Path<Definition<?>> path, SchemaSpaceID schemaSpace, Filter filter)
path
- the definition path, the topmost element has to represent a
TypeDefinition
, all other elements must be
ChildDefinition
sschemaSpace
- the associated schema spacefilter
- the entity filter on the type, may be null
public static EntityDefinition getDefaultEntity(EntityDefinition entity)
entity
- the entity definitionpublic static EntityDefinition getAllDefaultEntity(EntityDefinition entity)
entity
- the entity definitionpublic static EntityDefinition deriveEntity(EntityDefinition entity, int pathLength)
entity
- the entity definitionpathLength
- the maximum path lengthpublic static boolean isParent(EntityDefinition parent, EntityDefinition child)
parent
- the parentchild
- the potential childpublic static boolean entityOrChildMapped(EntityDefinition entity, Alignment alignment)
entity
- the entity definitionalignment
- the alignmentpublic static boolean entityOrChildContained(EntityDefinition entity, Iterable<? extends Entity> candidates)
entity
- the entity definitioncandidates
- the entity candidates to testpublic static TypeEntityDefinition getTypeEntity(EntityDefinition entityDef)
entityDef
- the entity definitionTypeEntityDefinition
,
otherwise a new type entity definition is createdpublic static Integer getContextName(EntityDefinition candidate)
candidate
- the entity definitionnull
for the default contextpublic static Integer getContextIndex(EntityDefinition candidate)
candidate
- the entity definitionnull
for the default contextpublic static Condition getContextCondition(EntityDefinition candidate)
candidate
- the entity definitionnull
for the default contextpublic static String getContextText(EntityDefinition entityDef)
entityDef
- the entity definitionnull
if it is the default
context or the context has no text representationpublic static String getFilterText(Filter filter)
filter
- the filter, may be null
null
public static boolean isDefaultEntity(EntityDefinition entity)
entity
- the entity to checkpublic static boolean matchCondition(Condition condition, Object value, Object parent)
condition
- the property conditionvalue
- the property valueparent
- the parent of the property value, may be null
if there is nonepublic static Cell reparentCell(Cell propertyCell, Cell typeCell, boolean strict)
propertyCell
- the property cell to updatetypeCell
- the type cell with the target typesstrict
- If false and the target type cell has no sources or target,
the property cell is updated to have the sources/target in
their declaring type. If true, said properties are left
unchanged. Does not matter for complete type cells, since they
have sources and a target.null
if an update isn't possiblepublic static boolean associatedWith(EntityDefinition entity, Cell cell, boolean allowInheritance, boolean orChildren)
entity
- the entity to checkcell
- the cell to check the entity againstallowInheritance
- whether inheritance is allowedorChildren
- will also check against the entities childrenpublic static com.google.common.collect.Multiset<Object> getValues(Instance instance, PropertyEntityDefinition definition, boolean onlyValues)
instance
- the instance to collect values fromdefinition
- the propertyonlyValues
- whether to only return values, or to return whatever
can be found (including groups/instances)public static void addValues(Group group, List<ChildContext> path, com.google.common.collect.Multiset<Object> collectedValues, boolean onlyValues)
group
- the parent grouppath
- the path on the groupcollectedValues
- the set to add the values toonlyValues
- whether to only return values, or to return whatever
can be found (including groups/instances)Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a