public SchemaSpec()

in harry-core/src/harry/ddl/SchemaSpec.java [73:122]


    public SchemaSpec(String keyspace,
                      String table,
                      List<ColumnSpec<?>> partitionKeys,
                      List<ColumnSpec<?>> clusteringKeys,
                      List<ColumnSpec<?>> regularColumns,
                      List<ColumnSpec<?>> staticColumns,
                      boolean isCompactStorage)
    {
        assert !isCompactStorage || clusteringKeys.size() == 0 || regularColumns.size() <= 1;

        this.keyspace = keyspace;
        this.table = table;
        this.isCompactStorage = isCompactStorage;

        this.partitionKeys = Collections.unmodifiableList(new ArrayList<>(partitionKeys));
        for (int i = 0; i < partitionKeys.size(); i++)
            partitionKeys.get(i).setColumnIndex(i);
        this.clusteringKeys = Collections.unmodifiableList(new ArrayList<>(clusteringKeys));
        for (int i = 0; i < clusteringKeys.size(); i++)
            clusteringKeys.get(i).setColumnIndex(i);
        this.staticColumns = Collections.unmodifiableList(new ArrayList<>(staticColumns));
        for (int i = 0; i < staticColumns.size(); i++)
            staticColumns.get(i).setColumnIndex(i);
        this.regularColumns = Collections.unmodifiableList(new ArrayList<>(regularColumns));
        for (int i = 0; i < regularColumns.size(); i++)
            regularColumns.get(i).setColumnIndex(i);

        List<ColumnSpec<?>> all = new ArrayList<>();
        for (ColumnSpec<?> columnSpec : concat(partitionKeys,
                                               clusteringKeys,
                                               staticColumns,
                                               regularColumns))
        {
            all.add(columnSpec);
        }
        this.allColumns = Collections.unmodifiableList(all);
        this.allColumnsSet = Collections.unmodifiableSet(new LinkedHashSet<>(all));

        this.pkGenerator = DataGenerators.createKeyGenerator(partitionKeys);
        this.ckGenerator = DataGenerators.createKeyGenerator(clusteringKeys);

        this.ALL_COLUMNS_BITSET = BitSet.allSet(regularColumns.size());

        this.staticColumnsOffset = partitionKeys.size() + clusteringKeys.size();
        this.regularColumnsOffset = staticColumnsOffset + staticColumns.size();

        this.regularColumnsMask = regularColumnsMask(this);
        this.regularAndStaticColumnsMask = regularAndStaticColumnsMask(this);
        this.staticColumnsMask = staticColumnsMask(this);
    }