// Path: src/main/java/com/jordanwilliams/heftydb/table/Table.java
// public interface Table extends Iterable<Tuple>, Comparable<Table> {
// 
//     public long id();
// 
//     public boolean mightContain(Key key);
// 
//     public Tuple get(Key key);
// 
//     public CloseableIterator<Tuple> ascendingIterator(long snapshotId);
// 
//     public CloseableIterator<Tuple> descendingIterator(long snapshotId);
// 
//     public CloseableIterator<Tuple> ascendingIterator(Key key, long snapshotId);
// 
//     public CloseableIterator<Tuple> descendingIterator(Key key, long snapshotId);
// 
//     public long tupleCount();
// 
//     public long size();
// 
//     public int level();
// 
//     public long maxSnapshotId();
// 
//     public void close();
// 
//     public boolean isPersistent();
// }


import com.jordanwilliams.heftydb.table.Table;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NavigableSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/*
 * Copyright (c) 2014. Jordan Williams
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.jordanwilliams.heftydb.state;



/**
 * A collection of all of the Tables in a database. Concurrent access from multiple threads is guarded by a
 * ReentrantReadWriteLock.
 */
public class Tables implements Iterable<Table> {

    public interface ChangeHandler {
        public void changed();
    }

    private final AtomicLong currentTableId = new AtomicLong();
// Path: src/main/java/com/jordanwilliams/heftydb/table/Table.java
// public interface Table extends Iterable<Tuple>, Comparable<Table> {
// 
//     public long id();
// 
//     public boolean mightContain(Key key);
// 
//     public Tuple get(Key key);
// 
//     public CloseableIterator<Tuple> ascendingIterator(long snapshotId);
// 
//     public CloseableIterator<Tuple> descendingIterator(long snapshotId);
// 
//     public CloseableIterator<Tuple> ascendingIterator(Key key, long snapshotId);
// 
//     public CloseableIterator<Tuple> descendingIterator(Key key, long snapshotId);
// 
//     public long tupleCount();
// 
//     public long size();
// 
//     public int level();
// 
//     public long maxSnapshotId();
// 
//     public void close();
// 
//     public boolean isPersistent();
// }


// Path: src/main/java/com/jordanwilliams/heftydb/state/Tables.java
import com.jordanwilliams.heftydb.table.Table;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NavigableSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/*
 * Copyright (c) 2014. Jordan Williams
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.jordanwilliams.heftydb.state;



/**
 * A collection of all of the Tables in a database. Concurrent access from multiple threads is guarded by a
 * ReentrantReadWriteLock.
 */
public class Tables implements Iterable<Table> {

    public interface ChangeHandler {
        public void changed();
    }

    private final AtomicLong currentTableId = new AtomicLong();
    private final NavigableSet<Table> tables = new TreeSet<Table>();