GXml.HashThreeMap – GXml-0.20 – Vala Binding Reference

GXml.HashThreeMap – GXml-0.20 Reference Manual

# HashThreeMap

## Object Hierarchy:

## Description:

public class HashThreeMap : BaseCollection, ThreeMap

A class implementing Collection to store references to child DomElement of Collection.element, using three attributes in items as primary, secondary tertiary keys or MappeableElementThreeKey.get_map_pkey, MappeableElementThreeKey.get_map_skey and MappeableElementThreeKey.get_map_tkey methods if MappeableElementThreeKey are implemented by items to be added. All keys should be defined in node, otherwise it is not added; but keeps it as a child node of actual Collection.element.

If GXml.Element to be added is of type Collection.items_type and implements MappeableElementThreeKey, you should set attribute_primary_key, attribute_secondary_key and attribute_third_key to null in order to use returned value of MappeableElementThreeKey.get_map_pkey, MappeableElementThreeKey.get_map_skey and MappeableElementThreeKey.get_map_tkey as keys.

      public class YourObject : GXml.Element, MappeableElementThreeKey {
       [Description (nick="::Name")]
       public string name { get; set; }
       public string code { get; set; }
       public string category { get; set; }
       public string get_map_primary_key () { return code; }
       public string get_map_secondary_key () { return name; }
       public string get_map_third_key () { return category; }
      }
      public class YourList : HashThreeMap {
       construct {
         try { initialize_with (typeof (YourObject)); }
         catch (GLib.Error e) {
           warning ("Initialization error for collection type: %s : %s"
                .printf (get_type ().name(), e.message));
         }
       }
      }

Namespace: GXml
Package: GXml-0.20

## Content:

### Properties:

- public string attribute_primary_key { get; set construct; }
  An attribute's name in items to be added and used to retrieve elements as primary key.
- public string attribute_secondary_key { get; set construct; }
  An attribute's name in items to be added and used to retrieve elements as secondary key.
- public string attribute_third_key { get; set construct; }
  An attribute's name in items to be added and used to retrieve elements as third key.
- public Set<string> primary_keys_set { owned get; }

### Creation methods:

- public HashThreeMap ()

### Methods:

- public DomElement? @get (string primary_key, string secondary_key, string third_key)
  Returns an DomElement in the collection using given string keys.
- public override void clear ()
- public List<string> get_primary_keys ()
  Returns list of primary keys used in collection.
- public List<string> get_secondary_keys (string pkey)
  Returns list of secondary keys used in collection with pkey as primary key.
- public List<string> get_third_keys (string pkey, string skey)
  Returns list of third keys used in collection with pkey as primary key and skey as secondary key.
- public bool has_primary_key (string key)
  Returns true if @key is used in collection as primary key.
- public bool has_secondary_key (string pkey, string key)
  Returns true if @key is used in collection as secondary key with @pkey as primary.
- public bool has_third_key (string pkey, string skey, string key)
  Returns true if @key is used in collection as third key with secondary key and pkey as primary.
- public void initialize_element_with_keys (Element element, Type items_type, string attribute_primary_key, string attribute_secondary_key, string attribute_third_key) throws Error
  Convenient function to initialize a GXml.HashMap collection, using given element, items' type and name.
- public void initialize_with_keys (Type items_type, string attribute_primary_key, string attribute_secondary_key, string attribute_third_key) throws Error
  Convenient function to initialize a GXml.HashMap collection, using given element, items' type and name.
- public DomElement? item (string primary_key, string secondary_key, string third_key)
- public Set<string> secondary_keys_set (string pkey)
- public Set<string> third_keys_set (string pkey, string skey)
- public override bool validate_append (int index, DomElement element) throws Error
  Validates if given element has a attribute_primary_key, attribute_secondary_key and attribute_third_key set, if so adds a new keys pointing to given index and returns true.

### Fields:

- protected string _attribute_primary_key
  Element's attribute name used to refer of container's element as primary key. You should define it at construction time our set it as a construction property.
- protected string _attribute_secondary_key
  Element's attribute name used to refer of container's element as secondary key. You should define it at construction time our set it as a construction property.
- protected string _attribute_third_key
  Element's attribute name used to refer of container's element as third key. You should define it at construction time our set it as a construction property.
- protected HashMap<string,HashMap<string,HashMap<string,int>>> _hashtable
  A hashtable with all keys as string to node's index referred. Don't modify it manually.

### Inherited Members:

All known members inherited from class GXml.BaseCollection

- @foreach
- _element
- _items_name
- _items_type
- _nodes_index
- append

- clear
- element
- initialize
- initialize_element
- items_name

- items_type
- iterator
- nodes_index
- search
- validate_append

All known members inherited from class GLib.Object

- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data

- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer

- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref

All known members inherited from interface GXml.ThreeMap

- attribute_primary_key
- attribute_secondary_key
- attribute_third_key
- has_primary_key

- has_secondary_key
- has_third_key
- item

- primary_keys_set
- secondary_keys_set
- third_keys_set

All known members inherited from interface Gee.Traversable

- @foreach
- all_match
- any_match
- chop
- element_type
- filter

- first_match
- flat_map
- fold
- map
- max

- min
- order_by
- scan
- stream
- tee

All known members inherited from interface Gee.Iterable

- iterator

All known members inherited from interface GXml.Collection

- append
- clear
- create_item
- element

- get_item
- initialize
- items_name
- items_type

- length
- nodes_index
- search
- validate_append