public static Expression operation ( Operator op , List < Expression > operands ) { Preconditions . checkArgument ( operands . size ( ) == op . getNumOperands ( ) ) ; Preconditions . checkArgument ( op != Operator . AND && op != Operator . OR && op != Operator . CONDITIONAL ) ; switch ( op . getNumOperands ( ) ) { case 1 : return PrefixUnaryOperation . create ( op , operands . get ( 0 ) ) ; case 2 : return BinaryOperation . create ( op , operands . get ( 0 ) , operands . get ( 1 ) ) ; default : throw new AssertionError ( ) ; } }
Creates a code chunk representing the given Soy operator applied to the given operands .