1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the Cobweb Project.
*
* Cobweb is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* Cobweb is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with Cobweb. If not, see <http://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
define ([
"jquery",
"cobweb/Basic/X3DField",
"cobweb/Bits/X3DConstants",
],
function ($, X3DField, X3DConstants)
{
"use strict";
function SFInt32 (value)
{
if (this instanceof SFInt32)
return X3DField .call (this, ~~value);
return X3DField .call (Object .create (SFInt32 .prototype), ~~value);
}
SFInt32 .prototype = $.extend (Object .create (X3DField .prototype),
{
constructor: SFInt32,
copy: function ()
{
return new SFInt32 (this .getValue ());
},
getTypeName: function ()
{
return "SFInt32";
},
getType: function ()
{
return X3DConstants .SFInt32;
},
isDefaultValue: function ()
{
return this .getValue () === 0;
},
set: function (value)
{
X3DField .prototype .set .call (this, ~~value);
},
valueOf: X3DField .prototype .getValue,
toString: function (base)
{
return this .getValue () .toString (base);
},
toXMLStream: function (stream)
{
stream .string += this .getValue () .toString ();
},
});
return SFInt32;
});
|