Methods Summary |
---|
public static java.lang.String | getBitFieldFunction(java.lang.String name, java.lang.String bitMask, java.lang.String parentType, java.lang.String withType)
String type = getBitFieldType(name, bitMask, parentType);
String retVal = new String();
if(withType.equals("true"))
{
retVal = type + " ";
}
if(type.equals("boolean"))
{
retVal += "is" + getFieldName1stCap(name, 0);
}
else
{
retVal +="get" + getFieldName1stCap(name, 0);
}
return retVal;
|
public static java.lang.String | getBitFieldGet(java.lang.String name, java.lang.String bitMask, java.lang.String parentType, java.lang.String parentField)
String type = getBitFieldType(name, bitMask, parentType);
String retVal = null;
if(type.equals("boolean"))
retVal = name + ".isSet(" + parentField + ");";
else
retVal = "( " + type + " )" + name + ".getValue(" + parentField + ");";
return retVal;
|
public static java.lang.String | getBitFieldSet(java.lang.String name, java.lang.String bitMask, java.lang.String parentType, java.lang.String parentField)
String type = getBitFieldType(name, bitMask, parentType);
String retVal = null;
if(type.equals("boolean"))
retVal = "(" + parentType + ")" + getFieldName(name, 0) + ".setBoolean(" + parentField + ", value)";
else
retVal = "(" + parentType + ")" + getFieldName(name, 0) + ".setValue(" + parentField + ", value)";
return retVal;
|
public static java.lang.String | getBitFieldType(java.lang.String name, java.lang.String bitMask, java.lang.String parentType)
byte parentSize = 0;
byte numBits = 0;
int mask = (int)Long.parseLong(bitMask.substring(2), 16);
if (parentType.equals("byte"))
parentSize = 8;
else if (parentType.equals("short"))
parentSize = 16;
else if (parentType.equals("int"))
parentSize = 32;
for (int x = 0; x < parentSize; x++)
{
int temp = mask;
numBits += (temp >> x) & 0x1;
}
if(numBits == 1)
{
return "boolean";
}
else if (numBits < 8)
{
return "byte";
}
else if (numBits < 16)
{
return "short";
}
else
{
return "int";
}
|
public static java.lang.String | getType(java.lang.String size, java.lang.String type, int padTo)
return type;
|
public static java.lang.String | getType1stCap(java.lang.String size, java.lang.String type, int padTo)
StringBuffer result = new StringBuffer();
result.append(type);
result = pad(result, padTo);
result.setCharAt(0, Character.toUpperCase(result.charAt(0)));
return result.toString();
|