project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/NativeSizeT.java
author koda
Tue, 21 Jan 2014 22:43:06 +0100
changeset 10017 de822cd3df3a
parent 7584 7831c84cc644
permissions -rw-r--r--
fixwhitespace and dos2unix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     1
/*
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     2
 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     4
 *
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     5
 * This program is free software; you can redistribute it and/or
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     6
 * modify it under the terms of the GNU General Public License
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     8
 * of the License, or (at your option) any later version.
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
     9
 *
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    13
 * GNU General Public License for more details.
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    14
 *
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    15
 * You should have received a copy of the GNU General Public License
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    16
 * along with this program; if not, write to the Free Software
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    18
 */
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7558
diff changeset
    19
7558
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
package org.hedgewars.hedgeroid.frontlib;
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
/**
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
 * This class represents the native C type size_t. On Android, this type could be mapped with int,
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
 * but we use a separate type to make it easier to adapt for other platforms if anyone wants to use
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    25
 * the mappings elsewhere.
7558
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
 */
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
public final class NativeSizeT extends Number {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    28
    private static final long serialVersionUID = 1L;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    29
    private final long value;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    30
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    31
    private NativeSizeT(long value) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    32
        this.value = value;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    33
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    34
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    35
    public static NativeSizeT valueOf(long l) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    36
        return new NativeSizeT(l);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    37
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    38
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    39
    @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    40
    public int intValue() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    41
        return (int)value;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    42
    }
7558
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    44
    @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    45
    public long longValue() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    46
        return value;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    47
    }
7558
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    49
    @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    50
    public double doubleValue() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    51
        return value;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    52
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    53
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    54
    @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    55
    public float floatValue() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    56
        return value;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7584
diff changeset
    57
    }
7558
983ff426f91e Hedgeroid: Fixed JNA mapping of size_t
Medo <smaxein@googlemail.com>
parents:
diff changeset
    58
}