element.go raw

   1  package strategy
   2  
   3  import "git.mleku.dev/mleku/dendrite/pkg/axiom"
   4  
   5  // StrategyElement wraps a strategic text fragment as a lattice element.
   6  // Implements axiom.Element, axiom.StickyElement, and axiom.LayeredElement.
   7  type StrategyElement struct {
   8  	Content string
   9  	Ch      int      // source chapter (1-13)
  10  	Cat     Category // strategic category
  11  	Lvl     Level    // granularity level
  12  }
  13  
  14  // Type returns a tag encoding category and level.
  15  func (e StrategyElement) Type() string {
  16  	return "strategy:" + e.Cat.String() + ":" + e.Lvl.String()
  17  }
  18  
  19  // Value returns the text content.
  20  func (e StrategyElement) Value() any { return e.Content }
  21  
  22  // IsSticky always returns true — strategy elements survive dissolution.
  23  func (e StrategyElement) IsSticky() bool { return true }
  24  
  25  // Layer returns the strategy layer for the coherence field.
  26  func (e StrategyElement) Layer() axiom.Layer {
  27  	return axiom.Layer{
  28  		Name:  "strategy",
  29  		Depth: int(e.Lvl),
  30  	}
  31  }
  32  
  33  // Verify interface compliance at compile time.
  34  var (
  35  	_ axiom.Element       = StrategyElement{}
  36  	_ axiom.StickyElement = StrategyElement{}
  37  	_ axiom.LayeredElement = StrategyElement{}
  38  )
  39