Documentation ¶
Index ¶
- func Apply(o Op, t *Tree) error
- func AsRunes(s string) []rune
- func AsString(rs []rune) string
- func CloneRunes(body []rune) []rune
- func RandIntn(n int) int
- func Transform(as, bs Ops) (Ops, Ops, error)
- type Controller
- type Doc
- type Op
- func (o Op) Clone() Op
- func (o *Op) IsDelete() bool
- func (o *Op) IsInsert() bool
- func (o *Op) IsInsertBranch() bool
- func (o *Op) IsInsertLeaf() bool
- func (o *Op) IsRetain() bool
- func (o *Op) IsWith() bool
- func (o *Op) IsZero() bool
- func (o *Op) Len() int
- func (o Op) SplitAt(n int) (Op, Op, error)
- func (o *Op) String() string
- type OpTag
- type Ops
- func C(os ...Ops) Ops
- func Compose(as, bs Ops) (Ops, error)
- func ComposeAll(all []Ops) (Ops, error)
- func Ds(n int) Ops
- func Ir(rs []rune) Ops
- func Is(s string) Ops
- func NewDelete(docLen int, pos int, length int) Ops
- func NewInsert(docLen int, pos int, s string) Ops
- func Normalize(os Ops) (Ops, error)
- func Rs(n int) Ops
- func Ws(kids Ops) Ops
- func Zs() Ops
- func (os Ops) Clone() Ops
- func (os *Ops) Delete(size int)
- func (os Ops) Empty() bool
- func (os Ops) First() *Op
- func (os *Ops) Insert(t Tree)
- func (os Ops) Last() *Op
- func (os Ops) Rest() Ops
- func (os *Ops) Retain(size int)
- func (os Ops) SplitAt(n int) (Ops, Ops, error)
- func (os Ops) String() string
- func (os *Ops) With(kids Ops)
- type Receiver
- type Sender
- type State
- type Tree
- type TreeTag
- type Trees
- type Zipper
- func (z *Zipper) CanSkip(n int) bool
- func (z *Zipper) Current() *Tree
- func (z *Zipper) Delete(n int)
- func (z *Zipper) Depth() int
- func (z *Zipper) Down()
- func (z *Zipper) HasDown() bool
- func (z *Zipper) Index() int
- func (z *Zipper) IndexP() *int
- func (z *Zipper) Insert(t Tree)
- func (z *Zipper) Parent() *Tree
- func (z *Zipper) Retain(n int)
- func (z *Zipper) Skip(n int)
- func (z *Zipper) Up()
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneRunes ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(sender Sender, receiver Receiver) *Controller
func (*Controller) IsSynchronized ¶
func (c *Controller) IsSynchronized() bool
func (*Controller) OnClientWrite ¶
func (c *Controller) OnClientWrite(ops Ops)
func (*Controller) OnServerAck ¶
func (c *Controller) OnServerAck(rev int, ops Ops)
func (*Controller) OnServerWrite ¶
func (c *Controller) OnServerWrite(rev int, ops Ops)
func (*Controller) ServerRev ¶
func (c *Controller) ServerRev() int
func (*Controller) String ¶
func (c *Controller) String() string
type Op ¶
type Op struct { // Tag indicates what kind of Op we have Tag OpTag // Len is either delete-len (if negative) or retain-len (if positive) Size int // Body is the tree to be inserted Body Tree // Kids are the child-ops for parent With operations Kids Ops }
func (*Op) IsInsertBranch ¶
func (*Op) IsInsertLeaf ¶
type Tree ¶
func AsRuneTree ¶
Notes ¶
Bugs ¶
should With() fold into previous With ops?
on a newly created zipper to a Branch(nil), tz.Current is nil because our zipper is an insertion-point, at index 0, to the left of cell #0 in t.Kids (bug?).
However, as we advance down into t, we will create new zippers each time we descend (bug?). Therefore, for the purposes of applying a top-level With-op, we want to recurse on tz.Parent()
However, assuming we're already in the middle of processing, current will correctly point to the branch to be modified.
(Argh!)
how to shorten With ops?
needed for op.IsZero(), but is it correct?
Click to show internal directories.
Click to hide internal directories.