Class C3Linearization
java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.C3Linearization
Implements the C3 linearization (Method Resolution Order) merge step used to
deterministically order a Type's ancestors under multiple inheritance.
- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionMerges the given sequences following the C3 algorithm: repeatedly takes the head of the first sequence that does not appear in the tail of any other sequence, until all sequences are consumed.
-
Method Details
-
merge
public static List<String> merge(String typeName, List<List<String>> sequences) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException Merges the given sequences following the C3 algorithm: repeatedly takes the head of the first sequence that does not appear in the tail of any other sequence, until all sequences are consumed.- Parameters:
typeName- the name of the type being linearized, used only for the error messagesequences- each direct parent's own linearization (parent first), plus the local precedence list of direct parents in declaration order, last- Returns:
- the merged, linearized list of ancestor names
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException- if no consistent linearization exists (multiple-inheritance conflict)
-