@Test public void testReadFrom() throws Exception { channelBuffer = ChannelBuffers.copiedBuffer(metricReachability); reachability.readFrom(channelBuffer); assertThat(reachability, is(notNullValue())); }
public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDefaultMetric(metric); this.setDelayMetric(metric); this.setExpenseMetric(metric); this.setErrorMetric(metric); this.setDelayMetric(metric); if (metricInBinary.charAt(0) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); this.setExpenseMetricSupported(true); this.setErrorMetricSupported(true); } else { this.setDelayMetricSupported(false); this.setExpenseMetricSupported(false); this.setErrorMetricSupported(false); } byte temp = channelBuffer.readByte(); String internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setDelayIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setExpenseIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setErrorIsInternal(true); } byte[] tempByteArray = new byte[IsisUtil.ID_PLUS_ONE_BYTE]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.ID_PLUS_ONE_BYTE); this.setNeighborId(IsisUtil.systemIdPlus(tempByteArray)); }
MetricsOfReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDefaultMetric(metric); this.setDelayMetric(metric); this.setExpenseMetric(metric); this.setErrorMetric(metric); this.setDelayMetric(metric); if (metricInBinary.charAt(0) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); this.setExpenseMetricSupported(true); this.setErrorMetricSupported(true); } else { this.setDelayMetricSupported(false); this.setExpenseMetricSupported(false); this.setErrorMetricSupported(false); } byte temp = channelBuffer.readByte(); String internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setDelayIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setExpenseIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setErrorIsInternal(true); } byte[] tempByteArray = new byte[IsisUtil.ID_PLUS_ONE_BYTE]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.ID_PLUS_ONE_BYTE); this.setNeighborId(IsisUtil.systemIdPlus(tempByteArray)); } }
MetricsOfReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDefaultMetric(metric); this.setDelayMetric(metric); this.setExpenseMetric(metric); this.setErrorMetric(metric); this.setDelayMetric(metric); if (metricInBinary.charAt(0) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); this.setExpenseMetricSupported(true); this.setErrorMetricSupported(true); } else { this.setDelayMetricSupported(false); this.setExpenseMetricSupported(false); this.setErrorMetricSupported(false); } byte temp = channelBuffer.readByte(); String internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setDelayIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setExpenseIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setErrorIsInternal(true); } byte[] tempByteArray = new byte[IsisUtil.ID_PLUS_ONE_BYTE]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.ID_PLUS_ONE_BYTE); this.setNeighborId(IsisUtil.systemIdPlus(tempByteArray)); }  }
MetricsOfReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDefaultMetric(metric); this.setDelayMetric(metric); this.setExpenseMetric(metric); this.setErrorMetric(metric); this.setDelayMetric(metric); if (metricInBinary.charAt(0) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); this.setExpenseMetricSupported(true); this.setErrorMetricSupported(true); } else { this.setDelayMetricSupported(false); this.setExpenseMetricSupported(false); this.setErrorMetricSupported(false); } byte temp = channelBuffer.readByte(); String internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setDelayIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setExpenseIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setErrorIsInternal(true); } byte[] tempByteArray = new byte[IsisUtil.ID_PLUS_ONE_BYTE]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.ID_PLUS_ONE_BYTE); this.setNeighborId(IsisUtil.systemIdPlus(tempByteArray)); }  boolean isDelayIsInternal(); void setDelayIsInternal(boolean delayIsInternal); boolean isExpenseIsInternal(); void setExpenseIsInternal(boolean expenseIsInternal); boolean isErrorIsInternal(); void setErrorIsInternal(boolean errorIsInternal); boolean isDefaultIsInternal(); void setDefaultIsInternal(boolean defaultIsInternal); boolean isDelayMetricSupported(); void setDelayMetricSupported(boolean delayMetricSupported); boolean isExpenseMetricSupported(); void setExpenseMetricSupported(boolean expenseMetricSupported); boolean isErrorMetricSupported(); void setErrorMetricSupported(boolean errorMetricSupported); String neighborId(); void setNeighborId(String neighborId); byte defaultMetric(); void setDefaultMetric(byte defaultMetric); byte delayMetric(); void setDelayMetric(byte delayMetric); byte expenseMetric(); void setExpenseMetric(byte expenseMetric); byte errorMetric(); void setErrorMetric(byte errorMetric); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); @Override String toString(); }
MetricsOfReachability { public void readFrom(ChannelBuffer channelBuffer) { byte metric = channelBuffer.readByte(); String metricInBinary = Integer.toBinaryString(Byte.toUnsignedInt(metric)); metricInBinary = IsisUtil.toEightBitBinary(metricInBinary); this.setDefaultMetric(metric); this.setDelayMetric(metric); this.setExpenseMetric(metric); this.setErrorMetric(metric); this.setDelayMetric(metric); if (metricInBinary.charAt(0) == 0) { this.setDefaultIsInternal(true); } else { this.setDefaultIsInternal(false); } if (metricInBinary.charAt(0) == 0) { this.setDelayMetricSupported(true); this.setExpenseMetricSupported(true); this.setErrorMetricSupported(true); } else { this.setDelayMetricSupported(false); this.setExpenseMetricSupported(false); this.setErrorMetricSupported(false); } byte temp = channelBuffer.readByte(); String internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setDelayIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setExpenseIsInternal(true); } temp = channelBuffer.readByte(); internalBit = Integer.toBinaryString(Byte.toUnsignedInt(temp)); internalBit = IsisUtil.toEightBitBinary(internalBit); if (internalBit.charAt(1) == 0) { this.setErrorIsInternal(true); } byte[] tempByteArray = new byte[IsisUtil.ID_PLUS_ONE_BYTE]; channelBuffer.readBytes(tempByteArray, 0, IsisUtil.ID_PLUS_ONE_BYTE); this.setNeighborId(IsisUtil.systemIdPlus(tempByteArray)); }  boolean isDelayIsInternal(); void setDelayIsInternal(boolean delayIsInternal); boolean isExpenseIsInternal(); void setExpenseIsInternal(boolean expenseIsInternal); boolean isErrorIsInternal(); void setErrorIsInternal(boolean errorIsInternal); boolean isDefaultIsInternal(); void setDefaultIsInternal(boolean defaultIsInternal); boolean isDelayMetricSupported(); void setDelayMetricSupported(boolean delayMetricSupported); boolean isExpenseMetricSupported(); void setExpenseMetricSupported(boolean expenseMetricSupported); boolean isErrorMetricSupported(); void setErrorMetricSupported(boolean errorMetricSupported); String neighborId(); void setNeighborId(String neighborId); byte defaultMetric(); void setDefaultMetric(byte defaultMetric); byte delayMetric(); void setDelayMetric(byte delayMetric); byte expenseMetric(); void setExpenseMetric(byte expenseMetric); byte errorMetric(); void setErrorMetric(byte errorMetric); void readFrom(ChannelBuffer channelBuffer); byte[] asBytes(); @Override String toString();  }