<commit_before>package org.motechproject.sms.smpp;

import org.smslib.smpp.Address;
import org.smslib.smpp.BindAttributes;

import java.util.Properties;

import static org.motechproject.sms.smpp.constants.SmppProperties.*;

public class JSMPPPropertiesMapper {

    private Properties smppProperties;

    public JSMPPPropertiesMapper(Properties smppProperties) {
        this.smppProperties = smppProperties;
    }

    public Address getSourceAddress() {
        if (null != smppProperties.getProperty(SOURCE_TON))
            return new Address(Address.TypeOfNumber.valueOf(smppProperties.getProperty(SOURCE_TON)),
                    Address.NumberingPlanIndicator.valueOf(smppProperties.getProperty(SOURCE_NPI)));
        return new Address();
    }

    public Address getDestinationAddress() {
        if (null != smppProperties.getProperty(DESTINATION_TON))
            return new Address(Address.TypeOfNumber.valueOf(smppProperties.getProperty(DESTINATION_TON)),
                    Address.NumberingPlanIndicator.valueOf(smppProperties.getProperty(DESTINATION_NPI)));
        return new Address();
    }

    public BindAttributes getBindAttributes() {
        if (null != smppProperties.getProperty(BINDTYPE))
            return new BindAttributes(smppProperties.getProperty(SYSTEM_ID),
                    smppProperties.getProperty(PASSWORD),
                    null,
                    BindAttributes.BindType.valueOf(smppProperties.getProperty(BINDTYPE)),
                    getBindAddress());

        return null;
    }

    private Address getBindAddress() {
        if (null != smppProperties.getProperty(BIND_TON))
            return new Address(Address.TypeOfNumber.valueOf(Byte.valueOf(smppProperties.getProperty(BIND_TON))),
                    Address.NumberingPlanIndicator.valueOf(Byte.valueOf(smppProperties.getProperty(BIND_NPI))));
        return new Address();
    }

    public String getHost() {
        return smppProperties.getProperty(HOST);
    }

    public int getPort() {
        return Integer.parseInt(smppProperties.getProperty(PORT));
    }
}
<commit_msg>Alex, Arvind | #945 | Modified Byte to be accepted for Smpp Type of Number Configs<commit_after>package org.motechproject.sms.smpp;

import org.smslib.smpp.Address;
import org.smslib.smpp.BindAttributes;

import java.util.Properties;

import static org.motechproject.sms.smpp.constants.SmppProperties.*;

public class JSMPPPropertiesMapper {

    private Properties smppProperties;

    public JSMPPPropertiesMapper(Properties smppProperties) {
        this.smppProperties = smppProperties;
    }

    public Address getSourceAddress() {
        if (null != smppProperties.getProperty(SOURCE_TON))
            return new Address(Address.TypeOfNumber.valueOf(Byte.valueOf(smppProperties.getProperty(SOURCE_TON))),
                    Address.NumberingPlanIndicator.valueOf(Byte.valueOf(smppProperties.getProperty(SOURCE_NPI))));
        return new Address();
    }

    public Address getDestinationAddress() {
        if (null != smppProperties.getProperty(DESTINATION_TON))
            return new Address(Address.TypeOfNumber.valueOf(Byte.valueOf(smppProperties.getProperty(DESTINATION_TON))),
                    Address.NumberingPlanIndicator.valueOf(Byte.valueOf(smppProperties.getProperty(DESTINATION_NPI))));
        return new Address();
    }

    public BindAttributes getBindAttributes() {
        if (null != smppProperties.getProperty(BINDTYPE))
            return new BindAttributes(smppProperties.getProperty(SYSTEM_ID),
                    smppProperties.getProperty(PASSWORD),
                    null,
                    BindAttributes.BindType.valueOf(smppProperties.getProperty(BINDTYPE)),
                    getBindAddress());

        return null;
    }

    private Address getBindAddress() {
        if (null != smppProperties.getProperty(BIND_TON))
            return new Address(Address.TypeOfNumber.valueOf(Byte.valueOf(smppProperties.getProperty(BIND_TON))),
                    Address.NumberingPlanIndicator.valueOf(Byte.valueOf(smppProperties.getProperty(BIND_NPI))));
        return new Address();
    }

    public String getHost() {
        return smppProperties.getProperty(HOST);
    }

    public int getPort() {
        return Integer.parseInt(smppProperties.getProperty(PORT));
    }
}

{'fraction_non_alphanumeric': 0.09198058701178646, 'fraction_numerical': 0.0006933210076265311, 'mean_word_length': 3.193798449612403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1894669', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1154, 'n_words': 185}