Documentation
¶
Index ¶
- func BuildLineToCharMap(content string) []int
- func SimpleFindLineNumber(content, key, value string, lineToChar []int) int
- type FindPattern
- type LineAnalysisReport
- type LineMapper
- func (lm *LineMapper) AnalyzeLineDetection(patterns []FindPattern) *LineAnalysisReport
- func (lm *LineMapper) CharToLine(charPos int) int
- func (lm *LineMapper) FindLineNumber(pattern FindPattern) *LineResult
- func (lm *LineMapper) FindPattern(regex *regexp.Regexp) []*LineResult
- func (lm *LineMapper) GenerateLineReport(patterns []FindPattern) string
- func (lm *LineMapper) GetLine(lineNum int) string
- func (lm *LineMapper) GetLines(startLine, endLine int) []string
- func (lm *LineMapper) LineToChar(lineNum int) int
- func (lm *LineMapper) TotalLines() int
- type LineResult
- type MatchDetail
- type PerformanceMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLineToCharMap ¶
BuildLineToCharMap creates a character position mapping (for backward compatibility)
func SimpleFindLineNumber ¶
SimpleFindLineNumber provides a simple interface for basic line number finding This maintains compatibility with the existing findLineNumber function
Types ¶
type FindPattern ¶
type FindPattern struct {
Key string // YAML key (e.g., "run", "name")
Value string // The value to search for
ContextBefore int // Lines of context before the match
ContextAfter int // Lines of context after the match
}
FindPattern represents a search pattern for line number detection
type LineAnalysisReport ¶
type LineAnalysisReport struct {
TotalLines int `json:"total_lines"`
SearchAttempts int `json:"search_attempts"`
SuccessfulMatches int `json:"successful_matches"`
MatchAccuracy float64 `json:"match_accuracy"`
MatchDetails []MatchDetail `json:"match_details"`
PerformanceMetrics PerformanceMetrics `json:"performance_metrics"`
}
LineAnalysisReport provides detailed information about line number detection
type LineMapper ¶
type LineMapper struct {
// contains filtered or unexported fields
}
LineMapper provides line number mapping and calculation services
func NewLineMapper ¶
func NewLineMapper(content []byte) *LineMapper
NewLineMapper creates a new line mapper for the given content
func NewLineMapperFromString ¶
func NewLineMapperFromString(content string) *LineMapper
NewLineMapperFromString creates a new line mapper from string content
func (*LineMapper) AnalyzeLineDetection ¶
func (lm *LineMapper) AnalyzeLineDetection(patterns []FindPattern) *LineAnalysisReport
AnalyzeLineDetection analyzes the effectiveness of line number detection
func (*LineMapper) CharToLine ¶
func (lm *LineMapper) CharToLine(charPos int) int
CharToLine converts a character position to line number (1-based)
func (*LineMapper) FindLineNumber ¶
func (lm *LineMapper) FindLineNumber(pattern FindPattern) *LineResult
FindLineNumber finds the line number for a pattern with improved accuracy
func (*LineMapper) FindPattern ¶
func (lm *LineMapper) FindPattern(regex *regexp.Regexp) []*LineResult
FindPattern searches for patterns using regular expressions
func (*LineMapper) GenerateLineReport ¶
func (lm *LineMapper) GenerateLineReport(patterns []FindPattern) string
GenerateLineReport creates a human-readable report of line detection analysis
func (*LineMapper) GetLine ¶
func (lm *LineMapper) GetLine(lineNum int) string
GetLine returns the content of a specific line (1-based)
func (*LineMapper) GetLines ¶
func (lm *LineMapper) GetLines(startLine, endLine int) []string
GetLines returns a range of lines (1-based, inclusive)
func (*LineMapper) LineToChar ¶
func (lm *LineMapper) LineToChar(lineNum int) int
LineToChar converts a line number to starting character position
func (*LineMapper) TotalLines ¶
func (lm *LineMapper) TotalLines() int
TotalLines returns the total number of lines in the content
type LineResult ¶
type LineResult struct {
LineNumber int // The line number where the pattern was found
ColumnStart int // Starting column position
ColumnEnd int // Ending column position
LineContent string // The actual content of the line
ContextBefore []string // Lines before the match
ContextAfter []string // Lines after the match
MatchedText string // The exact text that was matched
}
LineResult contains the result of a line number search
type MatchDetail ¶
type MatchDetail struct {
SearchedFor string `json:"searched_for"`
FoundAt int `json:"found_at"`
Strategy string `json:"strategy"`
Confidence string `json:"confidence"`
ContextBefore string `json:"context_before,omitempty"`
ContextAfter string `json:"context_after,omitempty"`
}
MatchDetail contains information about a specific line number match
type PerformanceMetrics ¶
type PerformanceMetrics struct {
AverageSearchTimeMS float64 `json:"average_search_time_ms"`
CacheHitRate float64 `json:"cache_hit_rate"`
MemoryUsageBytes int64 `json:"memory_usage_bytes"`
}
PerformanceMetrics tracks performance of line number detection