Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions CheckUp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package loop;

public class Checkup {
Doctor Doctor;
Patient Patient;
int Priority;
String Recomendation;
String Date;

public Checkup(Doctor Doctor, loop.Patient Patient, int Priority, String Recomendation, String Date) {
this.Doctor = Doctor;
this.Patient = Patient;
this.Priority = Priority;
this.Recomendation = Recomendation;
this.Date = Date;
}
public Doctor getDoctor() {
return Doctor;
}
public void setDoctor(Doctor Doctor) {
this.Doctor = Doctor;
}
public Patient getPatient() {
return Patient;
}
public void setPatient(Patient Patient) {
this.Patient = Patient;
}
public int getPriority() {
return Priority;
}
public void setPriority(int Priority) {
this.Priority = Priority;
}
public String getRecomendation() {
return Recomendation;
}
public void setRecomendation(String Recomendation) {
this.Recomendation = Recomendation;
}
public String getDate() {
return Date;
}
public void setDate(String Date) {
this.Date = Date;
}
@Override
public String toString() {
return "Checkup [Doctor=" + Doctor.toString() + ", Patient=" + Patient.toString()+ ", priority=" + Priority + ", Recomendation=" + Recomendation + ", Date=" + Date + "]";
}



}
105 changes: 105 additions & 0 deletions CheckUpList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package loop;

class CheckNode {
Checkup cp;
CheckNode next,prev;
public CheckNode(Checkup cp)
{
next=prev=null;
this.cp=cp;
}

}
public class CheckUpList{
CheckNode head,tail;
public CheckUpList()
{
head=null;
tail=null;
}

public void Enqueue(Checkup cp)
{
CheckNode node=new CheckNode(cp);

if(head==null || tail==null)
{
head=node;
tail=node;
}
else if(head.cp.getPriority()<cp.getPriority())
{
head.next=node;
node.prev=head;
head=node;

}
else if(tail.cp.getPriority()>=cp.getPriority())
{
tail.prev=node;
node.next=tail;
tail=node;
}
else
{
CheckNode temp=tail;
while(temp!=null)
{
if(temp.cp.getPriority()>=cp.getPriority())
{
break;
}
temp=temp.next;
}
node.next=temp;
node.prev=temp.prev;
temp.prev.next=node;
temp.prev=node;
}
}

public Checkup Dequeue()
{
if(head==null)
{
return null;
}
CheckNode checkup=head;
head=head.next;
return checkup.cp;
}



public Patient getPatient(int index)
{
CheckNode temp=head;
int i=0;
while(temp!=null)
{
if(index==1)
{
break;
}
i++;
temp=temp.prev;
}
return temp.cp.getPatient();

}

public void print()
{
CheckNode temp=head;
while(temp!=null)
{
System.out.println(temp.cp.getPriority()+" "+temp.cp.getRecomendation());
temp=temp.prev;
}

}



}

68 changes: 68 additions & 0 deletions Doctor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package loop;

public class Doctor {

//Deceleration of Variables
private String Id;
private String Name;
private String Speciality;
private int fees;


//Parameterized Constructor
public Doctor(String Id, String Name, String Speciality, int fees) {
this.Id = Id;
this.Name = Name;
this.Speciality = Speciality;
this.fees = fees;
}

// Getter Setter...
public String getId()
{
return Id;
}

public void setId(String Id)
{
this.Id = Id;
}

public String getName()
{
return Name;
}

public void setName(String Name)
{
this.Name = Name;
}

public String getSpeciality()
{
return Speciality;
}

public void setSpeciality(String Speciality)
{
this.Speciality = Speciality;
}

public int getFees()
{
return fees;
}

public void setFees(int fees)
{
this.fees = fees;
}

@Override
public String toString()
{
return "Doctor [Id=" + Id + ", Name=" + Name + ", Speciality=" + Speciality + ", fees=" + fees + "]";
}


}
114 changes: 114 additions & 0 deletions DoctorList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package loop;


class dNode
{
Doctor Doctor ;
dNode next;
dNode prev;

//Constructor

public dNode(Doctor Doctor) {

this.Doctor = Doctor ;
next=null;
prev=null;
}

}

//Double Linked list TO insert Doctor
public class DoctorList {


dNode head,tail;
public DoctorList()
{
head=null;
tail=null;
}
public void Insert(Doctor Doctor)
{

dNode node=new dNode(Doctor);

if(head==null || tail==null)
{
head=node;
tail=node;
}

else
{
head.next=node;
node.prev=head;
head=node;
}
}


public void searchBySpeciality(String Speciality)
{
boolean b=false;
dNode temp=head;
while(temp!=null)
{
if(temp.Doctor.getSpeciality().equals(Speciality))
{
b=true;
System.out.println(temp.Doctor);

}

temp=temp.prev;
}
if(b==false)
{
System.out.println("Doctor with this speciality is not available");
}

}
public int Size()
{
dNode temp=head;
int count=0;
while(temp!=null)
{
count++;
temp=temp.prev;
}
return count;
}

public void AllDoctorInfo()
{
dNode temp=tail;
while(temp!=null)
{
System.out.println(" DoctorId : "+temp.Doctor.getId() +" DoctorName : "+temp.Doctor.getName() +" Doctor Speciality : "+temp.Doctor.getSpeciality() +" Doctor fees : "+temp.Doctor.getFees());

temp=temp.next;
}
}
public void PrintData()
{
dNode temp =head;
int count=0;
while(temp!=null)
{
count++;
System.out.println(count+": "+temp.Doctor.toString());
temp=temp.prev;
}
}
public Doctor getAtIndex(int index) {
dNode temp=head;
for(int i=0;i<index;i++)
{
temp=temp.prev;
}
return temp.Doctor;

}
}
Loading