/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.collection.mockup;

import net.ranides.assira.generic.HashUtils;
import net.ranides.assira.test.TMap;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public final class TMaps {
    
    public static final TMap<Integer, String> MAP_IS = new TMap<Integer, String>() {
    
        @Override
        protected Integer key(int index, int n) {
            if(n != 0) {
                throw new UnsupportedOperationException("NO TEST");
            }
            return index;
        }

        @Override
        protected String value(int index, int n) {
            return "S" + index + "." + n;
        }

        @Override
        protected int cmp(Integer a, Integer b) {
            return a-b;
        }

        @Override
        protected int hash(Integer key) {
            return HashUtils.murmurHash3(key);
        }
    };
    
    public static final TMap<TPoint, Integer> MAP_PI = new TMap<TPoint, Integer>(){

        @Override
        protected TPoint key(int index, int n) {
            return new TPoint(index, index, 10*index+n);
        }

        @Override
        protected Integer value(int index, int n) {
            return 10 * index + n;
        }

        @Override
        protected int cmp(TPoint a, TPoint b) {
            int dx = a.x - b.x;
            int dy = a.y - b.y;
            int dz = a.z - b.z;
            return dx!=0 ? dx : (dy!=0 ? dy : dz);
        }

        @Override
        protected int hash(TPoint key) {
            return HashUtils.hashValues(1, 1199, key.x, key.y);
        }

    };

}
