bool find(_Key key, out Image image) { D.assert(this.validate); var entry = this._head; while (entry != null) { if (entry.key == key) { image = entry.image; // move to the head of our list, so we purge it last this.release(entry); this.attachToHead(entry); D.assert(this.validate); return(true); } entry = entry.next; } D.assert(this.validate); image = null; return(false); }
public Image getGradient(List <Color> colors, List <float> positions) { var key = new _Key(colors, positions); if (!this.find(key, out var image)) { image = this.fillGradient(colors, positions); this.add(key, image); } return(image); }
void add(_Key key, Image image) { if (this._entryCount == this.maxEntries) { D.assert(this._tail != null); this.release(this._tail); this._entryCount--; } var entry = new _Entry { key = key, image = image }; this.attachToHead(entry); this._entryCount++; }
get => _Key; set => SetProperty(ref _Key, value);
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="c"></param> /// <param name="d"></param> public SipHash(_Key key, ushort c = DefaultC, ushort d = DefaultD) { _key = key; _c = c; _d = d; }