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,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class TableIO
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_content(name)
|
11
|
+
return ::Sys::Io::HxFile.get_content(name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def save_content(name,txt)
|
15
|
+
::Sys::Io::HxFile.save_content(name,txt)
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
def args
|
20
|
+
return HxSys.args
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_stdout(txt)
|
24
|
+
HxSys.stdout.write_string(txt)
|
25
|
+
end
|
26
|
+
|
27
|
+
def write_stderr(txt)
|
28
|
+
HxSys.stderr.write_string(txt)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class TableModifier
|
6
|
+
|
7
|
+
def initialize(t)
|
8
|
+
@t = t
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
attr_accessor :t
|
14
|
+
|
15
|
+
public
|
16
|
+
|
17
|
+
def remove_column(at)
|
18
|
+
fate = []
|
19
|
+
begin
|
20
|
+
_g1 = 0
|
21
|
+
_g = @t.get_width
|
22
|
+
while(_g1 < _g)
|
23
|
+
i = _g1
|
24
|
+
_g1+=1
|
25
|
+
if i < at
|
26
|
+
fate.push(i)
|
27
|
+
elsif i > at
|
28
|
+
fate.push(i - 1)
|
29
|
+
else
|
30
|
+
fate.push(-1)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
return @t.insert_or_delete_columns(fate,@t.get_width - 1)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class TableText
|
6
|
+
|
7
|
+
def initialize(rows)
|
8
|
+
@rows = rows
|
9
|
+
@view = rows.get_cell_view
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
attr_accessor :rows
|
15
|
+
attr_accessor :view
|
16
|
+
|
17
|
+
public
|
18
|
+
|
19
|
+
def get_cell_text(x,y)
|
20
|
+
return @view.to_s(@rows.get_cell(x,y))
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Unit
|
6
|
+
|
7
|
+
def initialize(l = -2,r = -2,p = -2)
|
8
|
+
@l = l
|
9
|
+
@r = r
|
10
|
+
@p = p
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :l
|
14
|
+
attr_accessor :r
|
15
|
+
attr_accessor :p
|
16
|
+
|
17
|
+
def lp
|
18
|
+
if @p == -2
|
19
|
+
return @l
|
20
|
+
else
|
21
|
+
return @p
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
return _hx_str(::Coopy::Unit.describe(@p)) + "|" + _hx_str(::Coopy::Unit.describe(@l)) + ":" + _hx_str(::Coopy::Unit.describe(@r)) if @p >= -1
|
27
|
+
return _hx_str(::Coopy::Unit.describe(@l)) + ":" + _hx_str(::Coopy::Unit.describe(@r))
|
28
|
+
end
|
29
|
+
|
30
|
+
def from_string(txt)
|
31
|
+
txt += "]"
|
32
|
+
at = 0
|
33
|
+
begin
|
34
|
+
_g1 = 0
|
35
|
+
_g = txt.length
|
36
|
+
while(_g1 < _g)
|
37
|
+
i = _g1
|
38
|
+
_g1+=1
|
39
|
+
ch = (txt[i].ord rescue nil)
|
40
|
+
if ch >= 48 && ch <= 57
|
41
|
+
at *= 10
|
42
|
+
at += ch - 48
|
43
|
+
elsif ch == 45
|
44
|
+
at = -1
|
45
|
+
elsif ch == 124
|
46
|
+
@p = at
|
47
|
+
at = 0
|
48
|
+
elsif ch == 58
|
49
|
+
@l = at
|
50
|
+
at = 0
|
51
|
+
elsif ch == 93
|
52
|
+
@r = at
|
53
|
+
return true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
|
60
|
+
def Unit.describe(i)
|
61
|
+
if i >= 0
|
62
|
+
return "" + _hx_str(i)
|
63
|
+
else
|
64
|
+
return "-"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class View
|
6
|
+
def toString(d) puts "Abstract View.toString called" end
|
7
|
+
def getBag(d) puts "Abstract View.getBag called" end
|
8
|
+
def getTable(d) puts "Abstract View.getTable called" end
|
9
|
+
def hasStructure(d) puts "Abstract View.hasStructure called" end
|
10
|
+
def equals(d1,d2) puts "Abstract View.equals called" end
|
11
|
+
def toDatum(str) puts "Abstract View.toDatum called" end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class ViewedDatum
|
6
|
+
|
7
|
+
def initialize(datum,view)
|
8
|
+
@datum = datum
|
9
|
+
@view = view
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :datum
|
13
|
+
attr_accessor :view
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
return @view.to_s(@datum)
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_bag
|
20
|
+
return @view.get_bag(@datum)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_table
|
24
|
+
return @view.get_table(@datum)
|
25
|
+
end
|
26
|
+
|
27
|
+
def has_structure
|
28
|
+
return @view.has_structure(@datum)
|
29
|
+
end
|
30
|
+
|
31
|
+
def ViewedDatum.get_simple_view(datum)
|
32
|
+
return ::Coopy::ViewedDatum.new(datum,::Coopy::SimpleView.new)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Viterbi
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@k = @t = 0
|
9
|
+
self.reset
|
10
|
+
@cost = ::Coopy::SparseSheet.new
|
11
|
+
@src = ::Coopy::SparseSheet.new
|
12
|
+
@path = ::Coopy::SparseSheet.new
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
attr_accessor :k
|
18
|
+
attr_accessor :t
|
19
|
+
attr_accessor :index
|
20
|
+
attr_accessor :mode
|
21
|
+
attr_accessor :path_valid
|
22
|
+
attr_accessor :best_cost
|
23
|
+
attr_accessor :cost
|
24
|
+
attr_accessor :src
|
25
|
+
attr_accessor :path
|
26
|
+
|
27
|
+
public
|
28
|
+
|
29
|
+
def reset
|
30
|
+
@index = 0
|
31
|
+
@mode = 0
|
32
|
+
@path_valid = false
|
33
|
+
@best_cost = 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_size(states,sequence_length)
|
37
|
+
@k = states
|
38
|
+
@t = sequence_length
|
39
|
+
@cost.resize(@k,@t,0)
|
40
|
+
@src.resize(@k,@t,-1)
|
41
|
+
@path.resize(1,@t,-1)
|
42
|
+
end
|
43
|
+
|
44
|
+
def assert_mode(_next)
|
45
|
+
@index+=1 if _next == 0 && @mode == 1
|
46
|
+
@mode = _next
|
47
|
+
end
|
48
|
+
|
49
|
+
def add_transition(s0,s1,c)
|
50
|
+
resize = false
|
51
|
+
if s0 >= @k
|
52
|
+
@k = s0 + 1
|
53
|
+
resize = true
|
54
|
+
end
|
55
|
+
if s1 >= @k
|
56
|
+
@k = s1 + 1
|
57
|
+
resize = true
|
58
|
+
end
|
59
|
+
if resize
|
60
|
+
@cost.non_destructive_resize(@k,@t,0)
|
61
|
+
@src.non_destructive_resize(@k,@t,-1)
|
62
|
+
@path.non_destructive_resize(1,@t,-1)
|
63
|
+
end
|
64
|
+
@path_valid = false
|
65
|
+
self.assert_mode(1)
|
66
|
+
if @index >= @t
|
67
|
+
@t = @index + 1
|
68
|
+
@cost.non_destructive_resize(@k,@t,0)
|
69
|
+
@src.non_destructive_resize(@k,@t,-1)
|
70
|
+
@path.non_destructive_resize(1,@t,-1)
|
71
|
+
end
|
72
|
+
sourced = false
|
73
|
+
if @index > 0
|
74
|
+
c += @cost.get(s0,@index - 1)
|
75
|
+
sourced = @src.get(s0,@index - 1) != -1
|
76
|
+
else
|
77
|
+
sourced = true
|
78
|
+
end
|
79
|
+
if sourced
|
80
|
+
if c < @cost.get(s1,@index) || @src.get(s1,@index) == -1
|
81
|
+
@cost.set(s1,@index,c)
|
82
|
+
@src.set(s1,@index,s0)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def end_transitions
|
88
|
+
@path_valid = false
|
89
|
+
self.assert_mode(0)
|
90
|
+
end
|
91
|
+
|
92
|
+
def begin_transitions
|
93
|
+
@path_valid = false
|
94
|
+
self.assert_mode(1)
|
95
|
+
end
|
96
|
+
|
97
|
+
def calculate_path
|
98
|
+
return if @path_valid
|
99
|
+
self.end_transitions
|
100
|
+
best = 0
|
101
|
+
bestj = -1
|
102
|
+
if @index <= 0
|
103
|
+
@path_valid = true
|
104
|
+
return
|
105
|
+
end
|
106
|
+
begin
|
107
|
+
_g1 = 0
|
108
|
+
_g = @k
|
109
|
+
while(_g1 < _g)
|
110
|
+
j = _g1
|
111
|
+
_g1+=1
|
112
|
+
if (@cost.get(j,@index - 1) < best || bestj == -1) && @src.get(j,@index - 1) != -1
|
113
|
+
best = @cost.get(j,@index - 1)
|
114
|
+
bestj = j
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
@best_cost = best
|
119
|
+
begin
|
120
|
+
_g11 = 0
|
121
|
+
_g2 = @index
|
122
|
+
while(_g11 < _g2)
|
123
|
+
j1 = _g11
|
124
|
+
_g11+=1
|
125
|
+
i = @index - 1 - j1
|
126
|
+
@path.set(0,i,bestj)
|
127
|
+
::Haxe::Log._trace.call("Problem in Viterbi",{ file_name: "Viterbi.hx", line_number: 119, class_name: "coopy.Viterbi", method_name: "calculatePath"}) if !(bestj != -1 && (bestj >= 0 && bestj < @k))
|
128
|
+
bestj = @src.get(bestj,i)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
@path_valid = true
|
132
|
+
end
|
133
|
+
|
134
|
+
def to_s
|
135
|
+
self.calculate_path
|
136
|
+
txt = ""
|
137
|
+
begin
|
138
|
+
_g1 = 0
|
139
|
+
_g = @index
|
140
|
+
while(_g1 < _g)
|
141
|
+
i = _g1
|
142
|
+
_g1+=1
|
143
|
+
if @path.get(0,i) == -1
|
144
|
+
txt += "*"
|
145
|
+
else
|
146
|
+
txt += @path.get(0,i)
|
147
|
+
end
|
148
|
+
txt += " " if @k >= 10
|
149
|
+
end
|
150
|
+
end
|
151
|
+
txt += " costs " + _hx_str(self.get_cost)
|
152
|
+
return txt
|
153
|
+
end
|
154
|
+
|
155
|
+
def length
|
156
|
+
self.calculate_path if @index > 0
|
157
|
+
return @index
|
158
|
+
end
|
159
|
+
|
160
|
+
def get(i)
|
161
|
+
self.calculate_path
|
162
|
+
return @path.get(0,i)
|
163
|
+
end
|
164
|
+
|
165
|
+
def get_cost
|
166
|
+
self.calculate_path
|
167
|
+
return @best_cost
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module Coopy
|
5
|
+
class Workspace
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :parent
|
11
|
+
attr_accessor :local
|
12
|
+
attr_accessor :remote
|
13
|
+
attr_accessor :report
|
14
|
+
attr_accessor :tparent
|
15
|
+
attr_accessor :tlocal
|
16
|
+
attr_accessor :tremote
|
17
|
+
attr_accessor :p2l
|
18
|
+
attr_accessor :p2r
|
19
|
+
attr_accessor :l2r
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|