use of nars.term.compound.UnitCompound in project narchy by automenta.
the class Compound method normalize.
@Override
@Nullable
default Term normalize(byte varOffset) {
if (varOffset == 0 && this.isNormalized())
return this;
int vars = this.vars();
int pVars = this.varPattern();
int totalVars = vars + pVars;
assert (totalVars > 0);
Term y = transform(((vars == 1) && (pVars == 0) && varOffset == 0) ? // special case for efficiency
VariableNormalization.singleVariableNormalization : new VariableNormalization(totalVars, /* estimate */
varOffset));
if (varOffset == 0 && y instanceof Compound) {
if (!(y instanceof UnitCompound)) {
Subterms st = y.subterms();
st.setNormalized();
}
}
return y;
}
Aggregations