using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using FastReport.Utils;
namespace FastReport.Data
{
///
/// Represents the collection of objects.
///
public class RelationCollection : FRCollectionBase
{
///
/// Gets or sets a relation.
///
/// The index of a relation in this collection.
/// The relation with specified index.
public Relation this[int index]
{
get { return List[index] as Relation; }
set { List[index] = value; }
}
///
/// Finds a relation by its name.
///
/// The name of a relation.
/// The object if found; otherwise null.
public Relation FindByName(string name)
{
foreach (Relation c in this)
{
if (c.Name == name)
return c;
}
return null;
}
///
/// Finds a relation by its alias.
///
/// The alias of a relation.
/// The object if found; otherwise null.
public Relation FindByAlias(string alias)
{
foreach (Relation c in this)
{
if (c.Alias == alias)
return c;
}
return null;
}
///
/// Finds a relation that is equal to specified one.
///
/// Another relation to compare with.
/// The object if found; otherwise null.
public Relation FindEqual(Relation rel)
{
foreach (Relation c in this)
{
if (c.Equals(rel))
return c;
}
return null;
}
///
/// Initializes a new instance of the class with default settings.
///
/// The owner of this collection.
public RelationCollection(Base owner) : base(owner)
{
}
}
}