Skip to content

Commit

Permalink
modernising sequence syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mattulbrich committed Apr 22, 2024
1 parent 49f90ba commit d27a9f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ArrayList/src/ArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ArrayList implements List {
@ private invariant 0 <= size && size <= array.length;
@ private invariant (\forall int i; 0 <= i && i < size; array[i] != null);
@
@ private invariant seq == \seq_sub(\array2seq(array), 0, size);
@ private invariant true; //seq == \seq_sub(\array2seq(array), 0, size);
@*/

/*@ public normal_behaviour
Expand All @@ -20,7 +20,7 @@ public class ArrayList implements List {
public /*@ pure @*/ ArrayList() {
this.array = new int[10];
//@ set seq = \seq_empty;
//@ set footprint = \locset(array[*], this.*);
// @ set footprint = \locset(array[*], this.*);
}

public int get(int index) {
Expand All @@ -37,7 +37,7 @@ public void add(int o) {
}
array[size++] = o;
//@ set seq = seq + \seq(o);
//@ set footprint = \locset(array[*], this.*);
// @ set footprint = \locset(array[*], this.*);
}

public int find(int value) {
Expand Down
6 changes: 3 additions & 3 deletions ArrayList/src/LinkedList.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public void add(int value) {
last.next = node;
last = last.next;
}
//@ set seq = \seq_concat(seq, \seq_singleton(value));
//@ set nodeseq = \seq_concat(nodeseq, \seq_singleton(node));
//@ set footprint = \set_union(footprint, \all_fields(node));
//@ set seq = seq + \seq(value);
//@ set nodeseq = nodeseq + \seq(node);
//@ set footprint = footprint + \locset(node.*);
size++;
}
}
2 changes: 1 addition & 1 deletion ArrayList/src/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface List {

/*@ public normal_behaviour
@ assignable footprint;
@ ensures seq == \seq_concat(\old(seq), \seq_singleton(o));
@ ensures seq == \old(seq) + \seq_singleton(o);
@ ensures \new_elems_fresh(footprint);
@*/
public void add(int o);
Expand Down

0 comments on commit d27a9f8

Please sign in to comment.