repo
stringlengths 1
191
⌀ | file
stringlengths 23
351
| code
stringlengths 0
5.32M
| file_length
int64 0
5.32M
| avg_line_length
float64 0
2.9k
| max_line_length
int64 0
288k
| extension_type
stringclasses 1
value |
---|---|---|---|---|---|---|
Ludii | Ludii-master/Core/src/metadata/graphics/board/shape/BoardShape.java | package metadata.graphics.board.shape;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import game.types.board.ShapeType;
import metadata.graphics.GraphicsItem;
/**
* Sets the shape of the board.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the board's design (e.g. Mancala).
*/
@Hide
public class BoardShape implements GraphicsItem
{
/** Board shape. */
private final ShapeType shape;
//-------------------------------------------------------------------------
/**
* @param shape The shape of the board.
*/
public BoardShape
(
final ShapeType shape
)
{
this.shape = shape;
}
//-------------------------------------------------------------------------
/**
* @return The board's shape.
*/
public ShapeType shape()
{
return shape;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,226 | 16.782609 | 107 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/board/style/BoardStyle.java | package metadata.graphics.board.style;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.equipment.container.board.custom.MancalaBoard;
import game.types.board.StoreType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.ContainerStyleType;
import other.concept.Concept;
/**
* Sets the style of the board.
*
* @author Matthew.Stephenson
*/
@Hide
public class BoardStyle implements GraphicsItem
{
/** Container style to apply. */
private final ContainerStyleType containerStyleType;
/** Don't draw any components, and fill their cells instead. */
private final Boolean replaceComponentsWithFilledCells;
//-------------------------------------------------------------------------
/**
* @param containerStyleType Container style wanted for the board.
* @param replaceComponentsWithFilledCells True if cells should be filled instead of component drawn [False].
*/
public BoardStyle
(
final ContainerStyleType containerStyleType,
@Opt @Name final Boolean replaceComponentsWithFilledCells
)
{
this.containerStyleType = containerStyleType;
this.replaceComponentsWithFilledCells = replaceComponentsWithFilledCells == null ? Boolean.FALSE : replaceComponentsWithFilledCells;
}
//-------------------------------------------------------------------------
/**
* @return ComponentStyleType to apply onto component.
*/
public ContainerStyleType containerStyleType()
{
return containerStyleType;
}
/**
* @return True if cells should be filled instead of component drawn.
*/
public boolean replaceComponentsWithFilledCells()
{
return replaceComponentsWithFilledCells.booleanValue();
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
if (containerStyleType.equals(ContainerStyleType.Chess))
concepts.set(Concept.ChessStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Go))
concepts.set(Concept.GoStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Mancala))
{
concepts.set(Concept.MancalaStyle.id(), true);
concepts.set(Concept.MancalaBoard.id(), true);
if (game.board() instanceof MancalaBoard)
{
final MancalaBoard mancalaBoard = (MancalaBoard) game.board();
final int numRows = mancalaBoard.numRows();
final StoreType storeType = mancalaBoard.storeType();
if (!storeType.equals(StoreType.None))
concepts.set(Concept.MancalaStores.id(), true);
if (numRows == 2)
concepts.set(Concept.MancalaTwoRows.id(), true);
else if (numRows == 3)
concepts.set(Concept.MancalaThreeRows.id(), true);
else if (numRows == 4)
concepts.set(Concept.MancalaFourRows.id(), true);
else if (numRows == 6)
concepts.set(Concept.MancalaSixRows.id(), true);
concepts.set(Concept.Sow.id(), true);
}
else
{
final boolean circleTiling = game.booleanConcepts().get(Concept.CircleTiling.id());
if (circleTiling)
concepts.set(Concept.MancalaCircular.id(), true);
}
}
else if (containerStyleType.equals(ContainerStyleType.PenAndPaper))
concepts.set(Concept.PenAndPaperStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Shibumi))
concepts.set(Concept.ShibumiStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Backgammon))
concepts.set(Concept.BackgammonStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Janggi))
concepts.set(Concept.JanggiStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Xiangqi))
concepts.set(Concept.XiangqiStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Shogi))
concepts.set(Concept.ShogiStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Table))
concepts.set(Concept.TableStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Surakarta))
concepts.set(Concept.SurakartaStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Tafl))
concepts.set(Concept.TaflStyle.id(), true);
else if (containerStyleType.equals(ContainerStyleType.Graph))
concepts.set(Concept.GraphStyle.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 4,540 | 30.978873 | 134 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/board/styleThickness/BoardStyleThickness.java | package metadata.graphics.board.styleThickness;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.BoardGraphicsType;
/**
* Sets the preferred scale for the thickness of a specific aspect of the board.
*
* @author Matthew.Stephenson
*
* @remarks Different aspects of the board that can be specified are defined in BoardGraphicsType (must be InnerEdge, OuterEdge or Vertex).
*/
@Hide
public class BoardStyleThickness implements GraphicsItem
{
/** boardGraphicsType to set the thickness of (must be InnerEdge or OuterEdge). */
private final BoardGraphicsType boardGraphicsType;
/** Thickness scale. */
private final float thickness;
//-------------------------------------------------------------------------
/**
* @param boardGraphicsType The board graphics type to which the colour is to be applied (must be InnerEdge or OuterEdge).
* @param thickness The assigned thickness scale for the specified boardGraphicsType.
*
* @example (board StyleThickness OuterEdges 2.0)
*/
public BoardStyleThickness
(
final BoardGraphicsType boardGraphicsType,
final Float thickness
)
{
this.boardGraphicsType = boardGraphicsType;
this.thickness = thickness.floatValue();
}
//-------------------------------------------------------------------------
/**
* @return BoardGraphicsType that the scale is applied to.
*/
public BoardGraphicsType boardGraphicsType()
{
return boardGraphicsType;
}
//-------------------------------------------------------------------------
/**
* @return Thickness scale to apply onto the specified boardGraphicsType.
*/
public float thickness()
{
return thickness;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 2,128 | 23.755814 | 139 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/hand/Hand.java | package metadata.graphics.hand;
import java.util.BitSet;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.hand.placement.HandPlacement;
/**
* Sets a graphic data to the hand.
*
* @author Matthew.Stephenson
*/
public class Hand implements GraphicsItem
{
/**
* For setting the placement of the hand.
*
* @param HandPlacementType The type of data.
* @param player Roletype owner of the hand.
* @param scale Scale for the board.
* @param offsetX Offset distance percentage to push the board to the right.
* @param offsetY Offset distance percentage to push the board down.
* @param vertical If the hand should be drawn vertically.
*
* @example (hand Placement P1 scale:1.0 offsetX:0.5 offsetY:0.5 vertical:True)
*/
@SuppressWarnings("javadoc")
public static GraphicsItem construct
(
final HandPlacementType handType,
final RoleType player,
@Opt @Name final Float scale,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY,
@Opt @Name final Boolean vertical
)
{
switch (handType)
{
case Placement:
return new HandPlacement(player, scale, offsetX, offsetY, vertical);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("hand(): A HandPlacementType is not implemented.");
}
//-------------------------------------------------------------------------------
private Hand()
{
// Ensure that compiler does not pick up default constructor
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
throw new UnsupportedOperationException("Hand.concepts(...): Should never be called directly.");
}
@Override
public long gameFlags(final Game game)
{
throw new UnsupportedOperationException("Hand.gameFlags(...): Should never be called directly.");
}
@Override
public boolean needRedraw()
{
throw new UnsupportedOperationException("Hand.gameFlags(...): Should never be called directly.");
}
}
| 2,173 | 25.839506 | 99 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/hand/HandPlacementType.java | package metadata.graphics.hand;
/**
* Defines the types of Board metadata related to the placement.
*
* @author Matthew.Stephenson
*/
public enum HandPlacementType
{
/** To set the placement of the hand. */
Placement,
} | 227 | 18 | 64 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/hand/package-info.java | /**
* The {\tt (hand ...)} `super' metadata ludeme is used modify a graphic
* property of a hand.
*/
package metadata.graphics.hand;
| 136 | 21.833333 | 72 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/hand/placement/HandPlacement.java | package metadata.graphics.hand.placement;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Changes the placement of the hands
*
* @author Matthew.Stephenson
*/
@Hide
public class HandPlacement implements GraphicsItem
{
/** The owner of the hand. */
private final RoleType player;
/** Scale of hand. */
private final float scale;
/** Offset right for hand. */
private final float offsetX;
/** Offset down for hand. */
private final float offsetY;
/** If the hand should be drawn vertically. */
private final boolean vertical;
//-------------------------------------------------------------------------
/**
* @param player Roletype owner of the hand.
* @param scale Scale for the board [1.0].
* @param offsetX Offset distance percentage to push the board to the right [0].
* @param offsetY Offset distance percentage to push the board down [0].
* @param vertical If the hand should be drawn vertically [False].
*/
public HandPlacement
(
final RoleType player,
@Opt @Name final Float scale,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY,
@Opt @Name final Boolean vertical
)
{
this.player = player;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.offsetX = (offsetX == null) ? 0 : offsetX.floatValue();
this.offsetY = (offsetY == null) ? 0 : offsetY.floatValue();
this.vertical = (vertical == null) ? false : vertical.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return Scale of board.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Offset right for board.
*/
public float offsetX()
{
return offsetX;
}
//-------------------------------------------------------------------------
/**
* @return Offset down for board.
*/
public float offsetY()
{
return offsetY;
}
//-------------------------------------------------------------------------
/**
* @return If the hand should be drawn vertically.
*/
public boolean isVertical()
{
return vertical;
}
//-------------------------------------------------------------------------
/**
* @return The owner of the hand.
*/
public RoleType getPlayer()
{
return player;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 2,861 | 20.358209 | 87 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/No.java | package metadata.graphics.no;
import java.util.BitSet;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
import metadata.graphics.no.Boolean.NoAnimation;
import metadata.graphics.no.Boolean.NoBoard;
import metadata.graphics.no.Boolean.NoCurves;
import metadata.graphics.no.Boolean.NoDicePips;
import metadata.graphics.no.Boolean.NoSunken;
/**
* Hides a graphic element.
*
* @author Eric.Piette
*/
@SuppressWarnings("javadoc")
public class No implements GraphicsItem
{
/**
* @param boardType The type of data.
* @param value True if the graphic data has to be hidden [True].
*
* @example (no Board)
* @example (no Animation)
* @example (no Curves)
*/
public static GraphicsItem construct
(
final NoBooleanType boardType,
@Opt final Boolean value
)
{
switch (boardType)
{
case Board:
return new NoBoard(value);
case Animation:
return new NoAnimation(value);
case Sunken:
return new NoSunken(value);
case DicePips:
return new NoDicePips(value);
case Curves:
return new NoCurves(value);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("No(): A NoBooleanType is not implemented.");
}
//-------------------------------------------------------------------------------
private No()
{
// Ensure that compiler does not pick up default constructor
}
//-------------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
throw new UnsupportedOperationException("No.concepts(...): Should never be called directly.");
}
@Override
public long gameFlags(final Game game)
{
throw new UnsupportedOperationException("No.gameFlags(...): Should never be called directly.");
}
@Override
public boolean needRedraw()
{
throw new UnsupportedOperationException("No.gameFlags(...): Should never be called directly.");
}
}
| 1,972 | 22.771084 | 97 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/NoBooleanType.java | package metadata.graphics.no;
/**
* Defines the types of Hide metadata depending only of a boolean.
*
* @author Eric.Piette
*/
public enum NoBooleanType
{
/** To indicate whether the board should be hidden. */
Board,
/** To indicate whether the animations should be hidden. */
Animation,
/** To indicate whether the sunken outline should be drawn. */
Sunken,
/** To indicate whether pieces drawn in the hand should be scaled or not. */
HandScale,
/** To indicate if the lines that make up the board's rings should be drawn as straight lines. */
Curves,
/** To indicate if the colour of the masked players should not be the colour of the player. */
MaskedColour,
/** To indicate if pips on the dice should be always drawn as a single number. */
DicePips,
}
| 786 | 24.387097 | 98 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/package-info.java | /**
* The {\tt (no ...)} `super' metadata ludeme is used to not show a graphic
* property.
*/
package metadata.graphics.no;
| 127 | 20.333333 | 75 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/Boolean/NoAnimation.java | package metadata.graphics.no.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the movement animation should be disabled.
*
* @author Matthew.Stephenson
*
* @remarks Should be used in cases where specific BoardStyles or rule combinations
* may cause incorrect animations.
*/
@Hide
public class NoAnimation implements GraphicsItem
{
/** If animations are disabled. */
private final boolean noAnimation;
//-------------------------------------------------------------------------
/**
* @param noAnimation Whether animations are disabled or not [True].
*
* @example (noAnimation)
*/
public NoAnimation
(
@Opt final Boolean noAnimation
)
{
this.noAnimation = (noAnimation == null) ? true : noAnimation.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If animations are disabled.
*/
public boolean noAnimation()
{
return noAnimation;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,436 | 18.958333 | 84 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/Boolean/NoBoard.java | package metadata.graphics.no.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
import other.concept.Concept;
/**
* Indicates whether the board should be hidden.
*
* @author Matthew.Stephenson
*
* @remarks Useful in card and hand games which have no physical board.
*/
@Hide
public class NoBoard implements GraphicsItem
{
/** If the board should be hidden. */
private final boolean boardHidden;
//-------------------------------------------------------------------------
/**
* @param boardHidden Whether the board should be hidden or not [True].
*/
public NoBoard
(
@Opt final Boolean boardHidden
)
{
this.boardHidden = (boardHidden == null) ? true : boardHidden.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the board should be hidden.
*/
public boolean boardHidden()
{
return boardHidden;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
concepts.set(Concept.NoBoard.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,407 | 18.830986 | 79 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/Boolean/NoCurves.java | package metadata.graphics.no.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates if the lines that make up the board's rings should be drawn as straight lines.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the board's design, e.g. Wheel.
*/
@Hide
public class NoCurves implements GraphicsItem
{
/** If rings on the board should be drawn straight rather than curved. */
private final boolean straightRingLines;
//-------------------------------------------------------------------------
/**
* @param straightRingLines Whether rings on the board should be drawn straight or not [True].
*/
public NoCurves
(
@Opt final Boolean straightRingLines
)
{
this.straightRingLines = (straightRingLines == null) ? true : straightRingLines.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If rings on the board should be drawn straight rather than curved.
*/
public boolean straightRingLines()
{
return straightRingLines;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,547 | 21.434783 | 104 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/Boolean/NoDicePips.java | package metadata.graphics.no.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether pips on the dice should be always drawn as a single number.
*
* @author Matthew.Stephenson
*
*/
@Hide
public class NoDicePips implements GraphicsItem
{
/** If pips on the dice should be always drawn as a single number. */
private final boolean noDicePips;
//-------------------------------------------------------------------------
/**
* @param noDicePips Whether pips on the dice should be always drawn as a single number. [True].
*/
public NoDicePips
(
@Opt final Boolean noDicePips
)
{
this.noDicePips = (noDicePips == null) ? true : noDicePips.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If pips on the dice should be always drawn as a single number.
*/
public boolean noDicePips()
{
return noDicePips;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,381 | 19.323529 | 98 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/no/Boolean/NoSunken.java | package metadata.graphics.no.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the board should not be drawn sunken.
*
* @author Matthew.Stephenson
*
* @remarks Only applies to graph boards
*/
@Hide
public class NoSunken implements GraphicsItem
{
/** If the board should not be drawn sunken. */
private final boolean noSunken;
//-------------------------------------------------------------------------
/**
* @param noSunken If the board should not be drawn sunken. [True].
*
* @example (noSunken)
*/
public NoSunken
(
@Opt final Boolean noSunken
)
{
this.noSunken = (noSunken == null) ? true : noSunken.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the board should not be drawn sunken.
*/
public boolean noSunken()
{
return noSunken;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,338 | 17.859155 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/others/HiddenImage.java | package metadata.graphics.others;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Draws a specified image when a piece is hidden.
*
* @author Matthew.Stephenson
*/
public class HiddenImage implements GraphicsItem
{
/** Hidden image to draw. */
private final String image;
//-------------------------------------------------------------------------
/**
* @param image Name of the hidden Image image to draw.
*
* @example (hiddenImage "door")
*/
public HiddenImage
(
final String image
)
{
this.image = image;
}
//-------------------------------------------------------------------------
/**
* @return Hidden image to draw.
*/
public String hiddenImage()
{
return image;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,131 | 15.895522 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/others/StackType.java | package metadata.graphics.others;
import java.util.BitSet;
import annotations.Name;
import annotations.Opt;
import annotations.Or;
import game.Game;
import game.types.board.SiteType;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.PieceStackType;
import other.concept.Concept;
//-----------------------------------------------------------------------------
/**
* Sets the stack design for a container.
*
* @author Matthew.Stephenson
*
* @remarks Different stack types that can be specified are defined in PieceStackType.
* For games such as Snakes and Ladders, Backgammon, Tower of Hanoi, card games, etc.
*/
public class StackType implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Container name condition. */
private final String name;
/** Container index condition. */
private final Integer index;
/** GraphElementType for the specified location(s). */
private final SiteType graphElementType;
/** Set of locations to apply stack design onto. */
private final Integer[] sites;
/** Stack type to apply. */
private final PieceStackType stackType;
/** Scale to apply. */
private final float scale;
/** State condition. */
private final Integer state;
/** Piece value condition. */
private final Integer value;
/** Limit for stack, applies only to some stack types (e.g. backgammon). */
private final int limit;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index we want to match.
* @param name Container name to match.
* @param index Container index to match.
* @param sites Draw image on all specified sites.
* @param site Draw image on this site.
* @param graphElementType The GraphElementType for the specified sites [Cell].
* @param state Local state to match.
* @param value Piece value to match.
* @param stackType Stack type for this piece.
* @param scale Scaling factor [1.0].
* @param limit Stack limit [5].
*
* @example (stackType Ground)
*/
public StackType
(
@Opt final RoleType roleType,
@Opt final String name,
@Opt final Integer index,
@Opt final SiteType graphElementType,
@Opt @Or @Name final Integer[] sites,
@Opt @Or @Name final Integer site,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
final PieceStackType stackType,
@Opt final Float scale,
@Opt @Name final Integer limit
)
{
this.roleType = roleType;
this.name = name;
this.index = index;
this.graphElementType = graphElementType;
this.sites = ((sites != null) ? sites : ((site != null) ? (new Integer[]{ site }) : null));
this.state = state;
this.value = value;
this.stackType = stackType;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.limit = (limit == null) ? 5 : limit.intValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Container name condition to check.
*/
public String name()
{
return name;
}
//-------------------------------------------------------------------------
/**
* @return GraphElementType for the specified location(s).
*/
public SiteType graphElementType()
{
return graphElementType;
}
//-------------------------------------------------------------------------
/**
* @return Container index condition to check.
*/
public Integer index()
{
return index;
}
//-------------------------------------------------------------------------
/**
* @return Sites to apply stack design onto.
*/
public Integer[] sites()
{
return sites;
}
//-------------------------------------------------------------------------
/**
* @return Stack type to apply.
*/
public PieceStackType stackType()
{
return stackType;
}
//-------------------------------------------------------------------------
/**
* @return Scale for the stack.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return State condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return Stack limit
*/
public int limit()
{
return limit;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
concepts.set(Concept.StackType.id(), true);
if (stackType.equals(PieceStackType.Backgammon) || stackType.equals(PieceStackType.Default)
|| stackType.equals(PieceStackType.None) || stackType.equals(PieceStackType.Reverse))
concepts.set(Concept.Stack.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 5,439 | 22.859649 | 94 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/others/SuitRanking.java | package metadata.graphics.others;
import java.util.BitSet;
import game.Game;
import game.types.component.SuitType;
import metadata.graphics.GraphicsItem;
/**
* Indicates the ranking for card suits (lowest to highest).
*
* @author Matthew.Stephenson
*
* @remarks Should be used only for card games.
*/
public class SuitRanking implements GraphicsItem
{
/** Ranking for the card suits. */
private final SuitType[] suitRanking;
//-------------------------------------------------------------------------
/**
* @param suitRanking Ranking for card suits.
*
* @example (suitRanking {Spades Hearts Diamonds Clubs})
*/
public SuitRanking
(
final SuitType[] suitRanking
)
{
this.suitRanking = suitRanking;
}
//-------------------------------------------------------------------------
/**
* @return Ranking for the card suits.
*/
public SuitType[] suitRanking()
{
return suitRanking;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,296 | 17.797101 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/others/package-info.java | /**
* The ``other'' metadata items are used to modify the UI for a given game for
* more specific data.
*/
package metadata.graphics.others;
| 144 | 23.166667 | 78 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/Piece.java | package metadata.graphics.piece;
import java.util.BitSet;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.piece.colour.PieceColour;
import metadata.graphics.piece.families.PieceFamilies;
import metadata.graphics.piece.ground.PieceBackground;
import metadata.graphics.piece.ground.PieceForeground;
import metadata.graphics.piece.name.PieceAddStateToName;
import metadata.graphics.piece.name.PieceExtendName;
import metadata.graphics.piece.name.PieceRename;
import metadata.graphics.piece.rotate.PieceRotate;
import metadata.graphics.piece.scale.PieceScale;
import metadata.graphics.piece.style.PieceStyle;
import metadata.graphics.util.ComponentStyleType;
import metadata.graphics.util.colour.Colour;
/**
* Sets a graphic data to the pieces.
*
* @author Eric.Piette
*/
public class Piece implements GraphicsItem
{
/**
* For setting the style of a piece.
*
* @param pieceType The type of data to apply to the pieces.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param componentStyleType Component style wanted for this piece.
*
* @return GraphicsItem object.
*
* @example (piece Style ExtendedShogi)
*/
public static GraphicsItem construct
(
final PieceStyleType pieceType,
@Opt final RoleType roleType,
@Opt final String pieceName,
final ComponentStyleType componentStyleType
)
{
switch (pieceType)
{
case Style:
return new PieceStyle(roleType, pieceName, componentStyleType);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceStyleType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For setting the name of a piece.
*
* @param pieceType The type of data to apply to the pieces.
* @param roleType Player whose index is to be matched.
* @param piece Base piece name to match.
* @param container Container index to match.
* @param state State to match.
* @param value Value to match.
* @param name Text to use.
*
* @return GraphicsItem object.
*
* @example (piece Rename piece:"Die" "Triangle")
* @example (piece ExtendName P2 "2")
* @example (piece AddStateToName)
*/
public static GraphicsItem construct
(
final PieceNameType pieceType,
@Opt final RoleType roleType,
@Opt @Name final String piece,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt final String name
)
{
switch (pieceType)
{
case ExtendName:
return new PieceExtendName(roleType, piece, container, state, value, (name == null) ? "" : name);
case Rename:
return new PieceRename(roleType, piece, container, state, value, (name == null) ? "" : name);
case AddStateToName:
return new PieceAddStateToName(roleType, piece, container, state, value);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceNameType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For setting the families of the pieces.
*
* @param pieceType The type of data to apply to the pieces.
* @param pieceFamilies Set of family names for the pieces used in the game.
*
* @return GraphicsItem object.
*
* @example (piece Families {"Defined" "Microsoft" "Pragmata" "Symbola"})
*/
public static GraphicsItem construct
(
final PieceFamiliesType pieceType,
final String[] pieceFamilies
)
{
switch (pieceType)
{
case Families:
return new PieceFamilies(pieceFamilies);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceFamiliesType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For setting the background or foreground image of a piece.
*
* @param pieceType The type of data to apply to the pieces.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container Container index to match.
* @param image Name of the image to draw.
* @param text Text string to draw.
* @param state State to match.
* @param value Value to match.
* @param fillColour Colour for the inner sections of the image. Default value
* is the fill colour of the component.
* @param edgeColour Colour for the edges of the image. Default value is the
* edge colour of the component.
* @param scale Scale for the drawn image relative to the cell size of the
* container [1.0].
* @param scaleX Scale for the drawn image, relative to the cell size of the container, along x-axis [1.0].
* @param scaleY Scale for the drawn image, relative to the cell size of the container, along y-axis [1.0].
* @param rotation Amount of rotation for drawn image.
* @param offsetX Offset distance percentage to push the image to the right [0].
* @param offsetY Offset distance percentage to push the image down [0].
*
* @return GraphicsItem object.
*
* @example (piece Foreground "Pawn" image:"Pawn" fillColour:(colour White)
* scale:0.9)
*
* @example (piece Background "Han" image:"octagon" fillColour:(colour White)
* edgeColour:(colour White))
*/
public static GraphicsItem construct
(
final PieceGroundType pieceType,
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt @Name final String image,
@Opt @Name final String text,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour edgeColour,
@Opt @Name final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY,
@Opt @Name final Integer rotation,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
switch (pieceType)
{
case Background:
return new PieceBackground(roleType, pieceName, container, state, value, image, text, fillColour, edgeColour, scale, scaleX, scaleY, rotation, offsetX, offsetY);
case Foreground:
return new PieceForeground(roleType, pieceName, container, state, value, image, text, fillColour, edgeColour, scale, scaleX, scaleY, rotation, offsetX, offsetY);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceGroundType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For setting the colour of a piece.
*
* @param pieceType The type of data to apply to the pieces.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container Container index to match.
* @param state State to match.
* @param value Value to match.
* @param fillColour Fill colour for this piece.
* @param strokeColour Stroke colour for this piece.
* @param secondaryColour Secondary colour for this piece.
*
* @return GraphicsItem object.
*
* @example (piece Colour P2 "CounterStar" fillColour:(colour Red))
*/
public static GraphicsItem construct
(
final PieceColourType pieceType,
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour strokeColour,
@Opt @Name final Colour secondaryColour
)
{
switch (pieceType)
{
case Colour:
return new PieceColour(roleType, pieceName, container, state, value, fillColour, strokeColour, secondaryColour);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceColourType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For rotating the piece.
*
* @param pieceType The type of data to apply to the pieces.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container Container index to match.
* @param state State to match.
* @param value Value to match.
* @param degrees Degrees to rotate clockwise.
*
* @return GraphicsItem object.
*
* @example (piece Rotate P2 degrees:90)
*/
public static GraphicsItem construct
(
final PieceRotateType pieceType,
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Name final Integer degrees
)
{
switch (pieceType)
{
case Rotate:
return new PieceRotate(roleType, pieceName, container, state, value, degrees);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceRotateType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For scaling a piece.
*
* @param pieceType The type of data to apply to the pieces.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param scale Scaling factor in both x and y direction.
* @param scaleX The scale of the image along x-axis.
* @param scaleY The scale of the image along y-axis.
*
* @return GraphicsItem object.
*
* @example (piece Scale "Pawn" .5)
* @example (piece Scale "Disc" .5)
*/
public static GraphicsItem construct
(
final PieceScaleType pieceType,
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY
)
{
switch (pieceType)
{
case Scale:
return new PieceScale(roleType, pieceName, container, state, value, scale, scaleX, scaleY);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Piece(): A PieceScaleType is not implemented.");
}
//-------------------------------------------------------------------------------
private Piece()
{
// Ensure that compiler does not pick up default constructor
}
//-------------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
throw new UnsupportedOperationException("Piece.concepts(...): Should never be called directly.");
}
@Override
public long gameFlags(final Game game)
{
throw new UnsupportedOperationException("Piece.gameFlags(...): Should never be called directly.");
}
@Override
public boolean needRedraw()
{
throw new UnsupportedOperationException("Piece.gameFlags(...): Should never be called directly.");
}
}
| 11,650 | 31.274238 | 164 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceColourType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to set a colour.
*
* @author Eric.Piette
*/
public enum PieceColourType
{
/** To set the colour of a piece. */
Colour,
} | 203 | 16 | 55 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceFamiliesType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata belonging to some families.
*
* @author Eric.Piette
*/
public enum PieceFamiliesType
{
/** To specify a list of families for the game's pieces.. */
Families,
} | 242 | 19.25 | 66 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceGroundType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to set the foreground.
*
* @author Eric.Piette
*/
public enum PieceGroundType
{
/** To draw a specified image in front of a piece. */
Background,
/** To draw a specified image behind a piece. */
Foreground,
/** To draw a specified image as the hidden symbol. */
Hidden,
} | 361 | 19.111111 | 61 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceNameType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to change the name.
*
* @author Eric.Piette
*/
public enum PieceNameType
{
/** To replace a piece's name with an alternative. */
Rename,
/** To add additional text to a piece name. */
ExtendName,
/** To add the local state value of a piece to its name. */
AddStateToName,
/** To set the hidden image for a piece. */
Hidden,
} | 422 | 17.391304 | 60 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceReflectType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to reflect.
*
* @author Eric.Piette
*/
public enum PieceReflectType
{
/** To indicate whether to apply any vertical or horizontal image reflections to a piece. */
Reflect,
} | 256 | 20.416667 | 93 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceRotateType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to reflect.
*
* @author Eric.Piette
*/
public enum PieceRotateType
{
/** To indicate whether to rotate the image for a piece. */
Rotate,
} | 221 | 17.5 | 60 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceScaleByType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to scale by a data.
*
* @author Eric.Piette
*/
public enum PieceScaleByType
{
/**
* To indicate If the pieces in the game should be scaled in size based on their
* value.
*/
ByValue,
} | 273 | 17.266667 | 81 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceScaleType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to scale.
*
* @author Eric.Piette
*/
public enum PieceScaleType
{
/** To set the image scale of a piece. */
Scale,
} | 199 | 15.666667 | 48 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/PieceStyleType.java | package metadata.graphics.piece;
/**
* Defines the types of Piece metadata to set a style.
*
* @author Eric.Piette
*/
public enum PieceStyleType
{
/** To set the style of a piece. */
Style,
} | 199 | 15.666667 | 54 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/package-info.java | /**
* The {\tt (piece ...)} `super' metadata ludeme is used to modify a graphic
* property of a piece.
*/
package metadata.graphics.piece;
| 142 | 22.833333 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/colour/PieceColour.java | package metadata.graphics.piece.colour;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.colour.Colour;
/**
* Sets the colour of a piece.
*
* @author Matthew.Stephenson
*/
@Hide
public class PieceColour implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** Component fill colour to apply. */
private final Colour fillColour;
/** Component stroke colour to apply. */
private final Colour strokeColour;
/** Component secondary colour to apply. */
private final Colour secondaryColour;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param fillColour Fill colour for this piece.
* @param strokeColour Stroke colour for this piece.
* @param secondaryColour Secondary colour for this piece.
*/
public PieceColour
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour strokeColour,
@Opt @Name final Colour secondaryColour
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.container = container;
this.state = state;
this.value = value;
this.fillColour = fillColour;
this.strokeColour = strokeColour;
this.secondaryColour = secondaryColour;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return Piece state condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return Fill colour to apply onto component image.
*/
public Colour fillColour()
{
return fillColour;
}
//-------------------------------------------------------------------------
/**
* @return Stroke colour to apply onto component image.
*/
public Colour strokeColour()
{
return strokeColour;
}
//-------------------------------------------------------------------------
/**
* @return Secondary colour to apply onto component image.
*/
public Colour secondaryColour()
{
return secondaryColour;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 3,959 | 20.758242 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/families/PieceFamilies.java | package metadata.graphics.piece.families;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import metadata.graphics.GraphicsItem;
import other.concept.Concept;
/**
* Specifies a list of families for the game's pieces.
*
* @author Matthew.Stephenson
*
* @remarks Used for games where the pieces have multiple possible design schemes, e.g. Chess.
*/
@Hide
public class PieceFamilies implements GraphicsItem
{
/** Array of family names. */
private final String[] pieceFamilies;
//-------------------------------------------------------------------------
/**
* @param pieceFamilies Set of family names for the pieces used in the game.
*/
public PieceFamilies
(
final String[] pieceFamilies
)
{
this.pieceFamilies = pieceFamilies;
}
//-------------------------------------------------------------------------
/**
* @return All piece families.
*/
public String[] pieceFamilies()
{
return pieceFamilies;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
for (final String pieceFamily : pieceFamilies)
if (pieceFamily.equals("Abstract"))
concepts.set(Concept.MarkerComponent.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,475 | 19.5 | 94 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/ground/PieceBackground.java | package metadata.graphics.piece.ground;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.colour.Colour;
/**
* Draws a specified image behind a piece.
*
* @author Matthew.Stephenson
*/
@Hide
public class PieceBackground implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** Background image to draw. */
private final String image;
/** text to draw. */
private final String text;
/** Fill colour of drawn image. */
private final Colour fillColour;
/** Edge colour of drawn image. */
private final Colour edgeColour;
/** Scale of drawn image. */
private final float scale;
/** Scale of drawn image along x-axis. */
private final float scaleX;
/** Scale of drawn image along y-axis. */
private final float scaleY;
/** Rotation of drawn image. */
private final int rotation;
/** Offset right for drawn image. */
private final float offsetX;
/** Offset down for drawn image. */
private final float offsetY;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container Container index to match.
* @param state State to match.
* @param value Value to match.
* @param image Name of the background image to draw.
* @param text Text string to draw.
* @param fillColour Colour for the inner sections of the image. Default value is the fill colour of the component.
* @param edgeColour Colour for the edges of the image. Default value is the edge colour of the component.
* @param scale Scale for the drawn image relative to the cell size of the container [1.0].
* @param scaleX Scale for the drawn image, relative to the cell size of the container, along x-axis [1.0].
* @param scaleY Scale for the drawn image, relative to the cell size of the container, along y-axis [1.0].
* @param rotation Rotation of the drawn image [0].
* @param offsetX Offset distance percentage to push the image to the right [0].
* @param offsetY Offset distance percentage to push the image down [0].
*/
public PieceBackground
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt @Name final String image,
@Opt @Name final String text,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour edgeColour,
@Opt @Name final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY,
@Opt @Name final Integer rotation,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.container = container;
this.state = state;
this.value = value;
this.image = image;
this.text = text;
this.fillColour = fillColour;
this.edgeColour = edgeColour;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.scaleX = (scaleX == null) ? (float)1.0 : scaleX.floatValue();
this.scaleY = (scaleY == null) ? (float)1.0 : scaleY.floatValue();
this.rotation = (rotation == null) ? (int)0 : rotation.intValue();
this.offsetX = (offsetX == null) ? 0 : offsetX.floatValue();
this.offsetY = (offsetY == null) ? 0 : offsetY.floatValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return Piece state condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Background image to draw.
*/
public String image()
{
return image;
}
//-------------------------------------------------------------------------
/**
* @return Text to draw.
*/
public String text()
{
return text;
}
//-------------------------------------------------------------------------
/**
* @return Fill colour of drawn image.
*/
public Colour fillColour()
{
return fillColour;
}
//-------------------------------------------------------------------------
/**
* @return Edge colour of drawn image.
*/
public Colour edgeColour()
{
return edgeColour;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along x-axis.
*/
public float scaleX()
{
return scaleX;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along y-axis.
*/
public float scaleY()
{
return scaleY;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return Rotation of drawn image.
*/
public int rotation()
{
return rotation;
}
//-------------------------------------------------------------------------
/**
* @return Offset right for drawn image.
*/
public float offsetX()
{
return offsetX;
}
//-------------------------------------------------------------------------
/**
* @return Offset down for drawn image.
*/
public float offsetY()
{
return offsetY;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 6,862 | 22.423208 | 116 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/ground/PieceForeground.java | package metadata.graphics.piece.ground;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.colour.Colour;
/**
* Draws a specified image in front of a piece.
*
* @author Matthew.Stephenson
*/
@Hide
public class PieceForeground implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** Foreground image to draw. */
private final String image;
/** text to draw. */
private final String text;
/** Fill colour of drawn image. */
private final Colour fillColour;
/** Edge colour of drawn image. */
private final Colour edgeColour;
/** Scale of drawn image. */
private final float scale;
/** Scale of drawn image along x-axis. */
private final float scaleX;
/** Scale of drawn image along y-axis. */
private final float scaleY;
/** Rotation of drawn image. */
private final int rotation;
/** Offset right for drawn image. */
private final float offsetX;
/** Offset down for drawn image. */
private final float offsetY;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param image Name of the foreground image to draw.
* @param text Text string to draw.
* @param fillColour Colour for the inner sections of the image. Default value is the fill colour of the component.
* @param edgeColour Colour for the edges of the image. Default value is the edge colour of the component.
* @param scale Scale for the drawn image relative to the cell size of the container [1.0].
* @param scaleX Scale for the drawn image, relative to the cell size of the container, along x-axis [1.0].
* @param scaleY Scale for the drawn image, relative to the cell size of the container, along y-axis [1.0].
* @param rotation Rotation of the drawn image [0].
* @param offsetX Offset distance percentage to push the image to the right [0].
* @param offsetY Offset distance percentage to push the image down [0].
*/
public PieceForeground
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt @Name final String image,
@Opt @Name final String text,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour edgeColour,
@Opt @Name final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY,
@Opt @Name final Integer rotation,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.container = container;
this.state = state;
this.value = value;
this.image = image;
this.text = text;
this.fillColour = fillColour;
this.edgeColour = edgeColour;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.scaleX = (scaleX == null) ? (float)1.0 : scaleX.floatValue();
this.scaleY = (scaleY == null) ? (float)1.0 : scaleY.floatValue();
this.rotation = (rotation == null) ? (int)0 : rotation.intValue();
this.offsetX = (offsetX == null) ? 0 : offsetX.floatValue();
this.offsetY = (offsetY == null) ? 0 : offsetY.floatValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return Piece state condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Foreground image to draw.
*/
public String image()
{
return image;
}
//-------------------------------------------------------------------------
/**
* @return Text to draw.
*/
public String text()
{
return text;
}
//-------------------------------------------------------------------------
/**
* @return Fill colour of drawn image.
*/
public Colour fillColour()
{
return fillColour;
}
//-------------------------------------------------------------------------
/**
* @return Edge colour of drawn image.
*/
public Colour edgeColour()
{
return edgeColour;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along x-axis.
*/
public float scaleX()
{
return scaleX;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along y-axis.
*/
public float scaleY()
{
return scaleY;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return Rotation of drawn image.
*/
public int rotation()
{
return rotation;
}
//-------------------------------------------------------------------------
/**
* @return Offset right for drawn image.
*/
public float offsetX()
{
return offsetX;
}
//-------------------------------------------------------------------------
/**
* @return Offset down for drawn image.
*/
public float offsetY()
{
return offsetY;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 6,878 | 22.477816 | 116 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/name/PieceAddStateToName.java | package metadata.graphics.piece.name;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the local state value of a piece should be added to its name.
*
* @author Matthew.Stephenson
*
* @remarks This ludeme is used for finding and displaying the correct piece image
* for components (e.g. for the game Chopsticks).
*/
@Hide
public class PieceAddStateToName implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String piece;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param piece Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
*/
public PieceAddStateToName
(
@Opt final RoleType roleType,
@Opt @Name final String piece,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value
)
{
this.roleType = roleType;
this.piece = piece;
this.container = container;
this.state = state;
this.value = value;
}
//-------------------------------------------------------------------------
/**
* @return State condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return piece;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 2,812 | 19.683824 | 83 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/name/PieceExtendName.java | package metadata.graphics.piece.name;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Adds additional text to a piece name.
*
* @author Matthew.Stephenson
*
* @remarks Used for finding and displaying the correct piece image for components.
*/
@Hide
public class PieceExtendName implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String piece;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** String extension to add onto Piece name. */
private final String nameExtension;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param piece Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param nameExtension Text to add onto piece name.
*/
public PieceExtendName
(
@Opt final RoleType roleType,
@Opt @Name final String piece,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
final String nameExtension
)
{
this.roleType = roleType;
this.piece = piece;
this.container = container;
this.state = state;
this.value = value;
this.nameExtension = nameExtension;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return State condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return piece;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return String to add onto piece name.
*/
public String nameExtension()
{
return nameExtension;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 3,116 | 19.78 | 83 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/name/PieceRename.java | package metadata.graphics.piece.name;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Replaces a piece's name with an alternative.
*
* @author Matthew.Stephenson
*
* @remarks Used for finding and displaying the correct piece image for components.
*/
@Hide
public class PieceRename implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String piece;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** String extension to replace Piece name. */
private final String nameReplacement;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param piece Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param nameReplacement Text to replace piece name.
*/
public PieceRename
(
@Opt final RoleType roleType,
@Opt @Name final String piece,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
final String nameReplacement
)
{
this.roleType = roleType;
this.piece = piece;
this.container = container;
this.state = state;
this.value = value;
this.nameReplacement = nameReplacement;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return State condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return piece;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return String to replace piece name.
*/
public String nameReplacement()
{
return nameReplacement;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 3,130 | 19.735099 | 83 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/rotate/PieceRotate.java | package metadata.graphics.piece.rotate;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether to rotate a piece image.
*
* @author Matthew.Stephenson
*
* @remarks For games in which each player should see the piece from their own perspective, e.g. Shogi or Chopsticks.
*/
@Hide
public class PieceRotate implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** Degrees to rotate the image clockwise. */
private final int degrees;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param degrees Degrees to rotate the image clockwise.
*/
public PieceRotate
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Name final Integer degrees
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.container = container;
this.state = state;
this.value = value;
this.degrees = degrees.intValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return Rotation for piece image in degrees.
*/
public int rotation()
{
return degrees;
}
//-------------------------------------------------------------------------
/**
* @return Piece state condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 3,154 | 19.89404 | 117 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/scale/PieceScale.java | package metadata.graphics.piece.scale;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Sets the image scale of a piece.
*
* @author Matthew.Stephenson
*
* @remarks A scale of 0 shrinks the piece to nothing, 1 is full (100 percent) size.
* Use piece scaling for fitting pieces to boards with small cells,
* or if pieces should be sized relative to each other, e.g. Chess pawns are smaller.
*/
@Hide
public class PieceScale implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** container index condition. */
private final Integer container;
/** state condition. */
private final Integer state;
/** value condition. */
private final Integer value;
/** Component image scale to apply. */
private final float scale;
/** Scale of drawn image along x-axis. */
private final float scaleX;
/** Scale of drawn image along y-axis. */
private final float scaleY;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param container container index to match.
* @param state State to match.
* @param value Value to match.
* @param scale Scaling factor.
* @param scaleX Scaling factor on dimension X.
* @param scaleY Scaling factor on dimension Y.
*/
public PieceScale
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt @Name final Integer container,
@Opt @Name final Integer state,
@Opt @Name final Integer value,
@Opt final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.container = container;
this.state = state;
this.value = value;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.scaleX = (scaleX == null) ? (float)1.0 : scaleX.floatValue();
this.scaleY = (scaleY == null) ? (float)1.0 : scaleY.floatValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return container index condition to check.
*/
public Integer container()
{
return container;
}
//-------------------------------------------------------------------------
/**
* @return Piece state condition to check.
*/
public Integer state()
{
return state;
}
//-------------------------------------------------------------------------
/**
* @return Piece value condition to check.
*/
public Integer value()
{
return value;
}
//-------------------------------------------------------------------------
/**
* @return X scale to apply onto component image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along x-axis.
*/
public float scaleX()
{
return scaleX;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along y-axis.
*/
public float scaleY()
{
return scaleY;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 4,102 | 21.298913 | 94 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/piece/style/PieceStyle.java | package metadata.graphics.piece.style;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.ComponentStyleType;
/**
* Sets the style of a piece.
*
* @author Matthew.Stephenson
*/
@Hide
public class PieceStyle implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** Component style to apply. */
private final ComponentStyleType componentStyleType;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param componentStyleType Component style wanted for this piece.
*/
public PieceStyle
(
@Opt final RoleType roleType,
@Opt final String pieceName,
final ComponentStyleType componentStyleType
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.componentStyleType = componentStyleType;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return ComponentStyleType to apply onto component.
*/
public ComponentStyleType componentStyleType()
{
return componentStyleType;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 2,103 | 20.04 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/player/Player.java | package metadata.graphics.player;
import java.util.BitSet;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.player.colour.PlayerColour;
import metadata.graphics.player.name.PlayerName;
import metadata.graphics.util.colour.Colour;
/**
* Sets a graphic element to a player.
*
* @author Eric.Piette
*/
public class Player implements GraphicsItem
{
//-------------------------------------------------------------------------------
/**
* For setting the colour of a player.
*
* @param playerType The type of data.
* @param roleType Player whose index is to be matched.
* @param colour Colour wanted for this player.
*
* @return GraphicsItem object.
*
* @example (player Colour P1 (colour Black))
*/
public static GraphicsItem construct
(
final PlayerColourType playerType,
final RoleType roleType,
final Colour colour
)
{
switch (playerType)
{
case Colour:
return new PlayerColour(roleType, colour);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Player(): A PlayerColourType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For setting the name of a player.
*
* @param playerType The type of data.
* @param roleType Player whose index is to be matched.
* @param name Name wanted for this player.
*
* @return GraphicsItem object.
*
* @example (player Name P1 "Player 1")
*/
public static GraphicsItem construct
(
final PlayerNameType playerType,
final RoleType roleType,
final String name
)
{
switch (playerType)
{
case Name:
return new PlayerName(roleType, name);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Player(): A PlayerNameType is not implemented.");
}
//-------------------------------------------------------------------------------
private Player()
{
// Ensure that compiler does not pick up default constructor
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
throw new UnsupportedOperationException("Player.concepts(...): Should never be called directly.");
}
@Override
public long gameFlags(final Game game)
{
throw new UnsupportedOperationException("Player.gameFlags(...): Should never be called directly.");
}
@Override
public boolean needRedraw()
{
throw new UnsupportedOperationException("Player.gameFlags(...): Should never be called directly.");
}
}
| 2,690 | 23.463636 | 101 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/player/PlayerColourType.java | package metadata.graphics.player;
/**
* Defines the types of Player metadata depending of a colour.
*
* @author Eric.Piette
*/
public enum PlayerColourType
{
/** To set the colour of a player. */
Colour,
}
| 214 | 15.538462 | 62 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/player/PlayerNameType.java | package metadata.graphics.player;
/**
* Defines the types of Player metadata depending of a name.
*
* @author Matthew.Stephenson
*/
public enum PlayerNameType
{
/** To set the name of a player. */
Name,
}
| 213 | 15.461538 | 60 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/player/package-info.java | /**
* The ``player'' metadata items describe relevant player settings.
*/
package metadata.graphics.player;
| 110 | 21.2 | 67 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/player/colour/PlayerColour.java | package metadata.graphics.player.colour;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.colour.Colour;
//-----------------------------------------------------------------------------
/**
* Sets the colour of a player.
*
* @author Matthew.Stephenson
*/
@Hide
public class PlayerColour implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Player colour to apply. */
private final Colour colour;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param colour Colour wanted for this player.
*
* @example (playerColour P1 (colour Black))
*/
public PlayerColour
(
final RoleType roleType,
final Colour colour
)
{
this.roleType = roleType;
this.colour = colour;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Colour to apply onto player.
*/
public Colour colour()
{
return colour;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,687 | 18.181818 | 79 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/player/name/PlayerName.java | package metadata.graphics.player.name;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Sets the name of a player.
*
* @author Matthew.Stephenson
*/
@Hide
public class PlayerName implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Player name to apply. */
private final String name;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param name Name wanted for this player.
*
* @example (player Name P1 "Player 1")
*/
public PlayerName
(
final RoleType roleType,
final String name
)
{
this.roleType = roleType;
this.name = name;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return String to apply onto player.
*/
public String name()
{
return name;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,530 | 17.011765 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/puzzle/AdversarialPuzzle.java | package metadata.graphics.puzzle;
import java.util.BitSet;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
//-----------------------------------------------------------------------------
/**
* Indicates whether the game is an adversarial puzzle.
*
* @author Matthew.Stephenson
*
* @remarks Used in games which are expressed as a N-player game,
* but are actually puzzles, e.g. Chess puzzle.
*/
public class AdversarialPuzzle implements GraphicsItem
{
/** If the games is an adversarial puzzle. */
private final boolean adversarialPuzzle;
//-------------------------------------------------------------------------
/**
* @param adversarialPuzzle Whether the game is an adversarial puzzle or not [True].
*
* @example (adversarialPuzzle)
*/
public AdversarialPuzzle
(
@Opt final Boolean adversarialPuzzle
)
{
this.adversarialPuzzle = (adversarialPuzzle == null) ? true : adversarialPuzzle.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the games is an adversarial puzzle.
*/
public boolean adversarialPuzzle()
{
return adversarialPuzzle;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,566 | 21.070423 | 97 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/puzzle/DrawHint.java | package metadata.graphics.puzzle;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.PuzzleDrawHintType;
/**
* Indicates how the hints for the puzzle should be shown.
*
* @author Matthew.Stephenson
*/
public class DrawHint implements GraphicsItem
{
/** How hints should be shown. */
private final PuzzleDrawHintType drawHint;
//-------------------------------------------------------------------------
/**
* @param drawHint How hints should be shown.
*
* @example (drawHint TopLeft)
*/
public DrawHint
(
final PuzzleDrawHintType drawHint
)
{
this.drawHint = drawHint;
}
//-------------------------------------------------------------------------
/**
* @return How the hint should be drawn.
*/
public PuzzleDrawHintType drawHint()
{
return drawHint;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,228 | 17.621212 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/puzzle/HintLocation.java | package metadata.graphics.puzzle;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.PuzzleHintLocationType;
/**
* Indicates how to determine the site for the hint to be drawn.
*
* @author Matthew.Stephenson
*/
public class HintLocation implements GraphicsItem
{
/** How to determine hint location. */
private final PuzzleHintLocationType hintLocation;
//-------------------------------------------------------------------------
/**
* @param hintLocation How to determine hint location.
*
* @example (hintLocation BetweenVertices)
*/
public HintLocation
(
final PuzzleHintLocationType hintLocation
)
{
this.hintLocation = hintLocation;
}
//-------------------------------------------------------------------------
/**
* @return How to determine hint location.
*/
public PuzzleHintLocationType hintLocation()
{
return hintLocation;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,312 | 18.597015 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/puzzle/package-info.java | /**
* The ``Puzzle'' metadata items describe relevant puzzle settings.
*/
package metadata.graphics.puzzle;
| 110 | 21.2 | 67 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/region/Region.java | package metadata.graphics.region;
import java.util.BitSet;
import annotations.Name;
import annotations.Opt;
import annotations.Or;
import game.Game;
import game.functions.region.RegionFunction;
import game.types.board.SiteType;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.region.colour.RegionColour;
import metadata.graphics.util.colour.Colour;
/**
* Sets a graphic element to a region.
*
* @author Eric.Piette
*/
public class Region implements GraphicsItem
{
//-------------------------------------------------------------------------------
/**
* @param regionType Expected colour type.
* @param region Region to be coloured.
* @param roleType Player whose index is to be matched (only for Region).
* @param graphElementType The GraphElementType for the specified sites [DefaultBoardType].
* @param sites Sites to be coloured.
* @param site Site to be coloured.
* @param regionFunction RegionFunction to be coloured.
* @param regionSiteType The SiteType of the region [DefaultBoardType].
* @param colour The assigned colour for the specified boardGraphicsType.
* @param scale The scale for the region graphics (only applies to Edge siteType).
*
* @example (region Colour "Home" Edge regionSiteType:Cell (colour Black))
*
* @return Appropriate graphics item.
*/
public static GraphicsItem construct
(
final RegionColourType regionType,
@Opt final String region,
@Opt final RoleType roleType,
@Opt final SiteType graphElementType,
@Opt @Or final Integer[] sites,
@Opt @Or final Integer site,
@Opt final RegionFunction regionFunction,
@Opt @Name final SiteType regionSiteType,
@Opt final Colour colour,
@Opt @Name final Float scale
)
{
switch (regionType)
{
case Colour:
return new RegionColour(region, roleType,graphElementType,sites,site,regionFunction,regionSiteType,colour,scale);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Region(): A RegionColourType is not implemented.");
}
//-------------------------------------------------------------------------------
private Region()
{
// Ensure that compiler does not pick up default constructor
}
//-------------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
throw new UnsupportedOperationException("Board.concepts(...): Should never be called directly.");
}
@Override
public long gameFlags(final Game game)
{
throw new UnsupportedOperationException("Board.gameFlags(...): Should never be called directly.");
}
@Override
public boolean needRedraw()
{
throw new UnsupportedOperationException("Board.gameFlags(...): Should never be called directly.");
}
}
| 2,936 | 30.244681 | 116 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/region/RegionColourType.java | package metadata.graphics.region;
/**
* Defines the types of Region metadata depending of a colour.
*
* @author Eric.Piette
*/
public enum RegionColourType
{
/** To set the colour of a player. */
Colour,
}
| 214 | 15.538462 | 62 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/region/package-info.java | /**
* The {\tt (region ...)} `super' metadata ludeme is used to modify a graphic
* property of a region.
*/
package metadata.graphics.region;
| 145 | 23.333333 | 77 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/region/colour/RegionColour.java | package metadata.graphics.region.colour;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import annotations.Or;
import game.Game;
import game.functions.region.RegionFunction;
import game.types.board.SiteType;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.colour.Colour;
import other.context.Context;
/**
* Sets the colour of a specified region.
*
* @author Matthew.Stephenson
*/
@Hide
public class RegionColour implements GraphicsItem
{
/** Region to colour. */
private final String region;
/** Sites to colour. */
private final Integer[] sites;
/** Region to colour. */
private final RegionFunction regionFunction;
/** SiteType to be coloured. */
private final SiteType graphElementType;
/** Colour to apply. */
private final Colour colour;
/** RoleType condition. */
private final RoleType roleType;
/** The SiteType of the region. */
private final SiteType regionSiteType;
/** The scale for the region graphics (only applies to Edge siteType). */
private final float scale;
//-------------------------------------------------------------------------
/**
* @param region Region to be coloured.
* @param roleType Player whose index is to be matched.
* @param graphElementType SiteType to be coloured [DefaultBoardType].
* @param sites Sites to be coloured.
* @param site Site to be coloured.
* @param regionFunction RegionFunction to be coloured.
* @param regionSiteType The SiteType of the region [DefaultBoardType].
* @param colour The assigned colour for the specified boardGraphicsType.
* @param scale The scale for the region graphics (only applies to Edge siteType) [1.0].
*
* @example (region Colour "Home" Edge regionSiteType:Cell (colour Black) scale:2.0)
*/
public RegionColour
(
@Opt final String region,
@Opt final RoleType roleType,
@Opt final SiteType graphElementType,
@Opt @Or final Integer[] sites,
@Opt @Or final Integer site,
@Opt final RegionFunction regionFunction,
@Opt @Name final SiteType regionSiteType,
@Opt final Colour colour,
@Opt @Name final Float scale
)
{
int numNonNull = 0;
if (sites != null)
numNonNull++;
if (site != null)
numNonNull++;
if (numNonNull > 1)
throw new IllegalArgumentException("Only one of @Or should be different to null");
this.region = region;
this.sites = ((sites != null) ? sites : ((site != null) ? (new Integer[]{ site }) : null));
this.regionFunction = regionFunction;
this.colour = colour;
this.roleType = roleType;
this.regionSiteType = regionSiteType;
this.graphElementType = graphElementType;
this.scale = (scale == null) ? 1.0f : scale.floatValue();
}
//-------------------------------------------------------------------------
/**
* @param context
* @return SiteType to be coloured.
*/
public SiteType graphElementType(final Context context)
{
if (graphElementType == null)
return context.game().board().defaultSite();
return graphElementType;
}
//-------------------------------------------------------------------------
/**
* @return Region to Colour.
*/
public String region()
{
return region;
}
//-------------------------------------------------------------------------
/**
* @return Sites to Colour.
*/
public Integer[] sites()
{
return sites;
}
//-------------------------------------------------------------------------
/**
* @return Colour to apply.
*/
public Colour colour()
{
return colour;
}
//-------------------------------------------------------------------------
/**
* @return Region to Colour.
*/
public RegionFunction regionFunction()
{
return regionFunction;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @param context
* @return The SiteType of the region.
*/
public SiteType regionSiteType(final Context context)
{
if (regionSiteType == null)
return context.game().board().defaultSite();
return regionSiteType;
}
//-------------------------------------------------------------------------
/**
* @return The scale for the region graphics (only applies to Edge siteType).
*/
public float getScale()
{
return scale;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
long gameFlags = 0l;
if (regionFunction != null)
gameFlags |= regionFunction.gameFlags(game);
return gameFlags;
}
@Override
public boolean needRedraw()
{
if (regionFunction != null)
return !regionFunction.isStatic();
return false;
}
}
| 5,079 | 23.190476 | 101 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Show.java | package metadata.graphics.show;
import java.util.BitSet;
import annotations.Name;
import annotations.Opt;
import annotations.Or;
import game.Game;
import game.functions.ints.IntFunction;
import game.functions.region.RegionFunction;
import game.types.board.RelationType;
import game.types.board.SiteType;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.show.Boolean.ShowCost;
import metadata.graphics.show.Boolean.ShowCurvedEdges;
import metadata.graphics.show.Boolean.ShowEdgeDirections;
import metadata.graphics.show.Boolean.ShowLocalStateHoles;
import metadata.graphics.show.Boolean.ShowPits;
import metadata.graphics.show.Boolean.ShowPlayerHoles;
import metadata.graphics.show.Boolean.ShowPossibleMoves;
import metadata.graphics.show.Boolean.ShowRegionOwner;
import metadata.graphics.show.Boolean.ShowStraightEdges;
import metadata.graphics.show.check.ShowCheck;
import metadata.graphics.show.component.ShowPieceState;
import metadata.graphics.show.component.ShowPieceValue;
import metadata.graphics.show.edges.ShowEdges;
import metadata.graphics.show.line.ShowLine;
import metadata.graphics.show.score.ShowScore;
import metadata.graphics.show.sites.ShowSitesAsHoles;
import metadata.graphics.show.sites.ShowSitesIndex;
import metadata.graphics.show.symbol.ShowSymbol;
import metadata.graphics.util.BoardGraphicsType;
import metadata.graphics.util.CurveType;
import metadata.graphics.util.EdgeType;
import metadata.graphics.util.HoleType;
import metadata.graphics.util.LineStyle;
import metadata.graphics.util.ValueLocationType;
import metadata.graphics.util.WhenScoreType;
import metadata.graphics.util.colour.Colour;
/**
* Shows a graphic property or an information.
*
* @author Eric.Piette
*/
@SuppressWarnings("javadoc")
public class Show implements GraphicsItem
{
/**
* For showing properties on the holes.
*
* @param showDataType The type of data to apply to the holes.
* @param indices The list of indices of the holes.
* @param type The shape of the holes.
*
* @example (show AsHoles {5 10} Square)
*/
public static GraphicsItem construct
(
final ShowSiteDataType showDataType,
final Integer[] indices,
final HoleType type
)
{
return new ShowSitesAsHoles(indices,type);
}
//-------------------------------------------------------------------------------
/**
* For showing the index of sites on the board.
*
* @param showDataType The type of data to apply.
* @param type Site Type [Cell].
* @param additionalValue Additional value to add to the index [0].
*
* @example (show SiteIndex Cell 5)
*/
public static GraphicsItem construct
(
final ShowSiteDataType showDataType,
@Opt final SiteType type,
@Opt final Integer additionalValue
)
{
return new ShowSitesIndex(type, additionalValue);
}
//-------------------------------------------------------------------------------
/**
* For showing symbols on sites.
*
* @param showType The type of data to show.
* @param imageName Name of the image to show.
* @param text Text string to show.
* @param region Draw image on all sites in this region.
* @param roleType Player whose index is to be matched (only for
* Region).
* @param graphElementType The GraphElementType for the specified sites [Cell].
* @param sites Draw image on all specified sites.
* @param site Draw image on this site.
* @param regionFunction Draw image on this regionFunction.
* @param boardGraphicsType Only apply image onto sites that are also part of
* this BoardGraphicsType.
* @param fillColour Colour for the inner sections of the image. Default
* value is the fill colour of the component.
* @param edgeColour Colour for the edges of the image. Default value is
* the edge colour of the component.
* @param scale Scale for the drawn image relative to the cell size
* of the container [1.0].
* @param scaleX The scale of the image along x-axis.
* @param scaleY The scale of the image along y-axis.
* @param rotation The rotation of the symbol.
* @param offsetX Horizontal offset for image (to the right) [0.0].
* @param offsetY Vertical offset for image (downwards) [0.0].
*
* @example (show Symbol "water" Cell 15 scale:0.85)
*/
public static GraphicsItem construct
(
final ShowSymbolType showType,
@Opt final String imageName,
@Opt @Name final String text,
@Opt final String region,
@Opt final RoleType roleType,
@Opt final SiteType graphElementType,
@Opt @Or final Integer[] sites,
@Opt @Or final Integer site,
@Opt final RegionFunction regionFunction,
@Opt final BoardGraphicsType boardGraphicsType,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour edgeColour,
@Opt @Name final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY,
@Opt @Name final Integer rotation,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
switch (showType)
{
case Symbol:
return new ShowSymbol(imageName, text, region, roleType, graphElementType,sites,site,regionFunction,boardGraphicsType,fillColour,edgeColour,scale,scaleX,scaleY,rotation,offsetX,offsetY);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowSymbolType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For showing symbols on sites.
*
* @param showType The type of data to show.
* @param lines The line to draw (pairs of vertices).
* @param siteType The GraphElementType for the specified sites [Vertex].
* @param style Line style [Thin].
* @param colour The colour of the line.
* @param scale The scale of the line.
* @param curve The control points for the line to create a Bézier curve with (4 values: x1, y1, x2, y2, between 0 and 1).
* @param curveType Type of curve [Spline].
*
* @example (show Line { {1 0} {2 4} })
*/
public static GraphicsItem construct
(
final ShowLineType showType,
final Integer[][] lines,
@Opt final SiteType siteType,
@Opt final LineStyle style,
@Opt final Colour colour,
@Opt @Name final Float scale,
@Opt @Name final Float[] curve,
@Opt final CurveType curveType
)
{
switch (showType)
{
case Line:
return new ShowLine(lines, siteType, style, colour, scale, curve, curveType);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowLineType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For showing specific edges of the graph board (only valid with GraphStyle or its children).
*
* @param showType The type of data to show.
* @param type EdgeType condition [All].
* @param relationType RelationType condition[Neighbour].
* @param connection If this concerns cell connections, rather than graph
* edges [False].
* @param style Line style for drawing edges [ThinDotted].
* @param colour Colour in which to draw edges [LightGrey].
*
* @example (show Edges Diagonal Thin)
*/
public static GraphicsItem construct
(
final ShowEdgeType showType,
@Opt final EdgeType type,
@Opt final RelationType relationType,
@Opt @Name final Boolean connection,
@Opt final LineStyle style,
@Opt final Colour colour
)
{
switch (showType)
{
case Edges:
return new ShowEdges(type, relationType, connection, style, colour);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowEdgeType is not implemented.");
}
/**
* For showing properties.
*
* @param showType The type of data to show.
* @param value Whether the graphic data has to be showed. [True].
*
* @example (show Pits)
* @example (show PlayerHoles)
* @example (show RegionOwner)
*/
public static GraphicsItem construct
(
final ShowBooleanType showType,
@Opt final Boolean value
)
{
switch (showType)
{
case Pits:
return new ShowPits(value);
case PlayerHoles:
return new ShowPlayerHoles(value);
case LocalStateHoles:
return new ShowLocalStateHoles(value);
case RegionOwner:
return new ShowRegionOwner(value);
case Cost:
return new ShowCost(value);
case EdgeDirections:
return new ShowEdgeDirections(value);
case PossibleMoves:
return new ShowPossibleMoves(value);
case CurvedEdges:
return new ShowCurvedEdges(value);
case StraightEdges:
return new ShowStraightEdges(value);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowBooleanType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For showing properties on a piece.
*
* @param showType The type of element to show a data on it.
* @param showDataType The type of data to show.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param location The location to draw the value [Corner].
* @param offsetImage Offset the image by the size of the displayed value [False].
* @param valueOutline Draw outline around the displayed value [False].
* @param scale Scale for the drawn image relative to the cell size of the container [1.0].
* @param offsetX Offset distance percentage to push the image to the right [0].
* @param offsetY Offset distance percentage to push the image down [0].
*
* @example (show Piece State)
* @example (show Piece Value)
*/
public static GraphicsItem construct
(
final ShowComponentType showType,
final ShowComponentDataType showDataType,
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt final ValueLocationType location,
@Opt @Name final Boolean offsetImage,
@Opt @Name final Boolean valueOutline,
@Opt @Name final Float scale,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
switch (showType)
{
case Piece:
{
switch (showDataType)
{
case State:
return new ShowPieceState(roleType, pieceName, location, offsetImage, valueOutline, scale, offsetX, offsetY);
case Value:
return new ShowPieceValue(roleType, pieceName, location, offsetImage, valueOutline, scale, offsetX, offsetY);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException(
"Show(): A ShowComponentDataType is not implemented for the Piece type.");
}
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowComponentType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For showing the check message.
*
* @param showType The type of data to show.
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
*
* @example (show Check "King")
*/
public static GraphicsItem construct
(
final ShowCheckType showType,
@Opt final RoleType roleType,
@Opt final String pieceName
)
{
switch (showType)
{
case Check:
return new ShowCheck(roleType, pieceName);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowCheckType is not implemented.");
}
//-------------------------------------------------------------------------------
/**
* For showing the score.
*
* @param showType The type of data to show.
* @param whenScore When the score should be shown [Always].
* @param roleType Player whose index is to be matched [All].
* @param scoreReplacement Replacement value to display instead of score.
* @param scoreSuffix Extra string to append to the score displayed [""].
*
* @example (show Score Never)
*/
public static GraphicsItem construct
(
final ShowScoreType showType,
@Opt final WhenScoreType whenScore,
@Opt final RoleType roleType,
@Opt final IntFunction scoreReplacement,
@Opt final String scoreSuffix
)
{
switch (showType)
{
case Score:
return new ShowScore(whenScore, roleType, scoreReplacement, scoreSuffix);
default:
break;
}
// We should never reach that except if we forget some codes.
throw new IllegalArgumentException("Show(): A ShowScoreType is not implemented.");
}
//-------------------------------------------------------------------------------
private Show()
{
// Ensure that compiler does not pick up default constructor
}
//-------------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
throw new UnsupportedOperationException("Board.concepts(...): Should never be called directly.");
}
@Override
public long gameFlags(final Game game)
{
throw new UnsupportedOperationException("Board.gameFlags(...): Should never be called directly.");
}
@Override
public boolean needRedraw()
{
throw new UnsupportedOperationException("Board.gameFlags(...): Should never be called directly.");
}
}
| 13,898 | 31.626761 | 189 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowBooleanType.java | package metadata.graphics.show;
/**
* Defines the types of Show metadata depending only of a boolean.
*
* @author Eric.Piette
*/
public enum ShowBooleanType
{
/** To indicates whether the pits on the board should be marked with their owner. */
Pits,
/** To indicates whether the player's holes on the board should be marked with their owner. */
PlayerHoles,
/** To indicates whether the holes with a local state of zero should be marked. */
LocalStateHoles,
/** To indicates whether the owner of each region should be shown. */
RegionOwner,
/** To indicates whether the cost of the graph element has to be shown. */
Cost,
/** To indicates whether the hints of the puzzle has to be shown. */
Hints,
/** To indicates whether the edge directions should be shown. */
EdgeDirections,
/** To indicates whether the possible moves are always shown. */
PossibleMoves,
/** To indicates whether curved edges should be shown. */
CurvedEdges,
/** To indicates whether straight edges should be shown. */
StraightEdges,
} | 1,048 | 25.897436 | 95 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowCheckType.java | package metadata.graphics.show;
/**
* Defines the types of Show metadata for a check.
*
* @author Eric.Piette
*/
public enum ShowCheckType
{
/** To indicates whether a "Check" should be displayed when a piece is in threatened.
*/
Check,
} | 248 | 18.153846 | 86 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowComponentDataType.java | package metadata.graphics.show;
/**
* Defines the types of data to show for a component in the super metadata Show
* ludeme.
*
* @author Eric.Piette
*/
public enum ShowComponentDataType
{
/** To indicates whether the state of a piece should be displayed. */
State,
/** To indicates whether the value of a piece should be displayed. */
Value,
} | 355 | 21.25 | 79 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowComponentType.java | package metadata.graphics.show;
/**
* Defines the types of Show metadata for a type of components.
*
* @author Eric.Piette
*/
public enum ShowComponentType
{
/** To indicate that the component to apply the type is a piece. */
Piece,
} | 242 | 19.25 | 68 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowEdgeType.java | package metadata.graphics.show;
/**
* Defines the types of Draw metadata related to edges.
*
* @author Eric.Piette
*/
public enum ShowEdgeType
{
/** To specify customised drawing of edges in the board graph. */
Edges,
} | 227 | 18 | 66 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowLineType.java | package metadata.graphics.show;
/**
* Defines the types of Draw metadata related to line.
*
* @author Matthew.stephenson
*/
public enum ShowLineType
{
/** To draw a specified image on the board. */
Line,
} | 213 | 16.833333 | 54 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowScoreType.java | package metadata.graphics.show;
/**
* Defines the types of Show metadata for a score.
*
* @author Eric.Piette
*/
public enum ShowScoreType
{
/** To indicate whether the score should be shown only in certain situations. */
Score,
}
| 239 | 17.461538 | 81 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowSiteDataType.java | package metadata.graphics.show;
/**
* Defines the types of Show metadata related to a data of the sites.
*
* @author Eric.Piette
*/
public enum ShowSiteDataType
{
/** To indicate whether the sites of the board should be represented as holes. */
AsHoles,
/** Indicates whether the sites of the board should have their index displayed/ */
SiteIndex
} | 360 | 23.066667 | 83 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowSiteType.java | package metadata.graphics.show;
/**
* Defines the types of Show metadata related to a site.
*
* @author Eric.Piette
*/
public enum ShowSiteType
{
/** To apply it on the sites. */
Sites,
/** To apply it on the cells. */
Cell,
} | 237 | 14.866667 | 56 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/ShowSymbolType.java | package metadata.graphics.show;
/**
* Defines the types of Draw metadata related to symbol.
*
* @author Eric.Piette
*/
public enum ShowSymbolType
{
/** To draw a specified image on the board. */
Symbol,
} | 212 | 16.75 | 56 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/package-info.java | /**
* The {\tt (show ...)} `super' metadata ludeme is used to show a graphic
* property or an information during the game.
*/
package metadata.graphics.show;
| 161 | 26 | 73 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowCost.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
//-----------------------------------------------------------------------------
/**
* Indicates whether the cost of the different graph element should be shown.
*
* @author Eric.Piette
*/
@Hide
public class ShowCost implements GraphicsItem
{
/** If the cost should be shown. */
private final boolean showCost;
//-------------------------------------------------------------------------
/**
* @param showCost Whether the cost should be shown [True].
*/
public ShowCost
(
@Opt final Boolean showCost
)
{
this.showCost = (showCost == null) ? true : showCost.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the cost should be shown.
*/
public boolean showCost()
{
return showCost;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,327 | 18.246377 | 79 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowCurvedEdges.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether curved edges should be shown.
*
* @author Matthew.Stephenson
*/
@Hide
public class ShowCurvedEdges implements GraphicsItem
{
/** If the curved edges should be shown. */
private final boolean showCurvedEdges;
//-------------------------------------------------------------------------
/**
* @param showCurvedEdges Whether the curved edges should be shown [True].
*/
public ShowCurvedEdges
(
@Opt final Boolean showCurvedEdges
)
{
this.showCurvedEdges = (showCurvedEdges == null) ? true : showCurvedEdges.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the curved edges should be shown.
*/
public boolean showCurvedEdges()
{
return showCurvedEdges;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,320 | 18.716418 | 91 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowEdgeDirections.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the directions of the Edges should be shown (only valid for Graph Games).
*
* @author Matthew.Stephenson
*/
@Hide
public class ShowEdgeDirections implements GraphicsItem
{
/** If the edge directions should be shown. */
private final boolean showEdgeDirections;
//-------------------------------------------------------------------------
/**
* @param showEdgeDirections Whether the edge directions should be shown [True].
*/
public ShowEdgeDirections
(
@Opt final Boolean showEdgeDirections
)
{
this.showEdgeDirections = (showEdgeDirections == null) ? true : showEdgeDirections.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the edge directions should be shown.
*/
public boolean showEdgeDirections()
{
return showEdgeDirections;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,403 | 19.955224 | 100 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowLocalStateHoles.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the holes with a local state of zero on the board should be marked with their owner.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the board's design (e.g. Mancala).
*/
@Hide
public class ShowLocalStateHoles implements GraphicsItem
{
/** If the holes with a local state of zero should be marked. */
private final boolean useLocalState;
//-------------------------------------------------------------------------
/**
* @param useLocalState If the holes with a local state of zero should be marked [True].
*/
public ShowLocalStateHoles
(
@Opt final Boolean useLocalState
)
{
this.useLocalState = (useLocalState == null) ? true : useLocalState.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the holes with a local state of zero should be marked.
*/
public boolean useLocalState()
{
return useLocalState;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,541 | 21.028571 | 107 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowPits.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the pits on the board should be marked with their owner.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the board's design (e.g. Mancala).
*/
@Hide
public class ShowPits implements GraphicsItem
{
/** If the pits should be marked. */
private final boolean showPits;
//-------------------------------------------------------------------------
/**
* @param showPits Whether the pits should be marked or not [True].
*/
public ShowPits
(
@Opt final Boolean showPits
)
{
this.showPits = (showPits == null) ? true : showPits.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the pits should be marked.
*/
public boolean showPits()
{
return showPits;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,375 | 18.942029 | 107 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowPlayerHoles.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the player's holes on the board should be marked with their owner.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the board's design (e.g. Mancala).
*/
@Hide
public class ShowPlayerHoles implements GraphicsItem
{
/** If the player's holes should be marked. */
private final boolean showPlayerHoles;
//-------------------------------------------------------------------------
/**
* @param showPlayerHoles Whether the player's holes should be marked or not [True].
*/
public ShowPlayerHoles
(
@Opt final Boolean showPlayerHoles
)
{
this.showPlayerHoles = (showPlayerHoles == null) ? true : showPlayerHoles.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the player's holes should be marked.
*/
public boolean showPlayerHoles()
{
return showPlayerHoles;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,486 | 20.242857 | 107 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowPossibleMoves.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the possible moves are always shown.
*
* @author Matthew.Stephenson
*/
@Hide
public class ShowPossibleMoves implements GraphicsItem
{
/** If the possible moves are always shown. */
private final boolean showPossibleMoves;
//-------------------------------------------------------------------------
/**
* @param showPossibleMoves Whether the possible moves are always shown. [True].
*/
public ShowPossibleMoves
(
@Opt final Boolean showPossibleMoves
)
{
this.showPossibleMoves = (showPossibleMoves == null) ? true : showPossibleMoves.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the possible moves are always shown.
*/
public boolean showPossibleMoves()
{
return showPossibleMoves;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,357 | 19.268657 | 97 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowRegionOwner.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the owner of each region should be shown.
*
* @author cambolbro
*
* @remarks This is useful for graph games to indicate special sites.
*/
@Hide
public class ShowRegionOwner implements GraphicsItem
{
private final boolean show;
//-------------------------------------------------------------------------
/**
* @param show Whether to show the owner of each region [True].
*/
public ShowRegionOwner
(
@Opt final Boolean show
)
{
this.show = (show == null) ? true : show.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the board should be hidden.
*/
public boolean show()
{
return show;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,259 | 17.529412 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/Boolean/ShowStraightEdges.java | package metadata.graphics.show.Boolean;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether straight edges should be shown.
*
* @author Matthew.Stephenson
*/
@Hide
public class ShowStraightEdges implements GraphicsItem
{
/** If the curved edges should be shown. */
private final boolean showStraightEdges;
//-------------------------------------------------------------------------
/**
* @param showStraightEdges Whether the straight edges should be shown [True].
*/
public ShowStraightEdges
(
@Opt final Boolean showStraightEdges
)
{
this.showStraightEdges = (showStraightEdges == null) ? true : showStraightEdges.booleanValue();
}
//-------------------------------------------------------------------------
/**
* @return If the straight edges should be shown.
*/
public boolean showStraightEdges()
{
return showStraightEdges;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,346 | 19.104478 | 97 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/check/ShowCheck.java | package metadata.graphics.show.check;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether a "Check" should be displayed when a piece is in threatened.
*
* @author Matthew.Stephenson
*
* @remarks Should be used only for specific games where this is prudent, e.g.
* Chess.
*/
@Hide
public class ShowCheck implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
*/
public ShowCheck
(
@Opt final RoleType roleType,
@Opt final String pieceName
)
{
this.roleType = roleType;
this.pieceName = pieceName;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,698 | 18.755814 | 81 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/component/ShowPieceState.java | package metadata.graphics.show.component;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.ValueLocationType;
import other.concept.Concept;
/**
* Indicates whether the state of a piece should be displayed.
*
* @author Matthew.Stephenson and cambolbro
*
* @remarks Used for displaying information about pieces in specific games.
*/
@Hide
public class ShowPieceState implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** The location to draw the state. */
private final ValueLocationType location;
/** Offset the image by the size of the displayed value. */
private final boolean offsetImage;
/** Draw outline around the displayed value. */
private final boolean valueOutline;
/** Scale of drawn image. */
private final float scale;
/** Offset right for drawn image. */
private final float offsetX;
/** Offset down for drawn image. */
private final float offsetY;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param location The location to draw the state [Corner].
* @param offsetImage Offset the image by the size of the displayed value [False].
* @param valueOutline Draw outline around the displayed value [False].
* @param scale Scale for the drawn image relative to the cell size of the container [1.0].
* @param offsetX Offset distance percentage to push the image to the right [0].
* @param offsetY Offset distance percentage to push the image down [0].
*
* @example (showPieceState)
*/
public ShowPieceState
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt final ValueLocationType location,
@Opt @Name final Boolean offsetImage,
@Opt @Name final Boolean valueOutline,
@Opt @Name final Float scale,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.location = (location == null) ? ValueLocationType.CornerLeft : location;
this.offsetImage = (offsetImage == null) ? false : offsetImage.booleanValue();
this.valueOutline = (valueOutline == null) ? false : valueOutline.booleanValue();
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.offsetX = (offsetX == null) ? 0 : offsetX.floatValue();
this.offsetY = (offsetY == null) ? 0 : offsetY.floatValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return The location to draw the value.
*/
public ValueLocationType location()
{
return location;
}
//-------------------------------------------------------------------------
/**
* @return Offset the image by the size of the displayed value.
*/
public boolean offsetImage()
{
return offsetImage;
}
//-------------------------------------------------------------------------
/**
* @return Draw outline around the displayed value.
*/
public boolean valueOutline()
{
return valueOutline;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Offset right for drawn image.
*/
public float offsetX()
{
return offsetX;
}
//-------------------------------------------------------------------------
/**
* @return Offset down for drawn image.
*/
public float offsetY()
{
return offsetY;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
concepts.set(Concept.ShowPieceState.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 4,638 | 23.675532 | 94 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/component/ShowPieceValue.java | package metadata.graphics.show.component;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.ValueLocationType;
import other.concept.Concept;
/**
* Indicates whether the value of a piece should be displayed.
*
* @author Matthew.Stephenson
*
* @remarks Used for displaying information about pieces in specific games, e.g. Stratego.
*/
@Hide
public class ShowPieceValue implements GraphicsItem
{
/** RoleType condition. */
private final RoleType roleType;
/** Piece name condition. */
private final String pieceName;
/** The location to draw the value. */
private final ValueLocationType location;
/** Offset the image by the size of the displayed value. */
private final boolean offsetImage;
/** Draw outline around the displayed value. */
private final boolean valueOutline;
/** Scale of drawn image. */
private final float scale;
/** Offset right for drawn image. */
private final float offsetX;
/** Offset down for drawn image. */
private final float offsetY;
//-------------------------------------------------------------------------
/**
* @param roleType Player whose index is to be matched.
* @param pieceName Base piece name to match.
* @param location The location to draw the value [Corner].
* @param offsetImage Offset the image by the size of the displayed value [False].
* @param valueOutline Draw outline around the displayed value [False].
* @param scale Scale for the drawn image relative to the cell size of the container [1.0].
* @param offsetX Offset distance percentage to push the image to the right [0].
* @param offsetY Offset distance percentage to push the image down [0].
*/
public ShowPieceValue
(
@Opt final RoleType roleType,
@Opt final String pieceName,
@Opt final ValueLocationType location,
@Opt @Name final Boolean offsetImage,
@Opt @Name final Boolean valueOutline,
@Opt @Name final Float scale,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
this.roleType = roleType;
this.pieceName = pieceName;
this.location = (location == null) ? ValueLocationType.CornerLeft : location;
this.offsetImage = (offsetImage == null) ? false : offsetImage.booleanValue();
this.valueOutline = (valueOutline == null) ? false : valueOutline.booleanValue();
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.offsetX = (offsetX == null) ? 0 : offsetX.floatValue();
this.offsetY = (offsetY == null) ? 0 : offsetY.floatValue();
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Piece name condition to check.
*/
public String pieceName()
{
return pieceName;
}
//-------------------------------------------------------------------------
/**
* @return The location to draw the value.
*/
public ValueLocationType location()
{
return location;
}
//-------------------------------------------------------------------------
/**
* @return Offset the image by the size of the displayed value.
*/
public boolean offsetImage()
{
return offsetImage;
}
//-------------------------------------------------------------------------
/**
* @return Draw outline around the displayed value.
*/
public boolean valueOutline()
{
return valueOutline;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Offset right for drawn image.
*/
public float offsetX()
{
return offsetX;
}
//-------------------------------------------------------------------------
/**
* @return Offset down for drawn image.
*/
public float offsetY()
{
return offsetY;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
concepts.set(Concept.ShowPieceValue.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 4,601 | 23.741935 | 94 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/edges/ShowEdges.java | package metadata.graphics.show.edges;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.board.RelationType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.EdgeType;
import metadata.graphics.util.LineStyle;
import metadata.graphics.util.colour.Colour;
import metadata.graphics.util.colour.UserColourType;
//-----------------------------------------------------------------------------
/**
* Specifies customised drawing of edges in the board graph.
*
* @author matthew.stephenson and cambolbro
*
* @remarks Useful for graph games to show possible edge moves. Only works for games that use GraphStyle, or a child of GraphStyle (e.g. Pen and Paper style)
*/
@Hide
public class ShowEdges implements GraphicsItem
{
/** EdgeType condition to check. */
private final EdgeType type;
/** RelationType condition to check. */
private final RelationType relationType;
/** If this concerns cell connections, rather than graph edges. */
private final Boolean connection;
/** Line style of the edge. */
private final LineStyle style;
/** Colour of the edge. */
private final Colour colour;
//-------------------------------------------------------------------------
/**
* @param type EdgeType condition [All].
* @param relationType RelationType condition[Neighbour].
* @param connection If this concerns cell connections, rather than graph edges [False].
* @param style Line style for drawing edges [ThinDotted].
* @param colour Colour in which to draw edges [LightGrey].
*/
public ShowEdges
(
@Opt final EdgeType type,
@Opt final RelationType relationType,
@Opt @Name final Boolean connection,
@Opt final LineStyle style,
@Opt final Colour colour
)
{
this.type = (type != null) ? type : EdgeType.All;
this.relationType = (relationType != null) ? relationType : RelationType.All;
this.connection = (connection == null) ? Boolean.valueOf(false) : connection;
this.style = (style != null) ? style : LineStyle.ThinDotted;
this.colour = (colour != null) ? colour : new Colour(UserColourType.LightGrey);
}
//-------------------------------------------------------------------------
/**
* @return EdgeType condition to check.
*/
public EdgeType edgeType()
{
return type;
}
//-------------------------------------------------------------------------
/**
* @return RelationType condition to check.
*/
public RelationType relationType()
{
return relationType;
}
//-------------------------------------------------------------------------
/**
* @return If this concerns cell connections, rather than graph edges.
*/
public Boolean connection()
{
return connection;
}
//-------------------------------------------------------------------------
/**
* @return Line style of the edge.
*/
public LineStyle style()
{
return style;
}
//-------------------------------------------------------------------------
/**
* @return Colour of the edge.
*/
public Colour colour()
{
return colour;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 3,544 | 23.79021 | 157 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/line/ShowLine.java | package metadata.graphics.show.line;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import game.Game;
import game.types.board.SiteType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.CurveType;
import metadata.graphics.util.LineStyle;
import metadata.graphics.util.colour.Colour;
/**
* Draws a specified image on the board.
*
* @author Matthew.Stephenson and cambolbro
*
* @remarks The image name specifies the name of an image file that comes packed
* into the Ludii distribution. See Appendix A for a list of provided images.
*/
@Hide
public class ShowLine implements GraphicsItem
{
/** Set of vertex locations pairs to add the line onto. */
private final Integer[][] lines;
/** Scale of drawn line. */
private final float scale;
/** Colour of drawn line. */
private final Colour colour;
/** The control points for the line to create a Bézier curve with (4 values: x1, y1, x2, y2, between 0 and 1). */
private final Float[] curve;
/** SiteType to draw line on. */
private final SiteType siteType;
/** Line style. */
private final LineStyle style;
/** Type of curve. */
private final CurveType curveType;
//-------------------------------------------------------------------------
/**
* @param lines Set of vertex locations pairs to add the line onto.
* @param siteType SiteType to draw line on [Vertex].
* @param style Line style [Thin].
* @param colour Colour of drawn line.
* @param scale Scale of drawn line [1.0].
* @param curve The control points for the line to create a Bézier curve with (4 values: x1, y1, x2, y2, between 0 and 1).
* @param curveType Type of curve [Spline].
*/
public ShowLine
(
final Integer[][] lines,
@Opt final SiteType siteType,
@Opt final LineStyle style,
@Opt final Colour colour,
@Opt @Name final Float scale,
@Opt @Name final Float[] curve,
@Opt final CurveType curveType
)
{
this.lines = lines;
this.siteType = (siteType == null) ? SiteType.Vertex : siteType;
this.colour = colour;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.curve = curve;
this.style = (style != null) ? style : LineStyle.Thick;
this.curveType = (curveType == null) ? CurveType.Spline : curveType;
}
//-------------------------------------------------------------------------
/**
* @return Set of vertex locations pairs to add the line onto.
*/
public Integer[][] lines()
{
return lines;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return SiteType to draw line on.
*/
public SiteType siteType()
{
return siteType;
}
//-------------------------------------------------------------------------
/**
* @return CurveType of curve.
*/
public CurveType curveType()
{
return curveType;
}
//-------------------------------------------------------------------------
/**
* @return Colour of drawn line.
*/
public Colour colour()
{
return colour;
}
//-------------------------------------------------------------------------
/**
* @return The control points for the line to create a Bézier curve with (4 values: x1, y1, x2, y2, between 0 and 1).
*/
public Float[] curve()
{
return curve;
}
//-------------------------------------------------------------------------
/**
* @return Line style.
*/
public LineStyle style()
{
return style;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 4,059 | 22.74269 | 125 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/score/ShowScore.java | package metadata.graphics.show.score;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import game.functions.ints.IntFunction;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.WhenScoreType;
/**
* Indicates whether the score should be shown only in certain situations.
*
* @author Matthew.Stephenson
*
* @remarks Should be used only in games where the score is used for end-game
* calculations, e.g. for comparing number of pieces in Surakarta.
*/
@Hide
public class ShowScore implements GraphicsItem
{
/** When the score should be shown. */
private final WhenScoreType showScore;
/** Player whose index is to be matched. */
private final RoleType roleType;
/** Replacement value to display instead of score. */
private final IntFunction scoreReplacement;
/** Extra string to append to the score displayed. */
private final String scoreSuffix;
//-------------------------------------------------------------------------
/**
* @param showScore When the score should be shown [Always].
* @param roleType Player whose index is to be matched [All].
* @param scoreReplacement Replacement value to display instead of score.
* @param scoreSuffix Extra string to append to the score displayed [""].
*/
public ShowScore
(
@Opt final WhenScoreType showScore,
@Opt final RoleType roleType,
@Opt final IntFunction scoreReplacement,
@Opt final String scoreSuffix
)
{
this.showScore = (showScore == null) ? WhenScoreType.Always : showScore;
this.roleType = (roleType == null) ? RoleType.All : roleType;
this.scoreReplacement = scoreReplacement;
this.scoreSuffix = (scoreSuffix == null) ? "" : scoreSuffix;
}
//-------------------------------------------------------------------------
/**
* @return When the score should be shown.
*/
public WhenScoreType showScore()
{
return showScore;
}
/**
* @return Player whose index is to be matched.
*/
public RoleType roleType()
{
return roleType;
}
/**
* @return Replacement value to display instead of score.
*/
public IntFunction scoreReplacement()
{
return scoreReplacement;
}
/**
* @return Extra string to append to the score displayed.
*/
public String scoreSuffix()
{
return scoreSuffix;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 2,725 | 22.5 | 78 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/sites/ShowSitesAsHoles.java | package metadata.graphics.show.sites;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.HoleType;
/**
* Indicates whether the sites of the board should be represented as holes.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the board's design (e.g. Mancala).
*/
@Hide
public class ShowSitesAsHoles implements GraphicsItem
{
/** Hole Type. */
private final HoleType type;
/** The sites to modify the shape. */
private final int[] indices;
//-------------------------------------------------------------------------
/**
* @param indices The indices of the special holes.
* @param type The shape of the holes.
*/
public ShowSitesAsHoles
(
final Integer[] indices,
final HoleType type
)
{
this.type = type;
this.indices = new int[indices.length];
for (int i = 0; i < indices.length; i++)
this.indices[i] = indices[i].intValue();
}
//-------------------------------------------------------------------------
/**
* @return The shape of the holes.
*/
public HoleType type()
{
return type;
}
/**
* @return The indices of the holes.
*/
public int[] indices()
{
return indices;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,658 | 18.290698 | 107 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/sites/ShowSitesIndex.java | package metadata.graphics.show.sites;
import java.util.BitSet;
import annotations.Hide;
import annotations.Opt;
import game.Game;
import game.types.board.SiteType;
import metadata.graphics.GraphicsItem;
/**
* Indicates whether the sites of the board should have their index displayed.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of games (e.g. Game of the Goose).
*/
@Hide
public class ShowSitesIndex implements GraphicsItem
{
/** Site Type. */
private final SiteType type;
/** Additional value to add to the index. */
private final Integer additionalValue;
//-------------------------------------------------------------------------
/**
* @param type Site Type [Cell]
* @param additionalValue Additional value to add to the index [0]
*/
public ShowSitesIndex
(
@Opt final SiteType type,
@Opt final Integer additionalValue
)
{
this.type = type == null ? SiteType.Cell : type;
this.additionalValue = additionalValue == null ? Integer.valueOf(0) : additionalValue;
}
//-------------------------------------------------------------------------
/**
* @return Site Type.
*/
public SiteType type()
{
return type;
}
/**
* @return Additional value to add to the index
*/
public Integer additionalValue()
{
return additionalValue;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,695 | 19.190476 | 88 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/sites/ShowSitesShape.java | package metadata.graphics.show.sites;
import java.util.BitSet;
import annotations.Hide;
import game.Game;
import game.types.board.ShapeType;
import metadata.graphics.GraphicsItem;
/**
* Sets the shape of the board's cells.
*
* @author Matthew.Stephenson
*
* @remarks Only used by a specific number of board styles when creating the
* board's design, e.g. Mancala.
*/
@Hide
public class ShowSitesShape implements GraphicsItem
{
/** Cell shape. */
private final ShapeType shape;
//-------------------------------------------------------------------------
/**
* @param shape The shape of the board's cells.
*/
public ShowSitesShape
(
final ShapeType shape
)
{
this.shape = shape;
}
//-------------------------------------------------------------------------
/**
* @return The board's cell shape.
*/
public ShapeType shape()
{
return shape;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
} | 1,264 | 17.333333 | 77 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/show/symbol/ShowSymbol.java | package metadata.graphics.show.symbol;
import java.util.BitSet;
import annotations.Hide;
import annotations.Name;
import annotations.Opt;
import annotations.Or;
import game.Game;
import game.functions.region.RegionFunction;
import game.types.board.SiteType;
import game.types.play.RoleType;
import metadata.graphics.GraphicsItem;
import metadata.graphics.util.BoardGraphicsType;
import metadata.graphics.util.colour.Colour;
import other.concept.Concept;
import other.context.Context;
/**
* Draws a specified image on the board.
*
* @author Matthew.Stephenson and cambolbro
*
* @remarks The image name specifies the name of an image file that comes packed
* into the Ludii distribution. See Appendix A for a list of provided images.
*/
@Hide
public class ShowSymbol implements GraphicsItem
{
/** Image to draw. */
private final String imageName;
/** text to draw. */
private final String text;
/** Region to add the image onto. */
private final String region;
/** GraphElementType for the specified location(s). */
private final SiteType graphElementType;
/** Set of locations to add the image onto. */
private final Integer[] sites;
/** Region to colour. */
private final RegionFunction regionFunction;
/** RoleType condition. */
private final RoleType roleType;
/** Scale of drawn image. */
private final float scale;
/** Scale of drawn image along x-axis. */
private final float scaleX;
/** Scale of drawn image along y-axis. */
private final float scaleY;
/** Fill colour of drawn image. */
private final Colour fillColour;
/** Edge colour of drawn image. */
private final Colour edgeColour;
/** boardGraphicsType condition. */
private final BoardGraphicsType boardGraphicsType;
/** rotation of the drawn image. */
private final int rotation;
/** Offset right for drawn image. */
private final float offsetX;
/** Offset down for drawn image. */
private final float offsetY;
//-------------------------------------------------------------------------
/**
* @param imageName Name of the image to draw.
* @param text Text string to show.
* @param region Draw image on all sites in this region.
* @param graphElementType The GraphElementType for the specified sites [Default board type].
* @param sites Draw image on all specified sites.
* @param site Draw image on this site.
* @param regionFunction Draw image on this regionFunction.
* @param boardGraphicsType Only apply image onto sites that are also part of
* this BoardGraphicsType.
* @param fillColour Colour for the inner sections of the image. Default
* value is the fill colour of the component.
* @param edgeColour Colour for the edges of the image. Default value is
* the edge colour of the component.
* @param scale Scale for the drawn image relative to the cell size
* of the container [1.0].
* @param scaleX Scale for the drawn image, relative to the cell size of the container, along x-axis [1.0].
* @param scaleY Scale for the drawn image, relative to the cell size of the container, along y-axis [1.0].
* @param roleType Player whose index is to be matched (only for
* Region).
* @param rotation The rotation of the symbol.
* @param offsetX Horizontal offset for image (to the right) [0.0].
* @param offsetY Vertical offset for image (downwards) [0.0].
*/
public ShowSymbol
(
@Opt final String imageName,
@Opt @Name final String text,
@Opt final String region,
@Opt final RoleType roleType,
@Opt final SiteType graphElementType,
@Opt @Or final Integer[] sites,
@Opt @Or final Integer site,
@Opt final RegionFunction regionFunction,
@Opt final BoardGraphicsType boardGraphicsType,
@Opt @Name final Colour fillColour,
@Opt @Name final Colour edgeColour,
@Opt @Name final Float scale,
@Opt @Name final Float scaleX,
@Opt @Name final Float scaleY,
@Opt @Name final Integer rotation,
@Opt @Name final Float offsetX,
@Opt @Name final Float offsetY
)
{
int numNonNull = 0;
if (sites != null)
numNonNull++;
if (site != null)
numNonNull++;
if (numNonNull > 1)
throw new IllegalArgumentException("Only one of @Or should be different to null");
this.imageName = imageName;
this.text = text;
this.region = region;
this.graphElementType = graphElementType;
this.sites = ((sites != null) ? sites : ((site != null) ? (new Integer[]{ site }) : null));
this.regionFunction = regionFunction;
this.boardGraphicsType = boardGraphicsType;
this.fillColour = fillColour;
this.edgeColour = edgeColour;
this.scale = (scale == null) ? (float)1.0 : scale.floatValue();
this.scaleX = (scaleX == null) ? (float)1.0 : scaleX.floatValue();
this.scaleY = (scaleY == null) ? (float)1.0 : scaleY.floatValue();
this.rotation = (rotation == null) ? 0 : rotation.intValue();
this.roleType = roleType;
this.offsetX = (offsetX == null) ? (float)0.0 : offsetX.floatValue();
this.offsetY = (offsetY == null) ? (float)0.0 : offsetY.floatValue();
}
//-------------------------------------------------------------------------
/**
* @param context The context.
* @return GraphElementType for the specified location(s).
*/
public SiteType graphElementType(final Context context)
{
if (graphElementType == null)
return context.game().board().defaultSite();
return graphElementType;
}
//-------------------------------------------------------------------------
/**
* @return Sites to add the image onto.
*/
public Integer[] sites()
{
return sites;
}
//-------------------------------------------------------------------------
/**
* @return Image to draw.
*/
public String imageName()
{
return imageName;
}
//-------------------------------------------------------------------------
/**
* @return Text to draw.
*/
public String text()
{
return text;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image.
*/
public float scale()
{
return scale;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along x-axis.
*/
public float scaleX()
{
return scaleX;
}
//-------------------------------------------------------------------------
/**
* @return Scale of drawn image along y-axis.
*/
public float scaleY()
{
return scaleY;
}
//-------------------------------------------------------------------------
/**
* @return Fill colour of drawn image.
*/
public Colour fillColour()
{
return fillColour;
}
//-------------------------------------------------------------------------
/**
* @return Edge colour of drawn image.
*/
public Colour edgeColour()
{
return edgeColour;
}
//-------------------------------------------------------------------------
/**
* @return BoardGraphicsType that the image is drawn on.
*/
public BoardGraphicsType boardGraphicsType()
{
return boardGraphicsType;
}
//-------------------------------------------------------------------------
/**
* @return Region to add the image onto.
*/
public String region()
{
return region;
}
//-------------------------------------------------------------------------
/**
* @return Region to Colour.
*/
public RegionFunction regionFunction()
{
return regionFunction;
}
//-------------------------------------------------------------------------
/**
* @return Rotation of drawn image.
*/
public int rotation()
{
return rotation;
}
//-------------------------------------------------------------------------
/**
* @return RoleType condition to check.
*/
public RoleType roleType()
{
return roleType;
}
//-------------------------------------------------------------------------
/**
* @return Offset right for drawn image
*/
public float getOffsetX()
{
return offsetX;
}
//-------------------------------------------------------------------------
/**
* @return Offset down for drawn image
*/
public float getOffsetY()
{
return offsetY;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
concepts.set(Concept.Symbols.id(), true);
return concepts;
}
@Override
public long gameFlags(final Game game)
{
long gameFlags = 0l;
if (regionFunction != null)
gameFlags |= regionFunction.gameFlags(game);
return gameFlags;
}
@Override
public boolean needRedraw()
{
if (regionFunction != null)
return !regionFunction.isStatic();
return false;
}
}
| 8,973 | 25.316716 | 110 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/BoardGraphicsType.java | package metadata.graphics.util;
import game.types.board.SiteType;
import metadata.MetadataItem;
/**
*
* @author matthew.stephenson
*/
public enum BoardGraphicsType implements MetadataItem
{
/** Edges that are not along a board side. */
InnerEdges(0, SiteType.Edge),
/** Edges that define a board side. */
OuterEdges(1, SiteType.Edge),
/** Cells in phase 0, e.g. dark cells on the Chess board. */
Phase0(2, SiteType.Cell),
/** Cells in phase 1, e.g. light cells on the Chess board. */
Phase1(3, SiteType.Cell),
/** Cells in phase 2, e.g. for hexagonal tiling colouring. */
Phase2(4, SiteType.Cell),
/** Cells in phase 3, e.g. for exotic tiling colourings. */
Phase3(5, SiteType.Cell),
/** Cells in phase 4, e.g. for exotic tiling colouring. */
Phase4(6, SiteType.Cell),
/** Cells in phase 5, e.g. for exotic tiling colourings. */
Phase5(7, SiteType.Cell),
/** Symbols drawn on the board, e.g. Senet, Hnefatafl, Royal Game of Ur... */
Symbols(8, null),
/** Intersections of lines on the board, e.g. where Go stones are played. */
InnerVertices(9, SiteType.Vertex),
/** Intersections of lines on the board, along the perimeter of the board. */
OuterVertices(10, SiteType.Vertex);
private final int value;
private final SiteType siteType;
//-------------------------------------------------------------------------
private BoardGraphicsType(final int value, final SiteType siteType)
{
this.value = value;
this.siteType = siteType;
}
//-------------------------------------------------------------------------
/**
* @return The value of the graphic element type.
*/
public int value()
{
return value;
}
/**
* @return The SiteType of the graphic element type.
*/
public SiteType siteType()
{
return siteType;
}
//-------------------------------------------------------------------------
/**
* @param value The value.
*
* @return the Board Graphics Type from its value.
*/
public static BoardGraphicsType getTypeFromValue(final int value)
{
for (final BoardGraphicsType type : values())
if (type.value == value)
return type;
return null;
}
//-------------------------------------------------------------------------
}
| 2,272 | 23.706522 | 78 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/ComponentStyleType.java | package metadata.graphics.util;
import metadata.MetadataItem;
//-----------------------------------------------------------------------------
/**
* Supported style types for rendering particular components.
*
* @author matthew.stephenson and cambolbro
*/
public enum ComponentStyleType implements MetadataItem
{
/** Style for pieces. */
Piece,
/** Style for text/numbers (e.g. N Puzzles). */
Text,
/** Style for tiles (components that fill a cell and may have marked paths). */
Tile,
/** Style for playing cards. */
Card,
/** Style for die components used as playing pieces. */
Die,
/** Style for dominoes */
Domino,
/** Style for large pieces that srtaddle more than once site, e.g. the L Game. */
LargePiece,
/** Extended style for Shogi pieces. */
ExtendedShogi,
/** Extended style for Shogi pieces. */
ExtendedXiangqi,
/** Style for native american dice. */
NativeAmericanDice;
//-----------------------------------------------------------------------------
/**
* @param name The name.
*
* @return The component style from its name.
*/
public static ComponentStyleType fromName(final String name)
{
try
{
return valueOf(name);
}
catch (final Exception e)
{
return Piece;
}
}
}
| 1,266 | 18.796875 | 82 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/ContainerStyleType.java | package metadata.graphics.util;
import metadata.MetadataItem;
//-----------------------------------------------------------------------------
/**
* Supported style types for rendering particular boards.
*
* @author matthew.stephenson and cambolbro
*/
public enum ContainerStyleType implements MetadataItem
{
//---------- General styles for containers ----------
/** General style for boards. */
Board,
/** General style for player hands. */
Hand,
/** General style for player Decks. */
Deck,
/** General style for player Dice. */
Dice,
//---------- General styles for types of games ----------
/** General style for boardless games, e.g. Andantino. */
Boardless,
/** General board style for games with connective goals. */
ConnectiveGoal,
/** General style for Mancala boards. */
Mancala,
/** General style for the pen \& paper style games, such as graph games. */
PenAndPaper,
/** Style for square pyramidal games played on the Shibumi board, e.g. Spline. */
Shibumi,
/** General style for games played on a spiral board, e.g. Mehen. */
Spiral,
/** General style for games played on a isometric board. */
Isometric,
//---------- General styles for puzzles ----------
/** General style for deduction puzzle boards. */
Puzzle,
//---------- Custom styles for specific games ----------
/** Custom style for the Backgammon board. */
Backgammon,
/** Custom style for the Chess board. */
Chess,
/** Custom style for the Connect4 board. */
Connect4,
/** Custom style for the Go board. */
Go,
/** General style for graph game boards. */
Graph,
/** Custom style for the Hounds and Jackals (58 Holes) board. */
HoundsAndJackals,
/** Custom style for the Janggi board. */
Janggi,
/** Custom style for the Lasca board. */
Lasca,
/** Custom style for the Shogi board. */
Shogi,
/** Custom style for the Snakes and Ladders board. */
SnakesAndLadders,
/** Custom style for the Surakarta board. */
Surakarta,
/** Custom style for the Table board. */
Table,
/** Custom style for Tafl boards. */
Tafl,
/** Custom style for the Xiangqi board. */
Xiangqi,
/** Custom style for the Ultimate Tic-Tac-Toe board. */
UltimateTicTacToe,
//---------- Custom styles for specific puzzles ----------
/** Custom style for the Futoshiki puzzle board. */
Futoshiki,
/** Custom style for the Hashi puzzle board. */
Hashi,
/** Custom style for the Kakuro puzzle board. */
Kakuro,
/** Custom style for the Sudoku board. */
Sudoku,
;
/**
* @param value The name.
* @return The container style from its name.
*/
public static ContainerStyleType fromName(final String value)
{
try
{
return valueOf(value);
}
catch (final Exception e)
{
return Board;
}
}
}
| 2,789 | 19.666667 | 82 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/ControllerType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines supported controller types for handling user interactions for particular topologies.
*
* @author matthew.stephenson and cambolbro
*/
public enum ControllerType implements GraphicsItem
{
/** Basic user interaction controller. */
BasicController,
/** User interaction controller for games played on pyramidal topologies. */
PyramidalController,
;
//-----------------------------------------------------------------------------
/**
* @param value The name.
* @return The controller type from its name.
*/
public static ControllerType fromName(final String value)
{
try
{
return valueOf(value);
}
catch (final Exception e)
{
return BasicController;
}
}
//-----------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,200 | 18.063492 | 95 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/CurveType.java | package metadata.graphics.util;
import metadata.MetadataItem;
//-----------------------------------------------------------------------------
/**
* Supported style types for drawing curves.
*
* @author matthew.stephenson
*/
public enum CurveType implements MetadataItem
{
/** Spline curve based on relative distances. */
Spline,
/** Bezier curve based on absolute distances. */
Bezier;
//-----------------------------------------------------------------------------
/**
* @param name
* @return The curve type from its name.
*/
public static CurveType fromName(final String name)
{
try
{
return valueOf(name);
}
catch (final Exception e)
{
return Spline;
}
}
}
| 710 | 17.230769 | 80 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/EdgeInfoGUI.java | package metadata.graphics.util;
import java.awt.Color;
/**
* Relevant GUI information about an edge
*
* @author Matthew.Stephenson
*/
public class EdgeInfoGUI
{
private LineStyle style;
private Color colour;
//-----------------------------------------------------------------------------
/**
* @param style
* @param colour
*/
public EdgeInfoGUI
(
final LineStyle style,
final Color colour
)
{
this.setStyle(style);
this.setColour(colour);
}
/**
* @return The style of the edge.
*/
public LineStyle getStyle()
{
return style;
}
/**
* Set the style of the edge.
*
* @param style
*/
public void setStyle(final LineStyle style)
{
this.style = style;
}
/**
* @return The colour of the edge.
*/
public Color getColour()
{
return colour;
}
/**
* Set the colour of the edge.
*
* @param colour
*/
public void setColour(final Color colour)
{
this.colour = colour;
}
}
| 951 | 13.208955 | 80 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/EdgeType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines edge type for drawing board elements, e.g. for graph games.
*
* @author matthew.stephenson and cambolbro
*/
public enum EdgeType implements GraphicsItem
{
/** All board edges. */
All,
/** Inner board edges. */
Inner,
/** Outer board edges. */
Outer,
/** Interlayer board edges. */
Interlayer;
//-------------------------------------------------------------------------
/**
* Returns true if this is equal to or a subset of eA
*
* @param eA
* @return True if this super set of the edgeType in entry.
*/
public boolean supersetOf(final EdgeType eA)
{
if (this.equals(eA))
return true;
if (this.equals(All))
return true;
return false;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 1,190 | 16.514706 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/HoleType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines hole styles for Mancala board.
*
* @author Eric.Piette
*/
public enum HoleType implements GraphicsItem
{
/** Hole as Square. */
Square,
/** Oval as Square. */
Oval,
;
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 600 | 12.976744 | 44 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/LineStyle.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines line styles for drawing board elements, e.g. edges for graph games.
*
* @author matthew.stephenson and cambolbro
*/
public enum LineStyle implements GraphicsItem
{
/** Thin line. */
Thin,
/** Thick line. */
Thick,
/** Thin dotted line. */
ThinDotted,
/** Thick dotted line. */
ThickDotted,
/** Thin dashed line. */
ThinDashed,
/** Thick dashed line. */
ThickDashed,
/** Line not drawn. */
Hidden,
;
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 854 | 14 | 78 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/MetadataFunctions.java | package metadata.graphics.util;
import java.util.ArrayList;
import game.equipment.other.Regions;
import game.functions.ints.board.Id;
import game.types.play.RoleType;
import other.context.Context;
/**
* The metadata functions.
*/
public class MetadataFunctions
{
//-------------------------------------------------------------------------
/**
* Takes in the name of a region and returns an array of all sites in it.
*
* @param context The context.
* @param regionName The name of the region.
* @param roleType The role of the owner.
* @return The converting regions into integers sites.
*/
public static ArrayList<ArrayList<Integer>> convertRegionToSiteArray(final Context context, final String regionName, final RoleType roleType)
{
final ArrayList<ArrayList<Integer>> allRegionSites = new ArrayList<>();
for(final Regions region : context.equipment().regions())
if (region.name().equals((regionName)))
if (roleType == null || roleType.equals(region.role()))
{
allRegionSites.add(new ArrayList<>());
region.preprocess(context.game());
for (final int site : region.eval(context))
allRegionSites.get(allRegionSites.size()-1).add(Integer.valueOf(site));
}
return allRegionSites;
}
//-------------------------------------------------------------------------
/**
* @param context The context.
* @param roletype The roletype.
* @return The real owner.
*/
public static int getRealOwner(final Context context, final RoleType roletype)
{
return new Id(null, roletype).eval(context.currentInstanceContext());
}
}
| 1,617 | 27.385965 | 142 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/MetadataImageInfo.java | package metadata.graphics.util;
import java.awt.Color;
import game.types.board.SiteType;
/**
* The Metadata Image Info.
* Generic object for holding various bits of information when applying metadata graphics
*
* @author matthew.stephenson
*/
public class MetadataImageInfo
{
/**
* The vertices to draw line through.
*/
private Integer[] line;
/**
* The site.
*/
private int site = -1;
/**
* The type of the graph element.
*/
private SiteType siteType;
/**
* The path.
*/
private String path;
/**
* text string.
*/
private String text;
/**
* The image scale along x-axis.
*/
private float scaleX;
/**
* The image scale along y-axis.
*/
private float scaleY;
/**
* The main colour.
*/
private Color mainColour; // typically the fill colour
/**
* The secondary colour.
*/
private Color secondaryColour; // typically the edge colour
/**
* The BoardGraphicsType.
*/
private BoardGraphicsType boardGraphicsType;
/**
* The site type of the region.
*/
private SiteType regionSiteType;
/**
* The offset distance in pixels to the right.
*/
private float offestX = 0;
/**
* The offset distance in pixels downwards.
*/
private float offestY = 0;
/**
* The rotation.
*/
private int rotation = 0;
/**
* The curved values.
*/
private Float[] curve;
/**
* The type of curve.
*/
private CurveType curveType = CurveType.Spline;
/**
* LineStyle.
*/
private LineStyle lineStyle = LineStyle.Thin;
//-------------------------------------------------------------------------
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param scale The scale of the image.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final float scale)
{
setSite(site);
setSiteType(element);
setPath(path);
setScaleX(scale);
setScaleY(scale);
}
/**
* @param line The line between two vertices.
* @param element The type of the graph element.
* @param mainColour The colour of the edge.
* @param scale The scale of the edges.
*/
public MetadataImageInfo(final Integer[] line, final SiteType element, final Color mainColour, final float scale)
{
setLine(line);
setMainColour(mainColour);
setScaleX(scale);
setScaleY(scale);
setSiteType(element);
}
/**
* @param line The line between two vertices.
* @param mainColour The colour of the edge.
* @param scale The scale of the edges.
* @param curve The curved values.
* @param siteType The type of the graph element.
* @param curveType The type of curve.
* @param lineStyle The line style.
*/
public MetadataImageInfo(final Integer[] line, final Color mainColour, final float scale, final Float[] curve, final SiteType siteType, final CurveType curveType, final LineStyle lineStyle)
{
setLine(line);
setMainColour(mainColour);
setScaleX(scale);
setScaleY(scale);
setCurve(curve);
setSiteType(siteType);
setCurveType(curveType);
setLineStyle(lineStyle);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param scale The scale of the image.
* @param mainColour The main colour.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final float scale, final Color mainColour)
{
setSite(site);
setSiteType(element);
setPath(path);
setScaleX(scale);
setScaleY(scale);
setMainColour(mainColour);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param scale The scale of the image.
* @param mainColour The main colour.
* @param secondaryColour The secondary colour.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final float scale, final Color mainColour, final Color secondaryColour)
{
setSite(site);
setSiteType(element);
setPath(path);
setScaleX(scale);
setScaleY(scale);
setMainColour(mainColour);
setSecondaryColour(secondaryColour);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param scale The scale of the image.
* @param mainColour The main colour.
* @param secondaryColour The secondary colour.
* @param rotation The rotation.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final float scale, final Color mainColour, final Color secondaryColour, final int rotation)
{
setSite(site);
setSiteType(element);
setPath(path);
setScaleX(scale);
setScaleY(scale);
setMainColour(mainColour);
setSecondaryColour(secondaryColour);
setRotation(rotation);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param scale The scale of the image.
* @param mainColour The main colour.
* @param secondaryColour The secondary colour.
* @param rotation The rotation.
* @param offsetX The offset to the right.
* @param offsetY The offset downwards.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final float scale, final Color mainColour, final Color secondaryColour, final int rotation, final float offsetX, final float offsetY)
{
setSite(site);
setSiteType(element);
setPath(path);
setScaleX(scale);
setScaleY(scale);
setMainColour(mainColour);
setSecondaryColour(secondaryColour);
setRotation(rotation);
setOffestX(offsetX);
setOffestY(offsetY);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param scaleX The scale of the image along x-axis.
* @param scaleY The scale of the image along y-axis.
* @param mainColour The main colour.
* @param secondaryColour The secondary colour.
* @param rotation The rotation.
* @param offsetX The offset to the right.
* @param offsetY The offset downwards.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final float scaleX, final float scaleY, final Color mainColour, final Color secondaryColour, final int rotation, final float offsetX, final float offsetY)
{
setSite(site);
setSiteType(element);
setPath(path);
setScaleX(scaleX);
setScaleY(scaleY);
setMainColour(mainColour);
setSecondaryColour(secondaryColour);
setRotation(rotation);
setOffestX(offsetX);
setOffestY(offsetY);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param path The path.
* @param text The text string.
* @param scaleX The scale of the image along x-axis.
* @param scaleY The scale of the image along y-axis.
* @param mainColour The main colour.
* @param secondaryColour The secondary colour.
* @param rotation The rotation.
* @param offsetX The offset to the right.
* @param offsetY The offset downwards.
*/
public MetadataImageInfo(final int site, final SiteType element, final String path, final String text, final float scaleX, final float scaleY, final Color mainColour, final Color secondaryColour, final int rotation, final float offsetX, final float offsetY)
{
setSite(site);
setSiteType(element);
setPath(path);
setText(text);
setScaleX(scaleX);
setScaleY(scaleY);
setMainColour(mainColour);
setSecondaryColour(secondaryColour);
setRotation(rotation);
setOffestX(offsetX);
setOffestY(offsetY);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param boardGraphicsType The BoardGraphicsType.
* @param mainColour The main colour of the board.
*/
public MetadataImageInfo(final int site, final SiteType element, final BoardGraphicsType boardGraphicsType, final Color mainColour)
{
setSite(site);
setSiteType(element);
setMainColour(mainColour);
setBoardGraphicsType(boardGraphicsType);
}
/**
* @param site The site.
* @param element The type of the graph element.
* @param regionSiteType The type of the region.
* @param mainColour The main colour of the board.
* @param scale The scale.
*/
public MetadataImageInfo(final int site, final SiteType element, final SiteType regionSiteType, final Color mainColour, final float scale)
{
setSite(site);
setSiteType(element);
setMainColour(mainColour);
setRegionSiteType(regionSiteType);
setScaleX(scale);
setScaleY(scale);
}
//-------------------------------------------------------------------------
/**
* @return max scale along X and Y axis.
*/
public float scale()
{
return Math.max(scaleX(), scaleY());
}
/**
* @return The line indices.
*/
public Integer[] line()
{
return line;
}
/**
* @param line The line indices.
*/
public void setLine(final Integer[] line)
{
this.line = line;
}
/**
* @return The site.
*/
public int site()
{
return site;
}
/**
* @param site The site.
*/
public void setSite(final int site)
{
this.site = site;
}
/**
* @return The siteType.
*/
public SiteType siteType()
{
return siteType;
}
/**
* @param siteType The siteType.
*/
public void setSiteType(final SiteType siteType)
{
this.siteType = siteType;
}
/**
* @return The path.
*/
public String path()
{
return path;
}
/**
* @return The text.
*/
public String text()
{
return text;
}
/**
* @param path The path.
*/
public void setPath(final String path)
{
this.path = path;
}
/**
* @param text The text to set.
*/
public void setText(final String text)
{
this.text = text;
}
/**
* @return The X scale.
*/
public float scaleX()
{
return scaleX;
}
/**
* @param scaleX The X scale.
*/
public void setScaleX(final float scaleX)
{
this.scaleX = scaleX;
}
/**
* @return The Y scale.
*/
public float scaleY()
{
return scaleY;
}
/**
* @param scaleY The Y scale.
*/
public void setScaleY(final float scaleY)
{
this.scaleY = scaleY;
}
/**
* @return The main colour.
*/
public Color mainColour()
{
return mainColour;
}
/**
* @param mainColour The main colour.
*/
public void setMainColour(final Color mainColour)
{
this.mainColour = mainColour;
}
/**
* @return The secondary colour.
*/
public Color secondaryColour()
{
return secondaryColour;
}
/**
* @param secondaryColour The secondary colour.
*/
public void setSecondaryColour(final Color secondaryColour)
{
this.secondaryColour = secondaryColour;
}
/**
* @return The graphic type of the board.
*/
public BoardGraphicsType boardGraphicsType()
{
return boardGraphicsType;
}
/**
* @param boardGraphicsType The graphic type of the board.
*/
public void setBoardGraphicsType(final BoardGraphicsType boardGraphicsType)
{
this.boardGraphicsType = boardGraphicsType;
}
/**
* @return The type of the region.
*/
public SiteType regionSiteType()
{
return regionSiteType;
}
/**
* @param regionSiteType The type of the region.
*/
public void setRegionSiteType(final SiteType regionSiteType)
{
this.regionSiteType = regionSiteType;
}
/**
* @return The X offset.
*/
public float offestX()
{
return offestX;
}
/**
* @param offestX The X offset.
*/
public void setOffestX(final float offestX)
{
this.offestX = offestX;
}
/**
* @return The Y offset.
*/
public float offestY()
{
return offestY;
}
/**
* @param offestY The Y offset.
*/
public void setOffestY(final float offestY)
{
this.offestY = offestY;
}
/**
* @return The rotation value.
*/
public int rotation()
{
return rotation;
}
/**
* @param rotation The rotation value.
*/
public void setRotation(final int rotation)
{
this.rotation = rotation;
}
/**
* @return The curve parameters.
*/
public Float[] curve()
{
return curve;
}
/**
* @param curve The curve parameters.
*/
public void setCurve(final Float[] curve)
{
this.curve = curve;
}
/**
* @return The type of the curve.
*/
public CurveType curveType()
{
return curveType;
}
/**
* @param curveType The type of the curve.
*/
public void setCurveType(final CurveType curveType)
{
this.curveType = curveType;
}
/**
* @return The line style.
*/
public LineStyle lineStyle()
{
return lineStyle;
}
/**
* @param lineStyle The line style.
*/
public void setLineStyle(final LineStyle lineStyle)
{
this.lineStyle = lineStyle;
}
} | 12,880 | 20.39701 | 258 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/PieceColourType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines different colours for a piece.
*
* @author matthew.stephenson
*/
public enum PieceColourType implements GraphicsItem
{
/** Fill colour. */
Fill,
/** Edge colour. */
Edge,
/** Secondary colour. Used for things like the count colour. */
Secondary,
;
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 765 | 14.958333 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/PieceStackType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines different ways of visualising stacks of pieces.
*
* @author matthew.stephenson and cambolbro
*/
public enum PieceStackType implements GraphicsItem
{
/** Stacked one above the other (with offset). */
Default,
/** Spread on the ground, e.g. Snakes and Ladders or Pachisi. */
Ground,
/** Spread on the ground, but position based on size of stack. */
GroundDynamic,
/** Reverse stacking downwards. */
Reverse,
/** Spread to show each component like a hand of cards. */
Fan,
/** Spread to show each component like a hand of cards, alternating left and right side of centre. */
FanAlternating,
/** No visible stacking. */
None,
/** Stacked Backgammon-style in lines of five. */
Backgammon,
/** Show just top piece, with the stack value as number. */
Count,
/** Stacked one above the other (with offset), with the stack value as number. */
DefaultAndCount,
/** Show just top piece, with the stack value as number(s), coloured by who. */
CountColoured,
/** Stacked Ring-style around cell perimeter. */
Ring,
/** Stacked towards the center of the board. */
TowardsCenter,
;
//-------------------------------------------------------------------------
/**
* @param value The value.
* @return The PieceStackType.
*/
public static PieceStackType getTypeFromValue(final int value)
{
for (final PieceStackType type : values())
if (type.ordinal() == value)
return type;
return null;
}
//-------------------------------------------------------------------------
/**
* @return True if the stack is horizontal
*/
public boolean horizontalStack()
{
if (equals(PieceStackType.Fan))
return true;
if (equals(PieceStackType.FanAlternating))
return true;
return false;
}
//-------------------------------------------------------------------------
/**
* @return True if the stack is vertical
*/
public boolean verticalStack()
{
if (equals(PieceStackType.Default))
return true;
if (equals(PieceStackType.Reverse))
return true;
if (equals(PieceStackType.Backgammon))
return true;
return false;
}
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 2,626 | 20.532787 | 102 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/PuzzleDrawHintType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines different ways of visualising stacks of pieces.
*
* @author matthew.stephenson and cambolbro
*/
public enum PuzzleDrawHintType implements GraphicsItem
{
/** Hints drawn in the middle. */
Default,
/** Hints drawn in the top left. */
TopLeft,
/** Draw the hint next to the region. */
NextTo,
/** No hints. */
None,
;
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 837 | 15.115385 | 76 | java |
Ludii | Ludii-master/Core/src/metadata/graphics/util/PuzzleHintLocationType.java | package metadata.graphics.util;
import java.util.BitSet;
import game.Game;
import metadata.graphics.GraphicsItem;
/**
* Defines different ways of visualising stacks of pieces.
*
* @author matthew.stephenson and cambolbro
*/
public enum PuzzleHintLocationType implements GraphicsItem
{
/** Hints placed on top-left site of region. */
Default,
/** Draw hint on edge between vertex. */
BetweenVertices,
;
//-------------------------------------------------------------------------
@Override
public BitSet concepts(final Game game)
{
final BitSet concepts = new BitSet();
return concepts;
}
@Override
public long gameFlags(final Game game)
{
final long gameFlags = 0l;
return gameFlags;
}
@Override
public boolean needRedraw()
{
return false;
}
}
| 786 | 16.488889 | 76 | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.