File: DCEdge.pm

package info (click to toggle)
algotutor 0.8.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 576 kB
  • sloc: perl: 2,563; makefile: 41; php: 24; sh: 1
file content (58 lines) | stat: -rw-r--r-- 1,049 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Author:  Chao-Kuei Hung
# For more info, including license, please see doc/index.html

package DCEdge;
# Edge in a Doubly-Connected Edge List

use strict;
use Carp;
use vars qw(@ISA);
@ISA = qw(Edge);

use Edge;

# sub new { my ($self) = shift; $self->SUPER::new(@_); }

sub phantomize {
    my ($self) = @_;
    $self->{"#is_phantom"} = 1;
    $self->configure(-status=>"hidden");
}

sub is_phantom {
    return $_[0]->{"#is_phantom"};
}

sub twin {
    my ($self, $nv) = @_;
    my ($r) = $self->{adj}{twin};
    $self->{adj}{twin} = $nv if $#_ >= 1;
    return $r;
}

sub prev {
    my ($self, $nv) = @_;
    my ($r) = $self->{adj}{prev};
    $self->{adj}{prev} = $nv if $#_ >= 1;
    return $r;
}

sub next {
    my ($self, $nv) = @_;
    my ($r) = $self->{adj}{next};
    $self->{adj}{next} = $nv if $#_ >= 1;
    return $r;
}

sub configure {
    my ($self, %opts) = @_;
    $self->SUPER::configure(%opts);
    $self->twin()->SUPER::configure(%opts)
	if (not $self->cget(-directed) and ref $self->twin());
}

$::Config->{DCEdge} = {
};

1;