# File structures/CellComplex.rb, line 225 def switch(k, tuple) raise "nil Tuple given to switch" if tuple == nil raise "non-Tuple given to switch" if !tuple.is_a? CellTuple raise "bad call to switch" if k<0 || k>tuple.dim raise "bad tuple given to switch" if !tuple.dim.is_a? Integer triple = [tuple[k-1], tuple[k], tuple[k+1]] otherCell = @switchH[triple] if (otherCell == nil) return nil else newTupArr = Array.new for j in 0..tuple.dim newTupArr[j] = tuple[j] end newTupArr[k] = otherCell return CellTuple.new(newTupArr) end end