From: Xuan B. <med...@us...> - 2008-01-23 19:33:04
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9142/src/org/tm4j/topicmap/tmdm/basic Modified Files: BasicOccurrence.java Log Message: Clarify Occurence.setDatatypeAndValue() and friends Index: BasicOccurrence.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic/BasicOccurrence.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicOccurrence.java 21 Jan 2008 20:00:26 -0000 1.2 --- BasicOccurrence.java 23 Jan 2008 19:33:05 -0000 1.3 *************** *** 18,22 **** String value; ! protected BasicOccurrence(BasicTopic parent,BasicTopic type,Locator datatype,String value) { this.parent = parent; this.type = type; --- 18,23 ---- String value; ! protected BasicOccurrence(BasicTopic parent,BasicTopic type,Locator datatype,String value,BasicScope scope) { ! super(scope); this.parent = parent; this.type = type; *************** *** 76,79 **** --- 77,95 ---- } + /** + Provide a shortcut to change the datatype and the value in one transaction. + This is to avoid cases where value unintentionally does not match the datatype + for a very brief time. + */ + public void setDatatypeAndValue(Locator datatype,String value) { + Locator oldDatatype = this.datatype; + String oldValue = this.value; + this.datatype = datatype; + this.value = value; + + // We do not treat cases where the old value equals the new value specially. + getEventListener().notifyOccurrenceDatatypeAndValueChanged(getContainingTopicMap(),getParent(),this,oldDatatype,oldValue,datatype,value); + } + @TMAPI public String getValue() { |