Package com.lucimber.dbus.type
Class DBusArray<ElementT extends DBusType>
java.lang.Object
com.lucimber.dbus.type.DBusArray<ElementT>
- Type Parameters:
ElementT
- The element's data type.
- All Implemented Interfaces:
DBusContainerType
,DBusType
,Iterable<ElementT>
,Collection<ElementT>
,List<ElementT>
public final class DBusArray<ElementT extends DBusType>
extends Object
implements List<ElementT>, DBusContainerType
An ordered collection of elements.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance from another one.DBusArray
(DBusSignature signature) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection<? extends ElementT> c) boolean
addAll
(Collection<? extends ElementT> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) Creates an empty array with the specified element signature.boolean
void
get
(int index) Gets the wrapped value of this container type.Gets the signature of this container type.getType()
Gets the type of this implementation.int
hashCode()
int
boolean
isEmpty()
iterator()
int
listIterator
(int index) static DBusArray<DBusBoolean>
ofBooleans
(boolean... booleans) Creates an array of booleans.static DBusArray<DBusDouble>
ofDoubles
(double... doubles) Creates an array of doubles.ofInt32s
(int... integers) Creates an array of 32-bit integers.ofInt64s
(long... longs) Creates an array of 64-bit integers.static DBusArray<DBusObjectPath>
ofObjectPaths
(String... paths) Creates an array of object paths.static DBusArray<DBusString>
Creates an array of strings.remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
void
replaceAll
(UnaryOperator<ElementT> operator) boolean
retainAll
(Collection<?> c) int
size()
void
sort
(Comparator<? super ElementT> c) stream()
subList
(int fromIndex, int toIndex) Object[]
toArray()
<T> T[]
toArray
(T[] a) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
toArray
-
Constructor Details
-
DBusArray
Constructs a new instance.- Parameters:
signature
- aDBusSignature
; must describe an array
-
DBusArray
Constructs a new instance from another one.- Parameters:
other
- aDBusArray
-
-
Method Details
-
ofStrings
Creates an array of strings.- Parameters:
strings
- the strings to add to the array- Returns:
- a new DBusArray containing DBusString elements
-
ofInt32s
Creates an array of 32-bit integers.- Parameters:
integers
- the integers to add to the array- Returns:
- a new DBusArray containing DBusInt32 elements
-
ofInt64s
Creates an array of 64-bit integers.- Parameters:
longs
- the longs to add to the array- Returns:
- a new DBusArray containing DBusInt64 elements
-
ofBooleans
Creates an array of booleans.- Parameters:
booleans
- the booleans to add to the array- Returns:
- a new DBusArray containing DBusBoolean elements
-
ofDoubles
Creates an array of doubles.- Parameters:
doubles
- the doubles to add to the array- Returns:
- a new DBusArray containing DBusDouble elements
-
ofObjectPaths
Creates an array of object paths.- Parameters:
paths
- the paths to add to the array- Returns:
- a new DBusArray containing DBusObjectPath elements
-
empty
Creates an empty array with the specified element signature.- Type Parameters:
T
- the element type- Parameters:
elementSignature
- the signature of the array elements (e.g., "s" for strings)- Returns:
- a new empty DBusArray
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
add
-
remove
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<ElementT extends DBusType>
- Specified by:
containsAll
in interfaceList<ElementT extends DBusType>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<ElementT extends DBusType>
-
listIterator
- Specified by:
listIterator
in interfaceList<ElementT extends DBusType>
-
listIterator
- Specified by:
listIterator
in interfaceList<ElementT extends DBusType>
-
subList
-
getSignature
Description copied from interface:DBusContainerType
Gets the signature of this container type. The returned signature describes the container and its content.- Specified by:
getSignature
in interfaceDBusContainerType
- Returns:
- a
DBusSignature
-
getType
Description copied from interface:DBusType
Gets the type of this implementation. -
getDelegate
Description copied from interface:DBusContainerType
Gets the wrapped value of this container type. The D-Bus type system is made of ASCII characters representing the value's type. Each D-Bus data type is mapped in this framework by its corresponding class. This method enables the access to the Java's data type - the delegate. If this container is for example aDBusArray
, the returned object will be aList
.- Specified by:
getDelegate
in interfaceDBusContainerType
- Returns:
- an
Object
-
forEach
-
replaceAll
- Specified by:
replaceAll
in interfaceList<ElementT extends DBusType>
-
sort
-
spliterator
- Specified by:
spliterator
in interfaceCollection<ElementT extends DBusType>
- Specified by:
spliterator
in interfaceIterable<ElementT extends DBusType>
- Specified by:
spliterator
in interfaceList<ElementT extends DBusType>
-
removeIf
- Specified by:
removeIf
in interfaceCollection<ElementT extends DBusType>
-
stream
- Specified by:
stream
in interfaceCollection<ElementT extends DBusType>
-
parallelStream
- Specified by:
parallelStream
in interfaceCollection<ElementT extends DBusType>
-
equals
-
hashCode
public int hashCode()
-