@Override public String toString() { return (isNegated() ? "!" : "") + Double.toString(value); }
/** * Inserts a Constant in a row * @param row The row * @param constant The Constant */ private void insertConstant(int row, Constant constant) { if (constantsVector == null) { constantsVector = new Constant[height]; } if (constantsVector[row] == null) { constantsVector[row] = new Constant(constant.getValue()); } else { constantsVector[row].setValue(constantsVector[row].getValue() * constant.getValue()); } if (constant.isNegated()) { constantsVector[row].negate(); } }
@Override public Object visitConstant(Constant constant, Object arg) { GAPPMultivector mvTmp = gappCreator.createMv(); PosSelectorset selDestSet = new PosSelectorset(); selDestSet.add(new PosSelector(0, algebra.getBlade(0).toString())); Valueset valSet = new Valueset(); valSet.add(new GAPPConstant((constant.isNegated() ? -1 : 1) * constant.getValue())); gappCreator.gapp.addInstruction(new GAPPAssignMv(mvTmp, selDestSet, valSet)); return mvTmp; }
@Override public Object visitConstant(Constant constant, Object arg) { //arg must be filled! GAPPMultivectorComponent destination = (GAPPMultivectorComponent) arg; PosSelectorset selSet = new PosSelectorset(); selSet.add(new PosSelector(destination.getBladeIndex(), algebra.getBlade(destination.getBladeIndex()).toString())); Valueset valSet = new Valueset(); valSet.add(new GAPPConstant(((constant.isNegated()) ? -1 : 1) * constant.getValue())); gapp.addInstruction(new GAPPAssignMv(new GAPPMultivector(destination.getName()), selSet, valSet)); return null; }