How to Identify Whether Quote Is Duplicated, Revised or New

This artictle shows how to identify whether a quote is duplicated or revised or new in a quote header logic. 

def version = quoteProcessor.getQuoteView().version

def prevRev = quoteProcessor.getQuoteView().prevRev

New quote
version != null or (version == 3 && prevRev == null)

prevRev != null

Duplicated quote
version != null and version != 1 and version != 3