Feature #408

Feature #54: Add support for key mappings in Weave.

Create a reverse lookup for getting keys corresponding to a data value.

Added by Andy Dufilie over 6 years ago. Updated about 6 years ago.

Status:ResolvedStart date:08/19/2011
Priority:ImmediateDue date:
Assignee:Krithika Manohar% Done:

0%

Category:Internal Code Refactoring
Target version:1.0
Complexity:Medium OIC Priority:
Required by:

Description

We then need a function to do a reverse-lookup (put this in in EquationColumnLib.as for now):
getKeysFromValue(column:IAttributeColumn, value:Object, dataType:*):Array
which would return a list of IQualifiedKey objects.

This would need to loop over all the keys in the column and build a reverse lookup table:

// this code has not been tested
public static function getKeysFromValue(column:IAttributeColumn, value:Object, dataType:*):Array
{
    var reverseLookup:Dictionary = new Dictionary(true);
    for each (var qkey:IQualifiedKey in column.keys)
    {
        var value:* = column.getValueFromKey(qkey, dataType);
        if (!reverseLookup[value])
            reverseLookup[value] = [];
        reverseLookup[value].push(qkey);
    }
    return reverseLookup[value];
}

The first version of this function can rebuild the lookup table every time. Once it's verified to be working, then it can be improved to cache the lookup table for each column so it doesn't have to recreate it each time. Whenever the column runs its callbacks, the cached lookup table should be cleared.


Related issues

Related to Weave - Feature #1226: Add reverse lookup (value to key array) to StatisticsCache. Open 03/01/2013
Blocks Weave - Feature #407: Create an interface for populating the columns in a LineChartTool so we can have year values on the X axis. Resolved 08/19/2011

History

#1 Updated by Andy Dufilie over 6 years ago

  • Priority changed from Normal to Immediate

#2 Updated by Andy Dufilie over 6 years ago

  • Description updated (diff)

#3 Updated by Krithika Manohar about 6 years ago

  • Status changed from Open to Resolved

#4 Updated by Andy Dufilie about 6 years ago

  • Target version set to 1.0

Also available in: Atom PDF