Search in sources :

Example 1 with CurveBag

use of jcog.bag.impl.CurveBag in project narchy by automenta.

the class ArrayBagTest method testInsertOrBoostDoesntCauseSort.

@Disabled
@Test
public void testInsertOrBoostDoesntCauseSort() {
    final int[] sorts = { 0 };
    @NotNull CurveBag<PLink<String>> x = new CurveBag(PriMerge.plus, new HashMap<>(), 4) {

        @Override
        protected void sort(int from, int to) {
            sorts[0]++;
            super.sort(from, to);
        }
    };
    x.put(new PLink("x", 0.2f));
    x.put(new PLink("y", 0.1f));
    x.put(new PLink("z", 0f));
    assertEquals(0, sorts[0]);
    x.commit();
    assertEquals(0, sorts[0]);
    assertSorted(x);
}
Also used : PLink(jcog.pri.PLink) CurveBag(jcog.bag.impl.CurveBag) NotNull(org.jetbrains.annotations.NotNull) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with CurveBag

use of jcog.bag.impl.CurveBag in project narchy by automenta.

the class BagLab method main.

public static void main(String[] arg) {
    BagLab bagLab = new BagLab(new CurveBag(plus, new HashMap(), 256));
    SpaceGraph.window(bagLab.surface(), 1200, 800);
    long delayMS = 30;
    // new Thread(()->{
    while (true) {
        bagLab.update();
        Util.sleep(delayMS);
    }
// }).start();
}
Also used : HashMap(java.util.HashMap) CurveBag(jcog.bag.impl.CurveBag)

Aggregations

CurveBag (jcog.bag.impl.CurveBag)2 HashMap (java.util.HashMap)1 PLink (jcog.pri.PLink)1 NotNull (org.jetbrains.annotations.NotNull)1 Disabled (org.junit.jupiter.api.Disabled)1 Test (org.junit.jupiter.api.Test)1