diff --git a/pkg/ds/tripleset_left.go b/pkg/ds/tripleset_left.go index d44bab5..7f37353 100644 --- a/pkg/ds/tripleset_left.go +++ b/pkg/ds/tripleset_left.go @@ -22,7 +22,7 @@ func CartesianLeftTriple[S1 Set[S1], S2 Set[S2], S3 Set[S3]](s1 S1, s2 S2, s3 S3 } func (c *LeftTripleSet[S1, S2, S3]) Equal(other TripleSet[S1, S2, S3]) bool { - return c.m.Equal(asLeftTripleSet(other).m) + return c.m.Equal(AsLeftTripleSet(other).m) } func (c *LeftTripleSet[S1, S2, S3]) Copy() TripleSet[S1, S2, S3] { @@ -41,7 +41,7 @@ func (c *LeftTripleSet[S1, S2, S3]) Size() int { return c.m.Size() } -func asLeftTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, S3]) *LeftTripleSet[S1, S2, S3] { +func AsLeftTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, S3]) *LeftTripleSet[S1, S2, S3] { r, ok := other.(*LeftTripleSet[S1, S2, S3]) if ok { return r @@ -55,19 +55,19 @@ func asLeftTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, // IsSubset returns true if c is subset of other func (c *LeftTripleSet[S1, S2, S3]) IsSubset(other TripleSet[S1, S2, S3]) bool { - return c.m.IsSubset(asLeftTripleSet(other).m) + return c.m.IsSubset(AsLeftTripleSet(other).m) } func (c *LeftTripleSet[S1, S2, S3]) Union(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &LeftTripleSet[S1, S2, S3]{m: c.m.Union(asLeftTripleSet(other).m)} + return &LeftTripleSet[S1, S2, S3]{m: c.m.Union(AsLeftTripleSet(other).m)} } func (c *LeftTripleSet[S1, S2, S3]) Intersect(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &LeftTripleSet[S1, S2, S3]{m: c.m.Intersect(asLeftTripleSet(other).m)} + return &LeftTripleSet[S1, S2, S3]{m: c.m.Intersect(AsLeftTripleSet(other).m)} } func (c *LeftTripleSet[S1, S2, S3]) Subtract(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &LeftTripleSet[S1, S2, S3]{m: c.m.Subtract(asLeftTripleSet(other).m)} + return &LeftTripleSet[S1, S2, S3]{m: c.m.Subtract(AsLeftTripleSet(other).m)} } func (c *LeftTripleSet[S1, S2, S3]) NumPartitions() int { @@ -96,7 +96,7 @@ func (c *LeftTripleSet[S1, S2, S3]) Partitions() []Triple[S1, S2, S3] { func MapTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3], T1 Set[T1], T2 Set[T2], T3 Set[T3]](c TripleSet[S1, S2, S3], f func(Triple[S1, S2, S3]) Triple[T1, T2, T3]) TripleSet[T1, T2, T3] { var res TripleSet[T1, T2, T3] = NewLeftTripleSet[T1, T2, T3]() - for _, triple := range partitionsMap(asLeftTripleSet(c), f) { + for _, triple := range partitionsMap(AsLeftTripleSet(c), f) { res = res.Union(CartesianLeftTriple(triple.S1, triple.S2, triple.S3)) } return res diff --git a/pkg/ds/tripleset_outer.go b/pkg/ds/tripleset_outer.go index 15036b3..ce834e2 100644 --- a/pkg/ds/tripleset_outer.go +++ b/pkg/ds/tripleset_outer.go @@ -21,7 +21,7 @@ func CartesianOuterTriple[S1 Set[S1], S2 Set[S2], S3 Set[S3]](s1 S1, s2 S2, s3 S } func (c *OuterTripleSet[S1, S2, S3]) Equal(other TripleSet[S1, S2, S3]) bool { - return c.m.Equal(asOuterTripleSet(other).m) + return c.m.Equal(AsOuterTripleSet(other).m) } func (c *OuterTripleSet[S1, S2, S3]) Copy() TripleSet[S1, S2, S3] { @@ -40,7 +40,7 @@ func (c *OuterTripleSet[S1, S2, S3]) Size() int { return c.m.Size() } -func asOuterTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, S3]) *OuterTripleSet[S1, S2, S3] { +func AsOuterTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, S3]) *OuterTripleSet[S1, S2, S3] { r, ok := other.(*OuterTripleSet[S1, S2, S3]) if ok { return r @@ -54,19 +54,19 @@ func asOuterTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2 // IsSubset returns true if c is subset of other func (c *OuterTripleSet[S1, S2, S3]) IsSubset(other TripleSet[S1, S2, S3]) bool { - return c.m.IsSubset(asOuterTripleSet(other).m) + return c.m.IsSubset(AsOuterTripleSet(other).m) } func (c *OuterTripleSet[S1, S2, S3]) Union(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &OuterTripleSet[S1, S2, S3]{m: c.m.Union(asOuterTripleSet(other).m).(*LeftTripleSet[S1, S3, S2])} + return &OuterTripleSet[S1, S2, S3]{m: c.m.Union(AsOuterTripleSet(other).m).(*LeftTripleSet[S1, S3, S2])} } func (c *OuterTripleSet[S1, S2, S3]) Intersect(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &OuterTripleSet[S1, S2, S3]{m: c.m.Intersect(asOuterTripleSet(other).m).(*LeftTripleSet[S1, S3, S2])} + return &OuterTripleSet[S1, S2, S3]{m: c.m.Intersect(AsOuterTripleSet(other).m).(*LeftTripleSet[S1, S3, S2])} } func (c *OuterTripleSet[S1, S2, S3]) Subtract(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &OuterTripleSet[S1, S2, S3]{m: c.m.Subtract(asOuterTripleSet(other).m).(*LeftTripleSet[S1, S3, S2])} + return &OuterTripleSet[S1, S2, S3]{m: c.m.Subtract(AsOuterTripleSet(other).m).(*LeftTripleSet[S1, S3, S2])} } func (c *OuterTripleSet[S1, S2, S3]) Partitions() []Triple[S1, S2, S3] { diff --git a/pkg/ds/tripleset_right.go b/pkg/ds/tripleset_right.go index 0a1165d..c5b06e8 100644 --- a/pkg/ds/tripleset_right.go +++ b/pkg/ds/tripleset_right.go @@ -21,7 +21,7 @@ func CartesianRightTriple[S1 Set[S1], S2 Set[S2], S3 Set[S3]](s1 S1, s2 S2, s3 S } func (c *RightTripleSet[S1, S2, S3]) Equal(other TripleSet[S1, S2, S3]) bool { - return c.m.Equal(asRightTripleSet(other).m) + return c.m.Equal(AsRightTripleSet(other).m) } func (c *RightTripleSet[S1, S2, S3]) Copy() TripleSet[S1, S2, S3] { @@ -40,7 +40,7 @@ func (c *RightTripleSet[S1, S2, S3]) Size() int { return c.m.Size() } -func asRightTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, S3]) *RightTripleSet[S1, S2, S3] { +func AsRightTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2, S3]) *RightTripleSet[S1, S2, S3] { r, ok := other.(*RightTripleSet[S1, S2, S3]) if ok { return r @@ -54,19 +54,19 @@ func asRightTripleSet[S1 Set[S1], S2 Set[S2], S3 Set[S3]](other TripleSet[S1, S2 // IsSubset returns true if c is subset of other func (c *RightTripleSet[S1, S2, S3]) IsSubset(other TripleSet[S1, S2, S3]) bool { - return c.m.IsSubset(asRightTripleSet(other).m) + return c.m.IsSubset(AsRightTripleSet(other).m) } func (c *RightTripleSet[S1, S2, S3]) Union(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &RightTripleSet[S1, S2, S3]{m: c.m.Union(asRightTripleSet(other).m).(*LeftTripleSet[S2, S3, S1])} + return &RightTripleSet[S1, S2, S3]{m: c.m.Union(AsRightTripleSet(other).m).(*LeftTripleSet[S2, S3, S1])} } func (c *RightTripleSet[S1, S2, S3]) Intersect(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &RightTripleSet[S1, S2, S3]{m: c.m.Intersect(asRightTripleSet(other).m).(*LeftTripleSet[S2, S3, S1])} + return &RightTripleSet[S1, S2, S3]{m: c.m.Intersect(AsRightTripleSet(other).m).(*LeftTripleSet[S2, S3, S1])} } func (c *RightTripleSet[S1, S2, S3]) Subtract(other TripleSet[S1, S2, S3]) TripleSet[S1, S2, S3] { - return &RightTripleSet[S1, S2, S3]{m: c.m.Subtract(asRightTripleSet(other).m).(*LeftTripleSet[S2, S3, S1])} + return &RightTripleSet[S1, S2, S3]{m: c.m.Subtract(AsRightTripleSet(other).m).(*LeftTripleSet[S2, S3, S1])} } func (c *RightTripleSet[S1, S2, S3]) Partitions() []Triple[S1, S2, S3] {