Phanendra Manda
Committed by Ray Milkey

Simplify statement and write comment

Change-Id: Ie1f1cb087a2a38c4fd5749d71dc635428dbdb765
......@@ -525,7 +525,7 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler {
}
}
return (bFoundPceccCapability && bFoundStatefulPceCapability && bFoundPcInstantiationCapability) ? true : false;
return (bFoundPceccCapability && bFoundStatefulPceCapability && bFoundPcInstantiationCapability);
}
/**
......
......@@ -67,7 +67,7 @@ public class PcepErrorInfoVer1 implements PcepErrorInfo {
@Override
public boolean isErrorInfoPresent() {
return (!this.errList.isEmpty()) ? true : false;
return !this.errList.isEmpty();
}
@Override
......
......@@ -47,7 +47,6 @@ public class PcepInterLayerObjectVer1 implements PcepInterLayerObject {
public static final int OBJECT_HEADER_LENGTH = 4;
public static final int NFLAG_SHIFT_VALUE = 0x02;
public static final int IFLAG_SHIFT_VALUE = 0x01;
public static final int FLAGS_SET_VALUE = 1;
static final PcepObjectHeader DEFAULT_INTER_LAYER_OBJECT_HEADER = new PcepObjectHeader(INTER_LAYER_OBJ_CLASS,
INTER_LAYER_OBJ_TYPE, PcepObjectHeader.REQ_OBJ_OPTIONAL_PROCESS, PcepObjectHeader.RSP_OBJ_PROCESSED,
......@@ -128,8 +127,8 @@ public class PcepInterLayerObjectVer1 implements PcepInterLayerObject {
ChannelBuffer tempCb = cb.readBytes(interLayerObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);
int iTemp = tempCb.readInt();
bIFlag = ((iTemp & (byte) IFLAG_SHIFT_VALUE) == FLAGS_SET_VALUE) ? true : false;
bNFlag = ((iTemp & (byte) NFLAG_SHIFT_VALUE) == FLAGS_SET_VALUE) ? true : false;
bIFlag = ((iTemp & (byte) IFLAG_SHIFT_VALUE) == IFLAG_SHIFT_VALUE);
bNFlag = ((iTemp & (byte) NFLAG_SHIFT_VALUE) == NFLAG_SHIFT_VALUE);
return new PcepInterLayerObjectVer1(interLayerObjHeader, bNFlag, bIFlag);
}
......
......@@ -145,7 +145,7 @@ public class PcepLabelObjectVer1 implements PcepLabelObject {
ChannelBuffer tempCb = cb.readBytes(labelObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);
int iTemp = tempCb.readInt();
bOFlag = (iTemp & (byte) 0x01) == 1 ? true : false;
bOFlag = (iTemp & (byte) 0x01) == 1;
label = tempCb.readInt();
// parse optional TLV
......
......@@ -249,13 +249,13 @@ public class PcepLspObjectVer1 implements PcepLspObject {
Integer iX = (iTemp & OFLAG_TEMP_SHIFT_VALUE) >> OFLAG_SHIFT_VALUE;
yOFlag = iX.byteValue();
iX = (iTemp & AFLAG_TEMP_SHIFT_VALUE) >> AFLAG_SHIFT_VALUE;
bAFlag = (iX > 0) ? true : false;
bAFlag = iX > 0;
iX = (iTemp & RFLAG_TEMP_SHIFT_VALUE) >> RFLAG_SHIFT_VALUE;
bRFlag = (iX > 0) ? true : false;
bRFlag = iX > 0;
iX = (iTemp & SFLAG_TEMP_SHIFT_VALUE) >> SFLAG_SHIFT_VALUE;
bSFlag = (iX > 0) ? true : false;
bSFlag = iX > 0;
iX = iTemp & DFLAG_TEMP_SHIFT_VALUE;
bDFlag = (iX > 0) ? true : false;
bDFlag = iX > 0;
// parse optional TLV
llOptionalTlv = parseOptionalTlv(tempCb);
......
......@@ -227,7 +227,7 @@ public class PcepLspaObjectVer1 implements PcepLspaObject {
flags = tempCb.readByte();
tempCb.readByte();
bLFlag = (flags & (byte) LFLAG_SET) == LFLAG_SET ? true : false;
bLFlag = (flags & (byte) LFLAG_SET) == LFLAG_SET;
llOptionalTlv = parseOptionalTlv(tempCb);
......
......@@ -202,8 +202,8 @@ public class PcepMetricObjectVer1 implements PcepMetricObject {
tempCb.readShort();
yFlag = tempCb.readByte();
bType = tempCb.readByte();
bCFlag = (yFlag & CFLAG_CHECK) == CFLAG_CHECK ? true : false;
bBFlag = (yFlag & BFLAG_SET) == BFLAG_SET ? true : false;
bCFlag = (yFlag & CFLAG_CHECK) == CFLAG_CHECK;
bBFlag = (yFlag & BFLAG_SET) == BFLAG_SET;
iMetricVal = tempCb.readInt();
return new PcepMetricObjectVer1(metricObjHeader, iMetricVal, yFlag, bCFlag, bBFlag, bType);
......
......@@ -198,9 +198,9 @@ public class PcepRPObjectVer1 implements PcepRPObject {
int iTemp = tempCb.readInt();
yPriFlag = (byte) (iTemp & PRIFLAG_TEMP_SHIFT_VALUE);
bOFlag = (iTemp & OFLAG_TEMP_SHIFT_VALUE) == OFLAG_TEMP_SHIFT_VALUE ? true : false;
bBFlag = (iTemp & BFLAG_TEMP_SHIFT_VALUE) == BFLAG_TEMP_SHIFT_VALUE ? true : false;
bRFlag = (iTemp & RFLAG_TEMP_SHIFT_VALUE) == RFLAG_TEMP_SHIFT_VALUE ? true : false;
bOFlag = (iTemp & OFLAG_TEMP_SHIFT_VALUE) == OFLAG_TEMP_SHIFT_VALUE;
bBFlag = (iTemp & BFLAG_TEMP_SHIFT_VALUE) == BFLAG_TEMP_SHIFT_VALUE;
bRFlag = (iTemp & RFLAG_TEMP_SHIFT_VALUE) == RFLAG_TEMP_SHIFT_VALUE;
iRequestIdNum = tempCb.readInt();
......
......@@ -166,7 +166,7 @@ public class PcepSrpObjectVer1 implements PcepSrpObject {
//take only SrpObject buffer.
ChannelBuffer tempCb = cb.readBytes(srpObjHeader.getObjLen() - MINIMUM_COMMON_HEADER_LENGTH);
flags = tempCb.readInt();
bRFlag = (0 < flags) ? true : false;
bRFlag = 0 < flags;
srpID = tempCb.readInt();
llOptionalTlv = parseOptionalTlv(tempCb);
......
......@@ -211,8 +211,8 @@ public class PcepTEObjectVer1 implements PcepTEObject {
tempCb.readShort();
Integer iTemp = (int) tempCb.readByte(); //read 3rd byte Flag
bSFlag = ((iTemp & FLAG_SET_S_FLAG) == FLAG_SET_S_FLAG) ? true : false;
bRFlag = ((iTemp & FLAG_SET_R_FLAG) == FLAG_SET_R_FLAG) ? true : false;
bSFlag = (iTemp & FLAG_SET_S_FLAG) == FLAG_SET_S_FLAG;
bRFlag = (iTemp & FLAG_SET_R_FLAG) == FLAG_SET_R_FLAG;
iTEId = tempCb.readInt();
......
......@@ -99,7 +99,7 @@ public class ErrorObjListWithOpen {
public boolean isErrorObjListWithOpenPresent() {
// ( <error-obj-list> [<Open>]
// At least in this case <error-obj-list> should be present.
return (!this.llerrorObjList.isEmpty()) ? true : false;
return !this.llerrorObjList.isEmpty();
}
/**
......
......@@ -63,11 +63,10 @@ public class NodeFlagBitsTlv implements PcepValueType {
public NodeFlagBitsTlv(byte rawValue) {
this.rawValue = rawValue;
isRawValueSet = true;
byte temp = rawValue;
this.bOFlag = (temp & OFLAG_SET) == OFLAG_SET ? true : false;
this.bTFlag = (temp & TFLAG_SET) == TFLAG_SET ? true : false;
this.bEFlag = (temp & EFLAG_SET) == EFLAG_SET ? true : false;
this.bBFlag = (temp & BFLAG_SET) == BFLAG_SET ? true : false;
this.bOFlag = (rawValue & OFLAG_SET) == OFLAG_SET;
this.bTFlag = (rawValue & TFLAG_SET) == TFLAG_SET;
this.bEFlag = (rawValue & EFLAG_SET) == EFLAG_SET;
this.bBFlag = (rawValue & BFLAG_SET) == BFLAG_SET;
}
/**
......
......@@ -48,8 +48,8 @@ public class PceccCapabilityTlv implements PcepValueType {
this.rawValue = rawValue;
this.isRawValueSet = true;
bLFlag = (rawValue & LFLAG_CHECK) == LFLAG_CHECK ? true : false;
bGFlag = (rawValue & GFLAG_CHECK) == GFLAG_CHECK ? true : false;
bLFlag = (rawValue & LFLAG_CHECK) == LFLAG_CHECK;
bGFlag = (rawValue & GFLAG_CHECK) == GFLAG_CHECK;
}
/**
......
......@@ -204,8 +204,8 @@ public class PcepObjectHeader {
short objLen;
objClass = cb.readByte();
byte temp = cb.readByte();
bIFlag = ((temp & IFLAG_SET) == IFLAG_SET) ? true : false;
bPFlag = ((temp & PFLAG_SET) == PFLAG_SET) ? true : false;
bIFlag = (temp & IFLAG_SET) == IFLAG_SET;
bPFlag = (temp & PFLAG_SET) == PFLAG_SET;
objType = (byte) (temp >> OBJECT_TYPE_SHIFT_VALUE);
objLen = cb.readShort();
return new PcepObjectHeader(objClass, objType, bPFlag, bIFlag, objLen);
......
......@@ -275,10 +275,10 @@ public class SrEroSubObject implements PcepValueType {
byte st;
PcepNai nai = null;
bMFlag = (temp & MFLAG_SET) == MFLAG_SET ? true : false;
bCFlag = (temp & CFLAG_SET) == CFLAG_SET ? true : false;
bSFlag = (temp & SFLAG_SET) == SFLAG_SET ? true : false;
bFFlag = (temp & FFLAG_SET) == FFLAG_SET ? true : false;
bMFlag = (temp & MFLAG_SET) == MFLAG_SET;
bCFlag = (temp & CFLAG_SET) == CFLAG_SET;
bSFlag = (temp & SFLAG_SET) == SFLAG_SET;
bFFlag = (temp & FFLAG_SET) == FFLAG_SET;
st = (byte) (temp >> SHIFT_ST);
......
......@@ -70,11 +70,11 @@ public class StatefulPceCapabilityTlv implements PcepValueType {
public StatefulPceCapabilityTlv(int rawValue) {
this.rawValue = rawValue;
isRawValueSet = true;
this.bUFlag = (rawValue & UFLAG_SET) == UFLAG_SET ? true : false;
this.bSFlag = (rawValue & SFLAG_SET) == SFLAG_SET ? true : false;
this.bIFlag = (rawValue & IFLAG_SET) == IFLAG_SET ? true : false;
this.bTFlag = (rawValue & TFLAG_SET) == TFLAG_SET ? true : false;
this.bDFlag = (rawValue & DFLAG_SET) == DFLAG_SET ? true : false;
this.bUFlag = (rawValue & UFLAG_SET) == UFLAG_SET;
this.bSFlag = (rawValue & SFLAG_SET) == SFLAG_SET;
this.bIFlag = (rawValue & IFLAG_SET) == IFLAG_SET;
this.bTFlag = (rawValue & TFLAG_SET) == TFLAG_SET;
this.bDFlag = (rawValue & DFLAG_SET) == DFLAG_SET;
}
/**
......@@ -245,11 +245,11 @@ public class StatefulPceCapabilityTlv implements PcepValueType {
boolean bSFlag;
boolean bUFlag;
bUFlag = (temp & UFLAG_SET) == UFLAG_SET ? true : false;
bSFlag = (temp & SFLAG_SET) == SFLAG_SET ? true : false;
bIFlag = (temp & IFLAG_SET) == IFLAG_SET ? true : false;
bTFlag = (temp & TFLAG_SET) == TFLAG_SET ? true : false;
bDFlag = (temp & DFLAG_SET) == DFLAG_SET ? true : false;
bUFlag = (temp & UFLAG_SET) == UFLAG_SET;
bSFlag = (temp & SFLAG_SET) == SFLAG_SET;
bIFlag = (temp & IFLAG_SET) == IFLAG_SET;
bTFlag = (temp & TFLAG_SET) == TFLAG_SET;
bDFlag = (temp & DFLAG_SET) == DFLAG_SET;
return new StatefulPceCapabilityTlv(bDFlag, bTFlag, bIFlag, bSFlag, bUFlag);
}
......