Location: PHPKode > scripts > UML 2 Classes > uml-2-classes/src/Classes/Dependencies/AbstractionParser.class.php
<?
/**
 * Parser for the XMI Inheritances
 *
 *@author	Teoni Valois da Mota Silva
 *@name		AbstractionParser
 *@package	Dependencies
 *@version 	0.1.2
 *
 */

class AbstractionParser extends XMIParser {
	
	/**
	 * AbstractionParser's Object constructor
	 *
	 * @param String $xmiFile
	 */
	function AbstractionParser($data){
		$this->data = $data['UML:Abstraction'];
	}
	
	/**
	 * AbstractionParser's Object destructor
	 *
	 */
	function __destruct(){
		$this->data = null;
	}
		
	/**
	 * Returns the Client's ID of the Abstraction
	 *
	 * @param Int $abstractionId
	 * @return String
	 */
	function getClient($abstractionId){
		return $this->data[$abstractionId]['UML:Dependency.client'][0]['UML:Class'][0]['xmi.idref'];
	}
	
	/**
	 * Returns the Supplier's ID of the Abstraction
	 *
	 * @param Int $abstractionId
	 * @return String
	 */
	function getSupplier($abstractionId){		
		return $this->data[$abstractionId]['UML:Dependency.supplier'][0]['UML:Interface'][0]['xmi.idref'];
	}
	
	/**
	 * Returns an array containing all
	 * the Client's ID of a given Supplier ID
	 * in the file
	 *
	 * @param String $supplierXmiID
	 * @return Array
	 */
	function getClients($supplierXmiID){
		$clients = array();
		$numberOfClients = count($this->data);
		for($i=0;$i<$numberOfClients;$i++){
			if($this->getSupplier($i)==$supplierXmiID){
				array_push($clients,$this->getclient($i));
			}
		}
		return $clients;
	}
	
	/**
	 * Returns an array containing all
	 * the Suppliers's ID of a given Client ID
	 * in the file
	 *
	 * @param String $clientXmiID
	 * @return Array
	 */
	function getSuppliers($clientXmiID){
		$suppliers = array();
		$numberOfSuppliers = count($this->data);
		for($i=0;$i<$numberOfSuppliers;$i++){
			if($this->getClient($i)==$clientXmiID){
				array_push($suppliers,$this->getSupplier($i));
			}
		}
		return $suppliers;
	}
}
?>
Return current item: UML 2 Classes