1 // Created on: 1992-11-05
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <Units_ShiftedToken.ixx>
24 #include <TCollection_AsciiString.hxx>
28 //=======================================================================
29 //function : Units_ShiftedToken
31 //=======================================================================
33 Units_ShiftedToken::Units_ShiftedToken(const Standard_CString aword,
34 const Standard_CString amean,
35 const Standard_Real avalue,
36 const Standard_Real amove,
37 const Handle(Units_Dimensions)& adimensions)
38 : Units_Token(aword,amean,avalue,adimensions)
42 cout << " CREATES ShiftedToken " << endl;
47 //=======================================================================
50 //=======================================================================
52 Handle(Units_Token) Units_ShiftedToken::Creates() const
54 TCollection_AsciiString word = Word();
55 TCollection_AsciiString mean = Mean();
56 return new Units_ShiftedToken(word.ToCString(),mean.ToCString(),Value(),Move(),Dimensions());
59 //=======================================================================
62 //=======================================================================
64 Standard_Real Units_ShiftedToken::Move() const
69 //=======================================================================
70 //function : Multiplied
72 //=======================================================================
74 Standard_Real Units_ShiftedToken::Multiplied (const Standard_Real avalue) const
76 return (avalue + themove) * Value();
79 //=======================================================================
82 //=======================================================================
84 Standard_Real Units_ShiftedToken::Divided (const Standard_Real avalue) const
86 return (avalue / Value()) - themove;
89 //=======================================================================
92 //=======================================================================
94 void Units_ShiftedToken::Dump(const Standard_Integer ashift,
95 const Standard_Integer alevel) const
97 Units_Token::Dump(ashift,alevel);
98 for(int i=0; i<ashift; i++)cout<<" ";
99 cout<<" move : "<<themove<<endl;
102 void Units_ShiftedToken::Destroy () {
105 cout << " DESTROIES ShiftedToken " << endl;