Package xappy :: Module fieldmappings :: Class FieldMappings
[frames] | no frames]

Class FieldMappings

source code

object --+
         |
        FieldMappings

Mappings from field names to term prefixes, slot values, etc.

The following mappings are maintained:



Instance Methods
 
__init__(self, serialised=None)
Create a new field mapping object, or unserialise a saved one.
source code
 
get_fieldname_from_prefix(self, prefix)
Get a fieldname from a prefix.
source code
 
get_prefix(self, fieldname)
Get the prefix used for a given field name.
source code
 
get_slot(self, fieldname, purpose)
Get the slot number used for a given field name and purpose.
source code
 
add_prefix(self, fieldname)
Allocate a prefix for the given field.
source code
 
add_slot(self, fieldname, purpose, slotnum=None)
Allocate a slot number for the given field and purpose.
source code
 
serialise(self)
Serialise the field mappings to a string.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, serialised=None)
(Constructor)

source code 
Create a new field mapping object, or unserialise a saved one.
Overrides: object.__init__

get_fieldname_from_prefix(self, prefix)

source code 

Get a fieldname from a prefix.

If the prefix is not found, return None.

add_prefix(self, fieldname)

source code 

Allocate a prefix for the given field.

If a prefix is already allocated for this field, this has no effect.

add_slot(self, fieldname, purpose, slotnum=None)

source code 

Allocate a slot number for the given field and purpose.

If a slot number is already allocated for this field and purpose, this has no effect.

Returns the slot number allocated for the field and purpose (whether newly allocated, or previously allocated).

If slotnum is supplied, the number contained in it is used to allocate the new slot, instead of allocating a new number. No checks will be made to ensure that the slot number doesn't collide with existing (or later allocated) numbers: the main purpose of this parameter is to share allocations - ie, to collide deliberately.

serialise(self)

source code 

Serialise the field mappings to a string.

This can be unserialised by passing the result of this method to the constructor of a new FieldMappings object.