Class PossibleMappingsCalculator
- java.lang.Object
-
- graphql.schema.diffing.PossibleMappingsCalculator
-
public class PossibleMappingsCalculator extends java.lang.ObjectWe don't want to allow arbitrary schema changes. For example changing an Object type into a Scalar is not something we want to consider.We do this to make SchemaDiffings better understandable, but also to improve the overall runtime of the algorithm. By restricting the possible mappings the Schema diffing algo is actually able to finish in a reasonable time for real life inputs.
We restrict the algo by calculating which mappings are possible for given vertex. This is later used in
DiffImpl.calcLowerBoundMappingCost(graphql.schema.diffing.Vertex, graphql.schema.diffing.Vertex, java.util.List<graphql.schema.diffing.Vertex>, java.util.Set<graphql.schema.diffing.Vertex>, java.util.List<graphql.schema.diffing.Vertex>, java.util.Set<graphql.schema.diffing.Vertex>). While doing this we need to also ensure that there are the same amount of vertices in the same "context": for example if the source graph has 3 Objects, the target graph needs to have 3 Objects. We achieve this by adding "isolated vertices" as needed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPossibleMappingsCalculator.PossibleMappingsstatic classPossibleMappingsCalculator.VertexContextSegment
-
Constructor Summary
Constructors Constructor Description PossibleMappingsCalculator(SchemaGraph sourceGraph, SchemaGraph targetGraph, graphql.schema.diffing.SchemaDiffingRunningCheck runningCheck)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalcPossibleMappings(java.util.List<PossibleMappingsCalculator.VertexContextSegment> contexts, java.lang.String typeNameForDebug)PossibleMappingsCalculator.PossibleMappingscalculate()PossibleMappingsCalculator.PossibleMappingsgetIsolatedVertices()
-
-
-
Constructor Detail
-
PossibleMappingsCalculator
public PossibleMappingsCalculator(SchemaGraph sourceGraph, SchemaGraph targetGraph, graphql.schema.diffing.SchemaDiffingRunningCheck runningCheck)
-
-
Method Detail
-
calculate
public PossibleMappingsCalculator.PossibleMappings calculate()
-
calcPossibleMappings
public void calcPossibleMappings(java.util.List<PossibleMappingsCalculator.VertexContextSegment> contexts, java.lang.String typeNameForDebug)
-
getIsolatedVertices
public PossibleMappingsCalculator.PossibleMappings getIsolatedVertices()
-
-