tesuji.games.go
Interface ByteArray

All Known Implementing Classes:
ByteArrayImpl

public interface ByteArray

Interface for defining an array for a Go program that can be used both as a 1-dimensional array and as a 2-dimensional array.

The rule is that the index in the 1-dimensional can be computed from the 2-dimensional array as follows:
xy = x+y*getWidth()

Notes:

  • The first point is the 1,1 point and not the 0,0 point.
  • The size of the 1-dimensional array is always at least getWidth()*(getWidth()+1)
  • For the moment these arrays are always considerad as read-only. Therefore the behaviour of getSingleArray()[0] = 1 is undefined.


  • Creation date: (19-May-01 12:58:15 PM)

    Product: Tesuji Software Go Library.

    Copyright (c) 2001 Tesuji Software B.V.
    All rights reserved.

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Except as contained in this notice, the name of a Tesuji Software shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of Tesuji Software.


    Method Summary
     byte get(int xy)
              Get an element from the array using a 1-dimensional coordinate.
     byte get(int x, int y)
              Get an element from the array using a 2-dimensional coordinate.
     int getBoardSize()
              Get the board-size for this array.
     byte[][] getDoubleArray()
              Get the array as a 2-dimensional array.
     byte[] getSingleArray()
              Get the array as a 1-dimensional array.
     int getWidth()
              Get the width that is used to do the coordinate conversion between 1-dimensional and 2-dimensional.
     

    Method Detail

    get

    public byte get(int xy)
    Get an element from the array using a 1-dimensional coordinate.

    get

    public byte get(int x,
                    int y)
    Get an element from the array using a 2-dimensional coordinate.

    getBoardSize

    public int getBoardSize()
    Get the board-size for this array.

    getDoubleArray

    public byte[][] getDoubleArray()
    Get the array as a 2-dimensional array.

    getSingleArray

    public byte[] getSingleArray()
    Get the array as a 1-dimensional array.

    getWidth

    public int getWidth()
    Get the width that is used to do the coordinate conversion between 1-dimensional and 2-dimensional.