Class StructureDefinition<T>
- java.lang.Object
-
- com.gtnewhorizon.structurelib.structure.StructureDefinition<T>
-
- All Implemented Interfaces:
IStructureDefinition<T>
public class StructureDefinition<T> extends java.lang.Object implements IStructureDefinition<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStructureDefinition.Builder<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <B> StructureDefinition.Builder<B>builder()Create a new instance of builder.java.util.List<com.gtnewhorizon.structurelib.coords.Position<com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords>>getAllSockets(java.lang.String piece, char socket)Gets all sockets with a given character for a piece.com.gtnewhorizon.structurelib.coords.Position<com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords>getControllerPosition(java.lang.String piece)Gets the controller position for a piece.com.gtnewhorizon.structurelib.coords.StructureDefinitionCoordsgetCoordinateSystem(java.lang.String piece)Gets the coordinate system for a piece.java.util.Map<java.lang.Character,IStructureElement<T>>getElements()java.util.Map<java.lang.String,java.lang.String>getShapes()com.gtnewhorizon.structurelib.coords.Position<com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords>getSocket(java.lang.String piece, char socket)Gets a socket from a piece.IStructureElement<T>[]getStructureFor(java.lang.String name)Used internallyjava.util.Map<java.lang.String,IStructureElement<T>[]>getStructures()booleanisContainedInStructure(java.lang.String name, int offsetA, int offsetB, int offsetC)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.gtnewhorizon.structurelib.structure.IStructureDefinition
build, buildOrHints, check, hints, iterate, survivalBuild, survivalBuild
-
-
-
-
Method Detail
-
builder
public static <B> StructureDefinition.Builder<B> builder()
Description copied from interface:IStructureDefinitionCreate a new instance of builder.- Type Parameters:
B- type of context object
-
getElements
public java.util.Map<java.lang.Character,IStructureElement<T>> getElements()
-
getShapes
public java.util.Map<java.lang.String,java.lang.String> getShapes()
-
getStructures
public java.util.Map<java.lang.String,IStructureElement<T>[]> getStructures()
-
getStructureFor
public IStructureElement<T>[] getStructureFor(java.lang.String name)
Description copied from interface:IStructureDefinitionUsed internallyMight, but is not required, to throw
NoSuchElementExceptionif the given structure piece is not found.- Specified by:
getStructureForin interfaceIStructureDefinition<T>- Parameters:
name- same name as for other methods here- Returns:
- the array of elements to process
-
isContainedInStructure
public boolean isContainedInStructure(java.lang.String name, int offsetA, int offsetB, int offsetC)- Specified by:
isContainedInStructurein interfaceIStructureDefinition<T>
-
getControllerPosition
public com.gtnewhorizon.structurelib.coords.Position<com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords> getControllerPosition(java.lang.String piece)
Description copied from interface:IStructureDefinitionGets the controller position for a piece. Controller positions are denoted by a tilde.- Specified by:
getControllerPositionin interfaceIStructureDefinition<T>- Parameters:
piece- The piece name- Returns:
- The controller position, or null if it doesn't exist for the given piece
-
getCoordinateSystem
public com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords getCoordinateSystem(java.lang.String piece)
Description copied from interface:IStructureDefinitionGets the coordinate system for a piece. This is used to translate structure definition coordinates into structure relative coordinates.- Specified by:
getCoordinateSystemin interfaceIStructureDefinition<T>- Parameters:
piece- The piece- Returns:
- The coordinate system
-
getSocket
public com.gtnewhorizon.structurelib.coords.Position<com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords> getSocket(java.lang.String piece, char socket)Description copied from interface:IStructureDefinitionGets a socket from a piece.- Specified by:
getSocketin interfaceIStructureDefinition<T>- Parameters:
piece- The piece namesocket- The socket character- Returns:
- The socket's position
- See Also:
StructureDefinition.Builder.addSocket(char, char)
-
getAllSockets
@Nonnull public java.util.List<com.gtnewhorizon.structurelib.coords.Position<com.gtnewhorizon.structurelib.coords.StructureDefinitionCoords>> getAllSockets(java.lang.String piece, char socket)Description copied from interface:IStructureDefinitionGets all sockets with a given character for a piece.- Specified by:
getAllSocketsin interfaceIStructureDefinition<T>- Parameters:
piece- The piece namesocket- The socket character- Returns:
- The list of socket positions, or an empty list if the socket is not present
- See Also:
StructureDefinition.Builder.addSocket(char, char)
-
-