@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((globalTitleIndicator == null) ? 0 : globalTitleIndicator.hashCode()); result = prime * result + (pcPresent ? 1231 : 1237); result = prime * result + ((routingIndicator == null) ? 0 : routingIndicator.hashCode()); result = prime * result + (ssnPresent ? 1231 : 1237); result = prime * result + (reservedForNationalUseBit ? 1231 : 1237); return result; }
public AddressIndicator(byte v, SccpProtocolVersion sccpProtocolVersion) { init(v, sccpProtocolVersion); }
private void init(byte v, SccpProtocolVersion sccpProtocolVersion) { if (sccpProtocolVersion == SccpProtocolVersion.ANSI) { ssnPresent = (v & 0x01) == 0x01; pcPresent = (v & 0x02) == 0x02; int gtiCode = ((v >> 2) & 0x0f); switch (gtiCode) { case 1: globalTitleIndicator = GlobalTitleIndicator.GLOBAL_TITLE_INCLUDES_TRANSLATION_TYPE_NUMBERING_PLAN_AND_ENCODING_SCHEME; break; case 2: globalTitleIndicator = GlobalTitleIndicator.GLOBAL_TITLE_INCLUDES_TRANSLATION_TYPE_ONLY; break; default: globalTitleIndicator = GlobalTitleIndicator.NO_GLOBAL_TITLE_INCLUDED; break; } } else { pcPresent = (v & 0x01) == 0x01; ssnPresent = (v & 0x02) == 0x02; globalTitleIndicator = GlobalTitleIndicator.valueOf((v >> 2) & 0x0f); } routingIndicator = ((v >> 6) & 0x01) == 0x01 ? RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN : RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE; reservedForNationalUseBit = (v & 0x80) == 0x80; }
@Override public void encode(OutputStream out, final boolean removeSpc, final SccpProtocolVersion sccpProtocolVersion) throws ParseException { try{ if(super.digits == null){ throw new IllegalStateException(); } out.write(this.translationType); out.write((this.numberingPlan.getValue() << 4) | this.encodingScheme.getSchemeCode()); out.write(this.natureOfAddress.getValue()); this.encodingScheme.encode(digits, out); } catch (IOException e) { throw new ParseException(e); } }
@Override public void decode(final InputStream in,final ParameterFactory factory, final SccpProtocolVersion sccpProtocolVersion) throws ParseException { try{ this.translationType = in.read() & 0xff; int b = in.read() & 0xff; this.encodingScheme = factory.createEncodingScheme((byte) (b & 0x0f)); this.numberingPlan = NumberingPlan.valueOf((b & 0xf0) >> 4); b = in.read() & 0xff; this.natureOfAddress = NatureOfAddress.valueOf(b); super.digits = this.encodingScheme.decode(in); } catch (IOException e) { throw new ParseException(e); } }
public static NumberingPlanSccpType createInstance(String s) { Integer i1 = doCreateInstance(s, stringMap, intMap); if (i1 == null) return new NumberingPlanSccpType(NumberingPlan.UNKNOWN.getValue()); else return new NumberingPlanSccpType(i1); }
public void write(GlobalTitle0001Impl ai, OutputElement xml) throws XMLStreamException { // xml.setAttribute(GLOBALTITLE_INDICATOR, ai.gti.getValue()); xml.setAttribute(NATURE_OF_ADDRESS_INDICATOR, ai.natureOfAddress.getValue()); xml.setAttribute(DIGITS, ai.digits); }
public String toString() { return ((new StringBuffer()).append("pc=").append(pc).append(",ssn=").append(ssn).append(",AI=").append(ai.getValue(SccpProtocolVersion.ITU)) .append(",gt=").append(gt)).toString(); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((natureOfAddress == null) ? 0 : natureOfAddress.hashCode()); result = prime * result + ((numberingPlan == null) ? 0 : numberingPlan.hashCode()); result = prime * result + translationType; return result; }
public SccpAddressImpl(final RoutingIndicator ri, final GlobalTitle gt, final int dpc, final int ssn) { this.gt = gt; this.pc = dpc; this.ssn = ssn; this.ai = new AddressIndicator(dpc > 0, ssn > 0, ri, gt == null ? GlobalTitleIndicator.NO_GLOBAL_TITLE_INCLUDED : gt.getGlobalTitleIndicator()); }
public void write(SccpConfigurationData sccp, OutputElement xml) throws XMLStreamException { xml.setAttribute(REMOTE_ON_GT_MODE, sccp.isRouteOnGtMode()); xml.setAttribute(REMOTE_SPC, sccp.getRemoteSpc()); xml.setAttribute(LOCAL_SPC, sccp.getLocalSpc()); xml.setAttribute(NI, sccp.getNi()); xml.setAttribute(REMOTE_SSN, sccp.getRemoteSsn()); xml.setAttribute(LOCAL_SSN, sccp.getLocalSsn()); xml.setAttribute(LOCAL_SSN2, sccp.getLocalSsn2()); xml.setAttribute(TRANSLATION_TYTE, sccp.getTranslationType()); xml.add(sccp.getGlobalTitleType().toString(), GLOBAL_TITLE_TYPE, String.class); xml.add(sccp.getNatureOfAddress().toString(), ADDRESS_NATURE, String.class); xml.add(sccp.getNumberingPlan().toString(), NUMBERING_PLAN, String.class); xml.add(sccp.getSccpProtocolVersion().toString(), SCCP_PROTOCOL_VERSION, String.class); xml.add(sccp.getCallingPartyAddressDigits(), CALLING_PARTY_ADDRESS_DIGITS, String.class); }
b |= 0x02; b |= (globalTitleIndicator.getValue() << 2);
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((ai == null) ? 0 : ai.hashCode()); result = prime * result + ((gt == null) ? 0 : gt.hashCode()); result = prime * result + pc; result = prime * result + ssn; //result = prime * result + (translated ? 1231 : 1237); return result; }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((natureOfAddress == null) ? 0 : natureOfAddress.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((numberingPlan == null) ? 0 : numberingPlan.hashCode()); result = prime * result + translationType; return result; }
public void write(GlobalTitle0100Impl ai, OutputElement xml) throws XMLStreamException { xml.setAttribute(TRANSLATION_TYPE, ai.translationType); xml.setAttribute(ENCODING_SCHEME, ai.encodingScheme.getSchemeCode()); xml.setAttribute(NUMBERING_PLAN, ai.numberingPlan.getValue()); xml.setAttribute(NATURE_OF_ADDRESS_INDICATOR, ai.natureOfAddress.getValue()); xml.setAttribute(DIGITS, ai.digits); }
public void read(InputElement xml, GlobalTitle0100Impl ai) throws XMLStreamException { try { ai.translationType = xml.getAttribute(TRANSLATION_TYPE).toInt(); //wrong... final byte esCode = (byte) xml.getAttribute(ENCODING_SCHEME).toInt(); ai.encodingScheme = factory.createEncodingScheme(esCode); ai.numberingPlan = NumberingPlan.valueOf(xml.getAttribute(NUMBERING_PLAN).toInt()); ai.natureOfAddress = NatureOfAddress.valueOf(xml.getAttribute(NATURE_OF_ADDRESS_INDICATOR).toInt()); ai.digits = xml.getAttribute(DIGITS).toString(); } catch (Exception e) { throw new XMLStreamException(e); } } };
public void write(GlobalTitle0011Impl ai, OutputElement xml) throws XMLStreamException { xml.setAttribute(TRANSLATION_TYPE, ai.translationType); xml.setAttribute(ENCODING_SCHEME, ai.encodingScheme.getSchemeCode()); xml.setAttribute(NUMBERING_PLAN, ai.numberingPlan.getValue()); xml.setAttribute(DIGITS, ai.digits); }
public static NatureOfAddressType createInstance(String s) { Integer i1 = doCreateInstance(s, stringMap, intMap); if (i1 == null) return new NatureOfAddressType(NatureOfAddress.UNKNOWN.getValue()); else return new NatureOfAddressType(i1); }
public void write(AddressIndicator ai, OutputElement xml) throws XMLStreamException { xml.setAttribute(VALUE, ai.getValue(SccpProtocolVersion.ITU)); }