Class Relationship


  • public class Relationship
    extends Object
    Relationship between 2 social identities
    • Constructor Detail

      • Relationship

        public Relationship​(Identity sender,
                            Identity receiver)
        Instantiates a new relationship.
        Parameters:
        sender - the sender
        receiver - the receiver
      • Relationship

        public Relationship​(Identity sender,
                            Identity receiver,
                            Relationship.Type status)
        Instantiates a new relationship.
        Parameters:
        sender - the sender
        receiver - the receiver
        status - the status
      • Relationship

        public Relationship​(String uuid)
        Instantiates a new relationship.
        Parameters:
        uuid - the uuid
    • Method Detail

      • getSender

        public Identity getSender()
        Gets the sender.
        Returns:
        the sender
      • getReceiver

        public Identity getReceiver()
        Gets the receiver.
        Returns:
        the receiver
      • setSender

        public void setSender​(Identity sender)
        Sets the sender.
        Parameters:
        sender - the new sender
      • setReceiver

        public void setReceiver​(Identity receiver)
        Sets the receiver.
        Parameters:
        receiver - the new receiver
      • getId

        public String getId()
        Gets the id.
        Returns:
        the id
      • setId

        public void setId​(String id)
        Sets the id.
        Parameters:
        id - the new id
      • getStatus

        public Relationship.Type getStatus()
        Gets the status.
        Returns:
        the status
      • setStatus

        public void setStatus​(Relationship.Type status)
        Sets the status.
        Parameters:
        status - the new status
      • setSymetric

        public void setSymetric​(boolean isSymetric)
        Gets the isSymetric.
        Parameters:
        isSymetric -
      • isSymetric

        public boolean isSymetric()
        Sets the isSymetric
        Returns:
        isSymetric
      • toString

        public String toString()
        Gets string sender + "--[" + status + "]--" + receiver
        Overrides:
        toString in class Object
        Returns:
        string
      • getPartner

        public Identity getPartner​(Identity identity)
        Gets the partner of relationship. Returns null if not found any identity in this relationship
        Parameters:
        identity -
        Returns:
        identity
      • isSender

        public boolean isSender​(Identity identity)
        Checks the identity is the sender of relationship
        Parameters:
        identity -
        Returns:
        boolean
      • isReceiver

        public boolean isReceiver​(Identity identity)
        Checks the identity is the receiver of relationship
        Parameters:
        identity -
        Returns:
        boolean
      • equals

        public boolean equals​(Object obj)
        Compares to this object return true if parameter object have the same id with this
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object