Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ao-senXiong committed Mar 31, 2024
1 parent fa2c6ee commit 06c5409
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions testing/PolyOntologyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,51 @@
import ontology.qual.OntologyValue;

public class PolyOntologyTest {
@Ontology(values = {OntologyValue.VELOCITY_3D}) Vector externalVelocity;

@Ontology(values = {OntologyValue.FORCE_3D}) Vector externalForce;

public void applyVelocity(Vector velocity) {
// :: fixable-error: (assignment.type.incompatible)
@Ontology(values = {OntologyValue.VELOCITY_3D}) Vector res = externalVelocity.add(velocity);
}

public void applyForce(Vector force) {
// :: fixable-error: (assignment.type.incompatible)
@Ontology(values = {OntologyValue.FORCE_3D}) Vector res = externalForce.add(force);
// :: fixable-error: (assignment.type.incompatible)
@Ontology(values = {OntologyValue.FORCE_3D}) Vector max = Vector.max(externalForce, force);
}
// @Ontology(values = {OntologyValue.DICTIONARY}) Object externalVelocity;
// Object externalVelocity;
@Ontology(values = {OntologyValue.FORCE_3D}) Object externalForce;
//
// public void applyVelocity(Vector velocity) {
// // :: fixable-error: (assignment.type.incompatible)
// @Ontology(values = {OntologyValue.VELOCITY_3D}) Vector res = externalVelocity.add(velocity);
// }
//
// public void applyForce(Vector force) {
// // :: fixable-error: (assignment.type.incompatible)
// @Ontology(values = {OntologyValue.FORCE_3D}) Vector res = externalForce.add(force);
// // :: fixable-error: (assignment.type.incompatible)
// @Ontology(values = {OntologyValue.FORCE_3D}) Vector max = Vector.max(externalForce, force);
// }
}

class Vector {
int x;
int y;
int z;

public @Ontology(values = {OntologyValue.POLY}) Vector add(
@Ontology(values = {OntologyValue.POLY}) Vector this,
@Ontology(values = {OntologyValue.POLY}) Vector other) {
this.x += other.x;
this.y += other.y;
this.z += other.z;
return this;
}

public static @Ontology(values = {OntologyValue.POLY}) Vector max(
@Ontology(values = {OntologyValue.POLY}) Vector a,
@Ontology(values = {OntologyValue.POLY}) Vector b) {
int aLength = a.length();
int bLength = b.length();

// test lub of polys
if (aLength > bLength) {
return a;
}
return b;
}

public int length() {
return x * x + y * y + z * z;
}
}
//class Vector {
// int x;
// int y;
// int z;
//
// public @Ontology(values = {OntologyValue.POLY}) Vector add(
// @Ontology(values = {OntologyValue.POLY}) Vector this,
// @Ontology(values = {OntologyValue.POLY}) Vector other) {
// this.x += other.x;
// this.y += other.y;
// this.z += other.z;
// return this;
// }
//
// public static @Ontology(values = {OntologyValue.POLY}) Vector max(
// @Ontology(values = {OntologyValue.POLY}) Vector a,
// @Ontology(values = {OntologyValue.POLY}) Vector b) {
// int aLength = a.length();
// int bLength = b.length();
//
// // test lub of polys
// if (aLength > bLength) {
// return a;
// }
// return b;
// }
//
// public int length() {
// return x * x + y * y + z * z;
// }
//}

0 comments on commit 06c5409

Please sign in to comment.