I have an assignment which says that I need to create an queue class with instruction messages on it.
and instruction message is formed of following properties
-----------
>InstructionType integer
> ProductCode integer
> Quantity integer
> UOM byte
--------------------------------
Can I declare all the above given properties as variables and then pass it as a parameter in a function created for instruction message and place it in the instruction queue class. Can anyone give me a sample code for proceeding with this..and let me know if I think right or any other methodologies. Can be done? please help.
任何人都可以建议,如果是对的。我可以这样使用:
public class instructionqueue { LinkedList queue = new LinkedList() /* 如何从队列类中添加、检索和删除指令消息 */ } 其中指令消息是一个类
public class Instructionmessage
{
public int Instructiontype;
public Integer Productcode;
public Integer quantity;
public byte[] UOM = new byte[256];
public Integer Timestamp;
/*method to set and get the instruction type for the messages*/
public int getInstructiontype()
{
return Instructiontype;
}
public void setInstructiontype(int newInstructtype)
{
Instructiontype = newInstructtype;
}
/*method to set and get the product code for the messages*/
public int getProductcode()
{
return Productcode;
}
public void setProductCode(int newproductcode)
{
Productcode = newproductcode;
}
/*method to set and get the quantity for the messages*/
public int getquantity()
{
return quantity;
}
public void setquantity(int newquantity)
{
quantity = newquantity;
}
/*method to set and get the Timestamp for the messages*/
public int getTimestamp ()
{
return Timestamp;
}
public void setTimestamp(int newTimestamp)
{
Timestamp = newTimestamp;
}
/*method to set and get the UOM for the messages*/
public byte[] getUOM()
{
return UOM;
}
public void setUOM(byte[] newUOM)
{
UOM = newUOM;
}
}