Mercurial > hg > Database > jungle-sharp
view src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle/store/impl/logger/DefaultTreeOperationLog.cs @ 7:02b2ab7bffe6
fix
author | Kazuma |
---|---|
date | Tue, 27 Sep 2016 18:36:05 +0900 |
parents | dec15de2c6ff |
children |
line wrap: on
line source
using UnityEngine; using System.Collections.Generic; using System; using System.Collections; using System.Linq; public class DefaultTreeOperationLog : TreeOperationLog { private IEnumerable<TreeOperation> list; private int size; IEnumerator IEnumerable.GetEnumerator() { // call the generic version of the method return this.GetEnumerator(); } public IEnumerator<TreeOperation> GetEnumerator() { foreach (var i in list) { yield return i; } } public DefaultTreeOperationLog() { list = new List<TreeOperation>(); size = 0; } public DefaultTreeOperationLog(IEnumerable<TreeOperation> _list,int _size) { list = _list; size = _size; } // public IEnumerator<TreeOperation> iterator() // { // return list.itetator(); // } public TreeOperationLog add(NodePath _p, NodeOperation _op) { TreeOperation op = new DefaultTreeOperation(_p,_op); List<TreeOperation> newList = new List<TreeOperation>(op); // java write Iterables.concat ここは間違い IEnumerable<TreeOperation> concat = list.Union<TreeOperation>(newList); return new DefaultTreeOperationLog(concat,size + 1); } public TreeOperationLog append(TreeOperationLog _log) { int argumentLogSize = _log.length(); // java write Iterables.concat IEnumerable<TreeOperation> concat = list.Union<TreeOperation>(_log); return new DefaultTreeOperationLog(concat,argumentLogSize + size); } public int length(){ return size; } }