001package csheets.core.formula.lang; 002 003import csheets.core.IllegalValueTypeException; 004import csheets.core.Value; 005import csheets.core.formula.BinaryOperator; 006import csheets.core.formula.Expression; 007import java.lang.reflect.Type; 008 009/** 010 * The attribution operator := (exclusive for the SignNumber language). 011 * @author João Carreira 012 */ 013public class Attribution implements BinaryOperator { 014 015 /** The unique version identifier used for serialization */ 016 private static final long serialVersionUID = -6922027217525238297L; 017 018 /** 019 * Creates a new attribution operator. 020 */ 021 public Attribution() 022 { 023 } 024 025 /** 026 * applies attribution given a right and left operand 027 * @param leftOperand the operand on the left 028 * @param rightOperand the operand on the right 029 * @return returns the return of right operand evaluation 030 * @throws IllegalValueTypeException 031 */ 032 @Override 033 public Value applyTo(Expression leftOperand, Expression rightOperand) throws IllegalValueTypeException 034 { 035 return rightOperand.evaluate(); 036 } 037 038 /** 039 * returns identifier 040 * @return identifier 041 */ 042 @Override 043 public String getIdentifier() { 044 return ":="; 045 } 046 047 @Override 048 public Value.Type getOperandValueType() 049 { 050 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 051 } 052 053}