1 /* Copyright 2002-2022 CS GROUP 2 * Licensed to CS GROUP (CS) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * CS licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.orekit.files.ccsds.section; 18 19 import org.orekit.time.AbsoluteDate; 20 21 /** 22 * Header of a CCSDS Navigation Data Message. 23 * @author Bryan Cazabonne 24 * @since 10.2 25 */ 26 public class Header extends CommentsContainer { 27 28 /** CCSDS Format version. */ 29 private double formatVersion; 30 31 /** File creation date and time in UTC. */ 32 private AbsoluteDate creationDate; 33 34 /** Creating agency or operator. */ 35 private String originator; 36 37 /** ID that uniquely identifies a message from a given originator. */ 38 private String messageId; 39 40 /** Minimum version for {@link HeaderKey#MESSAGE_ID}. */ 41 private final double minVersionMessageId; 42 43 /** 44 * Constructor. 45 * @param minVersionMessageId minimum version for {@link HeaderKey#MESSAGE_ID} 46 */ 47 public Header(final double minVersionMessageId) { 48 this.formatVersion = Double.NaN; 49 this.minVersionMessageId = minVersionMessageId; 50 } 51 52 /** {@inheritDoc} */ 53 @Override 54 public void validate(final double version) { 55 super.validate(version); 56 checkNotNull(creationDate, HeaderKey.CREATION_DATE); 57 checkNotNull(originator, HeaderKey.ORIGINATOR); 58 checkAllowed(version, messageId, HeaderKey.MESSAGE_ID, minVersionMessageId, Double.POSITIVE_INFINITY); 59 } 60 61 /** 62 * Get the CCSDS NDM (ADM, ODM or TDM) format version. 63 * @return format version 64 */ 65 public double getFormatVersion() { 66 return formatVersion; 67 } 68 69 /** 70 * Set the CCSDS NDM (ADM, ODM or TDM) format version. 71 * @param formatVersion the format version to be set 72 */ 73 public void setFormatVersion(final double formatVersion) { 74 this.formatVersion = formatVersion; 75 } 76 77 /** 78 * Get the file creation date and time in UTC. 79 * @return the file creation date and time in UTC. 80 */ 81 public AbsoluteDate getCreationDate() { 82 return creationDate; 83 } 84 85 /** 86 * Set the file creation date and time in UTC. 87 * @param creationDate the creation date to be set 88 */ 89 public void setCreationDate(final AbsoluteDate creationDate) { 90 refuseFurtherComments(); 91 this.creationDate = creationDate; 92 } 93 94 /** 95 * Get the file originator. 96 * @return originator the file originator. 97 */ 98 public String getOriginator() { 99 return originator; 100 } 101 102 /** 103 * Set the file originator. 104 * @param originator the originator to be set 105 */ 106 public void setOriginator(final String originator) { 107 refuseFurtherComments(); 108 this.originator = originator; 109 } 110 111 /** 112 * Get the ID that uniquely identifies a message from a given originator. 113 * @return ID that uniquely identifies a message from a given originator 114 */ 115 public String getMessageId() { 116 return messageId; 117 } 118 119 /** 120 * Set the ID that uniquely identifies a message from a given originator. 121 * @param messageId ID that uniquely identifies a message from a given originator 122 */ 123 public void setMessageId(final String messageId) { 124 this.messageId = messageId; 125 } 126 127 }