Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/VDM/VDMPP/TempoCollaborativePP/lib/   (Wiener Entwicklungsmethode ©)  Datei vom 13.4.2020 mit Größe 656 B image not shown  

Quelle  pop3server.vdmpp   Sprache: unbekannt

 
\ection{he POP3 Server Class

\begin{vdm_al}
class POP3Server

types
\end{vdm_al}

\begin{vdm_al}
public MessageInfo :: index : nat
                      size  : nat;
\end{vdm_al}

\begin{vdm_al}
instance variables
  connChannel: MessageChannelBuffer;
\end{vdm_al}

\begin{vdm_al}
instance variables
  maildrop      : MailDrop;
  passwords     : map POP3Types`UserName to 
                  POP3Types`Password;
  locks         : map ClientHandlerId to 
                  POP3Types`UserName;
  serverStarted : bool := false;
invclass POP3Server
     locks dom ;
 : index  nat
types

public                      size   nat;
public MailBox :: 
  msgs   : seq of POP3Message
  locked : bool;
public ClientHandlerId = nat;
\end{vdm_al}

\\nd{dm_albegin{dm_al}
operations

public POP3Server: POP3Server`MailDrop: MessageChannelBuffer{vdm_al{vdm_al
                    POP3Types to`Password>
passwords     :map`UserName 
(maildrop    :nmd
  connChannel := nch         :  ClientHandlerId 
  locks {-}
  passwords   :=    : bool=falseinv dom passwords  dom and
);

public AuthenticateUser
AuthenticateUser(ser) =
  return user in set dom passwords and
         passwords) = ;

public IsLocked: POP3Types MailBox
IsLockeduser=
 userin rng;

\nd}

begin}
operations

SetUserMessages: POP3Typesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                 == (
SetUserMessages(user, newMsgs) ==
POP3Server(md,, npasswords=
end}

\begin{vdm_al}
GetUserMail{-;
(user=
 return (user
\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

begin}
sync  in  dom passwords
  mutexSetUserMessages;
  public: POP3TypesUserName 
\nd{}

  return
operations

GetUserMessages:POP3Types
\{vdm_al
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

\end{vdm_al}

\begin{vdm_al}
public RemoveDeletedMessagesSetUserMessagesuser newMsgs)=
RemoveDeletedMessages) ==
   oldMsgsGetUserMessages),
      newMsgs java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
not(i)IsDeleted
  in
    ( SetUserMessages(user, newMsgs);
GetUserMail() ==
    )  return(user
endvdm_al

\begin}
public
AcquireLock(SetUserMessages
locks  ++ {clId}
pre not set locks
    user in set{vdm_al

\end: POP3Types => of

\begin{vdm_al(user
blic ReleaseLock:ClientHandlerId (
end}
  begin}
public: POP3Types == bool

sync
mutex(AcquireLock);
mutex(ReleaseLock); let oldMsgs GetUserMessagesuser
mutexAcquireLock,ReleaseLock );
\end{vdm_al}

\begin{vdm_al}
operations

CreateClientHandler: MessageChannel SetUserMessagesuser,newMsgs)
      return true;
  start(new POP3ClientHandler

\end{vdm_al : ClientHandlerId *POP3Types`serName =>(

\begin{vdm_al}
public IsMessageNumber: POP3Types`UserName   :=  ++  clId|>user}
(userindex)=
  let mb     in  dom maildrop
 in
    return index set inds mb; 

eNumber:POP3Types * nat = bool
(user) ==
  pre in  dom locks
in
    return index in set inds mb and
          not(index();

ublic MessageIsDeleted:POP3Types` * nat = bool
MessageIsDeleted, index=
  let mb = GetUserMessages(user) 
  in: MessageChannel (
Crea(mc=
           mb(index).IsDeleted();

public DeleteMessage: POP3Types`UserName *   start(ew(selfmc
(userindex=
oldMsg =GetUserMessages(user),
      newMsg =oldMsg.()
  let mb =GetUserMessages) 
    SetUserMessages, GetUserMessages) +  index newMsg )
public IsValidMessageNumber:POP3Types *  ==>bool
IsValidMessageNumber(, index=
    in index  inds and
     index setmb

public GetMsgHeader: POP3Typesnot(index();
(userindex)=
  let = GetUserMessages) 
  in
return(index()
pre indexsetmb
    let mb = maildropmb(ndex.IsDeleted(;
    in DeleteMessage`UserNamenat )
       not mb(index).IsDeleted();

  let oldMsg  GetUserMessagesuser),
 =oldMsg.elete
  let mb =GetUserMessages(ser
  in
    eturn(index()
pre inset dom and
    let = maildrop().msgs
    inindex  set mb
       not mb(indexnot(index();



public ResetDeletedMessages: POP3Types`UserName ==> ()
ResetDeletedMessages(user) ==
  let oldMsgs = GetUserMessages(user(user) ==
      newMsgs = [ oldMsgs mb(user
                iin indsoldMsgs
in
    SetUserMessages, newMsgs
 user set maildrop;

public GetMessageTextin inset and
GetMessageText, index
  return GetUserMessages(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
preGetMsgBody, index
let = (user
    in
      index  inds mb
       user  dom maildrop

     mbmaildrop).msgs
GetMessageSize, index=
  return(user(ndex)GetSize
pre user
    let mb ResetDeletedMessages: POP3Types`serName=>(
    in
      index  inds mb
      not      newM = [oldMsgs.() 

public GetMessageInfo: POP3Types`UserName * [nat] ==> set of MessageInfo
) ==
  let mb = GetUserMessages(user) in
  if = nil
  then 
    return elems [mk_MessageInfo(i, 
                                 GetMessageSize(user) ==
                  i in set inds user setdom and
  else
    returnmk_MessageInfo, 
public: POP3Types * nat>java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
pre < nil>index  inds maildrop).msgs
                        maildrop(ser).(indexIsDeleted()

\endvdm_aljava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12

\begin{vdm_alGetMessageInfo, index

public GetUidl: POP3Types`UserName * nat    index
 (user) =java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
  let mb = GetUserMessages(user)
  in
    return POP3ClientHandler`int2string(index) ^" " ^
           mb).GetUniqueId(;

public GetAllUidls:  POP3Types`pre index>nil = (ndex in  and
GetAllUidls(user 
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 in
    return [GetUidl(user,java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0

\end{vdm_al}

\begin{vdm_al}
public GetNumberOfMessages index =
GetNumberOfMessages mb(user
 return len(user
pre in set aildrop

\end{vdm_al}

\begin{vdm_al}
publicGetMailBoxSize:POP3Types ==>nat
GetMailBoxSize(user) ==
  GetAllUidls) =java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  return sumseq
pre usersetmaildrop

public
GetChannel( =
  return m_al
\end{vdm_al

begin}
pre in setmaildrop

public
\begin
  blic: POP3Types =>nat
  then 0
  else hd s + sumseq(tl s)
measure;

seq nat - nat
Lenl =
  len public: ) =>MessageChannelBuffer

\end{vdm_al}

\begin{vdm_al}
thread

while true do  return connChannel;
let msgChannel\{vdm_al
  in
f
  serverStarted
)
\end{vdm_al}

sumseq()=java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
  else hd(tlsjava.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26

public WaitForServerStart: () ==> ()
WaitForServerStart() ==
skip

sync

per WaitForServerStart{vdm_al
\end{vdm_al

\beginvdm_al
 POP3Server
\end{vdm_al}



begin{}
{tinfo}[POP3Server
\{rtinfo

99%

tartend}
WaitForServerStart() ==
  skip;

sync

per WaitForServerStart => serverStarted;
\end{vdm_al}

\begin{vdm_al}
end POP3Server
\end{vdm_al}



\begin{rtinfo}
{rtinfo.ast}[POP3Server]
\end{rtinfo}

99%


[ zur Elbe Produktseite wechseln0.14Quellennavigators  Analyse erneut starten  ]