Documentation ¶
Index ¶
- type FrequencyEvaluator
- func (fe *FrequencyEvaluator[T]) AddElement(element T)
- func (fe *FrequencyEvaluator[T]) GetFrequency() map[T]int
- func (fe *FrequencyEvaluator[T]) GetInPercent() map[T]float64
- func (fe *FrequencyEvaluator[T]) GetKeys() []T
- func (fe *FrequencyEvaluator[T]) GetTotal() float64
- func (fe *FrequencyEvaluator[T]) Reset()
- func (fe *FrequencyEvaluator[T]) Sort(isAsc bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrequencyEvaluator ¶
type FrequencyEvaluator[T comparable] struct { // contains filtered or unexported fields }
FrequencyEvaluator is a structure that provides methods to evaluate the frequency of elements.
func NewFrequencyEvaluator ¶
func NewFrequencyEvaluator[T comparable]() *FrequencyEvaluator[T]
NewFrequencyEvaluator creates a new evaluator to evaluate the frequency of elements.
Returns:
- *FrequencyEvaluator[T]: The new evaluator.
func (*FrequencyEvaluator[T]) AddElement ¶
func (fe *FrequencyEvaluator[T]) AddElement(element T)
AddElement adds an element to the evaluator.
Parameters:
- element: The element to add.
func (*FrequencyEvaluator[T]) GetFrequency ¶
func (fe *FrequencyEvaluator[T]) GetFrequency() map[T]int
GetFrequency returns the frequency of each element.
Returns:
- map[T]int: The frequency of each element.
func (*FrequencyEvaluator[T]) GetInPercent ¶
func (fe *FrequencyEvaluator[T]) GetInPercent() map[T]float64
GetInPercent returns the frequency of each element in percent.
Returns:
- map[T]float64: The frequency of each element in percent.
func (*FrequencyEvaluator[T]) GetKeys ¶
func (fe *FrequencyEvaluator[T]) GetKeys() []T
GetKeys returns the keys of the elements.
Returns:
- []T: The keys of the elements.
func (*FrequencyEvaluator[T]) GetTotal ¶
func (fe *FrequencyEvaluator[T]) GetTotal() float64
GetTotal returns the total number of elements.
Returns:
- float64: The total number of elements.
func (*FrequencyEvaluator[T]) Reset ¶
func (fe *FrequencyEvaluator[T]) Reset()
Reset resets the evaluator.
func (*FrequencyEvaluator[T]) Sort ¶
func (fe *FrequencyEvaluator[T]) Sort(isAsc bool)
Sort sorts the elements.
Parameters:
- isAsc: A boolean value that indicates whether to sort in ascending order.
Click to show internal directories.
Click to hide internal directories.