daff 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/daff.rb +3 -0
- data/lib/daff.rb +95 -0
- data/lib/lib/coopy/alignment.rb +409 -0
- data/lib/lib/coopy/bag.rb +10 -0
- data/lib/lib/coopy/cell_info.rb +29 -0
- data/lib/lib/coopy/change.rb +48 -0
- data/lib/lib/coopy/change_type.rb +21 -0
- data/lib/lib/coopy/compare.rb +98 -0
- data/lib/lib/coopy/compare_flags.rb +46 -0
- data/lib/lib/coopy/compare_table.rb +402 -0
- data/lib/lib/coopy/coopy.rb +414 -0
- data/lib/lib/coopy/cross_match.rb +16 -0
- data/lib/lib/coopy/csv.rb +181 -0
- data/lib/lib/coopy/diff_render.rb +254 -0
- data/lib/lib/coopy/highlight_patch.rb +651 -0
- data/lib/lib/coopy/highlight_patch_unit.rb +37 -0
- data/lib/lib/coopy/index.rb +101 -0
- data/lib/lib/coopy/index_item.rb +20 -0
- data/lib/lib/coopy/index_pair.rb +87 -0
- data/lib/lib/coopy/mover.rb +195 -0
- data/lib/lib/coopy/ordering.rb +49 -0
- data/lib/lib/coopy/report.rb +23 -0
- data/lib/lib/coopy/row.rb +9 -0
- data/lib/lib/coopy/simple_cell.rb +23 -0
- data/lib/lib/coopy/simple_table.rb +242 -0
- data/lib/lib/coopy/simple_view.rb +41 -0
- data/lib/lib/coopy/sparse_sheet.rb +50 -0
- data/lib/lib/coopy/table.rb +17 -0
- data/lib/lib/coopy/table_comparison_state.rb +32 -0
- data/lib/lib/coopy/table_diff.rb +738 -0
- data/lib/lib/coopy/table_io.rb +33 -0
- data/lib/lib/coopy/table_modifier.rb +39 -0
- data/lib/lib/coopy/table_text.rb +25 -0
- data/lib/lib/coopy/unit.rb +70 -0
- data/lib/lib/coopy/view.rb +14 -0
- data/lib/lib/coopy/viewed_datum.rb +37 -0
- data/lib/lib/coopy/viterbi.rb +172 -0
- data/lib/lib/coopy/workspace.rb +22 -0
- data/lib/lib/haxe/ds/int_map.rb +14 -0
- data/lib/lib/haxe/ds/string_map.rb +14 -0
- data/lib/lib/haxe/format/json_parser.rb +264 -0
- data/lib/lib/haxe/format/json_printer.rb +239 -0
- data/lib/lib/haxe/io/bytes.rb +33 -0
- data/lib/lib/haxe/io/eof.rb +17 -0
- data/lib/lib/haxe/io/error.rb +21 -0
- data/lib/lib/haxe/io/output.rb +40 -0
- data/lib/lib/haxe/log.rb +16 -0
- data/lib/lib/hx_overrides.rb +18 -0
- data/lib/lib/imap.rb +6 -0
- data/lib/lib/lambda.rb +36 -0
- data/lib/lib/list.rb +42 -0
- data/lib/lib/rb/boot.rb +19 -0
- data/lib/lib/rb/ruby_iterator.rb +49 -0
- data/lib/lib/reflect.rb +29 -0
- data/lib/lib/string_buf.rb +14 -0
- data/lib/lib/sys.rb +19 -0
- data/lib/lib/sys/io/file.rb +19 -0
- data/lib/lib/sys/io/file_handle.rb +17 -0
- data/lib/lib/sys/io/file_output.rb +35 -0
- data/lib/lib/type.rb +32 -0
- data/lib/lib/value_type.rb +22 -0
- metadata +181 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Report
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@changes = Array.new
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_accessor :changes
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
return @changes.to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
def clear
|
18
|
+
@changes = Array.new
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,242 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class SimpleTable
|
6
|
+
|
7
|
+
def initialize(w,h)
|
8
|
+
@data = {}
|
9
|
+
@w = w
|
10
|
+
@h = h
|
11
|
+
end
|
12
|
+
|
13
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
14
|
+
|
15
|
+
attr_accessor :data
|
16
|
+
attr_accessor :w
|
17
|
+
attr_accessor :h
|
18
|
+
|
19
|
+
public
|
20
|
+
|
21
|
+
def get_table
|
22
|
+
return self
|
23
|
+
end
|
24
|
+
|
25
|
+
def height() get_height end
|
26
|
+
def height=(__v) @height = __v end
|
27
|
+
def width() get_width end
|
28
|
+
def width=(__v) @width = __v end
|
29
|
+
def size() get_size end
|
30
|
+
def size=(__v) @size = __v end
|
31
|
+
|
32
|
+
def get_width
|
33
|
+
return @w
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_height
|
37
|
+
return @h
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_size
|
41
|
+
return @h
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_cell(x,y)
|
45
|
+
return @data[x + y * @w]
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_cell(x,y,c)
|
49
|
+
value = c
|
50
|
+
begin
|
51
|
+
value1 = value
|
52
|
+
@data[x + y * @w] = value1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_s
|
57
|
+
return ::Coopy::SimpleTable.table_to_string(self)
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_cell_view
|
61
|
+
return ::Coopy::SimpleView.new
|
62
|
+
end
|
63
|
+
|
64
|
+
def is_resizable
|
65
|
+
return true
|
66
|
+
end
|
67
|
+
|
68
|
+
def resize(w,h)
|
69
|
+
@w = w
|
70
|
+
@h = h
|
71
|
+
return true
|
72
|
+
end
|
73
|
+
|
74
|
+
def clear
|
75
|
+
@data = {}
|
76
|
+
end
|
77
|
+
|
78
|
+
def insert_or_delete_rows(fate,hfate)
|
79
|
+
data2 = {}
|
80
|
+
begin
|
81
|
+
_g1 = 0
|
82
|
+
_g = fate.length
|
83
|
+
while(_g1 < _g)
|
84
|
+
i = _g1
|
85
|
+
_g1+=1
|
86
|
+
j = fate[i]
|
87
|
+
if j != -1
|
88
|
+
_g3 = 0
|
89
|
+
_g2 = @w
|
90
|
+
while(_g3 < _g2)
|
91
|
+
c = _g3
|
92
|
+
_g3+=1
|
93
|
+
idx = i * @w + c
|
94
|
+
if @data.include?(idx)
|
95
|
+
value = @data[idx]
|
96
|
+
begin
|
97
|
+
value1 = value
|
98
|
+
data2[j * @w + c] = value1
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
@h = hfate
|
106
|
+
@data = data2
|
107
|
+
return true
|
108
|
+
end
|
109
|
+
|
110
|
+
def insert_or_delete_columns(fate,wfate)
|
111
|
+
data2 = {}
|
112
|
+
begin
|
113
|
+
_g1 = 0
|
114
|
+
_g = fate.length
|
115
|
+
while(_g1 < _g)
|
116
|
+
i = _g1
|
117
|
+
_g1+=1
|
118
|
+
j = fate[i]
|
119
|
+
if j != -1
|
120
|
+
_g3 = 0
|
121
|
+
_g2 = @h
|
122
|
+
while(_g3 < _g2)
|
123
|
+
r = _g3
|
124
|
+
_g3+=1
|
125
|
+
idx = r * @w + i
|
126
|
+
if @data.include?(idx)
|
127
|
+
value = @data[idx]
|
128
|
+
begin
|
129
|
+
value1 = value
|
130
|
+
data2[r * wfate + j] = value1
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
@w = wfate
|
138
|
+
@data = data2
|
139
|
+
return true
|
140
|
+
end
|
141
|
+
|
142
|
+
def trim_blank
|
143
|
+
return true if @h == 0
|
144
|
+
h_test = @h
|
145
|
+
h_test = 3 if h_test >= 3
|
146
|
+
view = self.get_cell_view
|
147
|
+
space = view.to_datum("")
|
148
|
+
more = true
|
149
|
+
while(more)
|
150
|
+
begin
|
151
|
+
_g1 = 0
|
152
|
+
_g = self.get_width
|
153
|
+
while(_g1 < _g)
|
154
|
+
i = _g1
|
155
|
+
_g1+=1
|
156
|
+
c = self.get_cell(i,@h - 1)
|
157
|
+
if !(view.equals(c,space) || c == nil)
|
158
|
+
more = false
|
159
|
+
break
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
@h-=1 if more
|
164
|
+
end
|
165
|
+
more = true
|
166
|
+
nw = @w
|
167
|
+
while(more)
|
168
|
+
break if @w == 0
|
169
|
+
begin
|
170
|
+
_g2 = 0
|
171
|
+
while(_g2 < h_test)
|
172
|
+
i1 = _g2
|
173
|
+
_g2+=1
|
174
|
+
c1 = self.get_cell(nw - 1,i1)
|
175
|
+
if !(view.equals(c1,space) || c1 == nil)
|
176
|
+
more = false
|
177
|
+
break
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
nw-=1 if more
|
182
|
+
end
|
183
|
+
return true if nw == @w
|
184
|
+
data2 = {}
|
185
|
+
begin
|
186
|
+
_g3 = 0
|
187
|
+
while(_g3 < nw)
|
188
|
+
i2 = _g3
|
189
|
+
_g3+=1
|
190
|
+
begin
|
191
|
+
_g21 = 0
|
192
|
+
_g11 = @h
|
193
|
+
while(_g21 < _g11)
|
194
|
+
r = _g21
|
195
|
+
_g21+=1
|
196
|
+
idx = r * @w + i2
|
197
|
+
if @data.include?(idx)
|
198
|
+
value = @data[idx]
|
199
|
+
begin
|
200
|
+
value1 = value
|
201
|
+
data2[r * nw + i2] = value1
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
@w = nw
|
209
|
+
@data = data2
|
210
|
+
return true
|
211
|
+
end
|
212
|
+
|
213
|
+
def SimpleTable.table_to_string(tab)
|
214
|
+
x = ""
|
215
|
+
begin
|
216
|
+
_g1 = 0
|
217
|
+
_g = tab.get_height
|
218
|
+
while(_g1 < _g)
|
219
|
+
i = _g1
|
220
|
+
_g1+=1
|
221
|
+
begin
|
222
|
+
_g3 = 0
|
223
|
+
_g2 = tab.get_width
|
224
|
+
while(_g3 < _g2)
|
225
|
+
j = _g3
|
226
|
+
_g3+=1
|
227
|
+
x += " " if j > 0
|
228
|
+
begin
|
229
|
+
s = tab.get_cell(j,i)
|
230
|
+
x += s.to_s
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
x += "\n"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
return x
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class SimpleView
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s(d)
|
11
|
+
return nil if d == nil
|
12
|
+
return "" + _hx_str(d.to_s)
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_bag(d)
|
16
|
+
return nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_table(d)
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def has_structure(d)
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
def equals(d1,d2)
|
28
|
+
return true if d1 == nil && d2 == nil
|
29
|
+
return true if d1 == nil && "" + _hx_str(d2.to_s) == ""
|
30
|
+
return true if "" + _hx_str(d1.to_s) == "" && d2 == nil
|
31
|
+
return "" + _hx_str(d1.to_s) == "" + _hx_str(d2.to_s)
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_datum(str)
|
35
|
+
return nil if str == nil
|
36
|
+
return ::Coopy::SimpleCell.new(str)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class SparseSheet
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@h = @w = 0
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
attr_accessor :h
|
14
|
+
attr_accessor :w
|
15
|
+
attr_accessor :row
|
16
|
+
attr_accessor :zero
|
17
|
+
|
18
|
+
public
|
19
|
+
|
20
|
+
def resize(w,h,zero)
|
21
|
+
@row = {}
|
22
|
+
self.non_destructive_resize(w,h,zero)
|
23
|
+
end
|
24
|
+
|
25
|
+
def non_destructive_resize(w,h,zero)
|
26
|
+
@w = w
|
27
|
+
@h = h
|
28
|
+
@zero = zero
|
29
|
+
end
|
30
|
+
|
31
|
+
def get(x,y)
|
32
|
+
cursor = @row[y]
|
33
|
+
return @zero if cursor == nil
|
34
|
+
val = cursor[x]
|
35
|
+
return @zero if val == nil
|
36
|
+
return val
|
37
|
+
end
|
38
|
+
|
39
|
+
def set(x,y,val)
|
40
|
+
cursor = @row[y]
|
41
|
+
if cursor == nil
|
42
|
+
cursor = {}
|
43
|
+
@row[y] = cursor
|
44
|
+
end
|
45
|
+
cursor[x] = val
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Table
|
6
|
+
def getCell(x,y) puts "Abstract Table.getCell called" end
|
7
|
+
def setCell(x,y,c) puts "Abstract Table.setCell called" end
|
8
|
+
def getCellView() puts "Abstract Table.getCellView called" end
|
9
|
+
def isResizable() puts "Abstract Table.isResizable called" end
|
10
|
+
def resize(w,h) puts "Abstract Table.resize called" end
|
11
|
+
def clear() puts "Abstract Table.clear called" end
|
12
|
+
def insertOrDeleteRows(fate,hfate) puts "Abstract Table.insertOrDeleteRows called" end
|
13
|
+
def insertOrDeleteColumns(fate,wfate) puts "Abstract Table.insertOrDeleteColumns called" end
|
14
|
+
def trimBlank() puts "Abstract Table.trimBlank called" end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class TableComparisonState
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
self.reset
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_accessor :p
|
12
|
+
attr_accessor :a
|
13
|
+
attr_accessor :b
|
14
|
+
attr_accessor :completed
|
15
|
+
attr_accessor :run_to_completion
|
16
|
+
attr_accessor :is_equal
|
17
|
+
attr_accessor :is_equal_known
|
18
|
+
attr_accessor :has_same_columns
|
19
|
+
attr_accessor :has_same_columns_known
|
20
|
+
|
21
|
+
def reset
|
22
|
+
@completed = false
|
23
|
+
@run_to_completion = true
|
24
|
+
@is_equal_known = false
|
25
|
+
@is_equal = false
|
26
|
+
@has_same_columns = false
|
27
|
+
@has_same_columns_known = false
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|