/** * Check if data component has a phenomenon time element and return the position * * @param sweDataElement Data component * @return Position of the phenomenon time element or -1 if it is not contained */ public static int hasPhenomenonTime(final SweAbstractDataComponent sweDataElement) { if (sweDataElement instanceof SweDataArray && ((SweDataArray) sweDataElement).getElementType() instanceof SweDataRecord) { final SweDataArray dataArray = (SweDataArray) sweDataElement; return checkFields(((SweDataRecord) dataArray.getElementType()).getFields(), PHENOMENON_TIME); } else if (sweDataElement instanceof SweDataRecord) { final SweDataRecord dataRecord = (SweDataRecord) sweDataElement; return checkFields(dataRecord.getFields(), PHENOMENON_TIME); } return -1; }
private static Map<Integer, String> getValueOrderMap( final SweAbstractDataComponent sweDataElement) { final Map<Integer, String> valueOrder = new HashMap<Integer, String>(0); if (sweDataElement instanceof SweDataArray && ((SweDataArray) sweDataElement).getElementType() instanceof SweDataRecord) { final SweDataArray dataArray = (SweDataArray) sweDataElement; addOrderAndDefinitionToMap( ((SweDataRecord) dataArray.getElementType()).getFields(), valueOrder); } else if (sweDataElement instanceof SweDataRecord) { final SweDataRecord dataRecord = (SweDataRecord) sweDataElement; addOrderAndDefinitionToMap(dataRecord.getFields(), valueOrder); } return new TreeMap<Integer, String>(valueOrder); }