Skip to content

Commit

Permalink
#1307 - forma
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Aug 2, 2023
1 parent 8d9d86b commit 6932e60
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 55 deletions.
8 changes: 4 additions & 4 deletions eo-runtime/src/main/java/org/eolang/AtCage.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ public Phi get() {

@Override
public void put(final Phi phi) {
if (this.object != null && !this.object.form().equals(phi.form())) {
if (this.object != null && !this.object.forma().equals(phi.forma())) {
throw new ExFailure(
"Can't write an object of type %s because object of type %s was saved before",
phi.form(),
this.object.form()
"Can't write an object formed by %s because object formed by %s was saved before",
phi.forma(),
this.object.forma()
);
}
this.object = phi;
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ public String locator() {
}

@Override
public String form() {
return this.object.form();
public String forma() {
return this.object.forma();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String locator() {
}

@Override
public String form() {
return this.origin.form();
public String forma() {
return this.origin.forma();
}
}
12 changes: 6 additions & 6 deletions eo-runtime/src/main/java/org/eolang/PhDefault.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public abstract class PhDefault implements Phi, Cloneable {
protected int vertex;

/**
* Type of it.
* Forma of it.
*/
private String tpe;
private String form;

/**
* Order of their names.
Expand Down Expand Up @@ -113,7 +113,7 @@ public PhDefault() {
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public PhDefault(final Phi sigma) {
this.vertex = PhDefault.VTX.next();
this.tpe = this.getClass().getName();
this.form = this.getClass().getName();
this.attrs = new HashMap<>(0);
this.order = new ArrayList<>(0);
this.add("ρ", new AtSimple(sigma));
Expand Down Expand Up @@ -186,7 +186,7 @@ public final Phi copy() {
try {
final PhDefault copy = (PhDefault) this.clone();
copy.vertex = PhDefault.VTX.next();
copy.tpe = this.tpe;
copy.form = this.form;
copy.cached = new CachedPhi();
final Map<String, Attr> map = new HashMap<>(this.attrs.size());
for (final Map.Entry<String, Attr> ent : this.attrs.entrySet()) {
Expand Down Expand Up @@ -292,8 +292,8 @@ public String locator() {
}

@Override
public String form() {
return this.tpe;
public String forma() {
return this.form;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhImmovable.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public String locator() {
}

@Override
public String form() {
return this.origin.form();
public String forma() {
return this.origin.forma();
}
}
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhLocated.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public String locator() {
}

@Override
public String form() {
return this.origin.form();
public String forma() {
return this.origin.forma();
}

}
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhLogged.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public String locator() {
}

@Override
public String form() {
return this.origin.form();
public String forma() {
return this.origin.forma();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhNamed.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public String locator() {
}

@Override
public String form() {
return this.origin.form();
public String forma() {
return this.origin.forma();
}

}
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhOnce.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public String locator() {
}

@Override
public String form() {
return this.object.take().form();
public String forma() {
return this.object.take().forma();
}
}
2 changes: 1 addition & 1 deletion eo-runtime/src/main/java/org/eolang/PhPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public String locator() {
}

@Override
public String form() {
public String forma() {
throw new ExFailure(
String.format("Can't #type() from package object '%s'", this.pkg)
);
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/main/java/org/eolang/PhSafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public String locator() {
}

@Override
public String form() {
return this.origin.form();
public String forma() {
return this.origin.forma();
}

}
12 changes: 5 additions & 7 deletions eo-runtime/src/main/java/org/eolang/Phi.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public String locator() {
}

@Override
public String form() {
return this.pkg.form();
public String forma() {
return this.pkg.forma();
}
};

Expand Down Expand Up @@ -122,10 +122,8 @@ public String form() {
String locator();

/**
* Get form of the phi.
* Forming is the process describing an object: giving to it a name and
* describing object's attributes.
* @return Form of it as {@link String}.
* Get forma of the phi.
* @return Forma of it as {@link String}.
*/
String form();
String forma();
}
2 changes: 1 addition & 1 deletion eo-runtime/src/test/java/EOorg/EOeolang/EOcageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void writesAndRewritesPrimitive() {
}

@Test
void doesNotWritePrimitivesOfDifferentTypes() {
void doesNotWritePrimitivesFormedDifferently() {
final Phi cage = new EOcage(Phi.Φ);
EOcageTest.writeTo(cage, new Data.ToPhi(1L));
Assertions.assertThrows(
Expand Down
6 changes: 3 additions & 3 deletions eo-runtime/src/test/java/org/eolang/PhCopyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ void makesObjectCopy() {
}

@Test
void hasTheSameTypeAsCopied() {
void hasTheSameFormaAsCopied() {
final Phi phi = new Data.ToPhi(1L);
MatcherAssert.assertThat(
phi.form(),
phi.forma(),
Matchers.equalTo(
phi.copy().form()
phi.copy().forma()
)
);
}
Expand Down
18 changes: 9 additions & 9 deletions eo-runtime/src/test/java/org/eolang/PhDefaultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,46 +230,46 @@ void readsMultipleTimesThroughAttribute() {
}

@Test
void hasTheSameTypeWithBoundedData() {
void hasTheSameFormaWithBoundedData() {
final Phi five = new PhWith(new EOint(Phi.Φ), "Δ", new Data.Value<>(5L));
final Phi six = new PhWith(new EOint(Phi.Φ), "Δ", new Data.Value<>(5L));
MatcherAssert.assertThat(
five.form(),
Matchers.equalTo(six.form())
five.forma(),
Matchers.equalTo(six.forma())
);
}

@Test
void hasDifferentTypeWithBoundedMethod() {
void hasDifferentFormaWithBoundedMethod() {
final Phi five = new Data.ToPhi(5L);
MatcherAssert.assertThat(
five.form(),
five.forma(),
Matchers.not(
Matchers.equalTo(
new PhWith(
five.attr("plus").get().copy(),
"x",
new Data.ToPhi(5L)
).form()
).forma()
)
)
);
}

@Test
void hasTheSameTypeWithDifferentInstances() {
void hasTheSameFormaWithDifferentInstances() {
MatcherAssert.assertThat(
new PhWith(
new Data.ToPhi(5L).attr("plus").get().copy(),
"x",
new Data.ToPhi(5L)
).form(),
).forma(),
Matchers.equalTo(
new PhWith(
new Data.ToPhi(6L).attr("plus").get().copy(),
"x",
new Data.ToPhi(6L)
).form()
).forma()
)
);
}
Expand Down
6 changes: 3 additions & 3 deletions eo-runtime/src/test/java/org/eolang/PhMethodTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ void calculatesPhiManyTimes() {
}

@Test
void hasDifferentTypesWithOwnMethod() {
void hasDifferentFormasWithOwnMethod() {
final Phi dummy = new Dummy();
MatcherAssert.assertThat(
dummy.form(),
dummy.forma(),
Matchers.not(
Matchers.equalTo(
new PhMethod(dummy, "foo").form()
new PhMethod(dummy, "foo").forma()
)
)
);
Expand Down
4 changes: 2 additions & 2 deletions eo-runtime/src/test/java/org/eolang/PhPackageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ void doesNotGetAttributeByPosition() {
}

@Test
void doesNotGetType() {
void doesNotGetForma() {
Assertions.assertThrows(
ExFailure.class,
() -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).form()
() -> new PhPackage(PhPackageTest.DEFAULT_PACKAGE).forma()
);
}

Expand Down
6 changes: 3 additions & 3 deletions eo-runtime/src/test/java/org/eolang/PhWithTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ void runsInThreads(final String data) {
}

@Test
void hasTheSameTypeWithBoundAttribute() {
void hasTheSameFormaWithBoundAttribute() {
final Phi dummy = new DummyWithAtFree("x", Phi.Φ);
MatcherAssert.assertThat(
dummy.form(),
dummy.forma(),
Matchers.equalTo(
new PhWith(dummy, "x", new Data.Value<>(5L)).form()
new PhWith(dummy, "x", new Data.Value<>(5L)).forma()
)
);
}
Expand Down

0 comments on commit 6932e60

Please sign in to comment.