Commit aa48adec authored by SR-Lut3t1um's avatar SR-Lut3t1um

wip

parent 0541b881
Pipeline #88782 passed with stages
in 3 minutes and 22 seconds
......@@ -13,14 +13,14 @@ import org.un1qu3.models.Automaton;
@Path("/automaton")
public class AutomatonResource {
@SuppressWarnings("CdiInjectionPointsInspection")
@Inject
Template automaton;
@SuppressWarnings("CdiInjectionPointsInspection")
@Inject
Template automaton;
@GET
@Path("{name}")
@Produces(MediaType.TEXT_HTML)
public TemplateInstance get(@PathParam("name") String name) {
return automaton.data("automaton", new Automaton(name));
}
}
\ No newline at end of file
@GET
@Path("{name}")
@Produces(MediaType.TEXT_HTML)
public TemplateInstance get(@PathParam("name") String name) {
return automaton.data("automaton", new Automaton(name));
}
}
package org.un1qu3.models;
import java.util.ArrayList;
/** Class to model an Automaton */
public class Automaton {
public String name;
private String name;
private final ArrayList<State> states;
private final User owner;
public Automaton(String name) {
this.name = name;
states = new ArrayList<>();
owner = new User("Hello");
}
public String getName() {
return name;
}
public ArrayList<State> getStates() {
return states;
}
}
package org.un1qu3.models;
/** This Class models a State from an {@link Automaton} */
public class State {
/** is this State accepting? default: false */
private boolean isAccepting;
/** How do we want to name our state? */
private String name;
/** Where are we? */
private int x, y;
/**
* Let's assume this State is not starting nor accepting
*
* @param name the name
* @param x x position
* @param y y position
*/
public State(String name, int x, int y) {
this.name = name;
this.x = x;
this.y = y;
isAccepting = false;
}
/**
* Maybe it's accepting? just maybe
*
* @param name the name
* @param x x position
* @param y y position
*/
public State(String name, int x, int y, boolean isAccepting) {
this.name = name;
this.x = x;
this.y = y;
this.isAccepting = isAccepting;
}
// getter and setter love <3 god damn I really should use kotlin...
public void setAccepting(boolean accepting) {
isAccepting = accepting;
}
public boolean isAccepting() {
return isAccepting;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
/**
* Let's rape the toString method to return the State in a Latex representation
*
* @return this as latex node
*/
@Override
public String toString() {
return "State{"
+ "isAccepting="
+ isAccepting
+ ", name='"
+ name
+ '\''
+ ", x="
+ x
+ ", y="
+ y
+ '}';
}
}
package org.un1qu3.models;
public class User {
private final String name;
public User(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment