Extends
Constructor
new ve.dm.FlatLinearData(store, [data])
#
Flat linear data storage
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
store |
ve.dm.HashValueStore | Hash-value store |
|
data |
Array |
optional |
Linear data |
Methods
batchSplice(offset, remove, data) → {Array}
#
batchSpliceObject(offset, remove, data) → {ve.dm.LinearData}
#
Returns ve.batchSplice of linear data, wrapped in a LinearData object
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | |
remove |
number | |
data |
Array |
- Inherited from:
- Source:
- See:
Returns:
- Type
- ve.dm.LinearData
containsElementData() → {boolean}
#
Check for elements in data.
This method assumes that any value that has a type property that's a string is an element object. Elements are discovered by iterating through the entire data array (backwards).
Returns:
At least one elements exists in data
- Type
- boolean
getData([offset]) → {Object|Array}
#
Gets linear data from a specified index, or all data if no index specified
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
offset |
number |
optional |
Offset to get data from |
- Inherited from:
- Source:
Returns:
Data from index, or all data (by reference)
getDataSlice([range], [deep]) → {Array}
#
Get a slice or copy of the provided data.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
range |
ve.Range |
optional |
Range of data to get, all data will be given by default |
|
deep |
boolean |
optional |
false | Whether to return a deep copy (WARNING! This may be very slow) |
- Inherited from:
- Source:
Returns:
Slice or copy of data
- Type
- Array
getLength() → {number}
#
Gets length of the linear data
- Inherited from:
- Source:
Returns:
Length of the linear data
- Type
- number
getStore() → {ve.dm.HashValueStore}
#
Gets the hash-value store
- Inherited from:
- Source:
Returns:
The hash-value store
- Type
- ve.dm.HashValueStore
getType(offset) → {string}
#
Get the type of the element at a specified offset.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Data offset |
Returns:
Type of the element
- Type
- string
isCloseElementData(offset) → {boolean}
#
Checks if data at a given offset is a close element.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Data offset |
Returns:
Data at offset is a close element
- Type
- boolean
isElementData(offset) → {boolean}
#
Check if data at a given offset is an element.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Data offset |
Returns:
Data at offset is an element
- Type
- boolean
isOpenElementData(offset) → {boolean}
#
Checks if data at a given offset is an open element.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Data offset |
Returns:
Data at offset is an open element
- Type
- boolean
modifyData(offset, modify)
#
Modify an existing object in the linear model
As objects in the model and immutable, this creates a clone which is passed to a callback function for modification, then the clone is inserted into the model.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Offset to modify data at |
modify |
function | Modification function. First argument is the data element to modify. |
- Inherited from:
- Source:
Modify an existing object in the linear model
As objects in the model and immutable, this creates a clone which is passed to a callback function for modification, then the clone is inserted into the model.
push([…values]) → {number}
#
Push data to the end of the array
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
Object |
optional repeatable |
Values to store |
- Inherited from:
- Source:
Returns:
The new length of the linear data
- Type
- number
setData(offset, value)
#
Sets linear data at a specified index
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Offset to set data at |
value |
Object | string | Value to store |
- Inherited from:
- Source:
slice(begin, [end]) → {Array}
#
Slice linear data
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
begin |
number | Index to begin at |
|
end |
number |
optional |
Index to end at |
- Inherited from:
- Source:
Returns:
One-level deep copy of sliced range
- Type
- Array
sliceObject(begin, [end]) → {ve.dm.LinearData}
#
Slice linear data and return new LinearData object containing result
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
begin |
number | Index to begin at |
|
end |
number |
optional |
Index to end at |
- Inherited from:
- Source:
Returns:
LinearData object containing one-level deep copy of sliced range
- Type
- ve.dm.LinearData
splice(index, deleteCount, […elements]) → {Array}
#
spliceObject(index, deleteCount, […elements]) → {ve.dm.LinearData}
#
Splice linear data and return new LinearData object containing result
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
number | Splice from |
|
deleteCount |
number | Items to be removed |
|
elements |
Object |
optional repeatable |
Items to be inserted |
- Inherited from:
- Source:
Returns:
LinearData object containing elements removed
- Type
- ve.dm.LinearData