All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.questdb.ql.model.CreateJournalModel Maven / Gradle / Ivy

There is a newer version: 3.3.3
Show newest version
/*******************************************************************************
 *    ___                  _   ____  ____
 *   / _ \ _   _  ___  ___| |_|  _ \| __ )
 *  | | | | | | |/ _ \/ __| __| | | |  _ \
 *  | |_| | |_| |  __/\__ \ |_| |_| | |_) |
 *   \__\_\\__,_|\___||___/\__|____/|____/
 *
 * Copyright (C) 2014-2016 Appsicle
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 *
 ******************************************************************************/

package com.questdb.ql.model;

import com.questdb.factory.configuration.JournalStructure;
import com.questdb.std.CharSequenceObjHashMap;
import com.questdb.std.Mutable;
import com.questdb.std.ObjList;
import com.questdb.std.ObjectFactory;

public class CreateJournalModel implements Mutable, ParsedModel {
    public static final ObjectFactory FACTORY = new ObjectFactory() {
        @Override
        public CreateJournalModel newInstance() {
            return new CreateJournalModel();
        }
    };
    private final ObjList columnIndexModels = new ObjList<>();
    private final CharSequenceObjHashMap columnCastModels = new CharSequenceObjHashMap<>();
    private ExprNode name;
    private QueryModel queryModel;
    private ExprNode timestamp;
    private ExprNode partitionBy;
    private ExprNode recordHint;
    private JournalStructure struct;

    private CreateJournalModel() {
    }

    public boolean addColumnCastModel(ColumnCastModel model) {
        return columnCastModels.put(model.getName().token, model);
    }

    public void addColumnIndexModel(ColumnIndexModel model) {
        columnIndexModels.add(model);
    }

    @Override
    public void clear() {
        columnIndexModels.clear();
        columnCastModels.clear();
        queryModel = null;
        timestamp = null;
        partitionBy = null;
        recordHint = null;
        struct = null;
        name = null;
    }

    public CharSequenceObjHashMap getColumnCastModels() {
        return columnCastModels;
    }

    public ObjList getColumnIndexModels() {
        return columnIndexModels;
    }

    @Override
    public int getModelType() {
        return ParsedModel.CREATE_JOURNAL;
    }

    public ExprNode getName() {
        return name;
    }

    public void setName(ExprNode name) {
        this.name = name;
    }

    public ExprNode getPartitionBy() {
        return partitionBy;
    }

    public void setPartitionBy(ExprNode partitionBy) {
        this.partitionBy = partitionBy;
    }

    public QueryModel getQueryModel() {
        return queryModel;
    }

    public void setQueryModel(QueryModel queryModel) {
        this.queryModel = queryModel;
    }

    public ExprNode getRecordHint() {
        return recordHint;
    }

    public void setRecordHint(ExprNode recordHint) {
        this.recordHint = recordHint;
    }

    public JournalStructure getStruct() {
        return struct;
    }

    public void setStruct(JournalStructure struct) {
        this.struct = struct;
    }

    public ExprNode getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(ExprNode timestamp) {
        this.timestamp = timestamp;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy