diff --git a/AlgebraicDataflowArchitectureModel/models/CustomerManagement.model b/AlgebraicDataflowArchitectureModel/models/CustomerManagement.model new file mode 100644 index 0000000..5277f32 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/models/CustomerManagement.model @@ -0,0 +1,21 @@ +channel AddCustomer { + out customers(csDB:Map, addCustomer(uid:Str, org:Str)) = insert(csDB, uid, {"organization": org}) +} + +channel AddCampany { + out companies(cmDB:Map, addCampany(cid:Str, address:Str)) = insert(cmDB, cid, {"address": address}) +} + +channel SetCustomerOrganization(uid:Str) { + out customers.{uid}.organization(prevCid:Str, setOrganization(cid)) = cid +} + +channel SetCompanyAddress(cid:Str) { + out companies.{cid}.address(prevAdd:Str, setAddress(add)) = add +} + +channel UpdateCustomerAddress(uid:Str) { + in customers.{uid}.organization(prevCid, updateCustomerAddress(cid, add)) = cid + in companies.{cid}.address(prevAdd, updateCustomerAddress(cid, add)) = add + out customers.{uid}.address(prevAdd, updateCustomerAddress(cid, add)) = add +} diff --git a/AlgebraicDataflowArchitectureModel/models/CustomerOffice.model b/AlgebraicDataflowArchitectureModel/models/CustomerOffice.model deleted file mode 100644 index 5714436..0000000 --- a/AlgebraicDataflowArchitectureModel/models/CustomerOffice.model +++ /dev/null @@ -1,21 +0,0 @@ -channel AddCustomer { - out customers(csDB:Map, addCustomer(uid:Str, office:Str)) = insert(csDB, uid, {"office": office}) -} - -channel AddCampany { - out companies(cmDB:Map, addCampany(cid:Str, address:Str)) = insert(cmDB, cid, {"address": address}) -} - -channel SetCustomerOffice(uid:Str) { - out customers.{uid}.office(prevCid:Str, setOffice(cid)) = cid -} - -channel SetCompanyAddress(cid:Str) { - out companies.{cid}.address(prevAdd:Str, setAddress(add)) = add -} - -channel UpdateCustomerAddress(uid:Str) { - in customers.{uid}.office(prevCid, updateCustomerAddress(cid, add)) = cid - in companies.{cid}.address(prevAdd, updateCustomerAddress(cid, add)) = add - out customers.{uid}.address(prevAdd, updateCustomerAddress(cid, add)) = add -} diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Accounts/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Accounts/Account.java new file mode 100644 index 0000000..423e265 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Accounts/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private String name; + public Map getValue() { + Map temp_nil1 = new HashMap<>(); + temp_nil1.put("name",this.getName()); + return temp_nil1; + } + public String getName() { + return this.name; + } + public void changeName(int uid, String name) { + this.name = name; + } + public Account(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Accounts/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Accounts/Accounts.java new file mode 100644 index 0000000..d851471 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Accounts/Accounts.java @@ -0,0 +1,42 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/accounts") +@Component +public class Accounts { + private List value = new ArrayList<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public List getValue() { + return new ArrayList<>(value); + } + public Account getAccount(int uid) { + return this.value.get(uid); + } + @Path("/{uid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getAccountValue(@PathParam("uid") int uid) { + return getAccount(uid).getValue(); + } + @Path("/{uid}/name") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getNameValue(@PathParam("uid") int uid) { + return getAccount(uid).getName(); + } + @POST + public void signup(@FormParam("name") String name) { + this.value.add(new Account(name)); + } + @Path("/{uid}/name") + @PUT + public void changeName(@PathParam("uid") int uid, @FormParam("name") String name) { + getAccount(uid).changeName(uid, name); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Hour.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Hour.java new file mode 100644 index 0000000..063d06b --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Hour.java @@ -0,0 +1,31 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/hour") +@Component +public class Hour { + private double value = 0.0; + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @POST + public void updateFromMin(@FormParam("min") double min) { + double temp_if2; + if ((min==0)) { + temp_if2 = ((this.value+1)%24); + } else { + temp_if2 = this.value; + } + this.value = temp_if2; + } + public Hour(double hour) { + this.hour = hour; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Hour_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Hour_ang.java new file mode 100644 index 0000000..d237f76 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Hour_ang.java @@ -0,0 +1,19 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/hour_ang") +@Component +public class Hour_ang { + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + double hour = client.target("http://localhost:8080").path("/hour").request().get(double.class); + return ((hour/6)*Math.PI); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Min.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Min.java new file mode 100644 index 0000000..a4589a3 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Min.java @@ -0,0 +1,30 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/min") +@Component +public class Min { + private double value = 0.0; + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + public Min(double min) { + this.min = min; + } + @POST + public void tick() throws JsonProcessingException { + Form form = new Form(); + form.param("min", Double.toString(this.value)); + Entity
entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + String result = client.target("http://localhost:8080").path("/hour").request().post(entity, String.class); + this.value = ((this.value+1)%60); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Min_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Min_ang.java new file mode 100644 index 0000000..172cca8 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PULL-first/Min_ang.java @@ -0,0 +1,19 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/min_ang") +@Component +public class Min_ang { + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + double min = client.target("http://localhost:8080").path("/min").request().get(double.class); + return ((min/30)*Math.PI); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Hour.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Hour.java new file mode 100644 index 0000000..7733bfe --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Hour.java @@ -0,0 +1,36 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/hour") +@Component +public class Hour { + private double value = 0.0; + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @POST + public void updateFromMin(@FormParam("min") double min) throws JsonProcessingException { + double temp_if3; + if ((min==0)) { + temp_if3 = ((this.value+1)%24); + } else { + temp_if3 = this.value; + } + this.value = temp_if3; + Form form = new Form(); + form.param("hour", Double.toString(this.value)); + Entity entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + String result = client.target("http://localhost:8080").path("/hour_ang").request().put(entity, String.class); + } + public Hour(double hour) { + this.hour = hour; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Hour_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Hour_ang.java new file mode 100644 index 0000000..45c2864 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Hour_ang.java @@ -0,0 +1,25 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/hour_ang") +@Component +public class Hour_ang { + private double value = 0.0; + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @PUT + public void updateFromHour(@FormParam("hour") double hour) { + this.value = ((hour/6)*Math.PI); + } + public Hour_ang(double hour_ang) { + this.hour_ang = hour_ang; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Min.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Min.java new file mode 100644 index 0000000..b72f252 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Min.java @@ -0,0 +1,34 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/min") +@Component +public class Min { + private double value = 0.0; + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + public Min(double min) { + this.min = min; + } + @POST + public void tick() throws JsonProcessingException { + Form form = new Form(); + form.param("min", Double.toString(this.value)); + Entity entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + String result = client.target("http://localhost:8080").path("/hour").request().post(entity, String.class); + form = new Form(); + form.param("min", Double.toString(this.value)); + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + result = client.target("http://localhost:8080").path("/min_ang").request().put(entity, String.class); + this.value = ((this.value+1)%60); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Min_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Min_ang.java new file mode 100644 index 0000000..be7e6fb --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/Clock/PUSH-first/Min_ang.java @@ -0,0 +1,25 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/min_ang") +@Component +public class Min_ang { + private double value = 0.0; + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @PUT + public void updateFromMin(@FormParam("min") double min) { + this.value = ((min/30)*Math.PI); + } + public Min_ang(double min_ang) { + this.min_ang = min_ang; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Companies.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Companies.java new file mode 100644 index 0000000..a67aea8 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Companies.java @@ -0,0 +1,42 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/companies") +@Component +public class Companies { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Company getCompany(String cid) { + return this.value.get(cid); + } + @Path("/{cid}/address") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getAddressValue(@PathParam("cid") String cid) { + return getCompany(cid).getAddress(); + } + @Path("/{cid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getCompanyValue(@PathParam("cid") String cid) { + return getCompany(cid).getValue(); + } + @Path("/{cid}/address") + @PUT + public void setAddress(@PathParam("cid") String cid, @FormParam("add") String add) { + getCompany(cid).setAddress(cid, add); + } + @POST + public void addCampany(@FormParam("address") String address, @FormParam("cid") String cid) { + this.value.put(cid,new Company(address)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Company.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Company.java new file mode 100644 index 0000000..24e1769 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Company.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Company { + private String address; + public Map getValue() { + Map temp_nil2 = new HashMap<>(); + temp_nil2.put("address",this.getAddress()); + return temp_nil2; + } + public String getAddress() { + return this.address; + } + public void setAddress(String cid, String add) { + this.address = add; + } + public Company(String address) { + this.address = address; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Customer.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Customer.java new file mode 100644 index 0000000..96f2373 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Customer.java @@ -0,0 +1,26 @@ +import java.util.*; +import javax.ws.rs.client.*; + +public class Customer { + private Client client = ClientBuilder.newClient(); + private String organization; + public Map getValue() { + Map temp_nil3 = new HashMap<>(); + temp_nil3.put("address",this.getAddress()); + temp_nil3.put("organization",this.getOrganization()); + return temp_nil3; + } + public String getAddress() { + String address = client.target("http://localhost:8080").path("/companies/" + organization + "/address").request().get(String.class); + return address; + } + public String getOrganization() { + return this.organization; + } + public void setOrganization(String uid, String cid) { + this.organization = cid; + } + public Customer(String organization) { + this.organization = organization; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Customers.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Customers.java new file mode 100644 index 0000000..22358f4 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/CustomerManagement/Customers.java @@ -0,0 +1,48 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/customers") +@Component +public class Customers { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Customer getCustomer(String uid) { + return this.value.get(uid); + } + @Path("/{uid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getCustomerValue(@PathParam("uid") String uid) { + return getCustomer(uid).getValue(); + } + @Path("/{uid}/address") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getAddressValue(@PathParam("uid") String uid) { + return getCustomer(uid).getAddress(); + } + @Path("/{uid}/organization") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getOrganizationValue(@PathParam("uid") String uid) { + return getCustomer(uid).getOrganization(); + } + @POST + public void addCustomer(@FormParam("org") String org, @FormParam("uid") String uid) { + this.value.put(uid,new Customer(org)); + } + @Path("/{uid}/organization") + @PUT + public void setOrganization(@PathParam("uid") String uid, @FormParam("cid") String cid) { + getCustomer(uid).setOrganization(uid, cid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java new file mode 100644 index 0000000..6202db5 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private Map notifications; + public Map getValue() { + Map temp_nil11 = new HashMap<>(); + temp_nil11.put("notifications",this.getNotifications()); + return temp_nil11; + } + public Map getNotifications() { + return this.notifications; + } + public void hasRead(String aid, String gid) { + this.notifications.remove(gid); + } + public Account(Map notifications) { + this.notifications = notifications; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java new file mode 100644 index 0000000..49e585f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java @@ -0,0 +1,42 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/accounts") +@Component +public class Accounts { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String v1) { + return this.value.get(v1); + } + @Path("/{aid}/notifications") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getNotificationsValue(@PathParam("aid") String aid) { + return getAccount(aid).getNotifications(); + } + @Path("/{v1}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getAccountValue(@PathParam("v1") String v1) { + return getAccount(v1).getValue(); + } + @POST + public void signUp(@FormParam("aid") String aid) { + this.value.put(aid,new Account(new HashMap<>())); + } + @Path("/{aid}/notifications") + @DELETE + public void hasRead(@PathParam("aid") String aid, @FormParam("gid") String gid) { + getAccount(aid).hasRead(aid, gid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java new file mode 100644 index 0000000..1a617d9 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java @@ -0,0 +1,24 @@ +import java.util.*; + +public class Group { + private Members members = new Members(); + private List messages; + public Map getValue() { + Map temp_nil10 = new HashMap<>(); + temp_nil10.put("messages",this.getMessages()); + temp_nil10.put("members",this.members.getValue()); + return temp_nil10; + } + public Members getMembers() { + return this.members; + } + public List getMessages() { + return this.messages; + } + public void postMessage(String gid, String message) { + this.messages.add(message); + } + public Group(List messages) { + this.messages = messages; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java new file mode 100644 index 0000000..eba76e8 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java @@ -0,0 +1,53 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/groups") +@Component +public class Groups { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Group getGroup(String gid) { + return this.value.get(gid); + } + @Path("/{gid}/messages") + @Produces(MediaType.APPLICATION_JSON) + @GET + public List getMessagesValue(@PathParam("gid") String gid) { + return getGroup(gid).getMessages(); + } + @Path("/{gid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getGroupValue(@PathParam("gid") String gid) { + return getGroup(gid).getValue(); + } + @Path("/{gid}/members") + @Produces(MediaType.APPLICATION_JSON) + @GET + public List getMembersValue(@PathParam("gid") String gid) { + return getGroup(gid).getMembers().getValue(); + } + @POST + public void createGroup(@FormParam("gid") String gid) { + this.value.put(gid,new Group(new ArrayList<>())); + } + @Path("/{gid}/messages") + @POST + public void postMessage(@PathParam("gid") String gid, @FormParam("message") String message) { + getGroup(gid).postMessage(gid, message); + } + @Path("/{gid}/members") + @POST + public void addGroupMember(@PathParam("gid") String gid, @FormParam("aid") String aid) { + getGroup(gid).getMembers().addGroupMember(gid, aid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Members.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Members.java new file mode 100644 index 0000000..4d23cb7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Members.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Members { + private List value = new ArrayList<>(); + public List getValue() { + return new ArrayList<>(value); + } + public void addGroupMember(String gid, String aid) { + this.value.add(aid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/InventoryManagement/Inventory.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/InventoryManagement/Inventory.java new file mode 100644 index 0000000..de0f8fc --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/InventoryManagement/Inventory.java @@ -0,0 +1,42 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/inventory") +@Component +public class Inventory { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public InventoryElement getInventoryElement(String itemId) { + return this.value.get(itemId); + } + @Path("/{itemId}/count") + @Produces(MediaType.APPLICATION_JSON) + @GET + public int getCountValue(@PathParam("itemId") String itemId) { + return getInventoryElement(itemId).getCount(); + } + @Path("/{itemId}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getInventoryElementValue(@PathParam("itemId") String itemId) { + return getInventoryElement(itemId).getValue(); + } + @Path("/{itemId}/count") + @POST + public void receiveOrShip(@PathParam("itemId") String itemId, @FormParam("quantity") int quantity) { + getInventoryElement(itemId).receiveOrShip(itemId, quantity); + } + @POST + public void registerItem(@FormParam("itemName") String itemName, @FormParam("quantity") int quantity, @FormParam("itemId") String itemId) { + this.value.put(itemId,new InventoryElement(quantity)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/InventoryManagement/InventoryElement.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/InventoryManagement/InventoryElement.java new file mode 100644 index 0000000..8928640 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/InventoryManagement/InventoryElement.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class InventoryElement { + private int count; + public Map getValue() { + Map temp_nil16 = new HashMap<>(); + temp_nil16.put("count",this.getCount()); + return temp_nil16; + } + public int getCount() { + return this.count; + } + public void receiveOrShip(String itemId, int quantity) { + this.count = (this.value+quantity); + } + public InventoryElement(int count) { + this.count = count; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Account.java new file mode 100644 index 0000000..1f2a118 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private String name; + public Map getValue() { + Map temp_nil19 = new HashMap<>(); + temp_nil19.put("name",this.getName()); + return temp_nil19; + } + public String getName() { + return this.name; + } + public void changeName(String aid, String name) { + this.name = name; + } + public Account(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Accounts.java new file mode 100644 index 0000000..e4c2155 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Accounts.java @@ -0,0 +1,42 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/accounts") +@Component +public class Accounts { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String aid) { + return this.value.get(aid); + } + @Path("/{aid}/name") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getNameValue(@PathParam("aid") String aid) { + return getAccount(aid).getName(); + } + @Path("/{aid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getAccountValue(@PathParam("aid") String aid) { + return getAccount(aid).getValue(); + } + @POST + public void signUp(@FormParam("name") String name, @FormParam("aid") String aid) { + this.value.put(aid,new Account(name)); + } + @Path("/{aid}/name") + @PUT + public void changeName(@PathParam("aid") String aid, @FormParam("name") String name) { + getAccount(aid).changeName(aid, name); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Room.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Room.java new file mode 100644 index 0000000..c5ce166 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Room.java @@ -0,0 +1,40 @@ +import java.util.*; +import javax.ws.rs.client.*; + +public class Room { + private Client client = ClientBuilder.newClient(); + private String blue_id; + private String red_id; + public Map getValue() { + Map temp_nil18 = new HashMap<>(); + temp_nil18.put("blue_id",this.getBlue_id()); + temp_nil18.put("red_name",this.getRed_name()); + temp_nil18.put("blue_name",this.getBlue_name()); + temp_nil18.put("red_id",this.getRed_id()); + return temp_nil18; + } + public String getRed_name() { + String name = client.target("http://localhost:8080").path("/accounts/" + red_id + "/name").request().get(String.class); + return name; + } + public String getBlue_id() { + return this.blue_id; + } + public String getBlue_name() { + String name = client.target("http://localhost:8080").path("/accounts/" + blue_id + "/name").request().get(String.class); + return name; + } + public String getRed_id() { + return this.red_id; + } + public void changeRedId(String rid, String redId) { + this.red_id = redId; + } + public void changeBlueId(String rid, String blueId) { + this.blue_id = blueId; + } + public Room(String blue_id, String red_id) { + this.blue_id = blue_id; + this.red_id = red_id; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Rooms.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Rooms.java new file mode 100644 index 0000000..0124b30 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame/Rooms.java @@ -0,0 +1,65 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/rooms") +@Component +public class Rooms { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Room getRoom(String rid) { + return this.value.get(rid); + } + @Path("/{rid}/blue_id") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getBlue_idValue(@PathParam("rid") String rid) { + return getRoom(rid).getBlue_id(); + } + @Path("/{rid}/red_name") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getRed_nameValue(@PathParam("rid") String rid) { + return getRoom(rid).getRed_name(); + } + @Path("/{rid}/blue_name") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getBlue_nameValue(@PathParam("rid") String rid) { + return getRoom(rid).getBlue_name(); + } + @Path("/{rid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getRoomValue(@PathParam("rid") String rid) { + return getRoom(rid).getValue(); + } + @Path("/{rid}/red_id") + @Produces(MediaType.APPLICATION_JSON) + @GET + public String getRed_idValue(@PathParam("rid") String rid) { + return getRoom(rid).getRed_id(); + } + @Path("/{rid}/blue_id") + @PUT + public void changeBlueId(@PathParam("rid") String rid, @FormParam("blueId") String blueId) { + getRoom(rid).changeBlueId(rid, blueId); + } + @Path("/{rid}/red_id") + @PUT + public void changeRedId(@PathParam("rid") String rid, @FormParam("redId") String redId) { + getRoom(rid).changeRedId(rid, redId); + } + @POST + public void createRoom(@FormParam("blueId") String blueId, @FormParam("redId") String redId, @FormParam("rid") String rid) { + this.value.put(rid,new Room(blueId, redId)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/SimpleTwitter/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/SimpleTwitter/Account.java new file mode 100644 index 0000000..fe3d260 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/SimpleTwitter/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private List tweets; + public Map getValue() { + Map temp_nil26 = new HashMap<>(); + temp_nil26.put("tweets",this.getTweets()); + return temp_nil26; + } + public List getTweets() { + return this.tweets; + } + public void tweet(String accountId, String contents) { + this.tweets.add(contents); + } + public Account(List tweets) { + this.tweets = tweets; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/SimpleTwitter/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/SimpleTwitter/Accounts.java new file mode 100644 index 0000000..8797c5d --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/SimpleTwitter/Accounts.java @@ -0,0 +1,42 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/accounts") +@Component +public class Accounts { + private Map value = new HashMap<>(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String accountId) { + return this.value.get(accountId); + } + @Path("/{accountId}/tweets") + @Produces(MediaType.APPLICATION_JSON) + @GET + public List getTweetsValue(@PathParam("accountId") String accountId) { + return getAccount(accountId).getTweets(); + } + @Path("/{accountId}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getAccountValue(@PathParam("accountId") String accountId) { + return getAccount(accountId).getValue(); + } + @POST + public void signUp(@FormParam("name") String name, @FormParam("accountId") String accountId) { + this.value.put(accountId,new Account(new ArrayList<>())); + } + @Path("/{accountId}/tweets") + @POST + public void tweet(@PathParam("accountId") String accountId, @FormParam("contents") String contents) { + getAccount(accountId).tweet(accountId, contents); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Highest.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Highest.java new file mode 100644 index 0000000..71afbf6 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Highest.java @@ -0,0 +1,35 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/highest") +@Component +public class Highest { + private double value = 0.0; + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @POST + public void updateFromTemp_f(@FormParam("temp_f") double temp_f) { + double temp_if4; + if ((temp_f>=this.value)) { + temp_if4 = temp_f; + } else { + temp_if4 = this.value; + } + this.value = temp_if4; + } + public Highest(double highest) { + this.highest = highest; + } + @PUT + public void reset(@FormParam("v") double v) { + this.value = v; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Temp_c.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Temp_c.java new file mode 100644 index 0000000..3492c58 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Temp_c.java @@ -0,0 +1,19 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/temp_c") +@Component +public class Temp_c { + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + double temp_f = client.target("http://localhost:8080").path("/temp_f").request().get(double.class); + return ((temp_f-32)/1.8); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Temp_f.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Temp_f.java new file mode 100644 index 0000000..6cd8101 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PULL-first/Temp_f.java @@ -0,0 +1,30 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/temp_f") +@Component +public class Temp_f { + private double value = 0.0; + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + public Temp_f(double temp_f) { + this.temp_f = temp_f; + } + @PUT + public void observe(@FormParam("x") double x) throws JsonProcessingException { + Form form = new Form(); + form.param("temp_f", Double.toString(this.value)); + Entity entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + String result = client.target("http://localhost:8080").path("/highest").request().post(entity, String.class); + this.value = x; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Highest.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Highest.java new file mode 100644 index 0000000..89e309a --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Highest.java @@ -0,0 +1,35 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/highest") +@Component +public class Highest { + private double value = 0.0; + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @POST + public void updateFromTemp_f(@FormParam("temp_f") double temp_f) { + double temp_if3; + if ((temp_f>=this.value)) { + temp_if3 = temp_f; + } else { + temp_if3 = this.value; + } + this.value = temp_if3; + } + public Highest(double highest) { + this.highest = highest; + } + @PUT + public void reset(@FormParam("v") double v) { + this.value = v; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Temp_c.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Temp_c.java new file mode 100644 index 0000000..b875714 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Temp_c.java @@ -0,0 +1,25 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/temp_c") +@Component +public class Temp_c { + private double value = 0.0; + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + @PUT + public void updateFromTemp_f(@FormParam("temp_f") double temp_f) { + this.value = ((temp_f-32)/1.8); + } + public Temp_c(double temp_c) { + this.temp_c = temp_c; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Temp_f.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Temp_f.java new file mode 100644 index 0000000..e9c4b93 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/WeatherObservationSystem/PUSH-first/Temp_f.java @@ -0,0 +1,34 @@ +import java.util.*; +import javax.ws.rs.*; +import javax.ws.rs.client.*; +import javax.ws.rs.core.*; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.core.JsonProcessingException; + +@Path("/temp_f") +@Component +public class Temp_f { + private double value = 0.0; + private Client client = ClientBuilder.newClient(); + @Produces(MediaType.APPLICATION_JSON) + @GET + public double getValue() { + return value; + } + public Temp_f(double temp_f) { + this.temp_f = temp_f; + } + @PUT + public void observe(@FormParam("x") double x) throws JsonProcessingException { + Form form = new Form(); + form.param("temp_f", Double.toString(this.value)); + Entity entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + String result = client.target("http://localhost:8080").path("/temp_c").request().put(entity, String.class); + form = new Form(); + form.param("temp_f", Double.toString(this.value)); + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); + result = client.target("http://localhost:8080").path("/highest").request().post(entity, String.class); + this.value = x; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Account.java new file mode 100644 index 0000000..40c6dfb --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private String name; + public Map getValue() { + Map temp_nil0 = new HashMap<>(); + temp_nil0.put("name",this.getName()); + return temp_nil0; + } + public String getName() { + return this.name; + } + public void changeName(int uid, String name) { + this.name = name; + } + public Account(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Accounts.java new file mode 100644 index 0000000..9053c32 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Accounts.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Accounts { + private List value = new ArrayList<>(); + public List getValue() { + return new ArrayList<>(value); + } + public Account getAccount(int uid) { + return this.value.get(uid); + } + public void signup(String name) { + this.value.add(new Account(name)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Main.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Main.java new file mode 100644 index 0000000..1340414 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Accounts/Main.java @@ -0,0 +1,23 @@ +import java.util.*; + +public class Main { + private Accounts accounts; + public Main() { + accounts = new Accounts(); + } + public String getName(int uid) { + return this.accounts.getAccount(uid).getName(); + } + public void changeName(int uid, String name) { + this.accounts.getAccount(uid).changeName(uid, name); + } + public Map getAccount(int uid) { + return this.accounts.getAccount(uid).getValue(); + } + public List getAccounts() { + return this.accounts.getValue(); + } + public void signup(String name) { + this.accounts.signup(name); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Clock.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Clock.java new file mode 100644 index 0000000..a8b488a --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Clock.java @@ -0,0 +1,29 @@ +import java.util.*; + +public class Clock { + private Hour hour; + private Hour_ang hour_ang; + private Min min; + private Min_ang min_ang; + public Clock() { + hour = new Hour(); + hour_ang = new Hour_ang(hour); + min = new Min(hour); + min_ang = new Min_ang(min); + } + public double getHour() { + return this.hour.getValue(); + } + public double getHour_ang() { + return this.hour_ang.getValue(); + } + public double getMin() { + return this.min.getValue(); + } + public void tick() { + this.min.tick(); + } + public double getMin_ang() { + return this.min_ang.getValue(); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Hour.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Hour.java new file mode 100644 index 0000000..0e389ac --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Hour.java @@ -0,0 +1,17 @@ +import java.util.*; + +public class Hour { + private double value = 0.0; + public double getValue() { + return value; + } + public void updateFromMin(double min) { + double temp_if1; + if ((min==0)) { + temp_if1 = ((this.value+1)%24); + } else { + temp_if1 = this.value; + } + this.value = temp_if1; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Hour_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Hour_ang.java new file mode 100644 index 0000000..2758d12 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Hour_ang.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Hour_ang { + private Hour hour; + public double getValue() { + return ((this.hour.getValue()/6)*Math.PI); + } + public Hour_ang(Hour hour) { + this.hour = hour; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Min.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Min.java new file mode 100644 index 0000000..f0d82da --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Min.java @@ -0,0 +1,16 @@ +import java.util.*; + +public class Min { + private double value = 0.0; + private Hour hour; + public double getValue() { + return value; + } + public void tick() { + this.value = ((this.value+1)%60); + this.hour.updateFromMin(value); + } + public Min(Hour hour) { + this.hour = hour; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Min_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Min_ang.java new file mode 100644 index 0000000..d91aefa --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PULL-first/Min_ang.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Min_ang { + private Min min; + public double getValue() { + return ((this.min.getValue()/30)*Math.PI); + } + public Min_ang(Min min) { + this.min = min; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Clock.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Clock.java new file mode 100644 index 0000000..2710bd1 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Clock.java @@ -0,0 +1,29 @@ +import java.util.*; + +public class Clock { + private Hour_ang hour_ang; + private Min_ang min_ang; + private Hour hour; + private Min min; + public Clock() { + hour_ang = new Hour_ang(); + min_ang = new Min_ang(); + hour = new Hour(hour_ang); + min = new Min(min_ang,hour); + } + public double getHour_ang() { + return this.hour_ang.getValue(); + } + public double getMin_ang() { + return this.min_ang.getValue(); + } + public int getHour() { + return this.hour.getValue(); + } + public int getMin() { + return this.min.getValue(); + } + public void tick() { + this.min.tick(); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Hour.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Hour.java new file mode 100644 index 0000000..a305b95 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Hour.java @@ -0,0 +1,22 @@ +import java.util.*; + +public class Hour { + private int value = 0; + private Hour_ang hour_ang; + public int getValue() { + return value; + } + public void updateFromMin(int min) { + int temp_if0; + if ((min==0)) { + temp_if0 = ((this.value+1)%24); + } else { + temp_if0 = this.value; + } + this.value = temp_if0; + this.hour_ang.updateFromHour(value); + } + public Hour(Hour_ang hour_ang) { + this.hour_ang = hour_ang; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Hour_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Hour_ang.java new file mode 100644 index 0000000..8463ad7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Hour_ang.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Hour_ang { + private double value = 0.0; + public double getValue() { + return value; + } + public void updateFromHour(int hour) { + this.value = ((hour/6)*Math.PI); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Min.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Min.java new file mode 100644 index 0000000..c0e4de0 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Min.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Min { + private int value = 0; + private Min_ang min_ang; + private Hour hour; + public int getValue() { + return value; + } + public void tick() { + this.value = ((this.value+1)%60); + this.min_ang.updateFromMin(value); + this.hour.updateFromMin(value); + } + public Min(Min_ang min_ang, Hour hour) { + this.min_ang = min_ang; + this.hour = hour; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Min_ang.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Min_ang.java new file mode 100644 index 0000000..756097f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/Clock/PUSH-first/Min_ang.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Min_ang { + private double value = 0.0; + public double getValue() { + return value; + } + public void updateFromMin(int min) { + this.value = ((min/30)*Math.PI); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Companies.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Companies.java new file mode 100644 index 0000000..148543f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Companies.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Companies { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Company getCompany(String cid) { + return this.value.get(cid); + } + public void addCampany(String address, String cid) { + this.value.put(cid,new Company(address)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Company.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Company.java new file mode 100644 index 0000000..fd0eaba --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Company.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Company { + private String address; + public Map getValue() { + Map temp_nil6 = new HashMap<>(); + temp_nil6.put("address",this.getAddress()); + return temp_nil6; + } + public String getAddress() { + return this.address; + } + public void setAddress(String cid, String add) { + this.address = add; + } + public Company(String address) { + this.address = address; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Customer.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Customer.java new file mode 100644 index 0000000..4c19192 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Customer.java @@ -0,0 +1,28 @@ +import java.util.*; + +public class Customer { + private String organization; + private Company company; + private Companies companies; + public Map getValue() { + Map temp_nil7 = new HashMap<>(); + temp_nil7.put("address",this.getAddress()); + temp_nil7.put("organization",this.getOrganization()); + return temp_nil7; + } + public String getOrganization() { + return this.organization; + } + public String getAddress() { + return this.company.getAddress(); + } + public void setOrganization(String uid, String cid) { + this.organization = cid; + this.company = this.companies.getCompany(this.organization); + } + public Customer(String organization, Companies companies) { + this.organization = organization; + this.companies = companies; + this.company = this.companies.getCompany(this.organization); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/CustomerManagement.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/CustomerManagement.java new file mode 100644 index 0000000..a919176 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/CustomerManagement.java @@ -0,0 +1,43 @@ +import java.util.*; + +public class CustomerManagement { + private Companies companies; + private Customers customers; + public CustomerManagement() { + companies = new Companies(); + customers = new Customers(companies); + } + public Map getCompanies() { + return this.companies.getValue(); + } + public void addCampany(String address, String cid) { + this.companies.addCampany(address, cid); + } + public String getAddress(String cid) { + return this.companies.getCompany(cid).getAddress(); + } + public void setAddress(String cid, String add) { + this.companies.getCompany(cid).setAddress(cid, add); + } + public String getOrganization(String uid) { + return this.customers.getCustomer(uid).getOrganization(); + } + public void setOrganization(String uid, String cid) { + this.customers.getCustomer(uid).setOrganization(uid, cid); + } + public String getAddress(String uid) { + return this.customers.getCustomer(uid).getAddress(); + } + public Map getCompany(String cid) { + return this.companies.getCompany(cid).getValue(); + } + public Map getCustomers() { + return this.customers.getValue(); + } + public void addCustomer(String org, String uid) { + this.customers.addCustomer(org, uid); + } + public Map getCustomer(String uid) { + return this.customers.getCustomer(uid).getValue(); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Customers.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Customers.java new file mode 100644 index 0000000..04725d7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PULL-first/Customers.java @@ -0,0 +1,18 @@ +import java.util.*; + +public class Customers { + private Map value = new HashMap<>(); + private Companies companies; + public Map getValue() { + return new HashMap<>(value); + } + public Customer getCustomer(String uid) { + return this.value.get(uid); + } + public void addCustomer(String org, String uid) { + this.value.put(uid,new Customer(org, companies)); + } + public Customers(Companies companies) { + this.companies = companies; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Companies.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Companies.java new file mode 100644 index 0000000..148543f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Companies.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Companies { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Company getCompany(String cid) { + return this.value.get(cid); + } + public void addCampany(String address, String cid) { + this.value.put(cid,new Company(address)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Company.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Company.java new file mode 100644 index 0000000..518a8f0 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Company.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Company { + private String address; + public Map getValue() { + Map temp_nil8 = new HashMap<>(); + temp_nil8.put("address",this.getAddress()); + return temp_nil8; + } + public String getAddress() { + return this.address; + } + public void setAddress(String cid, String add) { + this.address = add; + } + public Company(String address) { + this.address = address; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Customer.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Customer.java new file mode 100644 index 0000000..1279f8c --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Customer.java @@ -0,0 +1,33 @@ +import java.util.*; + +public class Customer { + private Company company; + private Companies companies; + private String organization; + public Map getValue() { + Map temp_nil9 = new HashMap<>(); + temp_nil9.put("organization",this.getOrganization()); + temp_nil9.put("address",this.getAddress()); + return temp_nil9; + } + public String getAddress() { + return address; + } + public String getOrganization() { + return this.organization; + } + public void updateAddressFromOrganization(String self, String uid, String organization) { + this.address = address; + this.organization = organization; + } + public void setOrganization(String uid, String cid) { + this.organization = cid; + this.company = this.companies.getCompany(this.organization); + this.updateAddressFromOrganization(uid, uid, organization); + } + public Customer(Companies companies, String organization) { + this.companies = companies; + this.organization = organization; + this.company = this.companies.getCompany(this.organization); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/CustomerManagement.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/CustomerManagement.java new file mode 100644 index 0000000..6a2e752 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/CustomerManagement.java @@ -0,0 +1,43 @@ +import java.util.*; + +public class CustomerManagement { + private Companies companies; + private Customers customers; + public CustomerManagement() { + companies = new Companies(); + customers = new Customers(companies); + } + public String getAddress(String uid) { + return this.customers.getCustomer(uid).getAddress(); + } + public Map getCustomer(String uid) { + return this.customers.getCustomer(uid).getValue(); + } + public String getOrganization(String uid) { + return this.customers.getCustomer(uid).getOrganization(); + } + public void setOrganization(String uid, String cid) { + this.customers.getCustomer(uid).setOrganization(uid, cid); + } + public Map getCompany(String cid) { + return this.companies.getCompany(cid).getValue(); + } + public Map getCompanies() { + return this.companies.getValue(); + } + public void addCampany(String address, String cid) { + this.companies.addCampany(address, cid); + } + public Map getCustomers() { + return this.customers.getValue(); + } + public void addCustomer(String org, String uid) { + this.customers.addCustomer(org, uid); + } + public String getAddress(String cid) { + return this.companies.getCompany(cid).getAddress(); + } + public void setAddress(String cid, String add) { + this.companies.getCompany(cid).setAddress(cid, add); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Customers.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Customers.java new file mode 100644 index 0000000..c19487b --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/CustomerManagement/PUSH-first/Customers.java @@ -0,0 +1,18 @@ +import java.util.*; + +public class Customers { + private Map value = new HashMap<>(); + private Companies companies; + public Map getValue() { + return new HashMap<>(value); + } + public Customer getCustomer(String uid) { + return this.value.get(uid); + } + public void addCustomer(String org, String uid) { + this.value.put(uid,new Customer(companies, org)); + } + public Customers(Companies companies) { + this.companies = companies; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java new file mode 100644 index 0000000..17825e2 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private Map notifications; + public Map getValue() { + Map temp_nil13 = new HashMap<>(); + temp_nil13.put("notifications",this.getNotifications()); + return temp_nil13; + } + public Map getNotifications() { + return this.notifications; + } + public void hasRead(String aid, String gid) { + this.notifications.remove(gid); + } + public Account(Map notifications) { + this.notifications = notifications; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Accounts.java new file mode 100644 index 0000000..2e7c4e3 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Accounts.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Accounts { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String v1) { + return this.value.get(v1); + } + public void signUp(String aid) { + this.value.put(aid,new Account(new HashMap<>())); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java new file mode 100644 index 0000000..3d045fb --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java @@ -0,0 +1,24 @@ +import java.util.*; + +public class Group { + private Members members = new Members(); + private List messages; + public Map getValue() { + Map temp_nil12 = new HashMap<>(); + temp_nil12.put("messages",this.getMessages()); + temp_nil12.put("members",this.members.getValue()); + return temp_nil12; + } + public Members getMembers() { + return this.members; + } + public List getMessages() { + return this.messages; + } + public void postMessage(String gid, String message) { + this.messages.add(message); + } + public Group(List messages) { + this.messages = messages; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java new file mode 100644 index 0000000..bc7662e --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java @@ -0,0 +1,46 @@ +import java.util.*; + +public class GroupChat { + private Accounts accounts; + private Groups groups; + public GroupChat() { + accounts = new Accounts(); + groups = new Groups(); + } + public Map getAccount(String v1) { + return this.accounts.getAccount(v1).getValue(); + } + public Map getAccounts() { + return this.accounts.getValue(); + } + public void signUp(String aid) { + this.accounts.signUp(aid); + } + public List getMessages(String gid) { + return this.groups.getGroup(gid).getMessages(); + } + public void postMessage(String gid, String message) { + this.groups.getGroup(gid).postMessage(gid, message); + } + public List getMembers(String gid) { + return this.groups.getGroup(gid).getMembers().getValue(); + } + public void addGroupMember(String gid, String aid) { + this.groups.getGroup(gid).getMembers().addGroupMember(gid, aid); + } + public Map getGroup(String gid) { + return this.groups.getGroup(gid).getValue(); + } + public Map getNotifications(String aid) { + return this.accounts.getAccount(aid).getNotifications(); + } + public void hasRead(String aid, String gid) { + this.accounts.getAccount(aid).hasRead(aid, gid); + } + public Map getGroups() { + return this.groups.getValue(); + } + public void createGroup(String gid) { + this.groups.createGroup(gid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java new file mode 100644 index 0000000..fd30ee7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Groups { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Group getGroup(String gid) { + return this.value.get(gid); + } + public void createGroup(String gid) { + this.value.put(gid,new Group(new ArrayList<>())); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Members.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Members.java new file mode 100644 index 0000000..4d23cb7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Members.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Members { + private List value = new ArrayList<>(); + public List getValue() { + return new ArrayList<>(value); + } + public void addGroupMember(String gid, String aid) { + this.value.add(aid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java new file mode 100644 index 0000000..5432e13 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private Map notifications; + public Map getValue() { + Map temp_nil15 = new HashMap<>(); + temp_nil15.put("notifications",this.getNotifications()); + return temp_nil15; + } + public Map getNotifications() { + return this.notifications; + } + public void hasRead(String aid, String gid) { + this.notifications.remove(gid); + } + public Account(Map notifications) { + this.notifications = notifications; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Accounts.java new file mode 100644 index 0000000..2e7c4e3 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Accounts.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Accounts { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String v1) { + return this.value.get(v1); + } + public void signUp(String aid) { + this.value.put(aid,new Account(new HashMap<>())); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java new file mode 100644 index 0000000..45ed108 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java @@ -0,0 +1,24 @@ +import java.util.*; + +public class Group { + private Members members = new Members(); + private List messages; + public Map getValue() { + Map temp_nil14 = new HashMap<>(); + temp_nil14.put("messages",this.getMessages()); + temp_nil14.put("members",this.members.getValue()); + return temp_nil14; + } + public Members getMembers() { + return this.members; + } + public List getMessages() { + return this.messages; + } + public void postMessage(String gid, String message) { + this.messages.add(message); + } + public Group(List messages) { + this.messages = messages; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java new file mode 100644 index 0000000..bc7662e --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java @@ -0,0 +1,46 @@ +import java.util.*; + +public class GroupChat { + private Accounts accounts; + private Groups groups; + public GroupChat() { + accounts = new Accounts(); + groups = new Groups(); + } + public Map getAccount(String v1) { + return this.accounts.getAccount(v1).getValue(); + } + public Map getAccounts() { + return this.accounts.getValue(); + } + public void signUp(String aid) { + this.accounts.signUp(aid); + } + public List getMessages(String gid) { + return this.groups.getGroup(gid).getMessages(); + } + public void postMessage(String gid, String message) { + this.groups.getGroup(gid).postMessage(gid, message); + } + public List getMembers(String gid) { + return this.groups.getGroup(gid).getMembers().getValue(); + } + public void addGroupMember(String gid, String aid) { + this.groups.getGroup(gid).getMembers().addGroupMember(gid, aid); + } + public Map getGroup(String gid) { + return this.groups.getGroup(gid).getValue(); + } + public Map getNotifications(String aid) { + return this.accounts.getAccount(aid).getNotifications(); + } + public void hasRead(String aid, String gid) { + this.accounts.getAccount(aid).hasRead(aid, gid); + } + public Map getGroups() { + return this.groups.getValue(); + } + public void createGroup(String gid) { + this.groups.createGroup(gid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java new file mode 100644 index 0000000..fd30ee7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Groups { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Group getGroup(String gid) { + return this.value.get(gid); + } + public void createGroup(String gid) { + this.value.put(gid,new Group(new ArrayList<>())); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Members.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Members.java new file mode 100644 index 0000000..4d23cb7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Members.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Members { + private List value = new ArrayList<>(); + public List getValue() { + return new ArrayList<>(value); + } + public void addGroupMember(String gid, String aid) { + this.value.add(aid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/Inventory.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/Inventory.java new file mode 100644 index 0000000..da9dc38 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/Inventory.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Inventory { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public InventoryElement getInventoryElement(String itemId) { + return this.value.get(itemId); + } + public void registerItem(String itemName, int quantity, String itemId) { + this.value.put(itemId,new InventoryElement(quantity)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/InventoryElement.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/InventoryElement.java new file mode 100644 index 0000000..366444a --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/InventoryElement.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class InventoryElement { + private int count; + public Map getValue() { + Map temp_nil17 = new HashMap<>(); + temp_nil17.put("count",this.getCount()); + return temp_nil17; + } + public int getCount() { + return this.count; + } + public void receiveOrShip(String itemId, int quantity) { + this.count = (this.value+quantity); + } + public InventoryElement(int count) { + this.count = count; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/InventoryManagement.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/InventoryManagement.java new file mode 100644 index 0000000..3f3d2fc --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/InventoryManagement/InventoryManagement.java @@ -0,0 +1,23 @@ +import java.util.*; + +public class InventoryManagement { + private Inventory inventory; + public InventoryManagement() { + inventory = new Inventory(); + } + public Map getInventory() { + return this.inventory.getValue(); + } + public void registerItem(String itemName, int quantity, String itemId) { + this.inventory.registerItem(itemName, quantity, itemId); + } + public int getCount(String itemId) { + return this.inventory.getInventoryElement(itemId).getCount(); + } + public void receiveOrShip(String itemId, int quantity) { + this.inventory.getInventoryElement(itemId).receiveOrShip(itemId, quantity); + } + public Map getInventoryElement(String itemId) { + return this.inventory.getInventoryElement(itemId).getValue(); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Account.java new file mode 100644 index 0000000..5838e95 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private String name; + public Map getValue() { + Map temp_nil23 = new HashMap<>(); + temp_nil23.put("name",this.getName()); + return temp_nil23; + } + public String getName() { + return this.name; + } + public void changeName(String aid, String name) { + this.name = name; + } + public Account(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Accounts.java new file mode 100644 index 0000000..feb415f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Accounts.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Accounts { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String aid) { + return this.value.get(aid); + } + public void signUp(String name, String aid) { + this.value.put(aid,new Account(name)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/OnlineBattleGame.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/OnlineBattleGame.java new file mode 100644 index 0000000..5339f4c --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/OnlineBattleGame.java @@ -0,0 +1,52 @@ +import java.util.*; + +public class OnlineBattleGame { + private Accounts accounts; + private Rooms rooms; + public OnlineBattleGame() { + accounts = new Accounts(); + rooms = new Rooms(accounts); + } + public String getBlue_id(String rid) { + return this.rooms.getRoom(rid).getBlue_id(); + } + public void changeBlueId(String rid, String blueId) { + this.rooms.getRoom(rid).changeBlueId(rid, blueId); + } + public Map getAccount(String aid) { + return this.accounts.getAccount(aid).getValue(); + } + public String getName(String aid) { + return this.accounts.getAccount(aid).getName(); + } + public void changeName(String aid, String name) { + this.accounts.getAccount(aid).changeName(aid, name); + } + public String getBlue_name(String rid) { + return this.rooms.getRoom(rid).getBlue_name(); + } + public Map getRoom(String rid) { + return this.rooms.getRoom(rid).getValue(); + } + public String getRed_id(String rid) { + return this.rooms.getRoom(rid).getRed_id(); + } + public void changeRedId(String rid, String redId) { + this.rooms.getRoom(rid).changeRedId(rid, redId); + } + public Map getAccounts() { + return this.accounts.getValue(); + } + public void signUp(String name, String aid) { + this.accounts.signUp(name, aid); + } + public Map getRooms() { + return this.rooms.getValue(); + } + public void createRoom(String blueId, String redId, String rid) { + this.rooms.createRoom(blueId, redId, rid); + } + public String getRed_name(String rid) { + return this.rooms.getRoom(rid).getRed_name(); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Room.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Room.java new file mode 100644 index 0000000..399506e --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Room.java @@ -0,0 +1,43 @@ +import java.util.*; + +public class Room { + private String blue_id; + private Account account; + private Accounts accounts; + private String red_id; + public Map getValue() { + Map temp_nil22 = new HashMap<>(); + temp_nil22.put("blue_id",this.getBlue_id()); + temp_nil22.put("red_name",this.getRed_name()); + temp_nil22.put("blue_name",this.getBlue_name()); + temp_nil22.put("red_id",this.getRed_id()); + return temp_nil22; + } + public String getBlue_id() { + return this.blue_id; + } + public String getBlue_name() { + return this.account.getName(); + } + public String getRed_id() { + return this.red_id; + } + public String getRed_name() { + return this.account.getName(); + } + public void changeRedId(String rid, String redId) { + this.red_id = redId; + this.account = this.accounts.getAccount(this.red_id); + } + public void changeBlueId(String rid, String blueId) { + this.blue_id = blueId; + this.account = this.accounts.getAccount(this.blue_id); + } + public Room(String blue_id, Accounts accounts, String red_id) { + this.blue_id = blue_id; + this.accounts = accounts; + this.red_id = red_id; + this.account = this.accounts.getAccount(this.blue_id); + this.account = this.accounts.getAccount(this.red_id); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Rooms.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Rooms.java new file mode 100644 index 0000000..2016c96 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PULL-first/Rooms.java @@ -0,0 +1,18 @@ +import java.util.*; + +public class Rooms { + private Map value = new HashMap<>(); + private Accounts accounts; + public Map getValue() { + return new HashMap<>(value); + } + public Room getRoom(String rid) { + return this.value.get(rid); + } + public void createRoom(String blueId, String redId, String rid) { + this.value.put(rid,new Room(blueId, accounts, redId)); + } + public Rooms(Accounts accounts) { + this.accounts = accounts; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Account.java new file mode 100644 index 0000000..63f2dd3 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private String name; + public Map getValue() { + Map temp_nil21 = new HashMap<>(); + temp_nil21.put("name",this.getName()); + return temp_nil21; + } + public String getName() { + return this.name; + } + public void changeName(String aid, String name) { + this.name = name; + } + public Account(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Accounts.java new file mode 100644 index 0000000..feb415f --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Accounts.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Accounts { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String aid) { + return this.value.get(aid); + } + public void signUp(String name, String aid) { + this.value.put(aid,new Account(name)); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/OnlineBattleGame.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/OnlineBattleGame.java new file mode 100644 index 0000000..02e2ca7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/OnlineBattleGame.java @@ -0,0 +1,52 @@ +import java.util.*; + +public class OnlineBattleGame { + private Accounts accounts; + private Rooms rooms; + public OnlineBattleGame() { + accounts = new Accounts(); + rooms = new Rooms(accounts); + } + public Map getAccount(String aid) { + return this.accounts.getAccount(aid).getValue(); + } + public String getBlue_name(String rid) { + return this.rooms.getRoom(rid).getBlue_name(); + } + public String getBlue_id(String rid) { + return this.rooms.getRoom(rid).getBlue_id(); + } + public void changeBlueId(String rid, String blueId) { + this.rooms.getRoom(rid).changeBlueId(rid, blueId); + } + public String getRed_name(String rid) { + return this.rooms.getRoom(rid).getRed_name(); + } + public String getName(String aid) { + return this.accounts.getAccount(aid).getName(); + } + public void changeName(String aid, String name) { + this.accounts.getAccount(aid).changeName(aid, name); + } + public Map getRoom(String rid) { + return this.rooms.getRoom(rid).getValue(); + } + public String getRed_id(String rid) { + return this.rooms.getRoom(rid).getRed_id(); + } + public void changeRedId(String rid, String redId) { + this.rooms.getRoom(rid).changeRedId(rid, redId); + } + public Map getAccounts() { + return this.accounts.getValue(); + } + public void signUp(String name, String aid) { + this.accounts.signUp(name, aid); + } + public Map getRooms() { + return this.rooms.getValue(); + } + public void createRoom(String blueId, String redId, String rid) { + this.rooms.createRoom(blueId, redId, rid); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Room.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Room.java new file mode 100644 index 0000000..251aacf --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Room.java @@ -0,0 +1,53 @@ +import java.util.*; + +public class Room { + private Account account; + private Accounts accounts; + private String blue_id; + private String red_id; + public Map getValue() { + Map temp_nil20 = new HashMap<>(); + temp_nil20.put("blue_id",this.getBlue_id()); + temp_nil20.put("red_name",this.getRed_name()); + temp_nil20.put("blue_name",this.getBlue_name()); + temp_nil20.put("red_id",this.getRed_id()); + return temp_nil20; + } + public String getBlue_name() { + return name; + } + public String getBlue_id() { + return this.blue_id; + } + public String getRed_name() { + return name; + } + public String getRed_id() { + return this.red_id; + } + public void updateBlue_nameFromBlue_id(String self, String rid, String blue_id) { + this.blue_name = name; + this.blue_id = blue_id; + } + public void updateRed_nameFromRed_id(String self, String rid, String red_id) { + this.red_name = name; + this.red_id = red_id; + } + public void changeRedId(String rid, String redId) { + this.red_id = redId; + this.account = this.accounts.getAccount(this.red_id); + this.updateRed_nameFromRed_id(rid, rid, red_id); + } + public void changeBlueId(String rid, String blueId) { + this.blue_id = blueId; + this.account = this.accounts.getAccount(this.blue_id); + this.updateBlue_nameFromBlue_id(rid, rid, blue_id); + } + public Room(Accounts accounts, String blue_id, String red_id) { + this.accounts = accounts; + this.blue_id = blue_id; + this.red_id = red_id; + this.account = this.accounts.getAccount(this.blue_id); + this.account = this.accounts.getAccount(this.red_id); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Rooms.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Rooms.java new file mode 100644 index 0000000..f674087 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/OnlineBattleGame/PUSH-first/Rooms.java @@ -0,0 +1,18 @@ +import java.util.*; + +public class Rooms { + private Map value = new HashMap<>(); + private Accounts accounts; + public Map getValue() { + return new HashMap<>(value); + } + public Room getRoom(String rid) { + return this.value.get(rid); + } + public void createRoom(String blueId, String redId, String rid) { + this.value.put(rid,new Room(accounts, blueId, redId)); + } + public Rooms(Accounts accounts) { + this.accounts = accounts; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/Account.java new file mode 100644 index 0000000..f007a58 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/Account.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Account { + private List tweets; + public Map getValue() { + Map temp_nil27 = new HashMap<>(); + temp_nil27.put("tweets",this.getTweets()); + return temp_nil27; + } + public List getTweets() { + return this.tweets; + } + public void tweet(String accountId, String contents) { + this.tweets.add(contents); + } + public Account(List tweets) { + this.tweets = tweets; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/Accounts.java new file mode 100644 index 0000000..7f2a17b --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/Accounts.java @@ -0,0 +1,14 @@ +import java.util.*; + +public class Accounts { + private Map value = new HashMap<>(); + public Map getValue() { + return new HashMap<>(value); + } + public Account getAccount(String accountId) { + return this.value.get(accountId); + } + public void signUp(String name, String accountId) { + this.value.put(accountId,new Account(new ArrayList<>())); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/SimpleTwitter.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/SimpleTwitter.java new file mode 100644 index 0000000..36aaf77 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/SimpleTwitter/SimpleTwitter.java @@ -0,0 +1,23 @@ +import java.util.*; + +public class SimpleTwitter { + private Accounts accounts; + public SimpleTwitter() { + accounts = new Accounts(); + } + public List getTweets(String accountId) { + return this.accounts.getAccount(accountId).getTweets(); + } + public void tweet(String accountId, String contents) { + this.accounts.getAccount(accountId).tweet(accountId, contents); + } + public Map getAccount(String accountId) { + return this.accounts.getAccount(accountId).getValue(); + } + public Map getAccounts() { + return this.accounts.getValue(); + } + public void signUp(String name, String accountId) { + this.accounts.signUp(name, accountId); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Highest.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Highest.java new file mode 100644 index 0000000..407263c --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Highest.java @@ -0,0 +1,20 @@ +import java.util.*; + +public class Highest { + private double value = 0.0; + public double getValue() { + return value; + } + public void updateFromTemp_f(double temp_f) { + double temp_if5; + if ((temp_f>=this.value)) { + temp_if5 = temp_f; + } else { + temp_if5 = this.value; + } + this.value = temp_if5; + } + public void reset(double v) { + this.value = v; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Temp_c.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Temp_c.java new file mode 100644 index 0000000..7eb9df6 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Temp_c.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Temp_c { + private Temp_f temp_f; + public double getValue() { + return ((this.temp_f.getValue()-32)/1.8); + } + public Temp_c(Temp_f temp_f) { + this.temp_f = temp_f; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Temp_f.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Temp_f.java new file mode 100644 index 0000000..2b57682 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/Temp_f.java @@ -0,0 +1,16 @@ +import java.util.*; + +public class Temp_f { + private double value = 0.0; + private Highest highest; + public double getValue() { + return value; + } + public void observe(double x) { + this.value = x; + this.highest.updateFromTemp_f(value); + } + public Temp_f(Highest highest) { + this.highest = highest; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/WeatherObservationSystem.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/WeatherObservationSystem.java new file mode 100644 index 0000000..940b5a7 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PULL-first/WeatherObservationSystem.java @@ -0,0 +1,27 @@ +import java.util.*; + +public class WeatherObservationSystem { + private Highest highest; + private Temp_f temp_f; + private Temp_c temp_c; + public WeatherObservationSystem() { + highest = new Highest(); + temp_f = new Temp_f(highest); + temp_c = new Temp_c(temp_f); + } + public double getHighest() { + return this.highest.getValue(); + } + public void reset(double v) { + this.highest.reset(v); + } + public double getTemp_f() { + return this.temp_f.getValue(); + } + public void observe(double x) { + this.temp_f.observe(x); + } + public double getTemp_c() { + return this.temp_c.getValue(); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Highest.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Highest.java new file mode 100644 index 0000000..be085e2 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Highest.java @@ -0,0 +1,20 @@ +import java.util.*; + +public class Highest { + private double value = 0.0; + public double getValue() { + return value; + } + public void updateFromTemp_f(double temp_f) { + double temp_if6; + if ((temp_f>=this.value)) { + temp_if6 = temp_f; + } else { + temp_if6 = this.value; + } + this.value = temp_if6; + } + public void reset(double v) { + this.value = v; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Temp_c.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Temp_c.java new file mode 100644 index 0000000..8aea709 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Temp_c.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Temp_c { + private double value = 0.0; + public double getValue() { + return value; + } + public void updateFromTemp_f(double temp_f) { + this.value = ((temp_f-32)/1.8); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Temp_f.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Temp_f.java new file mode 100644 index 0000000..3a63072 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/Temp_f.java @@ -0,0 +1,19 @@ +import java.util.*; + +public class Temp_f { + private double value = 0.0; + private Temp_c temp_c; + private Highest highest; + public double getValue() { + return value; + } + public void observe(double x) { + this.value = x; + this.temp_c.updateFromTemp_f(value); + this.highest.updateFromTemp_f(value); + } + public Temp_f(Temp_c temp_c, Highest highest) { + this.temp_c = temp_c; + this.highest = highest; + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/WeatherObservationSystem.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/WeatherObservationSystem.java new file mode 100644 index 0000000..9d43e68 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/WeatherObservationSystem/PUSH-first/WeatherObservationSystem.java @@ -0,0 +1,27 @@ +import java.util.*; + +public class WeatherObservationSystem { + private Temp_c temp_c; + private Highest highest; + private Temp_f temp_f; + public WeatherObservationSystem() { + temp_c = new Temp_c(); + highest = new Highest(); + temp_f = new Temp_f(temp_c,highest); + } + public double getTemp_c() { + return this.temp_c.getValue(); + } + public double getHighest() { + return this.highest.getValue(); + } + public void reset(double v) { + this.highest.reset(v); + } + public double getTemp_f() { + return this.temp_f.getValue(); + } + public void observe(double x) { + this.temp_f.observe(x); + } +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/src/parser/Parser.java b/AlgebraicDataflowArchitectureModel/src/parser/Parser.java index d38b634..d10e0ec 100644 --- a/AlgebraicDataflowArchitectureModel/src/parser/Parser.java +++ b/AlgebraicDataflowArchitectureModel/src/parser/Parser.java @@ -434,7 +434,7 @@ } else if (operator.equals(DOT)) { // json accessor while (operator.equals(DOT)) { - Expression exp = expressions.removeLast(); + Expression exp = expressions.remove(expressions.size() - 1); stream.next(); // DOT if (stream.checkNext() == null) throw new WrongJsonExpression(stream.getLine()); String literalOrLeftCurlyBracket = stream.next();