FrameIT
FactComparer Class Referenceabstract

Base class for all FactComparer to be used in conjucntion with Stage.solution

See also
SolutionOrganizer, SolutionOrganizer.ValidationSet, FactOrganizer.DynamiclySolved(SolutionOrganizer, out System.Collections.Generic.List<System.Collections.Generic.List<string>>, out System.Collections.Generic.List<System.Collections.Generic.List<string>>)
More...

Inheritance diagram for FactComparer:
FactEquivalentsComparer LineFactHightComparer LineFactHightDirectionComparer LineSpanningOverRiverWorldComparer

Public Member Functions

FactComparer SetSearchRight ()
 Sets search_righthanded, so that parameter order of Equals(Fact, Fact) is effectively: (Compare(Fact, Fact).solution, Compare(Fact, Fact).fact), when a ICollection<Fact> is on the right hand side of an System.Linq operation More...
 
FactComparer SetSearchLeft ()
 Sets search_righthanded, so that parameter order of Equals(Fact, Fact) is effectively: (Compare(Fact, Fact).solution, Compare(Fact, Fact).fact), when a ICollection<Fact> is on the left hand side of an System.Linq operation More...
 
override bool Equals (Fact left, Fact right)
 Called by System.Linq iff GetHashCode(Fact) returns same result for both parameters left and right . More...
 
override int GetHashCode (Fact obj)
 Called by System.Linq to check for possible fulfillment of each parameter before calling Equals(Fact, Fact) iff both results are the same. More...
 

Protected Member Functions

abstract bool Compare (Fact solution, Fact fact)
 Implements criteria, by which fact is beeing compared to solution More...
 
abstract void Init ()
 Called by SetSearchLeft and SetSearchRight to initate any class variables. More...
 

Protected Attributes

bool search_righthanded
 defines parameter order for Equals(Fact, Fact) More...
 

Detailed Description

Base class for all FactComparer to be used in conjucntion with Stage.solution

See also
SolutionOrganizer, SolutionOrganizer.ValidationSet, FactOrganizer.DynamiclySolved(SolutionOrganizer, out System.Collections.Generic.List<System.Collections.Generic.List<string>>, out System.Collections.Generic.List<System.Collections.Generic.List<string>>)

Member Function Documentation

◆ Compare()

abstract bool FactComparer.Compare ( Fact  solution,
Fact  fact 
)
protectedpure virtual

Implements criteria, by which fact is beeing compared to solution

Parameters
solutionto be fulfilled
factto be fulfilling
Returns
true iff fact is described by solution

Implemented in FactEquivalentsComparer, LineFactHightDirectionComparer, LineFactHightComparer, and LineSpanningOverRiverWorldComparer.

◆ Equals()

override bool FactComparer.Equals ( Fact  left,
Fact  right 
)

Called by System.Linq iff GetHashCode(Fact) returns same result for both parameters left and right .

Always set correct search order manually beforehand, so that Compare(Fact, Fact) can return correct results.

See also
SetSearchRight, SetSearchLeft
Parameters
leftlefthand parameter
rightrighthand parameter
Returns
search_righthanded ? Compare(left, right) : Compare(right, left);

◆ GetHashCode()

override int FactComparer.GetHashCode ( Fact  obj)

Called by System.Linq to check for possible fulfillment of each parameter before calling Equals(Fact, Fact) iff both results are the same.

Default implementation checks for sameness of runtime type, but may vary for subclasses.

Parameters
objparameter of possible subsequent call of Equals(Fact, Fact)
Returns

◆ Init()

abstract void FactComparer.Init ( )
protectedpure virtual

◆ SetSearchLeft()

FactComparer FactComparer.SetSearchLeft ( )

Sets search_righthanded, so that parameter order of Equals(Fact, Fact) is effectively: (Compare(Fact, Fact).solution, Compare(Fact, Fact).fact), when a ICollection<Fact> is on the left hand side of an System.Linq operation

Returns
this object to be used

◆ SetSearchRight()

FactComparer FactComparer.SetSearchRight ( )

Sets search_righthanded, so that parameter order of Equals(Fact, Fact) is effectively: (Compare(Fact, Fact).solution, Compare(Fact, Fact).fact), when a ICollection<Fact> is on the right hand side of an System.Linq operation

Returns
this object to be used

Member Data Documentation

◆ search_righthanded

bool FactComparer.search_righthanded
protected

defines parameter order for Equals(Fact, Fact)


The documentation for this class was generated from the following file: