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

src.gov.nasa.worldwind.formats.vpf.GeoSymTableHeader Maven / Gradle / Ivy

Go to download

World Wind is a collection of components that interactively display 3D geographic information within Java applications or applets.

There is a newer version: 2.0.0-986
Show newest version
/*
 * Copyright (C) 2012 United States Government as represented by the Administrator of the
 * National Aeronautics and Space Administration.
 * All Rights Reserved.
 */
package gov.nasa.worldwind.formats.vpf;

import gov.nasa.worldwind.util.Logging;

import java.util.*;

/**
 * MIL-DTL-89045, section 3.5.3.1
 *
 * @author dcollins
 * @version $Id: GeoSymTableHeader.java 1171 2013-02-11 21:45:02Z dcollins $
 */
public class GeoSymTableHeader
{
    protected String fileName;
    protected String description;
    // Use LinkedHashMap to acheive predictable ordering of table columns.
    protected LinkedHashMap columnMap;

    public GeoSymTableHeader()
    {
        this.columnMap = new LinkedHashMap();
    }

    public String getFileName()
    {
        return this.fileName;
    }

    public void setFileName(String fileName)
    {
        this.fileName = fileName;
    }

    public String getDescription()
    {
        return this.description;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    public int getNumColumns()
    {
        return this.columnMap.size();
    }

    public boolean containsColumn(String name)
    {
        if (name == null)
        {
            String message = Logging.getMessage("nullValue.NameIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        return this.columnMap.containsKey(name);
    }

    public GeoSymColumn getColumn(String name)
    {
        if (name == null)
        {
            String message = Logging.getMessage("nullValue.NameIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        return this.columnMap.get(name);
    }

    public Set getColumnNames()
    {
        return Collections.unmodifiableSet(this.columnMap.keySet());
    }

    public Collection getColumns()
    {
        return Collections.unmodifiableCollection(this.columnMap.values());
    }

    public void setColumns(Collection collection)
    {
        this.removeAllColumns();

        if (collection != null)
            this.addAllColumns(collection);
    }

    public void addColumn(GeoSymColumn column)
    {
        if (column == null)
        {
            String message = Logging.getMessage("nullValue.ColumnIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        this.columnMap.put(column.getName(), column);
    }

    public void addAllColumns(Collection collection)
    {
        if (collection == null)
        {
            String message = Logging.getMessage("nullValue.CollectionIsNulln");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        for (GeoSymColumn col : collection)
        {
            this.addColumn(col);
        }
    }

    public void removeColumn(GeoSymColumn column)
    {
        if (column == null)
        {
            String message = Logging.getMessage("nullValue.ColumnIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        this.columnMap.remove(column.getName());
    }

    public void removeAllColumns()
    {
        this.columnMap.clear();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy