• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ArrayUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.andengine.util.adt.array.ArrayUtils的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils类的具体用法?Java ArrayUtils怎么用?Java ArrayUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayUtils类属于org.andengine.util.adt.array包,在下文中一共展示了ArrayUtils类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: set

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
private void set(final long[] pFrameDurations, final int pFrameCount, final int[] pFrames, final int pFirstFrameIndex, final int pLoopCount) {
	if (pFrameDurations.length != pFrameCount) {
		throw new IllegalArgumentException("pFrameDurations does not equal pFrameCount!");
	}

	this.mFrameDurations = pFrameDurations;
	this.mFrameCount = pFrameCount;
	this.mFrames = pFrames;
	this.mFirstFrameIndex = pFirstFrameIndex;
	this.mLoopCount = pLoopCount;

	if ((this.mFrameEndsInNanoseconds == null) || (this.mFrameCount > this.mFrameEndsInNanoseconds.length)) {
		this.mFrameEndsInNanoseconds = new long[this.mFrameCount];
	}

	final long[] frameEndsInNanoseconds = this.mFrameEndsInNanoseconds;
	ArrayUtils.sumCummulative(this.mFrameDurations, TimeConstants.NANOSECONDS_PER_MILLISECOND, frameEndsInNanoseconds);

	final long lastFrameEnd = frameEndsInNanoseconds[this.mFrameCount - 1];
	this.mAnimationDuration = lastFrameEnd;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:22,代码来源:AnimationData.java


示例2: RadialGradientFillBitmapTextureAtlasSourceDecorator

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
public RadialGradientFillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int[] pColors, final float[] pPositions, final RadialGradientDirection pRadialGradientDirection, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
	super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
	this.mColors = pColors;
	this.mPositions = pPositions;
	this.mRadialGradientDirection = pRadialGradientDirection;

	this.mPaint.setStyle(Style.FILL);

	final int width = pBitmapTextureAtlasSource.getTextureWidth();
	final int height = pBitmapTextureAtlasSource.getTextureHeight();

	final float centerX = width * 0.5f;
	final float centerY = height * 0.5f;

	final float radius = Math.max(centerX, centerY);

	switch (pRadialGradientDirection) {
		case INSIDE_OUT:
			this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
			break;
		case OUTSIDE_IN:
			ArrayUtils.reverse(pColors);
			this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
			break;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:27,代码来源:RadialGradientFillBitmapTextureAtlasSourceDecorator.java


示例3: append

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Puts a key/value pair into the array, optimizing for the case where
 * the key is greater than all existing keys in the array.
 */
public void append(int key, double value) {
    if (mSize != 0 && key <= mKeys[mSize - 1]) {
        put(key, value);
        return;
    }

    int pos = mSize;
    if (pos >= mKeys.length) {
        int n = ArrayUtils.idealIntArraySize(pos + 1);

        int[] nkeys = new int[n];
        double[] nvalues = new double[n];

        // Log.e("SparseDoubleArray", "grow " + mKeys.length + " to " + n);
        System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
        System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

        mKeys = nkeys;
        mValues = nvalues;
    }

    mKeys[pos] = key;
    mValues[pos] = value;
    mSize = pos + 1;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:SparseDoubleArray.java


示例4: append

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Puts a key/value pair into the array, optimizing for the case where
 * the key is greater than all existing keys in the array.
 */
public void append(int key, byte value) {
    if (mSize != 0 && key <= mKeys[mSize - 1]) {
        put(key, value);
        return;
    }

    int pos = mSize;
    if (pos >= mKeys.length) {
        int n = ArrayUtils.idealIntArraySize(pos + 1);

        int[] nkeys = new int[n];
        byte[] nvalues = new byte[n];

        // Log.e("SparseByteArray", "grow " + mKeys.length + " to " + n);
        System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
        System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

        mKeys = nkeys;
        mValues = nvalues;
    }

    mKeys[pos] = key;
    mValues[pos] = value;
    mSize = pos + 1;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:SparseByteArray.java


示例5: append

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Puts a key/value pair into the array, optimizing for the case where
 * the key is greater than all existing keys in the array.
 */
public void append(int key, long value) {
    if (mSize != 0 && key <= mKeys[mSize - 1]) {
        put(key, value);
        return;
    }

    int pos = mSize;
    if (pos >= mKeys.length) {
        int n = ArrayUtils.idealIntArraySize(pos + 1);

        int[] nkeys = new int[n];
        long[] nvalues = new long[n];

        // Log.e("SparseLongArray", "grow " + mKeys.length + " to " + n);
        System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
        System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

        mKeys = nkeys;
        mValues = nvalues;
    }

    mKeys[pos] = key;
    mValues[pos] = value;
    mSize = pos + 1;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:SparseLongArray.java


示例6: append

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Puts a key/value pair into the array, optimizing for the case where
 * the key is greater than all existing keys in the array.
 */
public void append(int key, char value) {
    if (mSize != 0 && key <= mKeys[mSize - 1]) {
        put(key, value);
        return;
    }

    int pos = mSize;
    if (pos >= mKeys.length) {
        int n = ArrayUtils.idealIntArraySize(pos + 1);

        int[] nkeys = new int[n];
        char[] nvalues = new char[n];

        // Log.e("SparseCharArray", "grow " + mKeys.length + " to " + n);
        System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
        System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

        mKeys = nkeys;
        mValues = nvalues;
    }

    mKeys[pos] = key;
    mValues[pos] = value;
    mSize = pos + 1;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:SparseCharArray.java


示例7: append

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Puts a key/value pair into the array, optimizing for the case where
 * the key is greater than all existing keys in the array.
 */
public void append(int key, float value) {
    if (mSize != 0 && key <= mKeys[mSize - 1]) {
        put(key, value);
        return;
    }

    int pos = mSize;
    if (pos >= mKeys.length) {
        int n = ArrayUtils.idealIntArraySize(pos + 1);

        int[] nkeys = new int[n];
        float[] nvalues = new float[n];

        // Log.e("SparseFloatArray", "grow " + mKeys.length + " to " + n);
        System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
        System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

        mKeys = nkeys;
        mValues = nvalues;
    }

    mKeys[pos] = key;
    mValues[pos] = value;
    mSize = pos + 1;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:30,代码来源:SparseFloatArray.java


示例8: RadialGradientFillBitmapTextureAtlasSourceDecorator

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
public RadialGradientFillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int[] pColors, final float[] pPositions, final RadialGradientDirection pRadialGradientDirection, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
	super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
	this.mColors = pColors;
	this.mPositions = pPositions;
	this.mRadialGradientDirection = pRadialGradientDirection;

	this.mPaint.setStyle(Style.FILL);

	final int width = pBitmapTextureAtlasSource.getTextureWidth();
	final int height = pBitmapTextureAtlasSource.getTextureHeight();

	final float centerX = width * 0.5f;
	final float centerY = height * 0.5f;

	final float radius = Math.max(centerX, centerY);

	switch(pRadialGradientDirection) {
		case INSIDE_OUT:
			this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
			break;
		case OUTSIDE_IN:
			ArrayUtils.reverse(pColors);
			this.mPaint.setShader(new RadialGradient(centerX, centerY, radius, pColors, pPositions, TileMode.CLAMP));
			break;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:27,代码来源:RadialGradientFillBitmapTextureAtlasSourceDecorator.java


示例9: deepCopyReverse

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
public CardinalSplineMoveModifierConfig deepCopyReverse() {
	final CardinalSplineMoveModifierConfig copy = this.deepCopy();

	ArrayUtils.reverse(copy.mControlPointXs);
	ArrayUtils.reverse(copy.mControlPointYs);

	return copy;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:CardinalSplineMoveModifier.java


示例10: PVRTextureHeader

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
public PVRTextureHeader(final byte[] pData) {
	this.mDataByteBuffer = ByteBuffer.wrap(pData);
	this.mDataByteBuffer.rewind();
	this.mDataByteBuffer.order(ByteOrder.LITTLE_ENDIAN);

	/* Check magic bytes. */
	if (!ArrayUtils.equals(pData, 11 * DataConstants.BYTES_PER_INT, PVRTextureHeader.MAGIC_IDENTIFIER, 0, PVRTextureHeader.MAGIC_IDENTIFIER.length)) {
		throw new IllegalArgumentException("Invalid " + this.getClass().getSimpleName() + "!");
	}

	this.mPVRTextureFormat = PVRTextureFormat.fromID(this.getFlags() & PVRTextureHeader.FORMAT_FLAG_MASK);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:PVRTexture.java


示例11: CCZHeader

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
public CCZHeader(final byte[] pData) {
	this.mDataByteBuffer = ByteBuffer.wrap(pData);
	this.mDataByteBuffer.rewind();
	this.mDataByteBuffer.order(ByteOrder.BIG_ENDIAN);

	/* Check magic bytes. */
	if (!ArrayUtils.equals(pData, 0, CCZHeader.MAGIC_IDENTIFIER, 0, CCZHeader.MAGIC_IDENTIFIER.length)) {
		throw new IllegalArgumentException("Invalid " + this.getClass().getSimpleName() + "!");
	}

	// TODO Check the version?

	this.mCCZCompressionFormat = CCZCompressionFormat.fromID(this.getCCZCompressionFormatID());
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:15,代码来源:PVRCCZTexture.java


示例12: SparseDoubleArray

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Creates a new SparseDoubleArray containing no mappings that will not
 * require any additional memory allocation to store the specified
 * number of mappings.
 */
public SparseDoubleArray(int initialCapacity) {
    initialCapacity = ArrayUtils.idealIntArraySize(initialCapacity);

    mKeys = new int[initialCapacity];
    mValues = new double[initialCapacity];
    mSize = 0;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:SparseDoubleArray.java


示例13: put

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Adds a mapping from the specified key to the specified value,
 * replacing the previous mapping from the specified key if there
 * was one.
 */
public void put(int key, double value) {
    int i = binarySearch(mKeys, 0, mSize, key);

    if (i >= 0) {
        mValues[i] = value;
    } else {
        i = ~i;

        if (mSize >= mKeys.length) {
            int n = ArrayUtils.idealIntArraySize(mSize + 1);

            int[] nkeys = new int[n];
            double[] nvalues = new double[n];

            // Log.e("SparseDoubleArray", "grow " + mKeys.length + " to " + n);
            System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
            System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

            mKeys = nkeys;
            mValues = nvalues;
        }

        if (mSize - i != 0) {
            // Log.e("SparseDoubleArray", "move " + (mSize - i));
            System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i);
            System.arraycopy(mValues, i, mValues, i + 1, mSize - i);
        }

        mKeys[i] = key;
        mValues[i] = value;
        mSize++;
    }
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:39,代码来源:SparseDoubleArray.java


示例14: SparseByteArray

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Creates a new SparseByteArray containing no mappings that will not
 * require any additional memory allocation to store the specified
 * number of mappings.
 */
public SparseByteArray(int initialCapacity) {
    initialCapacity = ArrayUtils.idealIntArraySize(initialCapacity);

    mKeys = new int[initialCapacity];
    mValues = new byte[initialCapacity];
    mSize = 0;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:SparseByteArray.java


示例15: put

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Adds a mapping from the specified key to the specified value,
 * replacing the previous mapping from the specified key if there
 * was one.
 */
public void put(int key, byte value) {
    int i = binarySearch(mKeys, 0, mSize, key);

    if (i >= 0) {
        mValues[i] = value;
    } else {
        i = ~i;

        if (mSize >= mKeys.length) {
            int n = ArrayUtils.idealIntArraySize(mSize + 1);

            int[] nkeys = new int[n];
            byte[] nvalues = new byte[n];

            // Log.e("SparseByteArray", "grow " + mKeys.length + " to " + n);
            System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
            System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

            mKeys = nkeys;
            mValues = nvalues;
        }

        if (mSize - i != 0) {
            // Log.e("SparseByteArray", "move " + (mSize - i));
            System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i);
            System.arraycopy(mValues, i, mValues, i + 1, mSize - i);
        }

        mKeys[i] = key;
        mValues[i] = value;
        mSize++;
    }
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:39,代码来源:SparseByteArray.java


示例16: LongSparseArray

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Creates a new SparseArray containing no mappings that will not
 * require any additional memory allocation to store the specified
 * number of mappings.
 */
public LongSparseArray(int initialCapacity) {
    initialCapacity = ArrayUtils.idealIntArraySize(initialCapacity);

    mKeys = new long[initialCapacity];
    mValues = new Object[initialCapacity];
    mSize = 0;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:LongSparseArray.java


示例17: append

import org.andengine.util.adt.array.ArrayUtils; //导入依赖的package包/类
/**
 * Puts a key/value pair into the array, optimizing for the case where
 * the key is greater than all existing keys in the array.
 */
public void append(long key, E value) {
    if (mSize != 0 && key <= mKeys[mSize - 1]) {
        put(key, value);
        return;
    }

    if (mGarbage && mSize >= mKeys.length) {
        gc();
    }

    int pos = mSize;
    if (pos >= mKeys.length) {
        int n = ArrayUtils.idealIntArraySize(pos + 1);

        long[] nkeys = new long[n];
        Object[] nvalues = new Object[n];

        // Log.e("SparseArray", "grow " + mKeys.length + " to " + n);
        System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
        System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

        mKeys = nkeys;
        mValues = nvalues;
    }

    mKeys[pos] = key;
    mValues[pos] = value;
    mSize = pos + 1;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:34,代码来源:LongSparseArray.java



注:本文中的org.andengine.util.adt.array.ArrayUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MessageChannels类代码示例发布时间:2022-05-23
下一篇:
Java KernelExtensionFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap