Exemplo n.º 1
0
        public void RemoveResident(ResidentsNode residentNode)
        {
            if (Start == residentNode)
            {
                Start = Start.NextObject;
                residentNode.NextObject = null;
            }
            else if (End == residentNode)
            {
                var elementBefore = ElementBefore(residentNode);

                if (elementBefore != null)
                {
                    elementBefore.NextObject = null;
                    End = elementBefore;
                    residentNode.NextObject = null;
                }
            }
            else
            {
                var elementBefore = ElementBefore(residentNode);
                elementBefore.NextObject = residentNode.NextObject;
                residentNode.NextObject  = null;
            }
        }
Exemplo n.º 2
0
        public ResidentsNode ElementBefore(ResidentsNode node)
        {
            ResidentsNode nodeBefore;

            for (nodeBefore = Start; nodeBefore.NextObject != node; nodeBefore = nodeBefore.NextObject)
            {
            }

            return(nodeBefore);
        }
Exemplo n.º 3
0
 public void NextList()
 {
     if (ListInterface != null)
     {
         ListInterface = ListInterface.NextObject;
     }
     else if (End != null)
     {
         ListInterface ==
     }
 }
Exemplo n.º 4
0
        public bool IsLastNode(Residents resident)
        {
            for (ResidentsNode node = Start; node != null; node = node.NextObject)
            {
                if (End.ResidentsData == resident)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        public ResidentsNode GetNodeLocation(Residents resident)
        {
            for (ResidentsNode node = Start; node != null; node = node.NextObject)
            {
                if (node.ResidentsData == resident)
                {
                    return(node);
                }
            }

            return(null);
        }
Exemplo n.º 6
0
        public void AddData(Residents newResident)
        {
            var newNode = new ResidentsNode(newResident, null);

            if (Start != null)
            {
                End.NextObject = newNode;
                End            = newNode;
            }
            else
            {
                Start = newNode;
                End   = newNode;
            }
        }
Exemplo n.º 7
0
 public void StartOfList()
 {
     ListInterface = Start;
 }
Exemplo n.º 8
0
 public ResidentsList()
 {
     Start         = null;
     End           = null;
     ListInterface = null;
 }
Exemplo n.º 9
0
 public void NextListNode()
 {
     ListInterface = ListInterface.NextObject;
 }
Exemplo n.º 10
0
 public ResidentsNode(Residents residentsValue, ResidentsNode nextObjectAddress)
 {
     ResidentsData = residentsValue;
     NextObject    = nextObjectAddress;
 }