Elektra: org.libelektra.KeySet Class Reference

Elektra 0.8.24

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
org.libelektra.KeySet Class Reference

A keyset holds together a set of keys. More...

Inherits Iterable< Key >.

## Public Member Functions
void | release ()
| Clean-up method to release keyset reference.
java.util.Iterator< Key > | iterator ()
| Iterable interface function. More...
String | toString ()
| Basic java function that represents object as String. More...
KeySet | dup ()
| Duplicates the key set. More...
int | copy (final KeySet other)
| Copies key references from other key set. More...
int | needsSync ()
| Helper function to check if synchronization is necessary. More...
int | length ()
| Helper function that returns key set size. More...
int | append (final Key k)
| Helper function to append key to key set. More...
int | append (final KeySet ks)
| Helper function that appends keys of key set. More...
KeySet | cut (final Key cutpoint)
| Helper function that creates new key set with help of a cut point. More...
Key | pop ()
| Helper function that returns key from key set and also removes it from the set. More...
Key | current ()
| Helper function that returns current key from the key set. More...
Key | next ()
| Helper function that returns the next key in the key set. More...
int | rewind ()
| Helper function that rewinds the current key set. More...
Key | head ()
| Helper function that gets the key set head. More...
Key | tail ()
| Helper function that gets the key set tail. More...
int | getCursor ()
| Helper function that gets the current cursor of the key set. More...
int | setCursor (final int cursor)
| Helper function that sets the current cursor of the key set. More...
Key | at (final int cursor)
| Helper function that gets the Key at the given cursor position. More...
Key | lookup (final Key find, final int options)
| Helper function to search for a key in the key set. More...
Key | lookup (final Key find)
| Helper function to search for a key in the key set. More...
Key | lookup (final String find, final int options)
| Helper function to search for a key in the key set. More...
Key | lookup (final String find)
| Helper function to search for a key in the key set. More...

## Static Public Member Functions
static KeySet | create ()
| Basic constructor for key set. More...
static KeySet | create (final int alloc, final Key... args)
| Basic constructor for key set. More...

## Protected Member Functions
| KeySet (final long p)
| Helper constructor for duplication by pointer in long format. More...
| KeySet (final Pointer p)
| Helper constructor for duplication by pointer. More...
void | finalize () throws Throwable
| Clean-up method to inform underlying c-library about the release of the keyset reference.
Pointer | get ()
| Native pointer used by JNA. More...

## Static Protected Member Functions
static KeySet | create (final int alloc, final Object... args)
| Basic constructor for key set. More...

## Detailed Description

A keyset holds together a set of keys.

## Constructor & Destructor Documentation

## ◆ KeySet() [1/2]

org.libelektra.KeySet.KeySet | ( | final long | p | ) |
| inlineprotected

Helper constructor for duplication by pointer in long format.

Parameters

  p | Pointer to another KeySet in long format

## ◆ KeySet() [2/2]

org.libelektra.KeySet.KeySet | ( | final Pointer | p | ) |
| inlineprotected

Helper constructor for duplication by pointer.

Parameters

  p | Pointer to another KeySet

## Member Function Documentation

## ◆ append() [1/2]

int org.libelektra.KeySet.append | ( | final Key | k | ) |
| inline

Helper function to append key to key set.

Does nothing if null is provided.

Parameters

  k | Key to append

Returns
  Index of key in key set; starting from 1, -1 if null was provided

## ◆ append() [2/2]

int org.libelektra.KeySet.append | ( | final KeySet | ks | ) |
| inline

Helper function that appends keys of key set.

Parameters

  ks | Key set to append

Returns
  Highest new index of key in key set; starting from 1, -1 if null was provided

## ◆ at()

Key org.libelektra.KeySet.at | ( | final int | cursor | ) |
| inline

Helper function that gets the Key at the given cursor position.

Parameters

  cursor | Cursor position used to fetch key; starting from 0

Returns
  Key at given cursor position

## ◆ copy()

int org.libelektra.KeySet.copy | ( | final KeySet | other | ) |
| inline

Copies key references from other key set.

Parameters

  other | Key set that is used as source

Returns
  1 in case of success, 0 if source was NULL and dest (this) was cleared successfully, -1 in case of an error (null pointer)

## ◆ create() [1/3]

static KeySet org.libelektra.KeySet.create | ( | final int | alloc,
|  | final Object... | args
| ) |  |
| inlinestaticprotected

Basic constructor for key set.

Example: KeySet keySet = KeySet.create(10, Key.create("A"), Key.create("B"));

Parameters

  alloc | Length of key set (key count) to be allocated
  args | List of initial arguments for the key set. Example: new Key(...), new Key(...), existing_key_reference, KeySet.KS_END

Returns
  New key set with the given initial data

See also
  create()

## ◆ create() [2/3]

static KeySet org.libelektra.KeySet.create | ( |  | ) |
| inlinestatic

Basic constructor for key set.

Returns
  New key set

## ◆ create() [3/3]

static KeySet org.libelektra.KeySet.create | ( | final int | alloc,
|  | final Key... | args
| ) |  |
| inlinestatic

Basic constructor for key set.

Parameters

  alloc | Length of key set (key count) to be allocated
  args | List of initial keys for the key set.

Returns
  New key set with the given initial data

See also
  create()

## ◆ current()

Key org.libelektra.KeySet.current | ( |  | ) |
| inline

Helper function that returns current key from the key set.

Returns
  Current Key in iteration

## ◆ cut()

KeySet org.libelektra.KeySet.cut | ( | final Key | cutpoint | ) |
| inline

Helper function that creates new key set with help of a cut point.

Parameters

  cutpoint | Key that is used as cutting point

Returns
  New KeySet containing all keys until the cutting point, this if null was provided

## ◆ dup()

KeySet org.libelektra.KeySet.dup | ( |  | ) |
| inline

Duplicates the key set.

Returns
  New KeySet containing the same key references as this object does

## ◆ get()

Pointer org.libelektra.KeySet.get | ( |  | ) |
| inlineprotected

Native pointer used by JNA.

Returns
  Native pointer object used for this key set

## ◆ getCursor()

int org.libelektra.KeySet.getCursor | ( |  | ) |
| inline

Helper function that gets the current cursor of the key set.

Returns
  Cursor position as integer; initially -1, incremented by next()

## ◆ head()

Key org.libelektra.KeySet.head | ( |  | ) |
| inline

Helper function that gets the key set head.

Returns
  First element of the key set

## ◆ iterator()

java.util.Iterator<Key> org.libelektra.KeySet.iterator | ( |  | ) |
| inline

Iterable interface function.

Returns
  Custom KeySetIterator

## ◆ length()

int org.libelektra.KeySet.length | ( |  | ) |
| inline

Helper function that returns key set size.

Returns
  Size of key set (number of possible keys)

## ◆ lookup() [1/4]

Key org.libelektra.KeySet.lookup | ( | final Key | find,
|  | final int | options
| ) |  |
| inline

Helper function to search for a key in the key set.

Parameters

  find | Key used in search
  options | Custom search options; concatenation of flags

Returns
  Key if search successful, null otherwise

## ◆ lookup() [2/4]

Key org.libelektra.KeySet.lookup | ( | final Key | find | ) |
| inline

Helper function to search for a key in the key set.

Parameters

  find | Key used in search

Returns
  Key if search successful, null otherwise

## ◆ lookup() [3/4]

Key org.libelektra.KeySet.lookup | ( | final String | find,
|  | final int | options
| ) |  |
| inline

Helper function to search for a key in the key set.

Parameters

  find | Key name used in search
  options | Custom search options; concatenation of flags

Returns
  Key if search successful, null otherwise

## ◆ lookup() [4/4]

Key org.libelektra.KeySet.lookup | ( | final String | find | ) |
| inline

Helper function to search for a key in the key set.

Parameters

  find | Key name used in search

Returns
  Key if search successful, null otherwise

## ◆ needsSync()

int org.libelektra.KeySet.needsSync | ( |  | ) |
| inline

Helper function to check if synchronization is necessary.

Returns
  1 if sync is necessary, 0 if no sync is necessary, -1 in case of an error (null key)

## ◆ next()

Key org.libelektra.KeySet.next | ( |  | ) |
| inline

Helper function that returns the next key in the key set.

Returns
  Next Key in key set

## ◆ pop()

Key org.libelektra.KeySet.pop | ( |  | ) |
| inline

Helper function that returns key from key set and also removes it from the set.

Returns
  First Key in the set

## ◆ rewind()

int org.libelektra.KeySet.rewind | ( |  | ) |
| inline

Helper function that rewinds the current key set.

Returns

## ◆ setCursor()

int org.libelektra.KeySet.setCursor | ( | final int | cursor | ) |
| inline

Helper function that sets the current cursor of the key set.

Parameters

  cursor | Cursor position as integer

Returns
  1 in case of success

## ◆ tail()

Key org.libelektra.KeySet.tail | ( |  | ) |
| inline

Helper function that gets the key set tail.

Returns
  Last element of the key set

## ◆ toString()

String org.libelektra.KeySet.toString | ( |  | ) |
| inline

Basic java function that represents object as String.

Iterates though all keys in this key set and appends their representation to the output. Uses the toString() function of the Key objects.

Returns
  List of key-value pairs contained in this key set

The documentation for this class was generated from the following file:

- KeySet.java