Markou is absolutely insane

This commit is contained in:
2024-01-26 15:28:42 -06:00
parent aa46f43ea5
commit aef4bcc29c
36 changed files with 1373 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package DAO;
import java.util.Collection;
/**
*
* @author caleb
*/
public interface DAO<T> {
public void create(T t);
public void delete(T t);
public void update(T t);
public T find (T t);
public Collection<T> findALl();
public boolean updateDBase();
}

View File

@@ -0,0 +1,19 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package DAO;
/**
*
* @author caleb
*/
public interface Exam<T> {
void editExam(T t);
void takeExam(T t);
void submitExam(T t);
void previewExam(T t);
void monitorExam(T t);
void gradeExam(T t);
}

View File

@@ -0,0 +1,13 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package DAO;
/**
*
* @author caleb
*/
public abstract class ExamFactory<T extends Keyable> {
public abstract Exam<T> createExam();
}

View File

@@ -0,0 +1,56 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package DAO;
/**
*
* @author caleb
*/
public class ExamFactoryOutlet<K, V extends Keyable> extends ExamFactory<Keyable> {
@Override
public Exam<Keyable> createExam()
{
return new Exam<Keyable>() {
@Override
public void editExam(Keyable t)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public void takeExam(Keyable t)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public void submitExam(Keyable t)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public void previewExam(Keyable t)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public void monitorExam(Keyable t)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public void gradeExam(Keyable t)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
};
}
}

View File

@@ -0,0 +1,15 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package DAO;
/**
*
* @author caleb
*/
public interface Keyable<K> {
public K getKey();
public void setKey(K key);
}

View File

@@ -0,0 +1,32 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package DAO;
import java.util.ArrayList;
/**
*
* @author caleb
*/
public class MathExam implements Keyable<MathExam> {
ArrayList<Object> fields = new ArrayList<Object>();
int key;
public MathExam(int key, ArrayList<Object> fields) {
}
@Override
public MathExam getKey()
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public void setKey(MathExam key)
{
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
}

View File

@@ -0,0 +1,23 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package DAO;
/**
*
* @author caleb
*/
public class Test {
public static void main(String[] args)
{
ExamFactory<MathExam> efm = new ExamFactory<MathExam>() {
@Override
public Exam<MathExam> createExam()
{
System.out.println("Hello World");
}
};
efm.createExam();
}
}

View File

@@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public class CheezePizza implements Pizza {
@Override
public void prepare()
{
System.out.println("preparing Cheeze Pizza");
}
@Override
public void bake()
{
System.out.println("baking Cheeze Pizza");
}
@Override
public void cut()
{
System.out.println("cutting Cheeze Pizza");
}
}

View File

@@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public class ChickenPizza implements Pizza {
@Override
public void prepare()
{
System.out.println("preparing Chicken Pizza");
}
@Override
public void bake()
{
System.out.println("baking Chicken Pizza");
}
@Override
public void cut()
{
System.out.println("cutting Chicken Pizza");
}
}

View File

@@ -0,0 +1,16 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public interface Pizza<T> {
public void prepare(T t);
public void bake(T t);
public void cut(T t);
}

View File

@@ -0,0 +1,29 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public class PizzaFactory {
public PizzaFactory(String cheeze)
{
}
public static <T> Pizza<T> createPizza(T type) throws Exception {
Pizza p = null;
if (type.equals("cheeze"))
p = new CheezePizza();
else if (type.equals("chicken"))
p = new ChickenPizza();
else if (type.equals("veggie"))
p = new VeggiePizza();
if (p == null) {
throw new Exception("Not a valid Pizza.");
}
return p;
}
}

View File

@@ -0,0 +1,19 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public class PizzaStore {
public Pizza orderPizza(String type) throws Exception {
Pizza p = PizzaFactory.createPizza(type);
p.prepare();
p.bake();
p.cut();
return p;
}
}

View File

@@ -0,0 +1,19 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public class TestPizza {
public static void main(String[] args) throws Exception
{
PizzaStore ps = new PizzaStore();
ps.orderPizza("cheeze");
ps.orderPizza("chicken");
ps.orderPizza("veggie");
}
}

View File

@@ -0,0 +1,31 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.dao.factory_pizza;
/**
*
* @author caleb
*/
public class VeggiePizza implements Pizza {
@Override
public void prepare()
{
System.out.println("Preparing Veggie Pizza");
}
@Override
public void bake()
{
System.out.println("Baking Veggie Pizza");
}
@Override
public void cut()
{
System.out.println("Cutting Veggie Pizza");
}
}

View File

@@ -0,0 +1,29 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package factory_generic_pizza;
import edu.slcc.asdv.caleb.dao.factory_pizza.*;
/**
*
* @author caleb
*/
public class Pizza<T> {
public void prepare(Object t)
{
System.out.println("preparing " + t.toString() +" Pizza");
}
public void bake(Object t)
{
System.out.println("baking " + t.toString() +" Pizza");
}
public void cut(Object t)
{
System.out.println("cutting" + t.toString() +"Pizza");
}
}

View File

@@ -0,0 +1,32 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package factory_generic_pizza;
import edu.slcc.asdv.caleb.dao.factory_pizza.*;
/**
*
* @author caleb
*/
public class PizzaFactory {
public static <T> Pizza<T> createPizza(T t)
{
return new Pizza<T>()
{
public void prepare(T t) {
System.out.println("Preparing pizza " + t.toString() + "...");
}
public void bake(T t) {
System.out.println("Baking pizza " + t.toString() + "...");
}
public void cut(T t) {
System.out.println("Cutting pizza " + t.toString() + "...");
}
};
}
}

View File

@@ -0,0 +1,21 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package factory_generic_pizza;
import edu.slcc.asdv.caleb.dao.factory_pizza.*;
/**
*
* @author caleb
*/
public class PizzaStore {
public Pizza orderPizza(String type) throws Exception {
Pizza p = PizzaFactory.createPizza(type);
p.prepare(type);
p.bake(type);
p.cut(type);
return p;
}
}

View File

@@ -0,0 +1,21 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package factory_generic_pizza;
import edu.slcc.asdv.caleb.dao.factory_pizza.*;
/**
*
* @author caleb
*/
public class TestPizza {
public static void main(String[] args) throws Exception
{
PizzaStore ps = new PizzaStore();
ps.orderPizza("cheeze");
ps.orderPizza("chicken");
ps.orderPizza("veggie");
}
}