/* * [Hint.java] * * Summary: What we can infer about presence/absence of various strings in responses from stores. * * Copyright: (c) 2011-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2012-05-25 initial version */ package com.mindprod.stores; /** * What we can infer about presence/absence of various strings in responses from stores. * * @author Roedy Green, Canadian Mind Products * @version 1.1 2014-10-03 and CHOP_LEAD type of HINT to chop off lead chars from consideration. * @see Clue * @since 2012-05-25 */ public enum Hint { // instock present:absent | carries present:absent CHOP_TAIL( 0, 0, 0, 0 ) /* don't look at this string or later */, CHOP_LEAD( 0, 0, 0, 0 ) /* don't look at this string or earlier */, FREEZE( 0, 0, 0, 0 ) /* something has gone wrong. Don't change the value */, IN( 1, 0, 1, 0 ) /* book probably in stock */, IN2( 2, 0, 2, 0 ) /* book very probably in stock */, IN3( 3, 0, 3, 0 ) /* book definitely in stock */, LISTED( 0, 0, 1, 0 ) /* indicator store carries this, but not necessarily in stock */, MUST( 1, -1, 1, 0 ) /* must have this to be in stock */, MUST2( 2, -2, 2, 0 ) /* must have this to be in stock */, MUST3( 3, -3, 3, 0 ) /* must have this to be in stock */, MUST4( 4, -4, 4, 0 ) /* must have this to be in stock */, MUST5( 5, -5, 5, 0 ) /* must have this to be in stock */, NA( -1, 0, 0, 0 ) /* not available, but we don't know if because out of stock or not listed */, NEWER( 0, 0, 0, 0 ) /* there is a newer version available */, OUT( -1, 0, 1, 0 ) /* book probably out of stock */, OUT2( -2, 0, 1, 0 ) /* book very probably out of stock */, OUT3( -3, 0, 1, 0 ) /* book definitely out of stock */, OUT4( -4, 0, 1, 0 ) /* book definitely out of stock */, OUT5( -5, 0, 1, 0 ) /* book definitely out of stock */, REFUSED( 0, 0, 0, 0 ) /* store is refusing probes. Treat like other refusals */, UNLISTED( -1, 0, -1, 0 ) /* indicator this product is not listed, not carried. ProductStatus.NOTCARRIED */, UNLISTED2( -2, 0, -2, 0 ) /* indicator this product is not listed, not carried. ProductStatus.NOTCARRIED */; /** * weight indicating in stock of corresponding string absent */ private final int carryWeightIfAbsent; /** * weight indicating in stock of corresponding string present */ private final int carryWeightIfPresent; /** * weight indicating in stock of corresponding string absent */ private final int inStockWeightIfAbsent; /** * weight indicating in stock of corresponding string present */ private final int inStockWeightIfPresent; /** * Constructor * * @param inStockWeightIfPresent weight indicating in stock of corresponding string present * @param inStockWeightIfAbsent weight indicating in stock of corresponding string absent * @param carryWeightIfPresent weight indicating carry of corresponding string present * @param carryWeightIfAbsent weight indicating carry of corresponding string absent */ Hint( final int inStockWeightIfPresent, final int inStockWeightIfAbsent, final int carryWeightIfPresent, final int carryWeightIfAbsent ) { this.inStockWeightIfPresent = inStockWeightIfPresent; this.inStockWeightIfAbsent = inStockWeightIfAbsent; this.carryWeightIfPresent = carryWeightIfPresent; this.carryWeightIfAbsent = carryWeightIfAbsent; } /** * get weight indicating carry of corresponding string absent * * @return weight */ public synchronized int getCarryWeightIfAbsent() { return this.carryWeightIfAbsent; } /** * get weight indicating carry of corresponding string present * * @return weight */ public synchronized int getCarryWeightIfPresent() { return this.carryWeightIfPresent; } /** * get weight indicating in stock of corresponding string absent * * @return weight */ public synchronized int getInStockWeightIfAbsent() { return this.inStockWeightIfAbsent; } /** * get weight indicating in stock of corresponding string present * * @return weight */ public synchronized int getInStockWeightIfPresent() { return this.inStockWeightIfPresent; } }