NAME
Treex::PML::List - lists of uniformly typed PML values
DESCRIPTION
This class implements the attribute value type 'list'.
- Treex::PML::List->new (val1,val2,...)
-
Create a new list (optionally populated with given values).
NOTE: Don't call this constructor directly, use Treex::PML::Factory->createList() instead!
- Treex::PML::List->new_from_ref (array_ref, reuse)
-
Create a new list consisting of values in a given array reference. Use this constructor instead of new() to pass large lists by reference. If reuse is true, then the same array_ref scalar is used to represent the Treex::PML::List object (i.e. blessed). Otherwise, a copy is created in the constructor.
NOTE: Don't call this constructor directly, use Treex::PML::Factory->createList() instead!
- $list->values ()
-
Returns all its values (i.e. the list members).
- $list->count ()
-
Return number of values in the list.
- $list->append (@values)
-
Append given values to the list.
- $list->push (@values)
-
An alias for
$list-
append()). - $list->append_list ($list2)
-
Append values from a given list or ARRAY-reference to the current list.
- $list->insert ($index, @values)
-
Insert values before the value at a given position in the list. The index of the first position in the list is 0. It is an error if $index is less then 0. If $index equals the index of the last value + 1, then values are appended to the list, but it is an error if $index is greater than that.
- $list->insert_list ($index, $list)
-
Insert all values in $list before the value at a given position in the current list. The index of the first position in the current list is 0. It is an error if $index is less then 0. If $index equals the index of the last value + 1, then values are appended to the list, but it is an error if $index is greater than that.
- $list->delete ($index, $count)
-
Delete $count values from the list starting at index $index.
- $list->delete_value ($value)
-
Delete all occurences of value $value. Values are compared as strings.
- $list->delete_values ($value1,$value2,...)
-
Delete all occurences of values $value1, $value2,... Values are compared as strings.
- $list->replace ($index, $count, @list)
-
Replacing $count values starting at index $index by values provided in the @list (the count of values in @list may differ from $count).
- $list->replace_list ($index, $count, $list)
-
Like replace, but replacement values are taken from a Treex::PML::List object $list.
- $list->value_at ($index)
-
Return value at index $index. This is in fact the same as $list->[$index] only $index is checked to be non-negative and less then the index of the last value.
- $list->set_value_at ($index,$value)
-
Set value at index $index to $value. This is in fact the same as assigning directly to $list->[$index], except that $index is checked to be non-negative and less then the index of the last value. Returns $value.
- $list->index_of ($value)
-
Search the list for the first occurence of value $value. Returns index of the first occurence or undef if the value is not in the list. (Values are compared as strings.)
- $list->unique_values ()
-
Return unique values in the list (ordered by the index of the first occurence). Values are compared as strings.
- $list->unique_list ()
-
Return a new Treex::PML::List object consisting of unique values in the current list (ordered by the index of the first occurence). Values are compared as strings.
- $list->make_unique ()
-
Remove duplicated values from the list. Values are compared as strings. Returns $list.
- $list->empty ()
-
Remove all values from the list.
SEE ALSO
Treex::PML, Treex::PML::Factory, Treex::PML::Schema, Treex::PML::Alt
COPYRIGHT AND LICENSE
Copyright (C) 2006-2010 by Petr Pajas, 2010-2024 Jan Stepanek
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.