1package Netdot::Model::Splice;
2
3use base 'Netdot::Model';
4use warnings;
5use strict;
6
7my $logger = Netdot->log->get_logger('Netdot::Model');
8
9=head1 NAME
10
11Netdot::Model::Splice
12
13=head1 CLASS METHODS
14=cut
15
16##################################################################
17
18=head2 insert
19
20    Splice together strand1 and strand2.
21    Note: Two Splice objects are created (bi-directional)
22
23  Arguments:
24    - strand1, strand2: the CableStrand objects to create a splice for.
25  Returns:
26    New Splice object
27  Examples:
28    Splice->insert({strand1=>$strand1, strand2=>$strand2})
29
30=cut
31
32sub insert {
33    my ($class, $argv) = @_;
34    $class->isa_class_method('insert');
35
36    $class->throw_fatal("Missing required arguments: strand1/strand2")
37	unless ( exists $argv->{strand1} && exists $argv->{strand2} );
38
39    $class->throw_user("You cannot splice a strand with itself!")
40	if ( $argv->{strand1} == $argv->{strand2} );
41
42    # Insert inverse first
43    $class->SUPER::insert({strand1=>$argv->{strand2}, strand2=>$argv->{strand1}});
44
45    return $class->SUPER::insert($argv);
46}
47
48=head1 AUTHORS
49
50Kai Waldron & Carlos Vicente, C<< <cvicente at ns.uoregon.edu> >>
51
52=head1 COPYRIGHT & LICENSE
53
54Copyright 2012 University of Oregon, all rights reserved.
55
56This program is free software; you can redistribute it and/or modify
57it under the terms of the GNU General Public License as published by
58the Free Software Foundation; either version 2 of the License, or
59(at your option) any later version.
60
61This program is distributed in the hope that it will be useful, but
62WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
63or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
64License for more details.
65
66You should have received a copy of the GNU General Public License
67along with this program; if not, write to the Free Software Foundation,
68Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
69
70=cut
71
72#Be sure to return 1
731;
74