1 package org.catacomb.druid.market; 2 3 import org.catacomb.interlish.structure.Consumer; 4 import org.catacomb.interlish.structure.Dependent; 5 import org.catacomb.interlish.structure.OptionsUser; 6 import org.catacomb.report.E; 7 8 9 10 public class ConsumerAgent implements Dependent { 11 12 Consumer consumer; 13 String modality; 14 String item; 15 16 17 public ConsumerAgent(Consumer c, String mod, String sit) { 18 consumer = c; 19 modality = mod; 20 item = sit; 21 22 } 23 24 25 public String getModality() { 26 return modality; 27 } 28 29 public String getInterestedIn() { 30 return item; 31 } 32 33 34 public void newValue(Object obj) { 35 if (modality.equals("ChoiceOptions") && 36 (consumer instanceof OptionsUser) && 37 obj instanceof String[]) { 38 39 ((OptionsUser)consumer).setOptions((String[])obj); 40 41 42 } else { 43 E.missing(" consumer=" + consumer + "\n modality=" + modality + "\n item=" + item + 44 "\n value=" + obj); 45 } 46 } 47 48 49 }