///////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2010 Wolfgang Kowarschick // // Permission is granted to copy, distribute and/or modify this document // under the terms of the WK License, Version 1.0 (WKL 1.0) or any later // version published by Wolfgang Kowarschick. ///////////////////////////////////////////////////////////////////////////////// package as3.component.level.service { import as3.assert.Assert; import as3.component.level.data.I_DataLevel; import as3.xml.data.I_DataXML; import as3.xml.service.I_ServiceXML; import as3.xml.service.ServiceXML; public class ServiceLevel implements I_ServiceLevel { ///////////////////////////////////////////////////////////////////////////// // LDVCS ///////////////////////////////////////////////////////////////////////////// private var v_service_xml: I_ServiceXML; public function set dataXML(p_data: I_DataXML): void { v_service_xml = new ServiceXML(p_data); } private var v_data_level: I_DataLevel; public function set dataLevel(p_data: I_DataLevel): void { if (v_data_level != p_data) { Assert.equals(v_data_level, null, this, "dataLevel has already been initialized"); Assert.notEquals(p_data, null, this, "dataLevel cannot be set to null"); v_data_level = p_data; }; } ///////////////////////////////////////////////////////////////////////////// // Constructor ///////////////////////////////////////////////////////////////////////////// public function ServiceLevel (p_data_xml: I_DataXML = null, p_data_level: I_DataLevel = null) { this.dataXML = p_data_xml; this.dataLevel = p_data_level; } ///////////////////////////////////////////////////////////////////////////// // Methods ///////////////////////////////////////////////////////////////////////////// public function load(p_url: String = null): void { if (p_url == null) { var l_zeros: String = ""; for (var i: int = 0; i < v_data_level.urlLevelLength; i++) l_zeros += "0"; p_url = v_data_level.urlPrefix + String(l_zeros + v_data_level.level) .substr(-v_data_level.urlLevelLength) + v_data_level.urlExtension; } v_service_xml.load(p_url); } ///////////////////////////////////////////////////////////////////////////// // End of class ///////////////////////////////////////////////////////////////////////////// } } ///////////////////////////////////////////////////////////////////////////////// // End of file /////////////////////////////////////////////////////////////////////////////////