Skip to content
kanasimi edited this page Nov 3, 2015 · 8 revisions

Demo code

內建相依性處理 class

主檔內建相依性(dependency chain)和關聯性處理 class。

var dc = new CeL.dependency_chain;
dc.add(1, 2);
CeL.assert(['1', CeL.Array_of_Iterator(dc.get(2).previous.values()).join()]);
dc.add(2, 3);
CeL.assert(['2', CeL.Array_of_Iterator(dc.get(3).previous.values()).join()]);
CeL.assert([1, dc.independent(3)]);
CeL.assert(['', CeL.Array_of_Iterator(dc.get(3).next.values()).join()]);
CeL.assert(['1,2,3', CeL.Array_of_Iterator(dc.get()).sort().join()]);
CeL.assert([1, dc.independent()]);
dc.add(0, 1);
CeL.assert([0, dc.independent()]);
dc['delete'](0);
CeL.assert([1, dc.independent()]);
Clone this wiki locally