All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unlaxer.tinyexpression.model.EditHistory Maven / Gradle / Ivy

The newest version!
package org.unlaxer.tinyexpression.model;

import java.util.Optional;

import org.unlaxer.Token;
import org.unlaxer.tinyexpression.CalculateResult;
import org.unlaxer.tinyexpression.CalculationContext;

public class EditHistory implements Cloneable{
	
	public final EditAction editAction;
	public final CalculationContext calculateContext;
	public final CalculateResult calculateResult;
	//TODO attach attribute to token before rendering
//	public final Map attributesByToken;
	/**
	 * initial position is 0
	 * after first character inserted, position is 1 and it position's element is empty
	 */
	public int caretPosition;
	public Optional select = Optional.empty();
	
	public EditHistory(EditAction editAction , int caretPosition, 
			CalculationContext calculateContext, 
			CalculateResult calculateResult){
		super();
		this.editAction = editAction;
		this.caretPosition = caretPosition;
		this.calculateContext = calculateContext;
		this.calculateResult = calculateResult;
	}

	public EditHistory clone(EditAction editAction)  {
		return new EditHistory(editAction , caretPosition, calculateContext, calculateResult);//, 
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy