Пример #1
0
  @Override
  public String[] listLogs() {

    if (existingMessages == null) {
      Vector<String> list = new Vector<String>();
      Vector<Integer> indexes = new Vector<Integer>();

      for (int i = 0; i < index.getNumberOfMessages(); i++) {
        int type = index.typeOf(i);
        if (!indexes.contains(type)) {
          indexes.add(type);
          String msgName = index.getDefinitions().getMessageName(type);
          if (msgName == null) {
            System.err.println(
                "Message type not found in the definitions: "
                    + type
                    + ", "
                    + (index.getNumberOfMessages() - i));
          } else list.add(index.getDefinitions().getMessageName(type));
        }
      }
      existingMessages = list.toArray(new String[list.size()]);
    }
    return existingMessages;
  }
Пример #2
0
 public Collection<Integer> getMessageGenerators(String msgType) {
   Vector<Integer> sources = new Vector<Integer>();
   int idx = 0;
   while ((idx = index.getNextMessageOfType(msgType, idx)) != -1) {
     if (!sources.contains(index.sourceOf(idx))) {
       sources.add(index.sourceOf(idx));
     }
   }
   return sources;
 }
Пример #3
0
 @Override
 public void process(LsfIndex source) {
   TidePredictionFinder finder = TidePredictionFactory.create(source);
   try {
     for (double i = source.getStartTime(); i < source.getEndTime(); i += 60) {
       long time = (long) (i * 1000);
       addValue(time, "Tide height", finder.getTidePrediction(new Date(time), false));
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Пример #4
0
 @Override
 public boolean canBeApplied(LsfIndex index) {
   LsfIterator<GpsFix> it = index.getIterator(GpsFix.class, 5000);
   if (it == null) return false;
   else {
     for (GpsFix fix : it) {
       if (fix.getSatellites() > 0) return true;
     }
   }
   return false;
 }
Пример #5
0
  /** @return The IMraLog object related to the type of message stated in logName */
  @Override
  public IMraLog getLog(String logName) {

    if (index == null) return null;

    try {
      int i = index.getFirstMessageOfType(logName);
      if (i != -1) return new LsfMraLog(index, logName);
      else return null;
    } catch (Exception e) {
      NeptusLog.pub().info("<###>Index is: " + index);
      e.printStackTrace();
      return null;
    }
  }
Пример #6
0
 public void cleanup() {
   if (index != null) index.cleanup();
 }
Пример #7
0
 @Override
 public String getSystemName(int src) {
   return index.getSystemName(src);
 }
Пример #8
0
 @Override
 public String getEntityName(int src, int src_ent) {
   return index.getEntityName(src, src_ent);
 }