journeta 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile +8 -0
  2. data/Gemfile.lock +20 -0
  3. data/{History.txt → HISTORY} +13 -1
  4. data/LICENSE +51 -0
  5. data/License.txt +2 -2
  6. data/{README.txt → README.rdoc} +12 -17
  7. data/Rakefile +46 -112
  8. data/VERSION +1 -0
  9. data/{examples/instant_messenger.rb → bin/journeta_instant_messenger.rb} +13 -0
  10. data/bin/journeta_mock_peers.rb +32 -0
  11. data/{examples/network_status.rb → bin/journeta_network_status.rb} +0 -0
  12. data/bin/journeta_peer_fuzzer.rb +54 -0
  13. data/{examples/queue_client.rb → bin/journeta_queue_client.rb} +0 -0
  14. data/{examples/queue_server.rb → bin/journeta_queue_server.rb} +0 -0
  15. data/bin/journeta_thread_leak_check.rb +16 -0
  16. data/bin/journeta_top.rb +73 -0
  17. data/{examples/instant_messenger_gui.rb → broken/journeta_instant_messenger_gui.rb} +0 -2
  18. data/broken/journeta_instant_messenger_shoes.rb +52 -0
  19. data/lib/diff.rb +280 -0
  20. data/lib/journeta.rb +1 -0
  21. data/lib/journeta/asynchronous.rb +2 -2
  22. data/lib/journeta/exception.rb +8 -0
  23. data/lib/journeta/journeta_engine.rb +4 -5
  24. data/lib/journeta/logger.rb +1 -1
  25. data/lib/journeta/peer_connection.rb +2 -2
  26. data/lib/journeta/peer_listener.rb +2 -2
  27. data/lib/journeta/presence_broadcaster.rb +19 -5
  28. data/lib/journeta/presence_listener.rb +8 -4
  29. data/lib/journeta/version.rb +6 -4
  30. data/rdoc/Array.html +199 -0
  31. data/rdoc/Diff.html +714 -0
  32. data/rdoc/Diffable.html +409 -0
  33. data/rdoc/Journeta.html +288 -0
  34. data/rdoc/Journeta/Asynchronous.html +429 -0
  35. data/rdoc/Journeta/Common.html +205 -0
  36. data/rdoc/Journeta/Common/BasicMessage.html +228 -0
  37. data/rdoc/Journeta/Common/DummyPeerHandler.html +237 -0
  38. data/rdoc/Journeta/Common/Job.html +279 -0
  39. data/rdoc/Journeta/Common/Shutdown.html +236 -0
  40. data/rdoc/Journeta/DefaultPeerHandler.html +248 -0
  41. data/rdoc/Journeta/DefaultPeerRegisteredHandler.html +249 -0
  42. data/rdoc/Journeta/DefaultPeerUnregisteredHandler.html +249 -0
  43. data/rdoc/Journeta/DefaultPeerUpdatedHandler.html +249 -0
  44. data/rdoc/Journeta/Engine.html +953 -0
  45. data/rdoc/Journeta/Logger.html +237 -0
  46. data/rdoc/Journeta/NotImplementedException.html +188 -0
  47. data/rdoc/Journeta/PeerConnection.html +549 -0
  48. data/rdoc/Journeta/PeerListener.html +276 -0
  49. data/rdoc/Journeta/PeerRegistry.html +804 -0
  50. data/rdoc/Journeta/PresenceBroadcaster.html +306 -0
  51. data/rdoc/Journeta/PresenceListener.html +300 -0
  52. data/rdoc/Journeta/PresenceMessage.html +321 -0
  53. data/rdoc/Journeta/VERSION.html +181 -0
  54. data/rdoc/README_rdoc.html +196 -0
  55. data/rdoc/String.html +199 -0
  56. data/rdoc/created.rid +20 -0
  57. data/rdoc/index.html +212 -0
  58. data/rdoc/lib/diff_rb.html +52 -0
  59. data/rdoc/lib/journeta/asynchronous_rb.html +60 -0
  60. data/rdoc/lib/journeta/common/basic_message_rb.html +52 -0
  61. data/rdoc/lib/journeta/common/dummy_peer_handler_rb.html +52 -0
  62. data/rdoc/lib/journeta/common/job_rb.html +52 -0
  63. data/rdoc/lib/journeta/common/shutdown_rb.html +52 -0
  64. data/rdoc/lib/journeta/exception_rb.html +55 -0
  65. data/rdoc/lib/journeta/journeta_engine_rb.html +62 -0
  66. data/rdoc/lib/journeta/logger_rb.html +55 -0
  67. data/rdoc/lib/journeta/peer_connection_rb.html +58 -0
  68. data/rdoc/lib/journeta/peer_handler_rb.html +52 -0
  69. data/rdoc/lib/journeta/peer_listener_rb.html +60 -0
  70. data/rdoc/lib/journeta/peer_registry_rb.html +54 -0
  71. data/rdoc/lib/journeta/presence_broadcaster_rb.html +57 -0
  72. data/rdoc/lib/journeta/presence_listener_rb.html +62 -0
  73. data/rdoc/lib/journeta/presence_message_rb.html +52 -0
  74. data/rdoc/lib/journeta/version_rb.html +52 -0
  75. data/rdoc/lib/journeta_rb.html +91 -0
  76. data/rdoc/rdoc.css +706 -0
  77. data/test/helper.rb +19 -0
  78. data/test/test_lifecycle.rb +49 -9
  79. data/website/images/arrow.png +0 -0
  80. data/website/images/banner.jpg +0 -0
  81. data/website/images/content_shadow.png +0 -0
  82. data/website/images/content_side.png +0 -0
  83. data/website/images/header.jpg +0 -0
  84. data/website/images/header_side.jpg +0 -0
  85. data/website/index.html +1 -1
  86. data/website/index.txt +1 -1
  87. data/website/stylesheets/reset.css +30 -0
  88. data/website/stylesheets/screen.css +1 -1
  89. metadata +152 -46
  90. data/test/test_event_broadcaster.rb +0 -15
  91. data/test/test_helper.rb +0 -4
  92. data/test/test_journeta.rb +0 -11
@@ -0,0 +1,8 @@
1
+ # Copyright 2011, Preston Lee Ventures, LLC. All rights reserved.
2
+
3
+ module Journeta
4
+
5
+ class NotImplementedException < Exception
6
+ end
7
+
8
+ end
@@ -1,10 +1,9 @@
1
- # Copyright © 2007 OpenRain, LLC. All rights reserved.
1
+ # Copyright © 2011 Preston Lee Ventures, LLC. All rights reserved.
2
2
  #
3
- # Preston Lee <preston.lee@openrain.com>
4
-
5
3
  # The root namespace for the entire #Journeta library.
6
4
  # See..
7
- # * Journeta::Engine
5
+ # * +Journeta::Engine+
6
+ # * https://github.com/preston/journeta
8
7
  # * http://journeta.rubyforge.org
9
8
  module Journeta
10
9
 
@@ -19,7 +18,7 @@ module Journeta
19
18
  # A supposedly universally unique id for this instance.
20
19
  attr_reader :uuid
21
20
 
22
- # An array of peer network names. Ex: ['OpenRain Test', 'quick_chat_app']
21
+ # An array of peer network names. Ex: ['Preston Lee Ventures Test', 'quick_chat_app']
23
22
  # An empty array indicates implicit membership in all discovered groups.
24
23
  attr_reader :groups
25
24
 
@@ -1,4 +1,4 @@
1
- # Copyright 2007, OpenRain, LLC. All rights reserved.
1
+ # Copyright 2011, Preston Lee Ventures, LLC. All rights reserved.
2
2
 
3
3
 
4
4
  module Journeta
@@ -1,6 +1,6 @@
1
- # Copyright © 2007 OpenRain, LLC. All rights reserved.
1
+ # Copyright © 2011 Preston Lee Ventures, LLC. All rights reserved.
2
2
  #
3
- # Preston Lee <preston.lee@openrain.com>
3
+ # Preston Lee <preston.lee@prestonlee.com>
4
4
  module Journeta
5
5
 
6
6
  # An outgoing message tube. Messages may or may not arrive at the destination, but if they do they'll be in order.
@@ -1,6 +1,6 @@
1
- # Copyright © 2007 OpenRain, LLC. All rights reserved.
1
+ # Copyright © 2011 Preston Lee Ventures, LLC. All rights reserved.
2
2
  #
3
- # Preston Lee <preston.lee@openrain.com>
3
+ # Preston Lee <preston.lee@prestonlee.com>
4
4
 
5
5
  require 'socket'
6
6
 
@@ -21,11 +21,25 @@ module Journeta
21
21
  begin
22
22
  socket = UDPSocket.open
23
23
  begin
24
- if PLATFORM[/linux/i]
25
- socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") )
26
- else
27
- # socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, [1].pack('i')) # Preston's original config for OS X.
28
- socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEPORT, [1].pack("i_") ) # Remi's suggested default.
24
+ if defined?(PLATFORM) # v1.8 (and prior?) MRI and JRuby on Linux, Windows, OSX and Solaris.
25
+ if PLATFORM.match(/linux/i)
26
+ socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") )
27
+ elsif PLATFORM.match(/java/i)
28
+ # puts 'Running on a JVM!'
29
+ socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") )
30
+ # socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, [1].pack('i'))
31
+ # socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEPORT, [1].pack("i_") )
32
+ else
33
+ # socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, [1].pack('i')) # Preston's original config for OS X.
34
+ socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEPORT, [1].pack("i_") ) # Remi's suggested default.
35
+ end
36
+ elsif defined?(RUBY_PLATFORM) # Ruby 1.9 MRI
37
+ if RUBY_PLATFORM.match(/linux/i)
38
+ socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") )
39
+ else
40
+ # socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, [1].pack('i'))
41
+ socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEPORT, [1].pack("i_") ) # Remi's suggested default.
42
+ end
29
43
  end
30
44
  rescue
31
45
  puts "Native socket library not supported on this platform. Please submit a patch! Exiting since this is fatal :("
@@ -20,14 +20,18 @@ module Journeta
20
20
  socket = UDPSocket.new
21
21
  # Remember how i said this was fucked up? yeaahhhhhh. i hope you like C.
22
22
  # `man setsockopt` for details.
23
- if PLATFORM[/linux/i]
23
+ #
24
+ # The PLATFORM constant got changed to RUBY_PLATFORM in the 1.9 MRI, so we have to handle both cases. :(
25
+ # Also note that jruby 1.3.1 uses PLATFORM.
26
+ if (defined?(PLATFORM) && PLATFORM.match(/linux/i)) || (defined?(RUBY_PLATFORM) && RUBY_PLATFORM.match(/linux/i))
24
27
  socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") )
28
+ elsif (defined?(PLATFORM) && PLATFORM.match(/java/i)) || (defined?(RUBY_PLATFORM) && RUBY_PLATFORM.match(/java/i))
29
+ socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") ) # TODO test this jruby case!
25
30
  else
26
31
  # SO_REUSEPORT is needed so multiple peers can be run on the same machine.
27
32
  # socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, [1].pack('i')) # Preston's original config for OS X.
28
33
  socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEPORT, [1].pack("i_") ) # Remi's suggested default.
29
34
  end
30
- # socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, [1].pack("i_") )
31
35
  socket.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, addresses)
32
36
  socket.bind(Socket::INADDR_ANY, port)
33
37
  putsd "Waiting for presence events."
@@ -48,8 +52,8 @@ module Journeta
48
52
  peer.groups = m.groups
49
53
  peer.created_at = peer.updated_at = Time.now
50
54
 
51
- # We should not start the #PeerConnection before registering because
52
- # the peer might already be registered. In this case, we'd have wasted a thread,
55
+ # We should not start the #PeerConnection before registering because a running
56
+ # PeerConnection might already be registered. In this case, we'd have wasted a thread,
53
57
  # so we'll let the registry handle startup (if it happens at all.)
54
58
  #
55
59
  # peer.start
@@ -1,9 +1,11 @@
1
1
  module Journeta #:nodoc:
2
2
  module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 1
5
- TINY = 7
6
3
 
7
- STRING = [MAJOR, MINOR, TINY].join('.')
4
+ STRING = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION'))
5
+
6
+ MAJOR = STRING.split('.')[0]
7
+ MINOR = STRING.split('.')[1]
8
+ TINY = STRING.split('.')[2]
9
+
8
10
  end
9
11
  end
@@ -0,0 +1,199 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Array</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="./js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="./js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="./lib/diff_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/diff.rb">lib/diff.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">Object</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+
69
+ <!-- Included Modules -->
70
+
71
+ <div id="includes-section" class="section">
72
+ <h3 class="section-header">Included Modules</h3>
73
+ <ul class="link-list">
74
+
75
+
76
+ <li><a class="include" href="Diffable.html">Diffable</a></li>
77
+
78
+
79
+ </ul>
80
+ </div>
81
+
82
+ </div>
83
+
84
+ <div id="project-metadata">
85
+
86
+
87
+ <div id="fileindex-section" class="section project-section">
88
+ <h3 class="section-header">Files</h3>
89
+ <ul>
90
+
91
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
92
+
93
+ </ul>
94
+ </div>
95
+
96
+
97
+ <div id="classindex-section" class="section project-section">
98
+ <h3 class="section-header">Class Index
99
+ <span class="search-toggle"><img src="./images/find.png"
100
+ height="16" width="16" alt="[+]"
101
+ title="show/hide quicksearch" /></span></h3>
102
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
103
+ <fieldset>
104
+ <legend>Quicksearch</legend>
105
+ <input type="text" name="quicksearch" value=""
106
+ class="quicksearch-field" />
107
+ </fieldset>
108
+ </form>
109
+
110
+ <ul class="link-list">
111
+
112
+ <li><a href="./Journeta/Asynchronous.html">Journeta::Asynchronous</a></li>
113
+
114
+ <li><a href="./Journeta/Common.html">Journeta::Common</a></li>
115
+
116
+ <li><a href="./Journeta/Common/BasicMessage.html">Journeta::Common::BasicMessage</a></li>
117
+
118
+ <li><a href="./Journeta/Common/DummyPeerHandler.html">Journeta::Common::DummyPeerHandler</a></li>
119
+
120
+ <li><a href="./Journeta/Common/Job.html">Journeta::Common::Job</a></li>
121
+
122
+ <li><a href="./Journeta/Common/Shutdown.html">Journeta::Common::Shutdown</a></li>
123
+
124
+ <li><a href="./Journeta/DefaultPeerHandler.html">Journeta::DefaultPeerHandler</a></li>
125
+
126
+ <li><a href="./Journeta/DefaultPeerRegisteredHandler.html">Journeta::DefaultPeerRegisteredHandler</a></li>
127
+
128
+ <li><a href="./Journeta/DefaultPeerUnregisteredHandler.html">Journeta::DefaultPeerUnregisteredHandler</a></li>
129
+
130
+ <li><a href="./Journeta/DefaultPeerUpdatedHandler.html">Journeta::DefaultPeerUpdatedHandler</a></li>
131
+
132
+ <li><a href="./Journeta/Engine.html">Journeta::Engine</a></li>
133
+
134
+ <li><a href="./Journeta/Logger.html">Journeta::Logger</a></li>
135
+
136
+ <li><a href="./Journeta/NotImplementedException.html">Journeta::NotImplementedException</a></li>
137
+
138
+ <li><a href="./Journeta/PeerConnection.html">Journeta::PeerConnection</a></li>
139
+
140
+ <li><a href="./Journeta/PeerListener.html">Journeta::PeerListener</a></li>
141
+
142
+ <li><a href="./Journeta/PeerRegistry.html">Journeta::PeerRegistry</a></li>
143
+
144
+ <li><a href="./Journeta/PresenceBroadcaster.html">Journeta::PresenceBroadcaster</a></li>
145
+
146
+ <li><a href="./Journeta/PresenceListener.html">Journeta::PresenceListener</a></li>
147
+
148
+ <li><a href="./Journeta/PresenceMessage.html">Journeta::PresenceMessage</a></li>
149
+
150
+ <li><a href="./Array.html">Array</a></li>
151
+
152
+ <li><a href="./Diff.html">Diff</a></li>
153
+
154
+ <li><a href="./Diffable.html">Diffable</a></li>
155
+
156
+ <li><a href="./String.html">String</a></li>
157
+
158
+ </ul>
159
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
160
+ </div>
161
+
162
+
163
+ </div>
164
+ </div>
165
+
166
+ <div id="documentation">
167
+ <h1 class="class">Array</h1>
168
+
169
+ <div id="description">
170
+
171
+ </div>
172
+
173
+ <!-- Constants -->
174
+
175
+
176
+ <!-- Attributes -->
177
+
178
+
179
+ <!-- Methods -->
180
+
181
+
182
+ </div>
183
+
184
+
185
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
186
+
187
+ <p>Disabled; run with --debug to generate this.</p>
188
+
189
+ </div>
190
+
191
+ <div id="validator-badges">
192
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
193
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
194
+ Rdoc Generator</a> 1.1.6</small>.</p>
195
+ </div>
196
+
197
+ </body>
198
+ </html>
199
+
@@ -0,0 +1,714 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Diff</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="./js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="./js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="./lib/diff_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/diff.rb">lib/diff.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">Object</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+ <div id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+ <ul class="link-list">
71
+
72
+ <li><a href="#method-c-lcs">::lcs</a></li>
73
+
74
+ <li><a href="#method-c-new">::new</a></li>
75
+
76
+ <li><a href="#method-i-compact">#compact</a></li>
77
+
78
+ <li><a href="#method-i-compact%21">#compact!</a></li>
79
+
80
+ <li><a href="#method-i-compactdiffs">#compactdiffs</a></li>
81
+
82
+ <li><a href="#method-i-discarda">#discarda</a></li>
83
+
84
+ <li><a href="#method-i-discardb">#discardb</a></li>
85
+
86
+ <li><a href="#method-i-inspect">#inspect</a></li>
87
+
88
+ <li><a href="#method-i-makediff">#makediff</a></li>
89
+
90
+ <li><a href="#method-i-match">#match</a></li>
91
+
92
+ </ul>
93
+ </div>
94
+
95
+
96
+ <!-- Included Modules -->
97
+
98
+ </div>
99
+
100
+ <div id="project-metadata">
101
+
102
+
103
+ <div id="fileindex-section" class="section project-section">
104
+ <h3 class="section-header">Files</h3>
105
+ <ul>
106
+
107
+ <li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
108
+
109
+ </ul>
110
+ </div>
111
+
112
+
113
+ <div id="classindex-section" class="section project-section">
114
+ <h3 class="section-header">Class Index
115
+ <span class="search-toggle"><img src="./images/find.png"
116
+ height="16" width="16" alt="[+]"
117
+ title="show/hide quicksearch" /></span></h3>
118
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
119
+ <fieldset>
120
+ <legend>Quicksearch</legend>
121
+ <input type="text" name="quicksearch" value=""
122
+ class="quicksearch-field" />
123
+ </fieldset>
124
+ </form>
125
+
126
+ <ul class="link-list">
127
+
128
+ <li><a href="./Journeta/Asynchronous.html">Journeta::Asynchronous</a></li>
129
+
130
+ <li><a href="./Journeta/Common.html">Journeta::Common</a></li>
131
+
132
+ <li><a href="./Journeta/Common/BasicMessage.html">Journeta::Common::BasicMessage</a></li>
133
+
134
+ <li><a href="./Journeta/Common/DummyPeerHandler.html">Journeta::Common::DummyPeerHandler</a></li>
135
+
136
+ <li><a href="./Journeta/Common/Job.html">Journeta::Common::Job</a></li>
137
+
138
+ <li><a href="./Journeta/Common/Shutdown.html">Journeta::Common::Shutdown</a></li>
139
+
140
+ <li><a href="./Journeta/DefaultPeerHandler.html">Journeta::DefaultPeerHandler</a></li>
141
+
142
+ <li><a href="./Journeta/DefaultPeerRegisteredHandler.html">Journeta::DefaultPeerRegisteredHandler</a></li>
143
+
144
+ <li><a href="./Journeta/DefaultPeerUnregisteredHandler.html">Journeta::DefaultPeerUnregisteredHandler</a></li>
145
+
146
+ <li><a href="./Journeta/DefaultPeerUpdatedHandler.html">Journeta::DefaultPeerUpdatedHandler</a></li>
147
+
148
+ <li><a href="./Journeta/Engine.html">Journeta::Engine</a></li>
149
+
150
+ <li><a href="./Journeta/Logger.html">Journeta::Logger</a></li>
151
+
152
+ <li><a href="./Journeta/NotImplementedException.html">Journeta::NotImplementedException</a></li>
153
+
154
+ <li><a href="./Journeta/PeerConnection.html">Journeta::PeerConnection</a></li>
155
+
156
+ <li><a href="./Journeta/PeerListener.html">Journeta::PeerListener</a></li>
157
+
158
+ <li><a href="./Journeta/PeerRegistry.html">Journeta::PeerRegistry</a></li>
159
+
160
+ <li><a href="./Journeta/PresenceBroadcaster.html">Journeta::PresenceBroadcaster</a></li>
161
+
162
+ <li><a href="./Journeta/PresenceListener.html">Journeta::PresenceListener</a></li>
163
+
164
+ <li><a href="./Journeta/PresenceMessage.html">Journeta::PresenceMessage</a></li>
165
+
166
+ <li><a href="./Array.html">Array</a></li>
167
+
168
+ <li><a href="./Diff.html">Diff</a></li>
169
+
170
+ <li><a href="./Diffable.html">Diffable</a></li>
171
+
172
+ <li><a href="./String.html">String</a></li>
173
+
174
+ </ul>
175
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
176
+ </div>
177
+
178
+
179
+ </div>
180
+ </div>
181
+
182
+ <div id="documentation">
183
+ <h1 class="class">Diff</h1>
184
+
185
+ <div id="description">
186
+
187
+ </div>
188
+
189
+ <!-- Constants -->
190
+
191
+ <div id="constants-list" class="section">
192
+ <h3 class="section-header">Constants</h3>
193
+ <dl>
194
+
195
+ <dt><a name="VERSION">VERSION</a></dt>
196
+
197
+ <dd class="description"></dd>
198
+
199
+
200
+ </dl>
201
+ </div>
202
+
203
+
204
+ <!-- Attributes -->
205
+
206
+ <div id="attribute-method-details" class="method-section section">
207
+ <h3 class="section-header">Attributes</h3>
208
+
209
+
210
+ <div id="diffs-attribute-method" class="method-detail">
211
+ <a name="diffs"></a>
212
+
213
+ <div class="method-heading attribute-method-heading">
214
+ <span class="method-name">diffs</span><span
215
+ class="attribute-access-type">[R]</span>
216
+ </div>
217
+
218
+ <div class="method-description">
219
+
220
+
221
+
222
+ </div>
223
+ </div>
224
+
225
+ <div id="difftype-attribute-method" class="method-detail">
226
+ <a name="difftype"></a>
227
+
228
+ <div class="method-heading attribute-method-heading">
229
+ <span class="method-name">difftype</span><span
230
+ class="attribute-access-type">[R]</span>
231
+ </div>
232
+
233
+ <div class="method-description">
234
+
235
+
236
+
237
+ </div>
238
+ </div>
239
+
240
+ </div>
241
+
242
+
243
+ <!-- Methods -->
244
+
245
+ <div id="public-class-method-details" class="method-section section">
246
+ <h3 class="section-header">Public Class Methods</h3>
247
+
248
+
249
+ <div id="lcs-method" class="method-detail ">
250
+ <a name="method-c-lcs"></a>
251
+
252
+ <div class="method-heading">
253
+
254
+ <span class="method-name">lcs</span><span
255
+ class="method-args">(a, b)</span>
256
+ <span class="method-click-advice">click to toggle source</span>
257
+
258
+ </div>
259
+
260
+ <div class="method-description">
261
+
262
+
263
+
264
+
265
+
266
+ <div class="method-source-code"
267
+ id="lcs-source">
268
+ <pre>
269
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 5</span>
270
+ 5: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Diff</span>.<span class="ruby-identifier">lcs</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
271
+ 6: <span class="ruby-identifier">astart</span> = <span class="ruby-value">0</span>
272
+ 7: <span class="ruby-identifier">bstart</span> = <span class="ruby-value">0</span>
273
+ 8: <span class="ruby-identifier">afinish</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
274
+ 9: <span class="ruby-identifier">bfinish</span> = <span class="ruby-identifier">b</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
275
+ 10: <span class="ruby-identifier">mvector</span> = []
276
+ 11:
277
+ 12: <span class="ruby-comment cmt"># First we prune off any common elements at the beginning</span>
278
+ 13: <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">astart</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">afinish</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">bstart</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">afinish</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">a</span>[<span class="ruby-identifier">astart</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">b</span>[<span class="ruby-identifier">bstart</span>])
279
+ 14: <span class="ruby-identifier">mvector</span>[<span class="ruby-identifier">astart</span>] = <span class="ruby-identifier">bstart</span>
280
+ 15: <span class="ruby-identifier">astart</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
281
+ 16: <span class="ruby-identifier">bstart</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
282
+ 17: <span class="ruby-keyword kw">end</span>
283
+ 18:
284
+ 19: <span class="ruby-comment cmt"># now the end</span>
285
+ 20: <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">astart</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">afinish</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">bstart</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">bfinish</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">a</span>[<span class="ruby-identifier">afinish</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">b</span>[<span class="ruby-identifier">bfinish</span>])
286
+ 21: <span class="ruby-identifier">mvector</span>[<span class="ruby-identifier">afinish</span>] = <span class="ruby-identifier">bfinish</span>
287
+ 22: <span class="ruby-identifier">afinish</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
288
+ 23: <span class="ruby-identifier">bfinish</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
289
+ 24: <span class="ruby-keyword kw">end</span>
290
+ 25:
291
+ 26: <span class="ruby-identifier">bmatches</span> = <span class="ruby-identifier">b</span>.<span class="ruby-identifier">reverse_hash</span>(<span class="ruby-identifier">bstart</span><span class="ruby-operator">..</span><span class="ruby-identifier">bfinish</span>)
292
+ 27: <span class="ruby-identifier">thresh</span> = []
293
+ 28: <span class="ruby-identifier">links</span> = []
294
+ 29:
295
+ 30: (<span class="ruby-identifier">astart</span><span class="ruby-operator">..</span><span class="ruby-identifier">afinish</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">aindex</span><span class="ruby-operator">|</span>
296
+ 31: <span class="ruby-identifier">aelem</span> = <span class="ruby-identifier">a</span>[<span class="ruby-identifier">aindex</span>]
297
+ 32: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">bmatches</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">aelem</span>
298
+ 33: <span class="ruby-identifier">k</span> = <span class="ruby-keyword kw">nil</span>
299
+ 34: <span class="ruby-identifier">bmatches</span>[<span class="ruby-identifier">aelem</span>].<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">bindex</span><span class="ruby-operator">|</span>
300
+ 35: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">thresh</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">bindex</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">thresh</span>[<span class="ruby-identifier">k</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>] <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">bindex</span>)
301
+ 36: <span class="ruby-identifier">thresh</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">bindex</span>
302
+ 37: <span class="ruby-keyword kw">else</span>
303
+ 38: <span class="ruby-identifier">k</span> = <span class="ruby-identifier">thresh</span>.<span class="ruby-identifier">replacenextlarger</span>(<span class="ruby-identifier">bindex</span>, <span class="ruby-identifier">k</span>)
304
+ 39: <span class="ruby-keyword kw">end</span>
305
+ 40: <span class="ruby-identifier">links</span>[<span class="ruby-identifier">k</span>] = [ (<span class="ruby-identifier">k</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">links</span>[<span class="ruby-identifier">k</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>], <span class="ruby-identifier">aindex</span>, <span class="ruby-identifier">bindex</span> ] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>
306
+ 41: }
307
+ 42: }
308
+ 43:
309
+ 44: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">thresh</span>.<span class="ruby-identifier">empty?</span>
310
+ 45: <span class="ruby-identifier">link</span> = <span class="ruby-identifier">links</span>[<span class="ruby-identifier">thresh</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
311
+ 46: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">link</span>
312
+ 47: <span class="ruby-identifier">mvector</span>[<span class="ruby-identifier">link</span>[<span class="ruby-value">1</span>]] = <span class="ruby-identifier">link</span>[<span class="ruby-value">2</span>]
313
+ 48: <span class="ruby-identifier">link</span> = <span class="ruby-identifier">link</span>[<span class="ruby-value">0</span>]
314
+ 49: <span class="ruby-keyword kw">end</span>
315
+ 50: <span class="ruby-keyword kw">end</span>
316
+ 51:
317
+ 52: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mvector</span>
318
+ 53: <span class="ruby-keyword kw">end</span></pre>
319
+ </div>
320
+
321
+ </div>
322
+
323
+
324
+
325
+
326
+ </div>
327
+
328
+
329
+ <div id="new-method" class="method-detail ">
330
+ <a name="method-c-new"></a>
331
+
332
+ <div class="method-heading">
333
+
334
+ <span class="method-name">new</span><span
335
+ class="method-args">(diffs_or_a, b = nil, isstring = nil)</span>
336
+ <span class="method-click-advice">click to toggle source</span>
337
+
338
+ </div>
339
+
340
+ <div class="method-description">
341
+
342
+
343
+
344
+
345
+
346
+ <div class="method-source-code"
347
+ id="new-source">
348
+ <pre>
349
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 109</span>
350
+ 109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">diffs_or_a</span>, <span class="ruby-identifier">b</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">isstring</span> = <span class="ruby-keyword kw">nil</span>)
351
+ 110: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">nil?</span>
352
+ 111: <span class="ruby-ivar">@diffs</span> = <span class="ruby-identifier">diffs_or_a</span>
353
+ 112: <span class="ruby-ivar">@isstring</span> = <span class="ruby-identifier">isstring</span>
354
+ 113: <span class="ruby-keyword kw">else</span>
355
+ 114: <span class="ruby-ivar">@diffs</span> = []
356
+ 115: <span class="ruby-ivar">@curdiffs</span> = []
357
+ 116: <span class="ruby-identifier">makediff</span>(<span class="ruby-identifier">diffs_or_a</span>, <span class="ruby-identifier">b</span>)
358
+ 117: <span class="ruby-ivar">@difftype</span> = <span class="ruby-identifier">diffs_or_a</span>.<span class="ruby-identifier">type</span>
359
+ 118: <span class="ruby-keyword kw">end</span>
360
+ 119: <span class="ruby-keyword kw">end</span></pre>
361
+ </div>
362
+
363
+ </div>
364
+
365
+
366
+
367
+
368
+ </div>
369
+
370
+
371
+ </div>
372
+
373
+ <div id="public-instance-method-details" class="method-section section">
374
+ <h3 class="section-header">Public Instance Methods</h3>
375
+
376
+
377
+ <div id="compact-method" class="method-detail ">
378
+ <a name="method-i-compact"></a>
379
+
380
+ <div class="method-heading">
381
+
382
+ <span class="method-name">compact</span><span
383
+ class="method-args">()</span>
384
+ <span class="method-click-advice">click to toggle source</span>
385
+
386
+ </div>
387
+
388
+ <div class="method-description">
389
+
390
+
391
+
392
+
393
+
394
+ <div class="method-source-code"
395
+ id="compact-source">
396
+ <pre>
397
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 134</span>
398
+ 134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compact</span>
399
+ 135: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Diff</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">compactdiffs</span>)
400
+ 136: <span class="ruby-keyword kw">end</span></pre>
401
+ </div>
402
+
403
+ </div>
404
+
405
+
406
+
407
+
408
+ </div>
409
+
410
+
411
+ <div id="compact--method" class="method-detail ">
412
+ <a name="method-i-compact%21"></a>
413
+
414
+ <div class="method-heading">
415
+
416
+ <span class="method-name">compact!</span><span
417
+ class="method-args">()</span>
418
+ <span class="method-click-advice">click to toggle source</span>
419
+
420
+ </div>
421
+
422
+ <div class="method-description">
423
+
424
+
425
+
426
+
427
+
428
+ <div class="method-source-code"
429
+ id="compact--source">
430
+ <pre>
431
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 138</span>
432
+ 138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compact!</span>
433
+ 139: <span class="ruby-ivar">@diffs</span> = <span class="ruby-identifier">compactdiffs</span>
434
+ 140: <span class="ruby-keyword kw">end</span></pre>
435
+ </div>
436
+
437
+ </div>
438
+
439
+
440
+
441
+
442
+ </div>
443
+
444
+
445
+ <div id="compactdiffs-method" class="method-detail ">
446
+ <a name="method-i-compactdiffs"></a>
447
+
448
+ <div class="method-heading">
449
+
450
+ <span class="method-name">compactdiffs</span><span
451
+ class="method-args">()</span>
452
+ <span class="method-click-advice">click to toggle source</span>
453
+
454
+ </div>
455
+
456
+ <div class="method-description">
457
+
458
+
459
+
460
+
461
+
462
+ <div class="method-source-code"
463
+ id="compactdiffs-source">
464
+ <pre>
465
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 84</span>
466
+ 84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compactdiffs</span>
467
+ 85: <span class="ruby-identifier">diffs</span> = []
468
+ 86: <span class="ruby-ivar">@diffs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">df</span><span class="ruby-operator">|</span>
469
+ 87: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
470
+ 88: <span class="ruby-identifier">curdiff</span> = []
471
+ 89: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">df</span>.<span class="ruby-identifier">length</span>
472
+ 90: <span class="ruby-identifier">whot</span> = <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">0</span>]
473
+ 91: <span class="ruby-identifier">s</span> = <span class="ruby-ivar">@isstring</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">2</span>].<span class="ruby-identifier">chr</span> <span class="ruby-operator">:</span> [<span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">2</span>]]
474
+ 92: <span class="ruby-identifier">p</span> = <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">1</span>]
475
+ 93: <span class="ruby-identifier">last</span> = <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">1</span>]
476
+ 94: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
477
+ 95: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">whot</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">last</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>
478
+ 96: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">2</span>]
479
+ 97: <span class="ruby-identifier">last</span> = <span class="ruby-identifier">df</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">1</span>]
480
+ 98: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
481
+ 99: <span class="ruby-keyword kw">end</span>
482
+ 100: <span class="ruby-identifier">curdiff</span>.<span class="ruby-identifier">push</span> [<span class="ruby-identifier">whot</span>, <span class="ruby-identifier">p</span>, <span class="ruby-identifier">s</span>]
483
+ 101: <span class="ruby-keyword kw">end</span>
484
+ 102: <span class="ruby-identifier">diffs</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">curdiff</span>
485
+ 103: }
486
+ 104: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">diffs</span>
487
+ 105: <span class="ruby-keyword kw">end</span></pre>
488
+ </div>
489
+
490
+ </div>
491
+
492
+
493
+
494
+
495
+ </div>
496
+
497
+
498
+ <div id="discarda-method" class="method-detail ">
499
+ <a name="method-i-discarda"></a>
500
+
501
+ <div class="method-heading">
502
+
503
+ <span class="method-name">discarda</span><span
504
+ class="method-args">(i, elem)</span>
505
+ <span class="method-click-advice">click to toggle source</span>
506
+
507
+ </div>
508
+
509
+ <div class="method-description">
510
+
511
+
512
+
513
+
514
+
515
+ <div class="method-source-code"
516
+ id="discarda-source">
517
+ <pre>
518
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 126</span>
519
+ 126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discarda</span>(<span class="ruby-identifier">i</span>, <span class="ruby-identifier">elem</span>)
520
+ 127: <span class="ruby-ivar">@curdiffs</span>.<span class="ruby-identifier">push</span> [<span class="ruby-value str">'-'</span>, <span class="ruby-identifier">i</span>, <span class="ruby-identifier">elem</span>]
521
+ 128: <span class="ruby-keyword kw">end</span></pre>
522
+ </div>
523
+
524
+ </div>
525
+
526
+
527
+
528
+
529
+ </div>
530
+
531
+
532
+ <div id="discardb-method" class="method-detail ">
533
+ <a name="method-i-discardb"></a>
534
+
535
+ <div class="method-heading">
536
+
537
+ <span class="method-name">discardb</span><span
538
+ class="method-args">(i, elem)</span>
539
+ <span class="method-click-advice">click to toggle source</span>
540
+
541
+ </div>
542
+
543
+ <div class="method-description">
544
+
545
+
546
+
547
+
548
+
549
+ <div class="method-source-code"
550
+ id="discardb-source">
551
+ <pre>
552
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 130</span>
553
+ 130: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discardb</span>(<span class="ruby-identifier">i</span>, <span class="ruby-identifier">elem</span>)
554
+ 131: <span class="ruby-ivar">@curdiffs</span>.<span class="ruby-identifier">push</span> [<span class="ruby-value str">'+'</span>, <span class="ruby-identifier">i</span>, <span class="ruby-identifier">elem</span>]
555
+ 132: <span class="ruby-keyword kw">end</span></pre>
556
+ </div>
557
+
558
+ </div>
559
+
560
+
561
+
562
+
563
+ </div>
564
+
565
+
566
+ <div id="inspect-method" class="method-detail ">
567
+ <a name="method-i-inspect"></a>
568
+
569
+ <div class="method-heading">
570
+
571
+ <span class="method-name">inspect</span><span
572
+ class="method-args">()</span>
573
+ <span class="method-click-advice">click to toggle source</span>
574
+
575
+ </div>
576
+
577
+ <div class="method-description">
578
+
579
+
580
+
581
+
582
+
583
+ <div class="method-source-code"
584
+ id="inspect-source">
585
+ <pre>
586
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 142</span>
587
+ 142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
588
+ 143: <span class="ruby-ivar">@diffs</span>.<span class="ruby-identifier">inspect</span>
589
+ 144: <span class="ruby-keyword kw">end</span></pre>
590
+ </div>
591
+
592
+ </div>
593
+
594
+
595
+
596
+
597
+ </div>
598
+
599
+
600
+ <div id="makediff-method" class="method-detail ">
601
+ <a name="method-i-makediff"></a>
602
+
603
+ <div class="method-heading">
604
+
605
+ <span class="method-name">makediff</span><span
606
+ class="method-args">(a, b)</span>
607
+ <span class="method-click-advice">click to toggle source</span>
608
+
609
+ </div>
610
+
611
+ <div class="method-description">
612
+
613
+
614
+
615
+
616
+
617
+ <div class="method-source-code"
618
+ id="makediff-source">
619
+ <pre>
620
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 55</span>
621
+ 55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">makediff</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
622
+ 56: <span class="ruby-identifier">mvector</span> = <span class="ruby-constant">Diff</span>.<span class="ruby-identifier">lcs</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
623
+ 57: <span class="ruby-identifier">ai</span> = <span class="ruby-identifier">bi</span> = <span class="ruby-value">0</span>
624
+ 58: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">ai</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">mvector</span>.<span class="ruby-identifier">length</span>
625
+ 59: <span class="ruby-identifier">bline</span> = <span class="ruby-identifier">mvector</span>[<span class="ruby-identifier">ai</span>]
626
+ 60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bline</span>
627
+ 61: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bi</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">bline</span>
628
+ 62: <span class="ruby-identifier">discardb</span>(<span class="ruby-identifier">bi</span>, <span class="ruby-identifier">b</span>[<span class="ruby-identifier">bi</span>])
629
+ 63: <span class="ruby-identifier">bi</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
630
+ 64: <span class="ruby-keyword kw">end</span>
631
+ 65: <span class="ruby-identifier">match</span>(<span class="ruby-identifier">ai</span>, <span class="ruby-identifier">bi</span>)
632
+ 66: <span class="ruby-identifier">bi</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
633
+ 67: <span class="ruby-keyword kw">else</span>
634
+ 68: <span class="ruby-identifier">discarda</span>(<span class="ruby-identifier">ai</span>, <span class="ruby-identifier">a</span>[<span class="ruby-identifier">ai</span>])
635
+ 69: <span class="ruby-keyword kw">end</span>
636
+ 70: <span class="ruby-identifier">ai</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
637
+ 71: <span class="ruby-keyword kw">end</span>
638
+ 72: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">ai</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span>
639
+ 73: <span class="ruby-identifier">discarda</span>(<span class="ruby-identifier">ai</span>, <span class="ruby-identifier">a</span>[<span class="ruby-identifier">ai</span>])
640
+ 74: <span class="ruby-identifier">ai</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
641
+ 75: <span class="ruby-keyword kw">end</span>
642
+ 76: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bi</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">length</span>
643
+ 77: <span class="ruby-identifier">discardb</span>(<span class="ruby-identifier">bi</span>, <span class="ruby-identifier">b</span>[<span class="ruby-identifier">bi</span>])
644
+ 78: <span class="ruby-identifier">bi</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
645
+ 79: <span class="ruby-keyword kw">end</span>
646
+ 80: <span class="ruby-identifier">match</span>(<span class="ruby-identifier">ai</span>, <span class="ruby-identifier">bi</span>)
647
+ 81: <span class="ruby-value">1</span>
648
+ 82: <span class="ruby-keyword kw">end</span></pre>
649
+ </div>
650
+
651
+ </div>
652
+
653
+
654
+
655
+
656
+ </div>
657
+
658
+
659
+ <div id="match-method" class="method-detail ">
660
+ <a name="method-i-match"></a>
661
+
662
+ <div class="method-heading">
663
+
664
+ <span class="method-name">match</span><span
665
+ class="method-args">(ai, bi)</span>
666
+ <span class="method-click-advice">click to toggle source</span>
667
+
668
+ </div>
669
+
670
+ <div class="method-description">
671
+
672
+
673
+
674
+
675
+
676
+ <div class="method-source-code"
677
+ id="match-source">
678
+ <pre>
679
+ <span class="ruby-comment cmt"># File lib/diff.rb, line 121</span>
680
+ 121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">match</span>(<span class="ruby-identifier">ai</span>, <span class="ruby-identifier">bi</span>)
681
+ 122: <span class="ruby-ivar">@diffs</span>.<span class="ruby-identifier">push</span> <span class="ruby-ivar">@curdiffs</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@curdiffs</span>.<span class="ruby-identifier">empty?</span>
682
+ 123: <span class="ruby-ivar">@curdiffs</span> = []
683
+ 124: <span class="ruby-keyword kw">end</span></pre>
684
+ </div>
685
+
686
+ </div>
687
+
688
+
689
+
690
+
691
+ </div>
692
+
693
+
694
+ </div>
695
+
696
+
697
+ </div>
698
+
699
+
700
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
701
+
702
+ <p>Disabled; run with --debug to generate this.</p>
703
+
704
+ </div>
705
+
706
+ <div id="validator-badges">
707
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
708
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
709
+ Rdoc Generator</a> 1.1.6</small>.</p>
710
+ </div>
711
+
712
+ </body>
713
+ </html>
714
+