using UnityEngine; using System.Collections.Generic; using System; using System.Collections; using System.Linq; namespace JungleDB { public class DefaultTreeOperationLog : TreeOperationLog { private IEnumerable list; private int size; IEnumerator IEnumerable.GetEnumerator() { // call the generic version of the method return this.GetEnumerator(); } public IEnumerator GetEnumerator() { foreach (var i in list) { yield return i; } } public DefaultTreeOperationLog() { list = new List(); size = 0; } public DefaultTreeOperationLog(IEnumerable _list,int _size) { list = _list; size = _size; } // public IEnumerator iterator() // { // return list.itetator(); // } public TreeOperationLog add(NodePath _p, NodeOperation _op) { TreeOperation op = new DefaultTreeOperation(_p,_op); List newList = new List(op); // java write Iterables.concat ここは間違い IEnumerable concat = list.Union(newList); return new DefaultTreeOperationLog(concat,size + 1); } public TreeOperationLog append(TreeOperationLog _log) { int argumentLogSize = _log.length(); // java write Iterables.concat IEnumerable concat = list.Union(_log); return new DefaultTreeOperationLog(concat,argumentLogSize + size); } public int length(){ return size; } } }