| 1 | # Copyright (c) 2007 by Christoph Lamprecht. All rights reserved. | ||||||||||||
| 2 | # This program is free software; you can redistribute it and/or | ||||||||||||
| 3 | # modify it under the same terms as Perl itself. | ||||||||||||
| 4 | # ch.l.ngre@online.de | ||||||||||||
| 5 | |||||||||||||
| 6 | package Tk::GraphItems::TiedCoord; | ||||||||||||
| 7 | 5 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 5 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 5 | ▶ | use Scalar::Util (qw/weaken/); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 5 | our $VERSION = '0.11'; | |||||||||||
| 11 | |||||||||||||
| 12 | 0 | ▶ | sub TIESCALAR{ | ||||||||||
|
Subroutine
TIESCALAR: not called CC=1 SCAR=6.9
| |||||||||||||
| 13 | 0 | my($class,$t_b,$c_in)=@_; | |||||||||||
| 14 | 0 | my $self = bless{TkGNode =>$t_b, | |||||||||||
| 15 | coord_index =>$c_in},$class; | ||||||||||||
| 16 | 0 | weaken ($self->{TkGNode}); | |||||||||||
| 17 | 0 | $self; | |||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 0 | ▶ | sub FETCH{ | ||||||||||
|
Subroutine
FETCH: not called CC=3 SCAR=24.8
| |||||||||||||
| 21 | 0 | my $self = shift; | |||||||||||
| 22 | 0 | my $i = $self->{coord_index}; | |||||||||||
| 23 | 0 | ▶ | if ($self->{TkGNode}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 24 | 0 | return ($self->{TkGNode}->get_coords)[$i]; | |||||||||||
| 25 | } | ||||||||||||
| 26 | 0 | ▶ | return $self->{cached}[$i]||0; | ||||||||||
|
Condition0%0/2
$self->{'cached'}[$i] || 0
MC/DC0%0/1
$self->{'cached'}[$i] || 0
$self->{'cached'}[$i]
Truth table0%0/2
A
A= $self->{'cached'}[$i]
| |||||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | 0 | ▶ | sub STORE{ | ||||||||||
|
Subroutine
STORE: not called CC=2 SCAR=17.9
| |||||||||||||
| 30 | 0 | my ($self,$value) = @_; | |||||||||||
| 31 | 0 | my $i = $self->{coord_index}; | |||||||||||
| 32 | 0 | my $tb = $self->{TkGNode}; | |||||||||||
| 33 | 0 | $self->{cached}[$i]= $value; | |||||||||||
| 34 | 0 | ▶ | return unless $tb; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | my @coords = $tb->get_coords; | |||||||||||
| 36 | 0 | $coords[$i] = $value; | |||||||||||
| 37 | 0 | $tb->set_coords(@coords); | |||||||||||
| 38 | } | ||||||||||||
| 39 | 5 | 1; | |||||||||||
| 40 | |||||||||||||
| 41 | |||||||||||||
| 42 | __END__ | ||||||||||||