1 package com.thaiopensource.validate.nrl; 2 3 import com.thaiopensource.validate.Schema; 4 import com.thaiopensource.validate.nrl.Mode; 5 import com.thaiopensource.validate.nrl.ModeUsage; 6 import com.thaiopensource.validate.nrl.NoResultAction; 7 import com.thaiopensource.validate.nrl.SectionState; 8 import org.xml.sax.SAXException ; 9 10 class ValidateAction extends NoResultAction { 11 private final Schema schema; 12 13 ValidateAction(ModeUsage modeUsage, Schema schema) { 14 super(modeUsage); 15 this.schema = schema; 16 } 17 18 void perform(SectionState state) throws SAXException { 19 state.addValidator(schema, getModeUsage()); 20 } 21 22 NoResultAction changeCurrentMode(Mode mode) { 23 return new ValidateAction(getModeUsage().changeCurrentMode(mode), schema); 24 } 25 26 public boolean equals(Object obj) { 27 return super.equals(obj) && schema.equals(((ValidateAction)obj).schema); 28 } 29 30 public int hashCode() { 31 return super.hashCode() ^ schema.hashCode(); 32 } 33 } 34 | Popular Tags |