com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree Java Examples

The following examples show how to use com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RibManager.java    From atrium-odl with Apache License 2.0 6 votes vote down vote up
@Override
public void stop() {
	// TODO Auto-generated method stub
	this.closed = true;
	// Stop host service
	hostService.stop();

	// Stop the thread(s)
	bgpUpdatesExecutor.shutdownNow();
	synchronized (this) {
		// Cleanup all local state
		ribTable4 = new ConcurrentInvertedRadixTree<>(new DefaultByteArrayNodeFactory());
		routeUpdatesQueue.clear();
		routesWaitingOnArp.clear();
		ip2Mac.clear();
	}
}
 
Example #2
Source File: InvertedRadixTreeUsage.java    From concurrent-trees with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    InvertedRadixTree<Integer> tree = new ConcurrentInvertedRadixTree<Integer>(new DefaultCharArrayNodeFactory());

    tree.put("TEST", 1);
    tree.put("TOAST", 2);
    tree.put("TEAM", 3);

    System.out.println("Tree structure:");
    // PrettyPrintable is a non-public API for testing, prints semi-graphical representations of trees...
    PrettyPrinter.prettyPrint((PrettyPrintable) tree, System.out);

    System.out.println();
    System.out.println("Value for 'TEST' (exact match): " + tree.getValueForExactKey("TEST"));
    System.out.println("Value for 'TOAST' (exact match): " + tree.getValueForExactKey("TOAST"));
    System.out.println();
    System.out.println("Keys contained in 'MY TEAM LIKES TOAST': " + Iterables.toString(tree.getKeysContainedIn("MY TEAM LIKES TOAST")));
    System.out.println("Keys contained in 'MY TEAM LIKES TOASTERS': " + Iterables.toString(tree.getKeysContainedIn("MY TEAM LIKES TOASTERS")));
    System.out.println("Values for keys contained in 'MY TEAM LIKES TOAST': " + Iterables.toString(tree.getValuesForKeysContainedIn("MY TEAM LIKES TOAST")));
    System.out.println("Key-value pairs for keys contained in 'MY TEAM LIKES TOAST': " + Iterables.toString(tree.getKeyValuePairsForKeysContainedIn("MY TEAM LIKES TOAST")));
}
 
Example #3
Source File: InvertedRadixTreeIndex.java    From cqengine with Apache License 2.0 6 votes vote down vote up
/**
 * Package-private constructor, used by static factory methods.
 */
protected InvertedRadixTreeIndex(Attribute<O, A> attribute, NodeFactory nodeFactory) {
    super(attribute, new HashSet<Class<? extends Query>>() {/**
         * 
         */
        private static final long serialVersionUID = 1L;

    {
        add(Equal.class);
        add(In.class);
        add(StringIsContainedIn.class);
        add(LongestPrefix.class);
        add(StringIsPrefixOf.class);
    }});
    this.nodeFactory = nodeFactory;
    this.tree = new ConcurrentInvertedRadixTree<StoredResultSet<O>>(nodeFactory);
}
 
Example #4
Source File: RibManager.java    From atrium-odl with Apache License 2.0 5 votes vote down vote up
@Override
public void onSessionInitiated(ProviderContext session) {
	LOG.info("Router Session Initiated");
	routesWaitingOnArp = Multimaps.synchronizedSetMultimap(HashMultimap.<AtriumIpAddress, RouteEntry> create());
	ribTable4 = new ConcurrentInvertedRadixTree<>(new DefaultByteArrayNodeFactory());
	bgpUpdatesExecutor = Executors
			.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("atrium-bgp-updates-%d").build());
}
 
Example #5
Source File: AccessControl.java    From outbackcdx with Apache License 2.0 5 votes vote down vote up
RulesBySsurt(Collection<AccessRule> rules) {
    tree = new ConcurrentInvertedRadixTree<>(new DefaultCharArrayNodeFactory());
    for (AccessRule rule: rules) {
        try {
            put(rule);
        } catch (IllegalArgumentException e) {
            log.log(Level.WARNING, "Skipping invalid access rule: " + rule.id, e);
        }
    }
}
 
Example #6
Source File: DefaultResolvedRouteStore.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new route table.
 */
public RouteTable() {
    routeTable = new ConcurrentInvertedRadixTree<>(
            new DefaultByteArrayNodeFactory());

    alternativeRoutes = Maps.newHashMap();
}
 
Example #7
Source File: InvertedRadixTreeIndex.java    From cqengine with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void clear(QueryOptions queryOptions) {
    this.tree = new ConcurrentInvertedRadixTree<StoredResultSet<O>>(new DefaultCharArrayNodeFactory());
}
 
Example #8
Source File: LocalRouteStore.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new route table.
 */
public RouteTable(RouteTableId id) {
    this.id = checkNotNull(id);
    routeTable = new ConcurrentInvertedRadixTree<>(
            new DefaultByteArrayNodeFactory());
}