當前位置: 首頁>>代碼示例>>Java>>正文


Java Validate.inclusiveBetween方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.Validate.inclusiveBetween方法的典型用法代碼示例。如果您正苦於以下問題:Java Validate.inclusiveBetween方法的具體用法?Java Validate.inclusiveBetween怎麽用?Java Validate.inclusiveBetween使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.Validate的用法示例。


在下文中一共展示了Validate.inclusiveBetween方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setAt

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * Sets the entry at the given location to the given value
 */
public void setAt(int index, int value)
{
    Validate.inclusiveBetween(0L, (long)(this.arraySize - 1), (long)index);
    Validate.inclusiveBetween(0L, this.maxEntryValue, (long)value);
    int i = index * this.bitsPerEntry;
    int j = i / 64;
    int k = ((index + 1) * this.bitsPerEntry - 1) / 64;
    int l = i % 64;
    this.longArray[j] = this.longArray[j] & ~(this.maxEntryValue << l) | ((long)value & this.maxEntryValue) << l;

    if (j != k)
    {
        int i1 = 64 - l;
        int j1 = this.bitsPerEntry - i1;
        this.longArray[k] = this.longArray[k] >>> j1 << j1 | ((long)value & this.maxEntryValue) >> i1;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:BitArray.java

示例2: readDataSignedInteger

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public static long readDataSignedInteger(final ByteBuffer byteBuffer, long size) {
    Validate.inclusiveBetween(0L,
            (long) EBML_SIZE_MAX_BYTES,
            size,
            "Asked for a numeric value of invalid size " + size);

    Validate.isTrue(byteBuffer.remaining() >= size);
    long value = 0;
    for (int i = 0; i < size; i++) {
        final int result = byteBuffer.get() & 0xFF;
        if (i == 0) {
            boolean positive = (result & 0x80) == 0;
            if (!positive) {
                value = -1;
            }
        }
        value = (value << Byte.SIZE) | result;
    }

    return value;
}
 
開發者ID:aws,項目名稱:amazon-kinesis-video-streams-parser-library,代碼行數:22,代碼來源:EBMLUtils.java

示例3: setStringConfigurationValue

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public void setStringConfigurationValue(String identifier, String... values) throws AlgorithmConfigurationException {
    if (Identifier.HLL_REL_STD_DEV.name().equals(identifier)) {
        Validate.inclusiveBetween(1, 1, values.length);
        this.hllRelativeStddev = Double.parseDouble(values[0]);
    } else if (Identifier.APPROXIMATE_TESTER.name().equals(identifier)) {
        Validate.inclusiveBetween(1, 1, values.length);
        this.approximateTester = values[0];
        if (!APPROXIMATE_TESTERS.contains(this.approximateTester)) {
            throw new AlgorithmConfigurationException(
                    String.format("Unknown tester: %s. Choose from %s.", this.approximateTester, APPROXIMATE_TESTERS)
            );
        }
    } else {
        this.handleUnknownConfiguration(identifier, Joiner.on(',').join(values));
    }
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:18,代碼來源:FAIDA.java

示例4: parseAnimationFrame

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
private AnimationFrame parseAnimationFrame(int p_110492_1_, JsonElement p_110492_2_)
{
    if (p_110492_2_.isJsonPrimitive())
    {
        return new AnimationFrame(JsonUtils.getInt(p_110492_2_, "frames[" + p_110492_1_ + "]"));
    }
    else if (p_110492_2_.isJsonObject())
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_110492_2_, "frames[" + p_110492_1_ + "]");
        int i = JsonUtils.getInt(jsonobject, "time", -1);

        if (jsonobject.has("time"))
        {
            Validate.inclusiveBetween(1L, 2147483647L, (long)i, "Invalid frame time");
        }

        int j = JsonUtils.getInt(jsonobject, "index");
        Validate.inclusiveBetween(0L, 2147483647L, (long)j, "Invalid frame index");
        return new AnimationFrame(j, i);
    }
    else
    {
        return null;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:AnimationMetadataSectionSerializer.java

示例5: readUnsignedIntegerSevenBytesOrLess

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
/**
 * A specialized method used to read a variable length unsigned integer of size 7 bytes or less.
 * @param byteBuffer The byteBuffer to read from.
 * @param size The size of bytes.
 * @return The long containing the integer value.
 */
public static long readUnsignedIntegerSevenBytesOrLess(final ByteBuffer byteBuffer, long size) {
    Validate.inclusiveBetween(0L,
            (long) EBML_SIZE_MAX_BYTES - 1,
            size,
            "Asked for a numeric value of invalid size " + size);

    Validate.isTrue(byteBuffer.remaining() >= size);
    long value = 0;
    for (int i = 0; i < size; i++) {
        final int result = byteBuffer.get() & 0xFF;
        value = (value << Byte.SIZE) | result;
    }

    return value;
}
 
開發者ID:aws,項目名稱:amazon-kinesis-video-streams-parser-library,代碼行數:22,代碼來源:EBMLUtils.java

示例6: AttributeModifier

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public AttributeModifier(UUID idIn, String nameIn, double amountIn, int operationIn)
{
    this.isSaved = true;
    this.id = idIn;
    this.name = nameIn;
    this.amount = amountIn;
    this.operation = operationIn;
    Validate.notEmpty(nameIn, "Modifier name cannot be empty", new Object[0]);
    Validate.inclusiveBetween(0L, 2L, (long)operationIn, "Invalid operation");
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:11,代碼來源:AttributeModifier.java

示例7: set

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override public void set(int x, int y, float value)
{
	Validate.inclusiveBetween(0, getWidth()-1, x, "x was "+x+", should be in [0;"+(getWidth()-1)+"]");
	Validate.inclusiveBetween(0, getHeight()-1, y, "y was "+y+", should be in [0;"+(getHeight()-1)+"]");

	this.floats[y][x] = value;
}
 
開發者ID:domisum,項目名稱:ExZiff,代碼行數:8,代碼來源:FloatMapInMemoryArray.java

示例8: setIntegerConfigurationValue

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
@Override
public void setIntegerConfigurationValue(String identifier, Integer... values) throws AlgorithmConfigurationException {
    if (Identifier.SAMPLE_GOAL.name().equals(identifier)) {
        Validate.inclusiveBetween(1, 1, values.length);
        this.sampleGoal = values[0];
    } else if (Identifier.APPROXIMATE_TESTER_BYTES.name().equals(identifier)) {
        Validate.inclusiveBetween(1, 1, values.length);
        this.approximateTesterBytes = values[0];
    } else {
        this.handleUnknownConfiguration(identifier, Joiner.on(',').join(values));
    }
}
 
開發者ID:HPI-Information-Systems,項目名稱:metanome-algorithms,代碼行數:13,代碼來源:FAIDA.java

示例9: readDataUnsignedInteger

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public static BigInteger readDataUnsignedInteger(final ByteBuffer byteBuffer, long size) {
    Validate.inclusiveBetween(0L,
            (long) EBML_SIZE_MAX_BYTES,
            size,
            "Asked for a numeric value of invalid size " + size);

    Validate.isTrue(byteBuffer.remaining() >= size);
    byte [] byteArray = new byte[(int)size];
    byteBuffer.get(byteArray);
    return new BigInteger(1, byteArray);
}
 
開發者ID:aws,項目名稱:amazon-kinesis-video-streams-parser-library,代碼行數:12,代碼來源:EBMLUtils.java

示例10: BitArray

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public BitArray(int bitsPerEntryIn, int arraySizeIn)
{
    Validate.inclusiveBetween(1L, 32L, (long)bitsPerEntryIn);
    this.arraySize = arraySizeIn;
    this.bitsPerEntry = bitsPerEntryIn;
    this.maxEntryValue = (1L << bitsPerEntryIn) - 1L;
    this.longArray = new long[MathHelper.roundUp(arraySizeIn * bitsPerEntryIn, 64) / 64];
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:9,代碼來源:BitArray.java

示例11: deserialize

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public AnimationMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    List<AnimationFrame> list = Lists.<AnimationFrame>newArrayList();
    JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "metadata section");
    int i = JsonUtils.getInt(jsonobject, "frametime", 1);

    if (i != 1)
    {
        Validate.inclusiveBetween(1L, 2147483647L, (long)i, "Invalid default frame time");
    }

    if (jsonobject.has("frames"))
    {
        try
        {
            JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "frames");

            for (int j = 0; j < jsonarray.size(); ++j)
            {
                JsonElement jsonelement = jsonarray.get(j);
                AnimationFrame animationframe = this.parseAnimationFrame(j, jsonelement);

                if (animationframe != null)
                {
                    list.add(animationframe);
                }
            }
        }
        catch (ClassCastException classcastexception)
        {
            throw new JsonParseException("Invalid animation->frames: expected array, was " + jsonobject.get("frames"), classcastexception);
        }
    }

    int k = JsonUtils.getInt(jsonobject, "width", -1);
    int l = JsonUtils.getInt(jsonobject, "height", -1);

    if (k != -1)
    {
        Validate.inclusiveBetween(1L, 2147483647L, (long)k, "Invalid width");
    }

    if (l != -1)
    {
        Validate.inclusiveBetween(1L, 2147483647L, (long)l, "Invalid height");
    }

    boolean flag = JsonUtils.getBoolean(jsonobject, "interpolate", false);
    return new AnimationMetadataSection(list, k, l, i, flag);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:51,代碼來源:AnimationMetadataSectionSerializer.java

示例12: deserialize

import org.apache.commons.lang3.Validate; //導入方法依賴的package包/類
public FontMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    float[] afloat = new float[256];
    float[] afloat1 = new float[256];
    float[] afloat2 = new float[256];
    float f = 1.0F;
    float f1 = 0.0F;
    float f2 = 0.0F;

    if (jsonobject.has("characters"))
    {
        if (!jsonobject.get("characters").isJsonObject())
        {
            throw new JsonParseException("Invalid font->characters: expected object, was " + jsonobject.get("characters"));
        }

        JsonObject jsonobject1 = jsonobject.getAsJsonObject("characters");

        if (jsonobject1.has("default"))
        {
            if (!jsonobject1.get("default").isJsonObject())
            {
                throw new JsonParseException("Invalid font->characters->default: expected object, was " + jsonobject1.get("default"));
            }

            JsonObject jsonobject2 = jsonobject1.getAsJsonObject("default");
            f = JsonUtils.getFloat(jsonobject2, "width", f);
            Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f, "Invalid default width");
            f1 = JsonUtils.getFloat(jsonobject2, "spacing", f1);
            Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f1, "Invalid default spacing");
            f2 = JsonUtils.getFloat(jsonobject2, "left", f1);
            Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f2, "Invalid default left");
        }

        for (int i = 0; i < 256; ++i)
        {
            JsonElement jsonelement = jsonobject1.get(Integer.toString(i));
            float f3 = f;
            float f4 = f1;
            float f5 = f2;

            if (jsonelement != null)
            {
                JsonObject jsonobject3 = JsonUtils.getJsonObject(jsonelement, "characters[" + i + "]");
                f3 = JsonUtils.getFloat(jsonobject3, "width", f);
                Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f3, "Invalid width");
                f4 = JsonUtils.getFloat(jsonobject3, "spacing", f1);
                Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f4, "Invalid spacing");
                f5 = JsonUtils.getFloat(jsonobject3, "left", f2);
                Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f5, "Invalid left");
            }

            afloat[i] = f3;
            afloat1[i] = f4;
            afloat2[i] = f5;
        }
    }

    return new FontMetadataSection(afloat, afloat2, afloat1);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:62,代碼來源:FontMetadataSectionSerializer.java


注:本文中的org.apache.commons.lang3.Validate.inclusiveBetween方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。