/*
 * Copyright (C) 2008-2012 Delft University of Technology - All rights reserved.
 *
 * Author: Reijer Idema
 */

/**
 * @file AdjacencyList.h
 * Power System Adjacency List class header.
 */
#ifndef PowerSystem_AdjacencyList_h
#define PowerSystem_AdjacencyList_h

#include "Branch.h"				// USES Branch::BusIndexType
#include <set>					// HASA multiset
#include <vector>				// HASA vector
#include "PowerSystem.def"

POWERSYSTEM_NAMESPACE_BEGIN

/**
 * Power System Adjacency List class.
 * Implements the power system adjacency list class, describing the connections in a power system.
 */
class AdjacencyList
{
public:
	// TYPES
	typedef Branch::BusIndexType BusIndexType;
	// LIFECYCLE
	AdjacencyList(void);
	// OPERATIONS
	void Clear(void);
	bool IsEmpty(void);
	void Initialize(BusIndexType busCount);
	void AddBranch(BusIndexType i, BusIndexType j);
	void RemoveBranch(BusIndexType i, BusIndexType j);
	bool IsConnected(BusIndexType i, BusIndexType j);
	// ACCESS

private:
	std::vector< std::multiset<BusIndexType> > mConnections;
};

POWERSYSTEM_NAMESPACE_END

#endif // PowerSystem_AdjacencyList_h
