Class FederationMap


  • public class FederationMap
    extends Object
    • Method Detail

      • getID

        public long getID()
      • isInitialized

        public boolean isInitialized()
      • getSize

        public int getSize()
      • isAligned

        public boolean isAligned​(FederationMap that,
                                 FTypes.AlignType... alignTypes)
        helper function for checking multiple allowed alignment types
        Parameters:
        that - FederationMap to check alignment with
        alignTypes - collection of alignment types which should be checked
        Returns:
        true if this and that FederationMap are aligned according to at least one alignment type
      • isAligned

        public boolean isAligned​(FederationMap that,
                                 boolean transposed)
        Determines if the two federation maps are aligned row/column partitions at the same federated sites (which allows for purely federated operation)
        Parameters:
        that - FederationMap to check alignment with
        transposed - true if that FederationMap should be transposed before checking alignment
        Returns:
        true if this and that FederationMap are aligned
      • isAligned

        public boolean isAligned​(FederationMap that,
                                 boolean transposed,
                                 boolean equalRows,
                                 boolean equalCols)
        determines if the two federated data are aligned row/column partitions (depending on parameters equalRows/equalCols) at the same federated site (which often allows for purely federated operations)
        Parameters:
        that - FederationMap to check alignment with
        transposed - true if that FederationMap should be transposed before checking alignment
        equalRows - true to indicate that the row dimension should be checked for alignment
        equalCols - true to indicate that the col dimension should be checked for alignment
        Returns:
        true if this and that FederationMap are aligned
      • execCleanup

        public void execCleanup​(long tid,
                                long... id)
      • identCopy

        public FederationMap identCopy​(long tid,
                                       long id)
      • copyWithNewID

        public FederationMap copyWithNewID()
        Copy the federation map with the next available federated ID as reference to the federated data. This means that the federated map refers to the next federated data object on the workers.
        Returns:
        copied federation map with next federated ID
      • copyWithNewID

        public FederationMap copyWithNewID​(long id)
        Copy the federation map with the given ID as reference to the federated data. This means that the federated map refers to the federated data object on the workers with the given ID.
        Parameters:
        id - federated data object ID
        Returns:
        copied federation map with given federated ID
      • copyWithNewID

        public FederationMap copyWithNewID​(long id,
                                           long clen)
        Copy the federation map with the given ID as reference to the federated data and with given clen as end dimension for the columns in the range. This means that the federated map refers to the federated data object on the workers with the given ID.
        Parameters:
        id - federated data object ID
        clen - column length of data objects on federated workers
        Returns:
        copied federation map with given federated ID and ranges adapted according to clen
      • copyWithNewIDAndRange

        public FederationMap copyWithNewIDAndRange​(long rowRangeEnd,
                                                   long colRangeEnd,
                                                   long outputID)
        Copy federated mapping while giving the federated data new IDs and setting the ranges from zero to row and column ends specified. The overlapping ranges are given an overlap number to separate the ranges when putting to the federated map. The federation map returned is of type FType.PART.
        Parameters:
        rowRangeEnd - end of range for the rows
        colRangeEnd - end of range for the columns
        outputID - ID given to the output
        Returns:
        new federation map with overlapping ranges with partially aggregated values
      • copyWithNewIDAndRange

        public FederationMap copyWithNewIDAndRange​(long rowRangeEnd,
                                                   long colRangeEnd,
                                                   long outputID,
                                                   FTypes.FType type)
      • modifyFedRanges

        public FederationMap modifyFedRanges​(long value,
                                             int dim)
        Take the federated mapping and sets one dimension of all federated ranges to the specified value.
        Parameters:
        value - long value for setting the dimension
        dim - indicates if the row (0) or column (1) dimension should be set to value
        Returns:
        FederationMap with the modified federated ranges
      • getMaxIndexInRange

        public long getMaxIndexInRange​(int dim)
      • forEachParallel

        public void forEachParallel​(BiFunction<FederatedRange,​FederatedData,​Void> forEachFunction)
        Execute a function for each FederatedRange + FederatedData pair. The function should not change any data of the pair and instead use mapParallel if that is a necessity. Note that this operation is parallel and necessary synchronisation has to be performed.
        Parameters:
        forEachFunction - function to execute for each pair
      • mapParallel

        public FederationMap mapParallel​(long newVarID,
                                         BiFunction<FederatedRange,​FederatedData,​Void> mappingFunction)
        Execute a function for each FederatedRange + FederatedData pair mapping the pairs to their new form by directly changing both FederatedRange and FederatedData. The varIDs don't have to be changed by the mappingFunction as that will be done by this method. Note that this operation is parallel and necessary synchronisation has to be performed.
        Parameters:
        newVarID - the new varID to be used by the new FederationMap
        mappingFunction - the function directly changing ranges and data
        Returns:
        the new FederationMap
      • reverseFedMap

        public void reverseFedMap()