org.restcomm.protocols.ss7.map.service.supplementary.SSStatusImpl Maven / Gradle / Ivy
/*
* Mobius Software LTD
* Copyright 2019, Mobius Software LTD and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see
*/
package org.restcomm.protocols.ss7.map.service.supplementary;
import org.restcomm.protocols.ss7.map.api.service.supplementary.SSStatus;
import com.mobius.software.telco.protocols.ss7.asn.primitives.ASNSingleByte;
/**
*
* @author sergey vetyutnev
* @author amit bhayani
* @author yulianoifa
*
*/
public class SSStatusImpl extends ASNSingleByte implements SSStatus {
public static final int _mask_QBit = 0x08;
public static final int _mask_PBit = 0x04;
public static final int _mask_RBit = 0x02;
public static final int _mask_ABit = 0x01;
public SSStatusImpl() {
super("SSStatus",1,15,false);
}
public SSStatusImpl(int data) {
super(data,"SSStatus",1,15,false);
}
public SSStatusImpl(boolean qBit, boolean pBit, boolean rBit, boolean aBit) {
super((qBit ? _mask_QBit : 0) + (pBit ? _mask_PBit : 0) + (rBit ? _mask_RBit : 0) + (aBit ? _mask_ABit : 0),"SSStatus",1,15,false);
}
public int getData() {
return getValue();
}
public boolean getQBit() {
return (this.getData() & _mask_QBit) != 0;
}
public boolean getPBit() {
return (this.getData() & _mask_PBit) != 0;
}
public boolean getRBit() {
return (this.getData() & _mask_RBit) != 0;
}
public boolean getABit() {
return (this.getData() & _mask_ABit) != 0;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("SSStatus");
sb.append(" [");
if (this.getQBit()) {
sb.append("QBit");
sb.append(", ");
}
if (this.getPBit()) {
sb.append("PBit");
sb.append(", ");
}
if (this.getRBit()) {
sb.append("RBit");
sb.append(", ");
}
if (this.getABit()) {
sb.append("ABit");
sb.append(", ");
}
sb.append("]");
return sb.toString();
}
}