2022-02-19 08:26:38 +00:00
|
|
|
package hyphae
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
2022-02-19 16:42:32 +00:00
|
|
|
// TextualHypha is a hypha with text, and nothing else. An article, a note, a poem, whatnot.
|
2022-02-19 08:26:38 +00:00
|
|
|
type TextualHypha struct {
|
|
|
|
sync.RWMutex
|
|
|
|
|
|
|
|
canonicalName string
|
|
|
|
mycoFilePath string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *TextualHypha) CanonicalName() string {
|
|
|
|
return t.canonicalName
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *TextualHypha) HasTextFile() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *TextualHypha) TextFilePath() string {
|
|
|
|
return t.mycoFilePath
|
|
|
|
}
|
|
|
|
|
2022-02-19 16:42:32 +00:00
|
|
|
// ExtendTextualToMedia returns a new media hypha with the same name and text file as the given textual hypha. The new hypha is not stored yet.
|
2022-02-19 08:26:38 +00:00
|
|
|
func ExtendTextualToMedia(t *TextualHypha, mediaFilePath string) *MediaHypha {
|
|
|
|
return &MediaHypha{
|
|
|
|
canonicalName: t.CanonicalName(),
|
|
|
|
mycoFilePath: t.TextFilePath(),
|
|
|
|
mediaFilePath: mediaFilePath,
|
|
|
|
}
|
|
|
|
}
|