Package org.basex.util
Class Atts
- java.lang.Object
-
- org.basex.util.list.ElementList
-
- org.basex.util.Atts
-
public final class Atts extends ElementList
Resizable-array implementation for attributes (name/value pairs).- Author:
- BaseX Team 2005-23, BSD License, Christian Gruen
-
-
Field Summary
-
Fields inherited from class org.basex.util.list.ElementList
factor, size
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Atts
add(byte[] name, byte[] value)
Adds the next name/value pair.Atts
add(byte[] name, byte[] value, boolean stripNS)
Adds the next name/value pair.boolean
contains(byte[] name)
Checks if the specified name is found.boolean
equals(Object obj)
boolean
equals(Atts atts)
Compares attributes.int
get(byte[] name)
Returns the offset to the specified name.byte[]
name(int index)
Returns the name at the specified index position.Atts
optimize()
Optimizes the attribute list.Atts
remove(int index)
Removes the element at the specified position.int
size()
Returns the number of elements.void
size(int sz)
Enforces the number of elements.String
toString()
byte[]
value(byte[] name)
Returns the value for the specified name ornull
.byte[]
value(int index)
Returns the value at the specified index position.-
Methods inherited from class org.basex.util.list.ElementList
isEmpty, newCapacity, newCapacity, reset
-
-
-
-
Constructor Detail
-
Atts
public Atts()
Default constructor.
-
Atts
public Atts(long capacity)
Constructor with initial capacity.- Parameters:
capacity
- array capacity
-
Atts
public Atts(Atts atts)
Constructor.- Parameters:
atts
- object to copy
-
-
Method Detail
-
size
public int size()
Description copied from class:ElementList
Returns the number of elements.- Overrides:
size
in classElementList
- Returns:
- number of elements
-
size
public void size(int sz)
Description copied from class:ElementList
Enforces the number of elements.- Overrides:
size
in classElementList
- Parameters:
sz
- number of elements
-
add
public Atts add(byte[] name, byte[] value)
Adds the next name/value pair.- Parameters:
name
- name to be added (can benull
)value
- value to be added (can benull
)- Returns:
- self reference
-
add
public Atts add(byte[] name, byte[] value, boolean stripNS)
Adds the next name/value pair.- Parameters:
name
- name to be added (can benull
)value
- value to be added (can benull
)stripNS
- strip namespaces- Returns:
- self reference
-
remove
public Atts remove(int index)
Removes the element at the specified position.- Parameters:
index
- entry index- Returns:
- self reference
-
contains
public boolean contains(byte[] name)
Checks if the specified name is found.- Parameters:
name
- name to be found- Returns:
- result of check
-
get
public int get(byte[] name)
Returns the offset to the specified name.- Parameters:
name
- name to be found- Returns:
- offset or -1
-
name
public byte[] name(int index)
Returns the name at the specified index position.- Parameters:
index
- index- Returns:
- name
-
value
public byte[] value(int index)
Returns the value at the specified index position.- Parameters:
index
- index- Returns:
- value
-
value
public byte[] value(byte[] name)
Returns the value for the specified name ornull
.- Parameters:
name
- name to be found- Returns:
- offset or -1
-
optimize
public Atts optimize()
Optimizes the attribute list.- Returns:
- self reference
-
equals
public boolean equals(Atts atts)
Compares attributes.- Parameters:
atts
- attributes to be compared- Returns:
- result of check
-
-