Package io.keikai.doc.collab.structs
Class AbstractStruct
- java.lang.Object
-
- io.keikai.doc.collab.structs.AbstractStruct
-
-
Constructor Summary
Constructors Constructor Description AbstractStruct(ID id, int length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDgetId()voidintegrate(Transaction transaction, int offset)Integrate this struct into a transaction.booleanisDeleted()intlength()booleanmergeWith(AbstractStruct right)Merge this struct with the item to the right.voidsetLength(int length)voidwrite(UpdateEncoder encoder, int offset)Write data to the encoder.voidwrite(java.lang.Object encoder, int offset, int encodingRef)Write data to the encoder.
-
-
-
Constructor Detail
-
AbstractStruct
public AbstractStruct(ID id, int length)
- Parameters:
id-length-
-
-
Method Detail
-
getId
public ID getId()
-
length
public int length()
-
setLength
public void setLength(int length)
-
isDeleted
public boolean isDeleted()
- Returns:
- boolean indicating if this struct is deleted
-
mergeWith
public boolean mergeWith(AbstractStruct right)
Merge this struct with the item to the right. This method assumes that `this.id.clock + this.length === right.id.clock`. Also, this method does *not* remove the right struct from the StructStore!- Parameters:
right-- Returns:
- boolean indicating whether this struct merged with the right struct
-
write
public void write(java.lang.Object encoder, int offset, int encodingRef)Write data to the encoder.- Parameters:
encoder- The encoder to write data to.offset-encodingRef-
-
write
public void write(UpdateEncoder encoder, int offset)
Write data to the encoder.- Parameters:
encoder- The encoder to write data to.offset-
-
integrate
public void integrate(Transaction transaction, int offset)
Integrate this struct into a transaction.- Parameters:
transaction-offset-
-
-