Package com.foundationdb.server.types

Examples of com.foundationdb.server.types.TClass


        private TInstance findCommon(V overload, TInputSet inputSet,
                                  List<? extends TPreptimeValue> inputs, TCastResolver resolver)
        {
            assert inputSet.targetType() == null : inputSet; // so we have to look at inputs
            TClass common = null;
            TInstance commonInst = null;
            int lastPositionalInput = overload.positionalInputs();
            boolean notVararg = ! overload.isVararg();
            boolean nullable = false;
            for (int i = 0, size = inputs.size(); i < size; ++i) {
                if (overload.inputSetAt(i) != inputSet)
                    continue;
                if (notVararg && (i >= lastPositionalInput))
                    break;
                TPreptimeValue inputTpv = inputs.get(i);
                nullable |= inputTpv.isNullable();
                TInstance inputInstance = inputTpv.type();
                if (inputInstance == null) {
                    // unknown type, like a NULL literal or parameter
                    continue;
                }
                TClass inputClass = inputInstance.typeClass();
                if (common == null) {
                    // First input we've seen, so just use it.
                    common = inputClass;
                    commonInst = inputInstance;
                }
                else if (inputClass == common) {
                    // saw the same TClass as before, so pick it
                    commonInst = (commonInst == null) ? inputInstance : common.pickInstance(commonInst, inputInstance);
                }
                else {
                    // Saw a different TCLass as before, so need to cast one of them. We'll get the new common type,
                    // at which point we have exactly one of three possibilities:
                    //   1) newCommon == [old] common, in which case we'll keep the old TInstance
                    //   2) newCommon == inputClass, in which case we'll use the inputInstance
                    //   3) newCommon is neither, in which case we'll generate a new TInstance
                    // We know that we can't have both #1 and #2, because that would imply [old] common == inputClass,
                    // which has already been handled.
                    TClass newCommon = resolver.commonTClass(common, inputClass);
                    if (newCommon == null)
                        throw new OverloadException(overload + ": couldn't find common types for " + inputSet
                            + " with " + inputs);

                    if (newCommon == inputClass) { // case #2
View Full Code Here


            return AkServerUtil.getUnsignedIntegerByWidth(bytes(), offset, width);
        }
    }

    private Signage signage() {
        TClass tclass = fieldDef().column().getType().typeClass();
        if (tclass instanceof MNumeric)
            return ((MNumeric)tclass).isUnsigned() ? Signage.UNSIGNED : Signage.SIGNED;
        else if (tclass == MDateAndTime.YEAR)
            return Signage.UNSIGNED;
        else
View Full Code Here

        assertFalse(canTypesBeJoined("MCOMPAT", "int", "MCOMPAT", "double"));
        assertFalse(canTypesBeJoined("MCOMPAT", "char", "MCOMPAT", "binary"));
    }

    protected boolean isTypeSupported(String bundle, String name) {
        TClass tc = typesRegistry.getTypeClass(bundle, name);
        assertNotNull(name, tc);
        return TypeValidator.isSupportedForColumn(tc);
    }
View Full Code Here

        assertNotNull(name, tc);
        return TypeValidator.isSupportedForColumn(tc);
    }

    protected boolean isTypeSupportedAsIndex(String bundle, String name) {
        TClass tc = typesRegistry.getTypeClass(bundle, name);
        assertNotNull(name, tc);
        return TypeValidator.isSupportedForIndex(tc);
    }
View Full Code Here

        assertNotNull(name, tc);
        return TypeValidator.isSupportedForIndex(tc);
    }

    protected boolean canTypesBeJoined(String b1, String t1, String b2, String t2) {
        TClass c1 = typesRegistry.getTypeClass(b1, t1);
        assertNotNull(t1, c1);
        TClass c2 = typesRegistry.getTypeClass(b2, t2);
        assertNotNull(t2, c2);
        return TypeValidator.isSupportedForJoin(c1, c2);
    }
View Full Code Here

        OverloadResolver.OverloadResult result = registry.getScalarsResolver().get(overloadName, prepValues);
        assertSame(msg, expected, result != null ? result.getOverload().getUnderlying() : null);
    }

    private void checkCommon(TClass a, TClass b, TClass common) {
        TClass actualCommon;
        try {
            actualCommon = registry.getCastsResolver().commonTClass(a, b);
        } catch (OverloadException e) {
            actualCommon = null;
        }
View Full Code Here

import java.util.List;

public final class IsCandidatePredicates {

    public static Predicate<List<? extends TPreptimeValue>> contains(TClass tClass) {
        final TClass tClassFinal = tClass;
        return new Predicate<List<? extends TPreptimeValue>>() {
            @Override
            public boolean apply(List<? extends TPreptimeValue> input) {
                for (int i = 0, size=input.size(); i < size; ++i) {
                    TInstance type = input.get(i).type();
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.TClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.