コード例 #1
0
ファイル: MessageBlock.java プロジェクト: jpollo/rcrss
  public SOSBitArray toBitArray(ChannelSystemType channelType) {
    if (messageBitArray != null) {
      if (lastChannelType == channelType) return messageBitArray;

      SOSAgent.currentAgent()
          .sosLogger
          .messageContent
          .debug(
              "lastchanneltype is different!!!!!"
                  + lastChannelType
                  + " new chaneltype"
                  + channelType);
    }

    lastChannelType = channelType;
    MessageGroup messageGroup = ReadXml.getValidChannelMessages(channelType);

    messageBitArray = new SOSBitArray(getBitSize(channelType));
    int tempBitPosition = 0;

    messageBitArray.set(
        tempBitPosition,
        SOSBitArray.makeBit(messageGroup.headerToIndex(header), messageGroup.bitSize()));
    tempBitPosition += messageGroup.bitSize();

    DataArrayList xmlData = ReadXml.blocks.get(header).data();

    for (int i = 0; i < xmlData.size(); i++) {
      if (xmlData.getValue(i) < 0) {
        new Error("value is negetive!!!!!!!!!!!![TO BIT ARRAY]").printStackTrace();
        messageBitArray.set(tempBitPosition, SOSBitArray.makeBit(0, xmlData.getValue(i)));
      } else
        messageBitArray.set(
            tempBitPosition, SOSBitArray.makeBit(getData(xmlData.getKey(i)), xmlData.getValue(i)));
      tempBitPosition += xmlData.getValue(i);
    }
    return messageBitArray;
  }
コード例 #2
0
ファイル: MessageBlock.java プロジェクト: jpollo/rcrss
 public int getBitSize(ChannelSystemType channelType) {
   return ReadXml.getBlockSize(header, channelType);
 }