package com.paritytrading.parity.fix;

import static com.paritytrading.philadelphia.fix44.FIX44Enumerations.*;

class Order {

    private long   orderEntryId;
    private long   orderId;
    private String nextClOrdId;
    private String clOrdId;
    private String origClOrdId;
    private char   ordStatus;
    private String account;
    private char   side;
    private String symbol;
    private double orderQty;
    private double cumQty;
    private double avgPx;
    private char   cxlRejResponseTo;

    Order(long orderEntryId, String clOrdId, String account, char side,
            String symbol, double orderQty) {
        this.orderEntryId     = orderEntryId;
        this.orderId          = 0;
        this.nextClOrdId      = null;
        this.clOrdId          = clOrdId;
        this.origClOrdId      = null;
        this.ordStatus        = OrdStatusValues.New;
        this.account          = null;
        this.side             = side;
        this.symbol           = symbol;
        this.orderQty         = orderQty;
        this.cumQty           = 0;
        this.avgPx            = 0.0;
        this.cxlRejResponseTo = CxlRejResponseToValues.OrderCancelRequest;
    }

    void orderAccepted(long orderNumber) {
        orderId = orderNumber;
    }

    void orderExecuted(double quantity, double price) {
        avgPx = (cumQty * avgPx + quantity * price) / (cumQty + quantity);

        cumQty += quantity;

        ordStatus = getLeavesQty() == 0 ? OrdStatusValues.Filled : OrdStatusValues.PartiallyFilled;
    }

    void orderCanceled(double canceledQuantity) {
        orderQty -= canceledQuantity;

        origClOrdId = clOrdId;

        clOrdId = nextClOrdId;

        nextClOrdId = null;
    }

    long getOrderEntryID() {
        return orderEntryId;
    }

    long getOrderID() {
        return orderId;
    }

    String getClOrdID() {
        return clOrdId;
    }

    String getOrigClOrdID() {
        return origClOrdId;
    }

    void setNextClOrdID(String nextClOrdId) {
        this.nextClOrdId = nextClOrdId;
    }

    String getNextClOrdID() {
        return nextClOrdId;
    }

    char getOrdStatus() {
        return ordStatus;
    }

    String getAccount() {
        return account;
    }

    char getSide() {
        return side;
    }

    String getSymbol() {
        return symbol;
    }

    double getOrderQty() {
        return orderQty;
    }

    double getCumQty() {
        return cumQty;
    }

    double getLeavesQty() {
        return orderQty - cumQty;
    }

    double getAvgPx() {
        return avgPx;
    }

    void setCxlRejResponseTo(char cxlRejResponseTo) {
        this.cxlRejResponseTo = cxlRejResponseTo;
    }

    char getCxlRejResponseTo() {
        return cxlRejResponseTo;
    }

    boolean isInPendingStatus() {
        return nextClOrdId != null;
    }

}

@@ -124,32 +124,38 @@
  %7B%0A%0A    private 
+final 
 long   orderEntr
@@ -171,16 +171,22 @@
 private 
+      
 long   o
@@ -201,24 +201,30 @@
     private 
+      
 String nextC
@@ -239,24 +239,30 @@
     private 
+      
 String clOrd
@@ -273,24 +273,30 @@
     private 
+      
 String origC
@@ -311,24 +311,30 @@
     private 
+      
 char   ordSt
@@ -347,24 +347,30 @@
     private 
+final 
 String accou
@@ -381,24 +381,30 @@
     private 
+final 
 char   side;
@@ -416,16 +416,22 @@
 private 
+final 
 String s
@@ -445,24 +445,30 @@
     private 
+      
 double order
@@ -480,24 +480,30 @@
     private 
+      
 double cumQt
@@ -517,16 +517,22 @@
 private 
+      
 double a
@@ -549,16 +549,22 @@
 private 
+      
 char   c

Use 'final' modifier in 'Order'