/************************************************************************************ * Copyright (C) 2008 by Politehnica University of Bucharest and Rutgers University * All rights reserved. * Refer to LICENSE for terms and conditions of use. ***********************************************************************************/ package vnsim.vehicular.routePlan.selfRouted; import java.util.ArrayList; import java.io.Serializable; import vnsim.vehicular.simulator.RouteSegment; public class MajorRoadArea implements Serializable { /** serialVersionUID */ private static final long serialVersionUID = -5883719321862303634L; public String areaCodeString; public byte[] areaCodeByte; public ArrayList roads; public float[] color; public MajorRoadArea(AreaCode a) { this.areaCodeByte = new byte[a.code.length]; copyAreaCode(a.code, this.areaCodeByte); this.areaCodeString = new String(a.areaCodeToString()); this.roads = new ArrayList(); color = new float[3]; } public MajorRoadArea(MajorRoadArea a) { this.areaCodeByte = new byte[a.areaCodeByte.length]; copyAreaCode(a.areaCodeByte, this.areaCodeByte); this.areaCodeString = new String(a.areaCodeString); this.roads = new ArrayList(); color = a.color; } public void move(MajorRoadArea a) { copyAreaCode(a.areaCodeByte, this.areaCodeByte); this.areaCodeString = new String(a.areaCodeString); this.color = a.color; } public void constructArea() { } public void setColor(float c1, float c2, float c3) { this.color[0] = c1; this.color[1] = c2; this.color[2] = c3; } public void setStringValue() { this.areaCodeString = new String(); for (int i = 0; i < this.areaCodeByte.length; i++) { this.areaCodeString = this.areaCodeString + this.areaCodeByte[i] + " "; } } public boolean copyAreaCode(byte[] src, byte[] dest) { if (src == null || dest == null) { return false; } if (src.length != dest.length) { return false; } for (int i = 0; i < src.length; i++) { dest[i] = src[i]; } return true; } }