コード例 #1
0
 public AISMessage09Parser(Sixbit content) {
   super(content);
   if (content.length() != 168) {
     throw new IllegalArgumentException("Wrong message length");
   } else {
     fAltitude = content.getInt(FROM[ALTITUDE], TO[ALTITUDE]);
     fSOG = content.getInt(FROM[SPEEDOVERGROUND], TO[SPEEDOVERGROUND]);
     fPositionAccuracy = content.getBoolean(TO[POSITIONACCURACY]);
     fLongitude = Longitude28.toDegrees(content.getAs28BitInt(FROM[LONGITUDE], TO[LONGITUDE]));
     if (!PositionInfo.isLongitudeCorrect(fLongitude))
       fViolations.add(
           new AISRuleViolation("LongitudeInDegrees", fLongitude, PositionInfo.LONGITUDE_RANGE));
     fLatitude = Latitude27.toDegrees(content.getAs27BitInt(FROM[LATITUDE], TO[LATITUDE]));
     if (!PositionInfo.isLatitudeCorrect(fLatitude))
       fViolations.add(
           new AISRuleViolation("LatitudeInDegrees", fLatitude, PositionInfo.LATITUDE_RANGE));
     fCOG = content.getInt(FROM[COURSEOVERGROUND], TO[COURSEOVERGROUND]);
     if (!Angle12.isCorrect(fCOG))
       fViolations.add(new AISRuleViolation("CourseOverGround", fCOG, Angle12.RANGE));
     fTimeStamp = content.getInt(FROM[TIMESTAMP], TO[TIMESTAMP]);
     fRegional = content.getInt(FROM[REGIONAL], TO[REGIONAL]);
     fDTE = content.getBoolean(TO[DTE]);
     fAssignedModeFlag = content.getBoolean(TO[ASSIGNEDMODEFLAG]);
     fRAIMFlag = content.getBoolean(TO[RAIMFLAG]);
     fRadioStatus = content.getInt(FROM[RADIOSTATUS], TO[RADIOSTATUS]);
   }
 }
コード例 #2
0
 public String toString() {
   String result = "\tAlt:      " + fAltitude;
   result += SEPARATOR + "SOG:     " + getSOGString();
   result += SEPARATOR + "Pos acc: " + (fPositionAccuracy ? "high" : "low") + " accuracy";
   result += SEPARATOR + "Lat:     " + PositionInfo.longitudeToString(fLongitude);
   result += SEPARATOR + "Lon:     " + PositionInfo.latitudeToString(fLatitude);
   result += SEPARATOR + "COG:     " + Angle12.toString(fCOG);
   result += SEPARATOR + "Time:    " + TimeStamp.toString(fTimeStamp);
   result += SEPARATOR + "Regional:     " + getRegional();
   result += SEPARATOR + "DTE: " + (fDTE ? "yes" : "no");
   result += SEPARATOR + "Assigned Mode Flag: " + (fAssignedModeFlag ? "yes" : "no");
   result += SEPARATOR + "RAIM Flag: " + (fRAIMFlag ? "yes" : "no");
   result += SEPARATOR + "RadioStatus:     " + getRadioStatus();
   return result;
 }