Helper method used by {@link #getSoyTypeForBinaryOperator} for handling {@code UnionType}
instances.
778049
@Nullable
  private static SoyType getSoyTypeFromUnionForBinaryOperator(
      UnionType t0, SoyType t1, boolean isNullable, SoyTypeBinaryOperator operator) {
    List<SoyType> subTypes = new ArrayList<>();
    for (SoyType unionMember : t0.getMembers()) {
      SoyType result = getSoyTypeForBinaryOperator(unionMember, t1, operator);
      if (result == null) {
        return null;
      }
      subTypes.add(result);
    }
    SoyType result = UnionType.of(subTypes);
    return isNullable ? makeNullable(result) : result;
  }
1155886
protected static String ConvertBinaryOperator(int oper)
    {
        // Convert the operator into the proper string
        String oper_string;
        switch (oper)
        {
            default:
            case EQUAL:
                oper_string = "=";
                break;
            case LIKE:
                oper_string = "LIKE";
                break;
            case NOT_EQUAL:
                oper_string = "!=";
                break;
            case LESS_THAN:
                oper_string = "<";
                break;
            case GREATER_THAN:
                oper_string = ">";
                break;
            case GREATER_EQUAL:
                oper_string = ">=";
                break;
            case LESS_EQUAL:
                oper_string = "<=";
                break;
        }
        return oper_string;
    }
570907
private Operation getOperation() {
        if (operation == null) {
            this.operation = (Operation) marshaller.unmarshal(new StringSource(getPayload(String.class)));
        }

        return operation;
    }
440385
@Nonnull
	public static <T> BinaryOperatorBuilder<T> binaryOperator(Consumer<BinaryOperator<T>> consumer) {
		return new BinaryOperatorBuilder(consumer);
	}
755360
static boolean isUnaryOperatorType(Token type) {
    switch (type) {
      case DELPROP:
      case VOID:
      case TYPEOF:
      case POS:
      case NEG:
      case BITNOT:
      case NOT:
        return true;

      default:
        return false;
    }
  }
1277009
private void checkType(BtrpOperand e) {
        if (!(e instanceof BtrpNumber)) {
            throw new UnsupportedOperationException(e + " must be a '" + prettyType() + "' instead of a '" + e.prettyType() + "'");
        }
    }
716266
protected JsonToken handleBinary() throws IOException {
		int size = _in.readInt();
		byte subtype = _in.readByte();
		Context ctx = getContext();
		switch (subtype) {
		case BsonConstants.SUBTYPE_BINARY_OLD:
			int size2 = _in.readInt();
			byte[] buf2 = new byte[size2];
			_in.readFully(buf2);
			ctx.value = buf2;
			break;
			
		case BsonConstants.SUBTYPE_UUID:
			long l1 = _in.readLong();
			long l2 = _in.readLong();
			ctx.value = new UUID(l1, l2);
			break;
			
		default:
			byte[] buf = new byte[size];
			_in.readFully(buf);
			ctx.value = buf;
			break;
		}
		
		return JsonToken.VALUE_EMBEDDED_OBJECT;
	}
928083
private SoyType getElementType(SoyType collectionType, ForNonemptyNode node) {
    Preconditions.checkNotNull(collectionType);
    switch (collectionType.getKind()) {
      case UNKNOWN:
        // If we don't know anything about the base type, then make no assumptions
        // about the field type.
        return UnknownType.getInstance();

      case LIST:
        if (collectionType == ListType.EMPTY_LIST) {
          errorReporter.report(node.getParent().getSourceLocation(), EMPTY_LIST_FOREACH);
          return ErrorType.getInstance();
        }
        return ((ListType) collectionType).getElementType();

      case UNION:
        {
          // If it's a union, then do the field type calculation for each member of
          // the union and combine the result.
          UnionType unionType = (UnionType) collectionType;
          List<SoyType> fieldTypes = new ArrayList<>(unionType.getMembers().size());
          for (SoyType unionMember : unionType.getMembers()) {
            SoyType elementType = getElementType(unionMember, node);
            if (elementType.getKind() == SoyType.Kind.ERROR) {
              return ErrorType.getInstance();
            }
            fieldTypes.add(elementType);
          }
          return SoyTypes.computeLowestCommonType(typeRegistry, fieldTypes);
        }

      default:
        errorReporter.report(
            node.getParent().getSourceLocation(),
            BAD_FOREACH_TYPE,
            node.getExpr().toSourceString(),
            node.getExpr().getType()); // Report the outermost union type in the error.
        return ErrorType.getInstance();
    }
  }
405496
public String getGenericType(RepositoryOperation op) {
		GenericAccessObjectStrategy strategy = genericAccessObjectStrategies.get(op.getName());
		if (strategy == null) {
			return "";
		} else {
			return strategy.getGenericType(op);
		}
	}
1358569
@SuppressWarnings("unchecked")
	public <OUT extends Tuple> SingleOutputStreamOperator<OUT> projectTupleX() {
		SingleOutputStreamOperator<OUT> projOperator = null;

		switch (fieldIndexes.length) {
			case 1: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple1(); break;
			case 2: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple2(); break;
			case 3: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple3(); break;
			case 4: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple4(); break;
			case 5: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple5(); break;
			case 6: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple6(); break;
			case 7: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple7(); break;
			case 8: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple8(); break;
			case 9: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple9(); break;
			case 10: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple10(); break;
			case 11: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple11(); break;
			case 12: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple12(); break;
			case 13: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple13(); break;
			case 14: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple14(); break;
			case 15: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple15(); break;
			case 16: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple16(); break;
			case 17: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple17(); break;
			case 18: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple18(); break;
			case 19: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple19(); break;
			case 20: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple20(); break;
			case 21: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple21(); break;
			case 22: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple22(); break;
			case 23: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple23(); break;
			case 24: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple24(); break;
			case 25: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple25(); break;
			default:
				throw new IllegalStateException("Excessive arity in tuple.");
		}

		return projOperator;
	}
165515
@Override
    public byte[] getBinaryValue(Base64Variant b64variant) throws IOException {
        Object n = currentNode();
        if (n instanceof byte[]) {
            return (byte[]) n;
        } else if (n instanceof org.bson.types.ObjectId) {
            return ((org.bson.types.ObjectId) n).toByteArray();
        }
        return null;
    }

    @Override
    public Object getEmbeddedObject() throws IOException, JsonParseException {
        return currentNode();
    }

    /*
   /**********************************************************
   /* Internal methods
   /**********************************************************
    */

    protected Object currentNode() {
        if (closed || nodeCursor == null) {
            return null;
        }
        return nodeCursor.currentNode();
    }
57118
@Nonnull
	public static LLongBinaryOperator longBinaryOperatorFrom(Consumer<LLongBinaryOperatorBuilder> buildingFunction) {
		LLongBinaryOperatorBuilder builder = new LLongBinaryOperatorBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
740291
public <T> BinaryValue getRiakBucketType(T obj)
    {
        BinaryValue bucketType = null;

        if (riakBucketTypeGetter != null)
        {
            if (riakBucketTypeGetter.getReturnType().isArray())
            {
                Object o = getMethodValue(riakBucketTypeGetter, obj);
                if (o != null)
                {
                    bucketType = BinaryValue.create((byte[]) o);
                }
            }
            else
            {
                Object o = getMethodValue(riakBucketTypeGetter, obj);
                if (o != null)
                {
                    bucketType = BinaryValue.create((String) o);
                }
            }
        }
        else if (riakBucketTypeField != null)
        {
            if (riakBucketTypeField.getType().equals(String.class))
            {
                Object o = getFieldValue(riakBucketTypeField, obj);
                if (o != null)
                {
                    bucketType = BinaryValue.create((String) o);
                }
            }
            else
            {
                Object o = getFieldValue(riakBucketTypeField, obj);
                if (o != null)
                {
                    bucketType = BinaryValue.create((byte[]) o);
                }
            }
        }
        return bucketType;
    }
1373216
public static Op.Type getTypeFromByte(byte type) {
        switch (type) {
            case OpType.SCALAR:
                return Op.Type.SCALAR;
            case OpType.SCALAR_BOOL:
                return Op.Type.SCALAR_BOOL;
            case OpType.BROADCAST:
                return Op.Type.BROADCAST;
            case OpType.BROADCAST_BOOL:
                return Op.Type.BROADCAST_BOOL;
            case OpType.TRANSFORM_BOOL:
                return Op.Type.TRANSFORM_BOOL;
            case OpType.TRANSFORM_FLOAT:
                return Op.Type.TRANSFORM_FLOAT;
            case OpType.TRANSFORM_SAME:
                return Op.Type.TRANSFORM_SAME;
            case OpType.TRANSFORM_ANY:
                return Op.Type.TRANSFORM_ANY;
            case OpType.TRANSFORM_STRICT:
                return Op.Type.TRANSFORM_STRICT;
            case OpType.REDUCE_BOOL:
                return Op.Type.REDUCE_BOOL;
            case OpType.REDUCE_LONG:
                return Op.Type.REDUCE_LONG;
            case OpType.REDUCE_FLOAT:
                return Op.Type.REDUCE_FLOAT;
            case OpType.REDUCE_SAME:
                return Op.Type.REDUCE_SAME;
            case OpType.REDUCE_3:
                return Op.Type.REDUCE3;
            case OpType.INDEX_REDUCE:
                return Op.Type.INDEXREDUCE;
            case OpType.RANDOM:
                return Op.Type.RANDOM;
            case OpType.LOGIC:
                return Op.Type.META;
            case OpType.CUSTOM:
                return Op.Type.CUSTOM;
            case OpType.PAIRWISE:
                return Op.Type.PAIRWISE;
            case OpType.PAIRWISE_BOOL:
                return Op.Type.PAIRWISE_BOOL;
            case OpType.SUMMARYSTATS:
                return Op.Type.SUMMARYSTATS;
            default:
                throw new UnsupportedOperationException("Unknown op type passed in: " + type);
        }
    }
129408
private void initBinaryOperators() {
        initOperators(binaryOperators,
            new BinaryStringOperator(Tag.PLUS)
                    .addBinaryOperator(STRING, OBJECT, STRING, string_add)
                    .addBinaryOperator(OBJECT, STRING, STRING, string_add)
                    .addBinaryOperator(STRING, STRING, STRING, string_add)
                    .addBinaryOperator(STRING, INT, STRING, string_add)
                    .addBinaryOperator(STRING, LONG, STRING, string_add)
                    .addBinaryOperator(STRING, FLOAT, STRING, string_add)
                    .addBinaryOperator(STRING, DOUBLE, STRING, string_add)
                    .addBinaryOperator(STRING, BOOLEAN, STRING, string_add)
                    .addBinaryOperator(STRING, BOT, STRING, string_add)
                    .addBinaryOperator(INT, STRING, STRING, string_add)
                    .addBinaryOperator(LONG, STRING, STRING, string_add)
                    .addBinaryOperator(FLOAT, STRING, STRING, string_add)
                    .addBinaryOperator(DOUBLE, STRING, STRING, string_add)
                    .addBinaryOperator(BOOLEAN, STRING, STRING, string_add)
                    .addBinaryOperator(BOT, STRING, STRING, string_add),
            new BinaryNumericOperator(Tag.PLUS)
                    .addBinaryOperator(DOUBLE, DOUBLE, DOUBLE, dadd)
                    .addBinaryOperator(FLOAT, FLOAT, FLOAT, fadd)
                    .addBinaryOperator(LONG, LONG, LONG, ladd)
                    .addBinaryOperator(INT, INT, INT, iadd),
            new BinaryNumericOperator(Tag.MINUS)
                    .addBinaryOperator(DOUBLE, DOUBLE, DOUBLE, dsub)
                    .addBinaryOperator(FLOAT, FLOAT, FLOAT, fsub)
                    .addBinaryOperator(LONG, LONG, LONG, lsub)
                    .addBinaryOperator(INT, INT, INT, isub),
            new BinaryNumericOperator(Tag.MUL)
                    .addBinaryOperator(DOUBLE, DOUBLE, DOUBLE, dmul)
                    .addBinaryOperator(FLOAT, FLOAT, FLOAT, fmul)
                    .addBinaryOperator(LONG, LONG, LONG, lmul)
                    .addBinaryOperator(INT, INT, INT, imul),
            new BinaryNumericOperator(Tag.DIV)
                    .addBinaryOperator(DOUBLE, DOUBLE, DOUBLE, ddiv)
                    .addBinaryOperator(FLOAT, FLOAT, FLOAT, fdiv)
                    .addBinaryOperator(LONG, LONG, LONG, ldiv)
                    .addBinaryOperator(INT, INT, INT, idiv),
            new BinaryNumericOperator(Tag.MOD)
                    .addBinaryOperator(DOUBLE, DOUBLE, DOUBLE, dmod)
                    .addBinaryOperator(FLOAT, FLOAT, FLOAT, fmod)
                    .addBinaryOperator(LONG, LONG, LONG, lmod)
                    .addBinaryOperator(INT, INT, INT, imod),
            new BinaryBooleanOperator(Tag.BITAND)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, iand),
            new BinaryNumericOperator(Tag.BITAND, Type::isIntegral)
                    .addBinaryOperator(LONG, LONG, LONG, land)
                    .addBinaryOperator(INT, INT, INT, iand),
            new BinaryBooleanOperator(Tag.BITOR)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, ior),
            new BinaryNumericOperator(Tag.BITOR, Type::isIntegral)
                    .addBinaryOperator(LONG, LONG, LONG, lor)
                    .addBinaryOperator(INT, INT, INT, ior),
            new BinaryBooleanOperator(Tag.BITXOR)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, ixor),
            new BinaryNumericOperator(Tag.BITXOR, Type::isIntegral)
                    .addBinaryOperator(LONG, LONG, LONG, lxor)
                    .addBinaryOperator(INT, INT, INT, ixor),
            new BinaryShiftOperator(Tag.SL)
                    .addBinaryOperator(INT, INT, INT, ishl)
                    .addBinaryOperator(INT, LONG, INT, ishll)
                    .addBinaryOperator(LONG, INT, LONG, lshl)
                    .addBinaryOperator(LONG, LONG, LONG, lshll),
            new BinaryShiftOperator(Tag.SR)
                    .addBinaryOperator(INT, INT, INT, ishr)
                    .addBinaryOperator(INT, LONG, INT, ishrl)
                    .addBinaryOperator(LONG, INT, LONG, lshr)
                    .addBinaryOperator(LONG, LONG, LONG, lshrl),
            new BinaryShiftOperator(Tag.USR)
                    .addBinaryOperator(INT, INT, INT, iushr)
                    .addBinaryOperator(INT, LONG, INT, iushrl)
                    .addBinaryOperator(LONG, INT, LONG, lushr)
                    .addBinaryOperator(LONG, LONG, LONG, lushrl),
            new BinaryNumericOperator(Tag.LT)
                    .addBinaryOperator(DOUBLE, DOUBLE, BOOLEAN, dcmpg, iflt)
                    .addBinaryOperator(FLOAT, FLOAT, BOOLEAN, fcmpg, iflt)
                    .addBinaryOperator(LONG, LONG, BOOLEAN, lcmp, iflt)
                    .addBinaryOperator(INT, INT, BOOLEAN, if_icmplt),
            new BinaryNumericOperator(Tag.GT)
                    .addBinaryOperator(DOUBLE, DOUBLE, BOOLEAN, dcmpl, ifgt)
                    .addBinaryOperator(FLOAT, FLOAT, BOOLEAN, fcmpl, ifgt)
                    .addBinaryOperator(LONG, LONG, BOOLEAN, lcmp, ifgt)
                    .addBinaryOperator(INT, INT, BOOLEAN, if_icmpgt),
            new BinaryNumericOperator(Tag.LE)
                    .addBinaryOperator(DOUBLE, DOUBLE, BOOLEAN, dcmpg, ifle)
                    .addBinaryOperator(FLOAT, FLOAT, BOOLEAN, fcmpg, ifle)
                    .addBinaryOperator(LONG, LONG, BOOLEAN, lcmp, ifle)
                    .addBinaryOperator(INT, INT, BOOLEAN, if_icmple),
            new BinaryNumericOperator(Tag.GE)
                    .addBinaryOperator(DOUBLE, DOUBLE, BOOLEAN, dcmpl, ifge)
                    .addBinaryOperator(FLOAT, FLOAT, BOOLEAN, fcmpl, ifge)
                    .addBinaryOperator(LONG, LONG, BOOLEAN, lcmp, ifge)
                    .addBinaryOperator(INT, INT, BOOLEAN, if_icmpge),
            new BinaryEqualityOperator(Tag.EQ)
                    .addBinaryOperator(OBJECT, OBJECT, BOOLEAN, if_acmpeq)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, if_icmpeq)
                    .addBinaryOperator(DOUBLE, DOUBLE, BOOLEAN, dcmpl, ifeq)
                    .addBinaryOperator(FLOAT, FLOAT, BOOLEAN, fcmpl, ifeq)
                    .addBinaryOperator(LONG, LONG, BOOLEAN, lcmp, ifeq)
                    .addBinaryOperator(INT, INT, BOOLEAN, if_icmpeq),
            new BinaryEqualityOperator(Tag.NE)
                    .addBinaryOperator(OBJECT, OBJECT, BOOLEAN, if_acmpne)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, if_icmpne)
                    .addBinaryOperator(DOUBLE, DOUBLE, BOOLEAN, dcmpl, ifne)
                    .addBinaryOperator(FLOAT, FLOAT, BOOLEAN, fcmpl, ifne)
                    .addBinaryOperator(LONG, LONG, BOOLEAN, lcmp, ifne)
                    .addBinaryOperator(INT, INT, BOOLEAN, if_icmpne),
            new BinaryBooleanOperator(Tag.AND)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_and),
            new BinaryBooleanOperator(Tag.OR)
                    .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_or));
    }
248234
@Override
	public BinaryRow baseRowToBinary(BaseRow row) {
		if (row instanceof BinaryRow) {
			return (BinaryRow) row;
		}
		BinaryRow binaryRow = new BinaryRow(types.length);
		BinaryRowWriter writer = new BinaryRowWriter(binaryRow);
		writer.writeHeader(row.getHeader());
		for (int i = 0; i < types.length; i++) {
			if (row.isNullAt(i)) {
				writer.setNullAt(i);
			} else {
				BinaryWriter.write(writer, i, TypeGetterSetters.get(row, i, types[i]), types[i]);
			}
		}
		writer.complete();
		return binaryRow;
	}
1332847
function fromBinaryType(t) {
    return BinaryType (t.name)
                      (t.url)
                      (t.supertypes)
                      (t._test ([]))
                      (t._extractors.$1)
                      (t._extractors.$2);
  }