Search in sources :

Example 1 with SimpleMultiset

use of com.xrtb.blocks.SimpleMultiset in project XRTB by benmfaul.

the class Configuration method readData.

public static String readData(String type, String name, S3Object object, long size) throws Exception {
    String message = "";
    switch(type) {
        case "range":
        case "cidr":
            NavMap map = new NavMap(name, object);
            message = "Added NavMap " + name + ": has " + map.size() + " members";
            break;
        case "set":
            SimpleSet set = new SimpleSet(name, object);
            message = "Initialize Set: " + name + " from S3, entries = " + set.size();
            break;
        case "bloom":
            Bloom b = new Bloom(name, object, size);
            message = "Initialize Bloom Filter: " + name + " from S3, members = " + b.getMembers();
            break;
        case "cuckoo":
            Cuckoo c = new Cuckoo(name, object, size);
            message = "Initialize Cuckoo Filter: " + name + " from S3, entries = " + c.getMembers();
            break;
        case "multiset":
            SimpleMultiset ms = new SimpleMultiset(name, object);
            message = "Initialize Multiset " + name + " from S3, entries = " + ms.getMembers();
            break;
        default:
            message = "Unknown type: " + type;
    }
    System.out.println("*** " + message);
    return message;
}
Also used : SimpleSet(com.xrtb.blocks.SimpleSet) Bloom(com.xrtb.blocks.Bloom) SimpleMultiset(com.xrtb.blocks.SimpleMultiset) NavMap(com.xrtb.blocks.NavMap) Cuckoo(com.xrtb.blocks.Cuckoo)

Example 2 with SimpleMultiset

use of com.xrtb.blocks.SimpleMultiset in project XRTB by benmfaul.

the class Configuration method readData.

public static String readData(String fileName) throws Exception {
    String message = "";
    int i = fileName.indexOf(".");
    if (i == -1)
        throw new Exception("Filename is missing type field");
    String type = fileName.substring(i);
    NavMap map;
    SimpleMultiset set;
    SimpleSet sset;
    Bloom b;
    Cuckoo c;
    switch(type) {
        case "range":
            map = new NavMap(fileName, fileName, false);
            message = "Added NavMap " + fileName + ": from file, has " + map.size() + " members";
            break;
        case "cidr":
            map = new NavMap(fileName, fileName, true);
            message = "Added NavMap " + fileName + ": from file, has " + map.size() + " members";
            break;
        case "bloom":
            b = new Bloom(fileName, fileName);
            message = "Initialize Bloom Filter: " + fileName + " from file, members = " + b.getMembers();
            break;
        case "cuckoo":
            c = new Cuckoo(fileName, fileName);
            break;
        case "multiset":
            set = new SimpleMultiset(fileName, fileName);
            message = "Initialize Multiset " + fileName + " from file, entries = " + set.getMembers();
            break;
        case "set":
            sset = new SimpleSet(fileName, fileName);
            message = "Initialize Multiset " + fileName + " from file, entries = " + sset.size();
            break;
        default:
            message = "Unknown type: " + type;
    }
    System.out.println("*** " + message);
    return message;
}
Also used : SimpleSet(com.xrtb.blocks.SimpleSet) Bloom(com.xrtb.blocks.Bloom) SimpleMultiset(com.xrtb.blocks.SimpleMultiset) NavMap(com.xrtb.blocks.NavMap) Cuckoo(com.xrtb.blocks.Cuckoo)

Aggregations

Bloom (com.xrtb.blocks.Bloom)2 Cuckoo (com.xrtb.blocks.Cuckoo)2 NavMap (com.xrtb.blocks.NavMap)2 SimpleMultiset (com.xrtb.blocks.SimpleMultiset)2 SimpleSet (com.xrtb.blocks.SimpleSet)2