本文整理汇总了Java中org.apache.commons.lang3.mutable.MutableInt.intValue方法的典型用法代码示例。如果您正苦于以下问题:Java MutableInt.intValue方法的具体用法?Java MutableInt.intValue怎么用?Java MutableInt.intValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.mutable.MutableInt
的用法示例。
在下文中一共展示了MutableInt.intValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserializeObject
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public synchronized Object deserializeObject(byte[] objectBytes, MutableInt offset)
{
int length = GPOUtils.deserializeInt(objectBytes, offset);
int startIndex = offset.intValue();
Map<Object, Object> primitiveMap = Maps.newHashMap();
while (startIndex + length > offset.intValue()) {
int typeOrdinal = GPOUtils.deserializeInt(objectBytes, offset);
GPOType gpoType = GPOType.GPO_TYPE_ARRAY[typeOrdinal];
Object key = gpoType.deserialize(objectBytes, offset);
typeOrdinal = GPOUtils.deserializeInt(objectBytes, offset);
gpoType = GPOType.GPO_TYPE_ARRAY[typeOrdinal];
Object value = gpoType.deserialize(objectBytes, offset);
primitiveMap.put(key, value);
}
return primitiveMap;
}
示例2: deserializeObject
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public synchronized Object deserializeObject(byte[] object, MutableInt offset)
{
Map<String, Type> fieldToType = Maps.newHashMap();
int length = GPOUtils.deserializeInt(object, offset);
int startIndex = offset.intValue();
while (startIndex + length > offset.intValue()) {
Type type = Type.values()[GPOUtils.deserializeInt(object, offset)];
String value = GPOUtils.deserializeString(object, offset);
fieldToType.put(value, type);
}
return new FieldsDescriptor(fieldToType);
}
示例3: deserializeLong
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method deserializes a long from the given byte array from the given offset,
* and increments the offset appropriately.
* @param buffer The byte buffer to deserialize from.
* @param offset The offset to deserialize from.
* @return The deserialized long.
*/
public static long deserializeLong(byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
long val = ((((long)buffer[0 + offsetInt]) & 0xFFL) << 56) |
((((long)buffer[1 + offsetInt]) & 0xFFL) << 48) |
((((long)buffer[2 + offsetInt]) & 0xFFL) << 40) |
((((long)buffer[3 + offsetInt]) & 0xFFL) << 32) |
((((long)buffer[4 + offsetInt]) & 0xFFL) << 24) |
((((long)buffer[5 + offsetInt]) & 0xFFL) << 16) |
((((long)buffer[6 + offsetInt]) & 0xFFL) << 8) |
(((long)buffer[7 + offsetInt]) & 0xFFL);
offset.add(Type.LONG.getByteSize());
return val;
}
示例4: deserializeDouble
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method deserializes a double from the given byte array from the given offset,
* and increments the offset appropriately.
* @param buffer The byte buffer to deserialize from.
* @param offset The offset to deserialize from.
* @return The deserialized double.
*/
public static double deserializeDouble(byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
long val = (((long)buffer[0 + offsetInt]) & 0xFFL) << 56 |
((((long)buffer[1 + offsetInt]) & 0xFFL) << 48) |
((((long)buffer[2 + offsetInt]) & 0xFFL) << 40) |
((((long)buffer[3 + offsetInt]) & 0xFFL) << 32) |
((((long)buffer[4 + offsetInt]) & 0xFFL) << 24) |
((((long)buffer[5 + offsetInt]) & 0xFFL) << 16) |
((((long)buffer[6 + offsetInt]) & 0xFFL) << 8) |
(((long)buffer[7 + offsetInt]) & 0xFFL);
offset.add(Type.DOUBLE.getByteSize());
return Double.longBitsToDouble(val);
}
示例5: serializeDouble
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method serializes the given double to the given byte buffer to the given offset,
* the method also increments the offset appropriately.
* @param valD The value to serialize.
* @param buffer The byte buffer to serialize to.
* @param offset The offset in the buffer to serialize to and also to increment appropriately.
*/
public static void serializeDouble(double valD, byte[] buffer, MutableInt offset)
{
long val = Double.doubleToLongBits(valD);
int offsetInt = offset.intValue();
buffer[0 + offsetInt] = (byte)((val >> 56) & 0xFFL);
buffer[1 + offsetInt] = (byte)((val >> 48) & 0xFFL);
buffer[2 + offsetInt] = (byte)((val >> 40) & 0xFFL);
buffer[3 + offsetInt] = (byte)((val >> 32) & 0xFFL);
buffer[4 + offsetInt] = (byte)((val >> 24) & 0xFFL);
buffer[5 + offsetInt] = (byte)((val >> 16) & 0xFFL);
buffer[6 + offsetInt] = (byte)((val >> 8) & 0xFFL);
buffer[7 + offsetInt] = (byte)(val & 0xFFL);
offset.add(Type.DOUBLE.getByteSize());
}
示例6: accept
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public boolean accept(RegexOccurrence occurrence) {
if(allowedChars == null)
return true;
int totalChars = 0;
int totalWords = 0;
int nbBadWords = 0;
MutableInt badChars = new MutableInt(0);
for(LabelledAnnotation a:occurrence.getLabelledAnnotations()) {
WordAnnotation w = (WordAnnotation) a.getAnnotation();
totalChars += w.getCoveredText().length();
totalWords += 1;
if(isBadWord(w, badChars))
nbBadWords +=1;
}
if(nbBadWords > 1)
return false;
if(totalChars <= totalWords*3 && totalWords > 1)
return false;
int badCharRate = 100*badChars.intValue()/totalChars;
if(badCharRate >= BAD_CHAR_RATE_THRESHOLD)
return false;
return true;
}
示例7: deserializeObject
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public synchronized Object deserializeObject(byte[] object, MutableInt offset)
{
int length = GPOUtils.deserializeInt(object, offset);
int startIndex = offset.intValue();
List<Object> listPrimitives = Lists.newArrayList();
while (startIndex + length > offset.intValue()) {
int typeOrdinal = GPOUtils.deserializeInt(object, offset);
GPOType gpoType = GPOType.GPO_TYPE_ARRAY[typeOrdinal];
Object primitive = gpoType.deserialize(object, offset);
listPrimitives.add(primitive);
}
return listPrimitives;
}
示例8: deserializeObject
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public synchronized Object deserializeObject(byte[] object, MutableInt offset)
{
int length = GPOUtils.deserializeInt(object, offset);
int startIndex = offset.intValue();
List<String> strings = Lists.newArrayList();
while (startIndex + length > offset.intValue()) {
String value = GPOUtils.deserializeString(object, offset);
strings.add(value);
}
return strings;
}
示例9: deserializeString
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method deserializes a string from the given byte array from the given offset,
* and increments the offset appropriately.
* @param buffer The byte buffer to deserialize from.
* @param offset The offset to deserialize from.
* @return The deserialized string.
*/
public static String deserializeString(byte[] buffer, MutableInt offset)
{
int length = deserializeInt(buffer, offset);
String val = new String(buffer, offset.intValue(), length);
offset.add(length);
return val;
}
示例10: serializeString
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method serializes the given string to the given byte buffer to the given offset,
* the method also increments the offset appropriately.
* @param val The value to serialize.
* @param buffer The byte buffer to serialize to.
* @param offset The offset in the buffer to serialize to and also to increment appropriately.
*/
public static void serializeString(String val, byte[] buffer, MutableInt offset)
{
byte[] stringBytes = val.getBytes();
int length = stringBytes.length;
serializeInt(length, buffer, offset);
for (int index = 0; index < length; index++) {
buffer[offset.intValue() + index] = stringBytes[index];
}
offset.add(length);
}
示例11: serializeLong
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method serializes the given long to the given byte buffer to the given offset,
* the method also increments the offset appropriately.
* @param val The value to serialize.
* @param buffer The byte buffer to serialize to.
* @param offset The offset in the buffer to serialize to and also to increment appropriately.
*/
public static void serializeLong(long val, byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
buffer[0 + offsetInt] = (byte)((val >> 56) & 0xFFL);
buffer[1 + offsetInt] = (byte)((val >> 48) & 0xFFL);
buffer[2 + offsetInt] = (byte)((val >> 40) & 0xFFL);
buffer[3 + offsetInt] = (byte)((val >> 32) & 0xFFL);
buffer[4 + offsetInt] = (byte)((val >> 24) & 0xFFL);
buffer[5 + offsetInt] = (byte)((val >> 16) & 0xFFL);
buffer[6 + offsetInt] = (byte)((val >> 8) & 0xFFL);
buffer[7 + offsetInt] = (byte)(val & 0xFFL);
offset.add(Type.LONG.getByteSize());
}
示例12: deserializeInt
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method deserializes an integer from the given byte array from the given offset,
* and increments the offset appropriately.
* @param buffer The byte buffer to deserialize from.
* @param offset The offset to deserialize from.
* @return The deserialized integer.
*/
public static int deserializeInt(byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
int val = ((((int)buffer[0 + offsetInt]) & 0xFF) << 24) |
((((int)buffer[1 + offsetInt]) & 0xFF) << 16) |
((((int)buffer[2 + offsetInt]) & 0xFF) << 8) |
(((int)buffer[3 + offsetInt]) & 0xFF);
offset.add(Type.INTEGER.getByteSize());
return val;
}
示例13: serializeInt
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method serializes the given integer to the given byte buffer to the given offset,
* the method also increments the offset appropriately.
* @param val The value to serialize.
* @param buffer The byte buffer to serialize to.
* @param offset The offset in the buffer to serialize to and also to increment appropriately.
*/
public static void serializeInt(int val, byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
buffer[0 + offsetInt] = (byte)((val >> 24) & 0xFF);
buffer[1 + offsetInt] = (byte)((val >> 16) & 0xFF);
buffer[2 + offsetInt] = (byte)((val >> 8) & 0xFF);
buffer[3 + offsetInt] = (byte)(val & 0xFF);
offset.add(Type.INTEGER.getByteSize());
}
示例14: deserializeFloat
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method deserializes a float from the given byte array from the given offset,
* and increments the offset appropriately.
* @param buffer The byte buffer to deserialize from.
* @param offset The offset to deserialize from.
* @return The deserialized float.
*/
public static float deserializeFloat(byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
int val = ((((int)buffer[0 + offsetInt]) & 0xFF) << 24) |
((((int)buffer[1 + offsetInt]) & 0xFF) << 16) |
((((int)buffer[2 + offsetInt]) & 0xFF) << 8) |
(((int)buffer[3 + offsetInt]) & 0xFF);
offset.add(Type.FLOAT.getByteSize());
return Float.intBitsToFloat(val);
}
示例15: serializeFloat
import org.apache.commons.lang3.mutable.MutableInt; //导入方法依赖的package包/类
/**
* This method serializes the given float to the given byte buffer to the given offset,
* the method also increments the offset appropriately.
* @param valf The value to serialize.
* @param buffer The byte buffer to serialize to.
* @param offset The offset in the buffer to serialize to and also to increment appropriately.
*/
public static void serializeFloat(float valf, byte[] buffer, MutableInt offset)
{
int offsetInt = offset.intValue();
int val = Float.floatToIntBits(valf);
buffer[0 + offsetInt] = (byte)((val >> 24) & 0xFF);
buffer[1 + offsetInt] = (byte)((val >> 16) & 0xFF);
buffer[2 + offsetInt] = (byte)((val >> 8) & 0xFF);
buffer[3 + offsetInt] = (byte)(val & 0xFF);
offset.add(Type.FLOAT.getByteSize());
}