亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? diff.pm

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? PM
?? 第 1 頁 / 共 4 頁
字號:
package Algorithm::Diff;
# Skip to first "=head" line for documentation.
use strict;

use integer;    # see below in _replaceNextLargerWith() for mod to make
                # if you don't use this
use vars qw( $VERSION @EXPORT_OK );
$VERSION = 1.19_01;
#          ^ ^^ ^^-- Incremented at will
#          | \+----- Incremented for non-trivial changes to features
#          \-------- Incremented for fundamental changes
require Exporter;
*import    = \&Exporter::import;
@EXPORT_OK = qw(
    prepare LCS LCSidx LCS_length
    diff sdiff compact_diff
    traverse_sequences traverse_balanced
);

# McIlroy-Hunt diff algorithm
# Adapted from the Smalltalk code of Mario I. Wolczko, <mario@wolczko.com>
# by Ned Konz, perl@bike-nomad.com
# Updates by Tye McQueen, http://perlmonks.org/?node=tye

# Create a hash that maps each element of $aCollection to the set of
# positions it occupies in $aCollection, restricted to the elements
# within the range of indexes specified by $start and $end.
# The fourth parameter is a subroutine reference that will be called to
# generate a string to use as a key.
# Additional parameters, if any, will be passed to this subroutine.
#
# my $hashRef = _withPositionsOfInInterval( \@array, $start, $end, $keyGen );

sub _withPositionsOfInInterval
{
    my $aCollection = shift;    # array ref
    my $start       = shift;
    my $end         = shift;
    my $keyGen      = shift;
    my %d;
    my $index;
    for ( $index = $start ; $index <= $end ; $index++ )
    {
        my $element = $aCollection->[$index];
        my $key = &$keyGen( $element, @_ );
        if ( exists( $d{$key} ) )
        {
            unshift ( @{ $d{$key} }, $index );
        }
        else
        {
            $d{$key} = [$index];
        }
    }
    return wantarray ? %d : \%d;
}

# Find the place at which aValue would normally be inserted into the
# array. If that place is already occupied by aValue, do nothing, and
# return undef. If the place does not exist (i.e., it is off the end of
# the array), add it to the end, otherwise replace the element at that
# point with aValue.  It is assumed that the array's values are numeric.
# This is where the bulk (75%) of the time is spent in this module, so
# try to make it fast!

sub _replaceNextLargerWith
{
    my ( $array, $aValue, $high ) = @_;
    $high ||= $#$array;

    # off the end?
    if ( $high == -1 || $aValue > $array->[-1] )
    {
        push ( @$array, $aValue );
        return $high + 1;
    }

    # binary search for insertion point...
    my $low = 0;
    my $index;
    my $found;
    while ( $low <= $high )
    {
        $index = ( $high + $low ) / 2;

        # $index = int(( $high + $low ) / 2);  # without 'use integer'
        $found = $array->[$index];

        if ( $aValue == $found )
        {
            return undef;
        }
        elsif ( $aValue > $found )
        {
            $low = $index + 1;
        }
        else
        {
            $high = $index - 1;
        }
    }

    # now insertion point is in $low.
    $array->[$low] = $aValue;    # overwrite next larger
    return $low;
}

# This method computes the longest common subsequence in $a and $b.

# Result is array or ref, whose contents is such that
#   $a->[ $i ] == $b->[ $result[ $i ] ]
# foreach $i in ( 0 .. $#result ) if $result[ $i ] is defined.

# An additional argument may be passed; this is a hash or key generating
# function that should return a string that uniquely identifies the given
# element.  It should be the case that if the key is the same, the elements
# will compare the same. If this parameter is undef or missing, the key
# will be the element as a string.

# By default, comparisons will use "eq" and elements will be turned into keys
# using the default stringizing operator '""'.

# Additional parameters, if any, will be passed to the key generation
# routine.

sub _longestCommonSubsequence
{
    my $a        = shift;    # array ref or hash ref
    my $b        = shift;    # array ref or hash ref
    my $counting = shift;    # scalar
    my $keyGen   = shift;    # code ref
    my $compare;             # code ref

    if ( ref($a) eq 'HASH' )
    {                        # prepared hash must be in $b
        my $tmp = $b;
        $b = $a;
        $a = $tmp;
    }

    # Check for bogus (non-ref) argument values
    if ( !ref($a) || !ref($b) )
    {
        my @callerInfo = caller(1);
        die 'error: must pass array or hash references to ' . $callerInfo[3];
    }

    # set up code refs
    # Note that these are optimized.
    if ( !defined($keyGen) )    # optimize for strings
    {
        $keyGen = sub { $_[0] };
        $compare = sub { my ( $a, $b ) = @_; $a eq $b };
    }
    else
    {
        $compare = sub {
            my $a = shift;
            my $b = shift;
            &$keyGen( $a, @_ ) eq &$keyGen( $b, @_ );
        };
    }

    my ( $aStart, $aFinish, $matchVector ) = ( 0, $#$a, [] );
    my ( $prunedCount, $bMatches ) = ( 0, {} );

    if ( ref($b) eq 'HASH' )    # was $bMatches prepared for us?
    {
        $bMatches = $b;
    }
    else
    {
        my ( $bStart, $bFinish ) = ( 0, $#$b );

        # First we prune off any common elements at the beginning
        while ( $aStart <= $aFinish
            and $bStart <= $bFinish
            and &$compare( $a->[$aStart], $b->[$bStart], @_ ) )
        {
            $matchVector->[ $aStart++ ] = $bStart++;
            $prunedCount++;
        }

        # now the end
        while ( $aStart <= $aFinish
            and $bStart <= $bFinish
            and &$compare( $a->[$aFinish], $b->[$bFinish], @_ ) )
        {
            $matchVector->[ $aFinish-- ] = $bFinish--;
            $prunedCount++;
        }

        # Now compute the equivalence classes of positions of elements
        $bMatches =
          _withPositionsOfInInterval( $b, $bStart, $bFinish, $keyGen, @_ );
    }
    my $thresh = [];
    my $links  = [];

    my ( $i, $ai, $j, $k );
    for ( $i = $aStart ; $i <= $aFinish ; $i++ )
    {
        $ai = &$keyGen( $a->[$i], @_ );
        if ( exists( $bMatches->{$ai} ) )
        {
            $k = 0;
            for $j ( @{ $bMatches->{$ai} } )
            {

                # optimization: most of the time this will be true
                if ( $k and $thresh->[$k] > $j and $thresh->[ $k - 1 ] < $j )
                {
                    $thresh->[$k] = $j;
                }
                else
                {
                    $k = _replaceNextLargerWith( $thresh, $j, $k );
                }

                # oddly, it's faster to always test this (CPU cache?).
                if ( defined($k) )
                {
                    $links->[$k] =
                      [ ( $k ? $links->[ $k - 1 ] : undef ), $i, $j ];
                }
            }
        }
    }

    if (@$thresh)
    {
        return $prunedCount + @$thresh if $counting;
        for ( my $link = $links->[$#$thresh] ; $link ; $link = $link->[0] )
        {
            $matchVector->[ $link->[1] ] = $link->[2];
        }
    }
    elsif ($counting)
    {
        return $prunedCount;
    }

    return wantarray ? @$matchVector : $matchVector;
}

sub traverse_sequences
{
    my $a                 = shift;          # array ref
    my $b                 = shift;          # array ref
    my $callbacks         = shift || {};
    my $keyGen            = shift;
    my $matchCallback     = $callbacks->{'MATCH'} || sub { };
    my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
    my $finishedACallback = $callbacks->{'A_FINISHED'};
    my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
    my $finishedBCallback = $callbacks->{'B_FINISHED'};
    my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );

    # Process all the lines in @$matchVector
    my $lastA = $#$a;
    my $lastB = $#$b;
    my $bi    = 0;
    my $ai;

    for ( $ai = 0 ; $ai <= $#$matchVector ; $ai++ )
    {
        my $bLine = $matchVector->[$ai];
        if ( defined($bLine) )    # matched
        {
            &$discardBCallback( $ai, $bi++, @_ ) while $bi < $bLine;
            &$matchCallback( $ai,    $bi++, @_ );
        }
        else
        {
            &$discardACallback( $ai, $bi, @_ );
        }
    }

    # The last entry (if any) processed was a match.
    # $ai and $bi point just past the last matching lines in their sequences.

    while ( $ai <= $lastA or $bi <= $lastB )
    {

        # last A?
        if ( $ai == $lastA + 1 and $bi <= $lastB )
        {
            if ( defined($finishedACallback) )
            {
                &$finishedACallback( $lastA, @_ );
                $finishedACallback = undef;
            }
            else
            {
                &$discardBCallback( $ai, $bi++, @_ ) while $bi <= $lastB;
            }
        }

        # last B?
        if ( $bi == $lastB + 1 and $ai <= $lastA )
        {
            if ( defined($finishedBCallback) )
            {
                &$finishedBCallback( $lastB, @_ );
                $finishedBCallback = undef;
            }
            else
            {
                &$discardACallback( $ai++, $bi, @_ ) while $ai <= $lastA;
            }
        }

        &$discardACallback( $ai++, $bi, @_ ) if $ai <= $lastA;
        &$discardBCallback( $ai, $bi++, @_ ) if $bi <= $lastB;
    }

    return 1;
}

sub traverse_balanced
{
    my $a                 = shift;              # array ref
    my $b                 = shift;              # array ref
    my $callbacks         = shift || {};
    my $keyGen            = shift;
    my $matchCallback     = $callbacks->{'MATCH'} || sub { };
    my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
    my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
    my $changeCallback    = $callbacks->{'CHANGE'};
    my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );

    # Process all the lines in match vector
    my $lastA = $#$a;
    my $lastB = $#$b;
    my $bi    = 0;
    my $ai    = 0;
    my $ma    = -1;
    my $mb;

    while (1)
    {

        # Find next match indices $ma and $mb
        do {
            $ma++;
        } while(
                $ma <= $#$matchVector
            &&  !defined $matchVector->[$ma]
        );

        last if $ma > $#$matchVector;    # end of matchVector?
        $mb = $matchVector->[$ma];

        # Proceed with discard a/b or change events until
        # next match
        while ( $ai < $ma || $bi < $mb )
        {

            if ( $ai < $ma && $bi < $mb )
            {

                # Change
                if ( defined $changeCallback )
                {
                    &$changeCallback( $ai++, $bi++, @_ );
                }
                else
                {
                    &$discardACallback( $ai++, $bi, @_ );
                    &$discardBCallback( $ai, $bi++, @_ );
                }
            }
            elsif ( $ai < $ma )
            {
                &$discardACallback( $ai++, $bi, @_ );
            }
            else
            {

                # $bi < $mb
                &$discardBCallback( $ai, $bi++, @_ );
            }
        }

        # Match
        &$matchCallback( $ai++, $bi++, @_ );
    }

    while ( $ai <= $lastA || $bi <= $lastB )
    {
        if ( $ai <= $lastA && $bi <= $lastB )
        {

            # Change
            if ( defined $changeCallback )
            {
                &$changeCallback( $ai++, $bi++, @_ );
            }
            else
            {
                &$discardACallback( $ai++, $bi, @_ );
                &$discardBCallback( $ai, $bi++, @_ );
            }
        }
        elsif ( $ai <= $lastA )
        {
            &$discardACallback( $ai++, $bi, @_ );
        }
        else
        {

            # $bi <= $lastB
            &$discardBCallback( $ai, $bi++, @_ );
        }
    }

    return 1;
}

sub prepare
{
    my $a       = shift;    # array ref
    my $keyGen  = shift;    # code ref

    # set up code ref
    $keyGen = sub { $_[0] } unless defined($keyGen);

    return scalar _withPositionsOfInInterval( $a, 0, $#$a, $keyGen, @_ );
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久电影国产免费久久电影| 亚洲色图视频网站| 六月丁香综合在线视频| 日韩欧美国产午夜精品| 国产精品99久久久久久久vr| 欧美激情一区二区| 久久视频一区二区| 国产精品综合一区二区| 国产精品久久一卡二卡| 色婷婷久久久综合中文字幕 | 亚洲在线中文字幕| 欧美亚州韩日在线看免费版国语版| 一区二区三区电影在线播| 欧美日本在线看| 韩国三级在线一区| 亚洲视频一区在线| 欧美精品123区| 高清视频一区二区| 一区二区三区在线观看网站| 日韩欧美国产三级电影视频| 成人高清伦理免费影院在线观看| 亚洲一区免费在线观看| 精品国产一区二区三区忘忧草 | 亚洲激情在线播放| 日韩久久免费av| 97久久超碰精品国产| 日韩av一区二区三区四区| 国产欧美日韩三区| 欧美揉bbbbb揉bbbbb| 国产一区二区三区黄视频 | 丝袜a∨在线一区二区三区不卡| 欧美tickle裸体挠脚心vk| 99国产麻豆精品| 欧美aaaaa成人免费观看视频| 欧美国产日韩精品免费观看| 欧美电影在哪看比较好| 成人av在线电影| 蜜臀久久久久久久| 亚洲免费视频成人| 国产欧美日韩精品一区| 欧美一级一区二区| 欧美综合在线视频| 国产91精品一区二区| 蜜桃av噜噜一区| 亚洲国产综合人成综合网站| 国产午夜精品一区二区三区视频| 欧美日韩精品欧美日韩精品一| 成人久久久精品乱码一区二区三区| 丝袜美腿亚洲综合| 一区二区成人在线视频| 国产精品免费视频一区| 精品国产网站在线观看| 91精品婷婷国产综合久久性色| 91免费看片在线观看| 国产白丝精品91爽爽久久| 久久精品国产第一区二区三区| 亚洲第一成年网| 亚洲美女视频在线| 亚洲人成小说网站色在线| 国产日产欧美精品一区二区三区| 欧美一区二区三区不卡| 欧美美女bb生活片| 欧美日韩视频在线一区二区| 91官网在线观看| 99久久免费精品高清特色大片| 国产一区二区三区免费观看| 久久成人精品无人区| 美腿丝袜亚洲综合| 蜜桃精品视频在线| 麻豆成人av在线| 美女一区二区视频| 精品无码三级在线观看视频| 久久精品二区亚洲w码| 老鸭窝一区二区久久精品| 蜜臀av性久久久久蜜臀aⅴ流畅| 日本在线不卡视频一二三区| 亚洲与欧洲av电影| 性欧美大战久久久久久久久| 亚洲mv在线观看| 日本特黄久久久高潮| 美女精品一区二区| 国产一区视频导航| 国产精品夜夜嗨| 成人免费看的视频| 91成人国产精品| 欧美三级午夜理伦三级中视频| 欧洲在线/亚洲| 91精品国产美女浴室洗澡无遮挡| 日韩一区二区免费电影| 久久久精品蜜桃| 国产精品家庭影院| 亚洲丝袜精品丝袜在线| 亚洲一区二区三区中文字幕在线| 亚洲成人手机在线| 日韩成人精品视频| 久久成人18免费观看| 高清不卡在线观看| 日本高清不卡视频| 3d成人动漫网站| 国产日韩亚洲欧美综合| 亚洲欧美色图小说| 日韩av电影天堂| 精品亚洲欧美一区| 97精品久久久久中文字幕| 国产精品美女久久久久久久久久久 | 亚洲综合在线免费观看| 天堂在线亚洲视频| 国产米奇在线777精品观看| 成人avav影音| 91精品国产黑色紧身裤美女| 2024国产精品| 亚洲一区二区三区在线播放| 美腿丝袜亚洲三区| 91网站视频在线观看| 欧美肥胖老妇做爰| 国产精品嫩草影院av蜜臀| 性欧美大战久久久久久久久| 国产精品乡下勾搭老头1| 欧美色视频在线| 欧美国产视频在线| 日本网站在线观看一区二区三区 | 91久久一区二区| 精品处破学生在线二十三| 亚洲精品高清视频在线观看| 激情久久五月天| 欧美日韩在线三级| 中文字幕国产一区二区| 日本美女视频一区二区| 91麻豆swag| 欧美精品一区二区精品网| 亚洲综合成人在线| 国产成人精品影院| 日韩欧美黄色影院| 亚洲v精品v日韩v欧美v专区| 99re免费视频精品全部| 2023国产一二三区日本精品2022| 亚洲国产一区二区a毛片| 国产成人日日夜夜| 91精选在线观看| 夜夜精品浪潮av一区二区三区| 国产一区二区91| 欧美一级在线免费| 一区av在线播放| gogogo免费视频观看亚洲一| 精品处破学生在线二十三| 日韩国产欧美在线观看| 欧美色综合网站| 一区二区三区在线播放| fc2成人免费人成在线观看播放| xnxx国产精品| 精品在线一区二区| 日韩精品最新网址| 蜜桃视频免费观看一区| 欧美精品高清视频| 亚洲国产日产av| 在线观看国产一区二区| 亚洲精选视频免费看| 91在线丨porny丨国产| 国产精品美女一区二区| 成人精品免费看| 国产精品久久久久久久午夜片| 国内成人免费视频| 久久久国产一区二区三区四区小说 | 91亚洲精品一区二区乱码| 亚洲国产精品av| 成人午夜大片免费观看| 中文字幕免费在线观看视频一区| 国产不卡高清在线观看视频| 久久久精品日韩欧美| 国产成人免费视| 国产精品国产成人国产三级 | 久久精品人人做人人爽97| 韩国精品主播一区二区在线观看 | 岛国av在线一区| 国产精品久久久久久久久果冻传媒| 国产精品77777竹菊影视小说| 国产欧美精品在线观看| 高清在线观看日韩| 一区视频在线播放| 色成年激情久久综合| 亚洲高清视频中文字幕| 在线播放亚洲一区| 麻豆freexxxx性91精品| 国产视频亚洲色图| 色呦呦网站一区| 午夜不卡av免费| 日韩精品一区二区三区在线观看| 久久成人18免费观看| 久久新电视剧免费观看| 国产成人av一区| 国产精品久久久久久久久快鸭 | 亚洲欧洲成人精品av97| 色综合欧美在线视频区| 亚洲一区在线观看免费观看电影高清| 欧美综合欧美视频| 美女网站色91| 欧美激情综合在线| 色天天综合久久久久综合片| 午夜精品福利在线| 2022国产精品视频|