Package esmska.data
Class Envelope
- java.lang.Object
-
- esmska.data.Envelope
-
public class Envelope extends java.lang.ObjectClass for preparing attributes of sms (single or multiple)
-
-
Constructor Summary
Constructors Constructor Description Envelope()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)java.util.ArrayList<SMS>generate()generate list of sms's to sendjava.util.Set<Contact>getContacts()get all recipientsjava.util.ArrayList<java.lang.Integer>getIndicesOfCuts(java.lang.String msgText, int limit)Cut text into pieces while trying to keep word boundaries.intgetMaxTextLength()get maximum length of sendable message.intgetMaxTextLength(java.lang.String customText)get maximum length of sendable messageintgetPenultimateIndexOfCut(java.lang.String msgText, int limit)If exists penultimate index of cut msgText to SMS pieces, find it, other return 0;java.lang.StringgetSenderName()intgetSMSCount(java.lang.String msgText, int limit)Get number of sms pieces cutting from msgText depending on max SMS length limit.intgetSMSLength()get length of one smsjava.lang.StringgetText()get text of smsvoidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidsetContacts(java.util.Set<Contact> contacts)set all recipientsvoidsetText(java.lang.String text)set text of sms
-
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
getText
public java.lang.String getText()
get text of sms
-
setText
public void setText(java.lang.String text)
set text of sms
-
getContacts
public java.util.Set<Contact> getContacts()
get all recipients
-
setContacts
public void setContacts(java.util.Set<Contact> contacts)
set all recipients
-
getSenderName
public java.lang.String getSenderName()
-
getMaxTextLength
public int getMaxTextLength(java.lang.String customText)
get maximum length of sendable message- Parameters:
customText- a message text to measure. Because of cutting message by word boundaries, the maximum length varies depending on how the input text is structured.
-
getMaxTextLength
public int getMaxTextLength()
get maximum length of sendable message. Uses envelope text to measure it.
-
getSMSLength
public int getSMSLength()
get length of one sms
-
getSMSCount
public int getSMSCount(java.lang.String msgText, int limit)Get number of sms pieces cutting from msgText depending on max SMS length limit. The pieces will be split by word boundaries, unless it would take away more than 10% of the text - in that case it will be split by characters (splitting the word).- Parameters:
msgText- full message textlimit- max SMS length limit- Returns:
- resulting number of sms cutting from msgText; the number is 0 if @param limit is zero or negative
-
generate
public java.util.ArrayList<SMS> generate()
generate list of sms's to send
-
getIndicesOfCuts
public java.util.ArrayList<java.lang.Integer> getIndicesOfCuts(java.lang.String msgText, int limit)Cut text into pieces while trying to keep word boundaries.- Parameters:
msgText- full message textlimit- max single piece length- Returns:
- list containing indices of cuts (in ascending order). The list is empty if @param limit is zero or negative.
-
getPenultimateIndexOfCut
public int getPenultimateIndexOfCut(java.lang.String msgText, int limit)If exists penultimate index of cut msgText to SMS pieces, find it, other return 0;- Parameters:
msgText- full message textlimit- max length of SMS- Returns:
- penultimate index of cut or 0
-
-