TDT4100/diagrammer/ex1/LineEditor.wsd

45 lines
810 B
Plaintext

@startuml LineEditor
skinparam DefaultFontName Fira Code
!definelong obj(id, txt, i)
object "~#1:LineEditor" as id
id : text = txt
id : insertionIndex = i
!enddefinelong
!define to(id1, id2, txt) id1 ..> id2 : txt
!define self(id, txt) id ..> id : "txt"
obj(A, '""', 0)
obj(B, "test", 0)
obj(C, "test", 1)
obj(D, "test", 0)
obj(E, "test", 2)
obj(F, "tet", 2)
obj(G, "tt", 1)
obj(H, "text", 3)
to(A, B, setText("test"))
self(B, 'getText() => "|test"')
to(B, C, "left()")
self(C, 'getText() => "t|est"')
to(C,D,"right()")
self(D, 'getText() => "|test"')
to(D,E,"setInsertionIndex(2)")
self(E, 'getText() => "te|st"')
to(E,F,"deleteRight()")
self(F, 'getText() => "te|t"')
to(F,G,"deleteLeft()")
self(G, 'getText() => "t|t"')
to(G,H,'insertString("ex")')
self(H, 'getText() => "tex|t"')
@enduml