亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美中文字幕一二三区视频| 精品午夜一区二区三区在线观看| 国产精品欧美精品| 一区二区三区四区激情| 婷婷综合五月天| 国产精品一品视频| 色哦色哦哦色天天综合| 欧美一区二区在线免费播放 | 欧美成人aa大片| 中文成人av在线| 午夜激情综合网| 国产激情偷乱视频一区二区三区 | 中文字幕成人网| 亚洲高清一区二区三区| 成人午夜激情视频| 91精品福利在线一区二区三区| 国产精品人人做人人爽人人添| 午夜欧美大尺度福利影院在线看| 成人一级片在线观看| 日韩亚洲欧美一区二区三区| 亚洲欧美激情视频在线观看一区二区三区| 三级成人在线视频| 欧美影院一区二区三区| 亚洲日本欧美天堂| 成人av在线播放网址| 国产午夜精品福利| 国产精品一二三四五| 欧美日韩精品一区二区三区蜜桃| 亚洲欧洲精品成人久久奇米网| 国产成人精品免费| 久久综合视频网| 福利一区福利二区| 亚洲啪啪综合av一区二区三区| 狠狠色丁香久久婷婷综| 久久网这里都是精品| 激情都市一区二区| 国产视频一区在线观看| 懂色av噜噜一区二区三区av| 国产嫩草影院久久久久| 成人听书哪个软件好| 亚洲日本欧美天堂| 在线不卡欧美精品一区二区三区| 亚洲一级二级在线| 欧美mv日韩mv国产| 97se亚洲国产综合自在线观| 亚洲一区二区三区影院| 日韩欧美一区二区视频| 国产夫妻精品视频| 一区二区三区在线播| 日韩欧美高清一区| 本田岬高潮一区二区三区| 亚洲韩国一区二区三区| 欧美xxxx老人做受| 色综合一区二区| 奇米影视在线99精品| 最新欧美精品一区二区三区| 欧美乱妇15p| 97久久久精品综合88久久| 亚洲国产精品麻豆| 亚洲国产精品成人久久综合一区 | 亚洲夂夂婷婷色拍ww47| 国产日韩欧美不卡| 日韩一区二区在线播放| 色综合一区二区| 成人涩涩免费视频| 激情欧美一区二区三区在线观看| 一区二区日韩电影| 亚洲日本一区二区三区| 国产精品乱码人人做人人爱| 日韩亚洲欧美在线| 精品区一区二区| 91精品国产黑色紧身裤美女| 在线观看日韩一区| 91色在线porny| 成人av一区二区三区| 国产精品综合一区二区三区| 国内精品自线一区二区三区视频| 亚洲观看高清完整版在线观看| 国产精品免费免费| 亚洲欧美日韩在线| 亚洲欧美色一区| 一区二区三区在线观看动漫 | av网站一区二区三区| 91在线一区二区三区| 91久久精品国产91性色tv| 欧美色手机在线观看| 欧美男同性恋视频网站| 日韩一区二区三区观看| 久久―日本道色综合久久| 精品国产91九色蝌蚪| 欧美韩日一区二区三区四区| 亚洲激情五月婷婷| 麻豆国产欧美一区二区三区| 懂色av一区二区在线播放| 91在线国内视频| 在线成人小视频| 欧美韩国日本一区| 日本不卡高清视频| jvid福利写真一区二区三区| 欧美三级乱人伦电影| 久久精品在这里| 日韩成人免费电影| 在线观看av一区| 国产婷婷精品av在线| 久久精品国产一区二区| 99免费精品视频| 欧美第一区第二区| 亚洲风情在线资源站| 国产精品456| 欧美不卡一二三| 日韩成人免费看| 欧美午夜精品久久久久久孕妇| 久久久久国产免费免费| 日韩国产欧美视频| 欧美三级在线视频| 一区二区三区四区高清精品免费观看 | 亚洲日本电影在线| 国产精品1区二区.| 久久一区二区三区国产精品| 午夜精品久久久久久久久久久 | 国产精品久久网站| 国产精品系列在线播放| 国产日产精品1区| 紧缚奴在线一区二区三区| 日韩午夜在线影院| 激情小说欧美图片| 久久精品人人做| www.综合网.com| 一二三区精品视频| 欧美一区二区视频在线观看| 蜜桃传媒麻豆第一区在线观看| 欧美精品日韩一区| 九九国产精品视频| 中文字幕亚洲成人| 精品视频在线免费看| 久久国产精品区| 亚洲日本免费电影| 日韩视频免费直播| 国产99精品国产| 日韩和欧美一区二区| 日本一区二区三区视频视频| 欧美亚洲国产一区二区三区va | 日韩一区二区精品葵司在线| 国产精品综合一区二区三区| 亚洲欧美电影一区二区| 欧美一二三区在线观看| 不卡av在线免费观看| 性欧美大战久久久久久久久| 久久综合久久综合亚洲| 欧美日韩中文一区| 国产精品一区二区免费不卡| 亚洲一区二区三区四区在线免费观看 | 91精品福利在线一区二区三区| 成人app网站| 国产成人综合在线播放| 日本女优在线视频一区二区| 一区二区免费看| 亚洲视频免费在线| 久久久国产午夜精品| 欧美日韩aaa| 欧美性欧美巨大黑白大战| 91欧美一区二区| 97久久超碰国产精品电影| 波多野结衣中文字幕一区 | 日韩精品在线看片z| 欧美视频在线不卡| 欧美中文字幕一区| 欧美日本一区二区| 欧美国产一区二区在线观看| 日本一二三四高清不卡| 成人免费在线观看入口| 国产日产欧美一区| 色综合久久九月婷婷色综合| 国内成+人亚洲+欧美+综合在线| 国产精品一区二区91| 色综合天天综合在线视频| 欧美成人精精品一区二区频| 1024国产精品| 首页综合国产亚洲丝袜| 日产精品久久久久久久性色| 轻轻草成人在线| 粉嫩在线一区二区三区视频| 一本色道亚洲精品aⅴ| 欧美一级高清片在线观看| 国产精品久久久久久户外露出 | 亚洲视频一区在线观看| 亚洲第一二三四区| 国产99久久久国产精品潘金网站| 色哟哟国产精品免费观看| 欧美视频完全免费看| 精品福利一区二区三区| 视频一区视频二区中文字幕| 成人免费视频免费观看| 精品国产凹凸成av人网站| 美日韩一区二区三区| 欧美视频一区二区在线观看| 中文字幕欧美国产| 国产一区亚洲一区| 欧美日韩视频不卡| 中文字幕在线视频一区|