'''
Created on Nov 3, 2011
Modified on Sep 3, 2012
@version: 0.11
@author: Dilum Bandara
@email: dilumb@engr.colostate.edu

   Copyright 2012 H. M. N. Dilum Bandara and Anura P. Jayasumana, Colorado State
   University

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
'''

import Config as Config

class OverlayJoinReplyMsg(object):
    '''
    OverlayJoinReply Message class
    '''


    def __init__(self, zone, dimToSplit, neighbors):
        '''
        Constructor
        @param zone: New zone
        @param dimToSplit: Which dimension to use while splitting next zone 
        @param neighbors: Current list of neighbors
        '''
        self.msgType = 'JoinRply' #Message type
        self.zone = zone
        self._dimToSplit  = dimToSplit
        self.nbrs = neighbors
        #2 * 8 (corner for zone) + 1 for split axis + neighbors. NID 4 bytes
        # 8 + zone size + 1 + no_neigh*(NID + loc + zones)
        size = 9 + Config.NUM_DIMENSIONS * 8 + \
                            len(neighbors) * (4 + 12 * Config.NUM_DIMENSIONS) 
        self.size = float(size * 8)