home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)mtproperty.tcl /main/titanic/3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)mtproperty.tcl /main/titanic/3 29 Aug 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "mergeobjec.tcl"
-
- Class MTProperty : {MergeObject} {
- constructor
- method destructor
- method hasConflict
- method getInfo
- method merge
- method import
- method copy
- method overwrite
- attribute baseValue
- }
-
- constructor MTProperty {class this name fromRepObj toRepObj} {
- set this [MergeObject::constructor $class $this $name $fromRepObj $toRepObj]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method MTProperty::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this MergeObject::destructor
- }
-
- method MTProperty::hasConflict {this} {
-
- set to [$this toRepObj]
-
- # check if 'to' element does not exist
- if {$to == ""} {
- return 0
- }
-
- # if 'to' value == 'base' value
- set toValue [[$this toRepObj] value]
- if {[$this baseValue] == $toValue} {
- return 0
- }
-
- # now it's clear there's a conflict
- return 1
- }
-
- method MTProperty::getInfo {this} {
-
- # show the values
- lappend info "Source value"
- lappend info [[$this fromRepObj] value]
- if {[$this toRepObj] != ""} {
- lappend info "Target value"
- lappend info [[$this toRepObj] value]
- }
- return $info
- }
-
- method MTProperty::merge {this} {
-
- if ![$this hasConflict] {
- return [$this copy]
- }
-
- # conflicting properties can not be merged (automaticly)
- return 0
-
- }
-
- method MTProperty::import {this} {
-
- return [$this copy]
- }
-
- method MTProperty::copy {this} {
-
- set parentObj [MTProcs::makeToWorking [$this parent]]
-
- if {$parentObj == ""} {
- return 0
- }
-
- set name [[$this fromRepObj] name]
- set value [[$this fromRepObj] value]
- # set property in the PropertyObject
- if [[$this fromRepObj] isA MTItemPropRepObj] {
-
- # search the item in the target
- set item [[[$this fromRepObj] item] item]
- set toWorkItem [$parentObj findDeclaration $item \
- [.main toConfig]]
-
- if [$toWorkItem isNil] {
- return 0
- }
- $toWorkItem setProperty $name $value
- } else {
- $parentObj setProperty $name $value
- }
- return 1
- }
-
- method MTProperty::overwrite {this} {
-
- return [$this copy]
- }
-
- # Do not delete this line -- regeneration end marker
-
-