Skip to content

Commit

Permalink
Add isPending to OrderStatus
Browse files Browse the repository at this point in the history
git-svn-id: https://source.marketcetera.org/root/trunk@17276 501a4a96-914b-0410-8454-f5988a4ca596
  • Loading branch information
colin committed Sep 25, 2016
1 parent 51c78fb commit 48fbe02
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/main/java/org/marketcetera/trade/OrderStatus.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.marketcetera.trade;

import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.marketcetera.quickfix.FIXMessageUtil;
import org.marketcetera.util.misc.ClassVersion;
Expand Down Expand Up @@ -46,6 +48,15 @@ public boolean isCancellable()
{
return FIXMessageUtil.isCancellable(getFIXValue());
}
/**
* Indicate if the order status is pending or not.
*
* @return a <code>boolean</code> value
*/
public boolean isPending()
{
return pendingOrderStatusValues.contains(this);
}
/**
* The FIX char value for this instance.
*
Expand Down Expand Up @@ -80,6 +91,7 @@ private OrderStatus(char inFIXValue) {
}
private final char mFIXValue;
private static final Map<Character, OrderStatus> mFIXValueTable;
private static final Set<OrderStatus> pendingOrderStatusValues = EnumSet.of(PendingCancel,PendingNew,PendingReplace);
static {
Map<Character, OrderStatus> table = new HashMap<Character, OrderStatus>();
for(OrderStatus status: values()) {
Expand Down

0 comments on commit 48fbe02

Please sign in to comment.