Пример #1
0
	/* ******************
	 * 	TREEOBJ MEMBERS
	 * ******************/
	
	public override Tile getTile (CanAddr cAddr) {
		int childIndex = (int) cAddr.getTuple(this.aggLev - 1);

		if (children[childIndex] == null) {
			if (this.aggLev == 1) {
				children[childIndex] = new Tile (this, childIndex);
			}
			else { children[childIndex] = new Node(this, childIndex); }
		}
		return children[childIndex].getTile(cAddr);
	}
Пример #2
0
	public override void updateProperties (CanAddr cAddr) {
		
		int childIndex = (int) cAddr.getTuple(this.aggLev - 1);

		if (this.children [childIndex] != null) {
			this.children [childIndex].updateProperties (cAddr);
		}

		/*
		for (int i = 0; i < NUM_CHILDREN; i++) {
			if (children[i] != null) {
				children[i].updateProperties(cAddr);
			}
		}
		*/
	}
Пример #3
0
	public override void RegisterController (CanAddr cAddr, TileTypeController tTCont) {
		int childIndex = (int) cAddr.getTuple(this.aggLev - 1);

		if (children[childIndex] == null) {
			if (this.aggLev == 1) {
				this.children[childIndex] = new Tile (this, childIndex);
				this.children[childIndex].RegisterController(cAddr, tTCont);
			}
			else {
				this.children[childIndex] = new Node (this, childIndex);
				this.children[childIndex].RegisterController(cAddr, tTCont);
			}
		}
		else {
			children[childIndex].RegisterController(cAddr, tTCont);
		}
	}
Пример #4
0
	public override void setState (CanAddr cAddr, TileTypeController.TileType tileType, float growthLevel) {
		int childIndex = (int) cAddr.getTuple(this.aggLev - 1);

		if (children[childIndex] == null) {
			if (this.aggLev == 1) {
				this.children[childIndex] = new Tile (this, childIndex);
				this.children[childIndex].setState(cAddr, tileType, growthLevel);
			}
			else {
				this.children[childIndex] = new Node (this, childIndex);
				this.children[childIndex].setState(cAddr, tileType, growthLevel);
			}
		}
		else {
			children[childIndex].setState(cAddr, tileType, growthLevel);
		}
	}
Пример #5
0
    public override void setState(CanAddr cAddr, byte state)
    {
        int childIndex = (int) cAddr.getTuple(this.aggLev - 1);

        if (children[childIndex] == null) {
            if (this.aggLev == 1) {
                this.childState[childIndex] = state;
            }
            else {
                this.children[childIndex] = new Node (this, childIndex);
                this.children[childIndex].inheritState (this.childState[childIndex]);
                this.children[childIndex].setState(cAddr, state);
            }
        }
        else {
            children[childIndex].setState(cAddr, state);
        }
    }
Пример #6
0
	// TODO: ordering check
	public static LatAddr convertCanAddrToLatAddr (CanAddr cAddr) {
		LatAddr result = new LatAddr();
		LatAddr tmp = new LatAddr();

		for (int i = 0; i < Config.TREE_DEPTH; i++) {
			byte curTup = cAddr.getTuple(i);
			tmp.A = (curTup >> 0) & 0x01;
			tmp.B = (curTup >> 1) & 0x01;
			tmp.C = (curTup >> 2) & 0x01;

			for (int j = i; j > 0; j--) {
				BasisVectors.applyBMatrixToLatAddr(tmp);
			}

			result.A += tmp.A;
			result.B += tmp.B;
			result.C += tmp.C;
		}

		result.cleanUpLatAddr();
		return result;
	}