# Entity.pm -- Represents an entity inside Crystal Palace.
# ---------
# September 11, 2000 -- Copyright Sunir Shah. All rights reserved.

package Entity;

use Element;
@ISA = (Element);

sub _initialize
{
    my ($self, $key) = @_;
    $self->SUPER::_initialize($key);

    $self->{name} = $key;
    $self->{type} = '';
    $self->{relationships} = [];
}

# Maintains set property
sub addRelationship
{
    my ($self, $relationship) = @_;
    push @{$self->{relationships}}, $relationship
        if !(grep {$relationship->equals($_)} @{$self->{relationships}});
    return $self;
}

1;
