public fUML.Semantics.Activities.IntermediateActivities.TokenList takeOfferedTokens( int maxCount) { // Take all the offered tokens, up to the given maximum count of // non-null object tokens, and return them. TokenList tokens = new TokenList(); int remainingCount = maxCount; while (this.offers.size() > 0 & remainingCount > 0) { Offer offer = this.offers.getValue(0); TokenList offeredTokens = offer.getOfferedTokens(); int count = offer.countOfferedValues(); if (count <= remainingCount) { for (int i = 0; i < offeredTokens.size(); i++) { tokens.addValue(offeredTokens.getValue(i)); } remainingCount = remainingCount - count; this.offers.removeValue(0); } else { for (int i = 0; i < remainingCount; i++) { Token token = offeredTokens.getValue(i); if (token.getValue() != null) { tokens.addValue(token); } } offer.removeOfferedValues(remainingCount); remainingCount = 0; } } return tokens; } // takeOfferedTokens
public fUML.Semantics.Activities.IntermediateActivities.TokenList takeOfferedTokens() { // Take all the offered tokens and return them. TokenList tokens = new TokenList(); while (this.offers.size() > 0) { TokenList offeredTokens = this.offers.getValue(0).getOfferedTokens(); for (int i = 0; i < offeredTokens.size(); i++) { tokens.addValue(offeredTokens.getValue(i)); } this.offers.removeValue(0); } return tokens; } // takeOfferedTokens
public fUML.Semantics.Activities.IntermediateActivities.TokenList getOfferedTokens() { // Get the offered tokens (after which the tokens will still be // offered). TokenList tokens = new TokenList(); OfferList offers = this.offers; for (int i = 0; i < offers.size(); i++) { TokenList offeredTokens = offers.getValue(i).getOfferedTokens(); for (int j = 0; j < offeredTokens.size(); j++) { tokens.addValue(offeredTokens.getValue(j)); } } return tokens; } // getOfferedTokens