/* 
 * Copyright 2015 Key Bridge LLC.
 *
 * 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 us.gov.dod.standard.ssrf;

import us.gov.dod.standard.ssrf._3_1.*;
import us.gov.dod.standard.ssrf._3_1.metadata.domains.Serial;

/**
 * Enumerated list of serial number data types.
 * <p>
 * This class contains the codes that MUST be used as the third part of the
 * Serial of each dataset corresponding to each class type.
 * <p>
 * Used by {@link Serial}
 * <p>
 * @author Jesse Caulfield
 * @version SSRF 3.1.0, 09/29/2014
 */
public enum EDatasetType {

  AD(Administrative.class),
  AL(Allotment.class),
  AN(Antenna.class),
  AS(Assignment.class),
  CN(Contact.class),
  CP(ChannelPlan.class),
  EX(ExternalReference.class),
  /**
   * Force Element Deployment
   */
  FD(FEDeployment.class),
  FE(ForceElement.class),
  /**
   * Spectrum Supportability Reply (Host Nation Declaration)
   */
  HD(SSReply.class),
  IF(IntfReport.class),
  JA(Role.class),
  JR(JRFL.class),
  LO(Location.class),
  LS(Loadset.class),
  MS(Message.class),
  NT(Note.class),
  OR(Organisation.class),
  RP(RadiationPlan.class),
  RX(Receiver.class),
  SA(Satellite.class),
  /**
   * Spectrum Supportability Request
   */
  SR(SSRequest.class),
  /**
   * Table of Allocations
   */
  TA(TOA.class),
  TR(RFSystem.class),
  TX(Transmitter.class);

  /**
   * The class type.
   */
  private final Class<? extends Common<?>> clazz;

  private EDatasetType(Class<? extends Common<?>> clazz) {
    this.clazz = clazz;
  }

  /**
   * Get the class type for this serial type.
   * <p>
   * @return the class type.
   */
  public Class<? extends Common<?>> getClazz() {
    return clazz;
  }

  /**
   * Get a serial number data type from an object instance. This method is used
   * within the {@link Common} constructor to automatically build a serial
   * number.
   * <p>
   * @param instance the object instance
   * @return the serial number data type code
   */
  public static EDatasetType fromInstance(Object instance) {
    return fromInstance(instance.getClass());
  }

  /**
   * Get a serial number data type from an object instance. This method is used
   * within the {@link Common} constructor to automatically build a serial
   * number.
   * <p>
   * @param clazz the object instance class type
   * @return the serial number data type code
   */
  public static EDatasetType fromInstance(Class<?> clazz) {
    for (EDatasetType eSerialType : EDatasetType.values()) {
      if (eSerialType.getClazz().equals(clazz)) {
        return eSerialType;
      }
    }
    return null;
  }

  /**
   * Get the class type simple name
   * <p>
   * @return the class type simple name. e.g. an Allotment instance will return
   *         "Allotment"
   */
  public String getClassSimpleName() {
    return clazz.getSimpleName();
  }

}

@@ -1,11 +1,10 @@
 /*
- 
 %0A * Copy
@@ -1066,147 +1066,348 @@
 %0A%0A  
-AD(Administrative.class),%0A  AL(Allotment.class),%0A  AN(Antenna.class),%0A  AS(Assignment.class),%0A  CN(Contact.class),%0A  CP(ChannelPlan.class),
+/**%0A   * Administrative%0A   */%0A  AD(Administrative.class),%0A  /**%0A   * Allotment%0A   */%0A  AL(Allotment.class),%0A  /**%0A   * Antenna%0A   */%0A  AN(Antenna.class),%0A  /**%0A   * Assignment%0A   */%0A  AS(Assignment.class),%0A  /**%0A   * Contact%0A   */%0A  CN(Contact.class),%0A  /**%0A   * ChannelPlan%0A   */%0A  CP(ChannelPlan.class),%0A  /**%0A   * ExternalReference%0A   */
 %0A  E
@@ -1502,16 +1502,46 @@
 class),%0A
+  /**%0A   * ForceElement%0A   */%0A
   FE(For
@@ -1658,222 +1658,506 @@
 ,%0A  
-IF(IntfReport.class),%0A  JA(Role.class),%0A  JR(JRFL.class),%0A  LO(Location.class),%0A  LS(Loadset.class),%0A  MS(Message.class),%0A  NT(Note.class),%0A  OR(Organisation.class),%0A  RP(RadiationPlan.class),%0A  RX(Receiver.class),
+/**%0A   * IntfReport%0A   */%0A  IF(IntfReport.class),%0A  /**%0A   * Role%0A   */%0A  JA(Role.class),%0A  /**%0A   * JRFL%0A   */%0A  JR(JRFL.class),%0A  /**%0A   * Location%0A   */%0A  LO(Location.class),%0A  /**%0A   * Loadset%0A   */%0A  LS(Loadset.class),%0A  /**%0A   * Message%0A   */%0A  MS(Message.class),%0A  /**%0A   * Note%0A   */%0A  NT(Note.class),%0A  /**%0A   * Organisation%0A   */%0A  OR(Organisation.class),%0A  /**%0A   * RadiationPlan%0A   */%0A  RP(RadiationPlan.class),%0A  /**%0A   * Receiver%0A   */%0A  RX(Receiver.class),%0A  /**%0A   * Satellite%0A   */
 %0A  S
@@ -2309,27 +2309,82 @@
 ,%0A  
-TR(RFSystem.class),
+/**%0A   * RFSystem%0A   */%0A  TR(RFSystem.class),%0A  /**%0A   * Transmitter%0A   */
 %0A  T

add documentation