All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zaber.motion.ascii.StreamAxisDefinition Maven / Gradle / Ivy

Go to download

A library that aims to provide easy-to-use API for communication with Zaber devices using Zaber ASCII Protocol.

There is a newer version: 6.7.0
Show newest version
// ===== THIS FILE IS GENERATED FROM A TEMPLATE ===== //
// ============== DO NOT EDIT DIRECTLY ============== //

package zaber.motion.ascii;

import zaber.motion.protobufs.Main;

/**
 * Defines an axis of the stream.
 */
public final class StreamAxisDefinition {

    private int axisNumber;

    /**
     * Number of a physical axis or a lockstep group.
     */
    public void setAxisNumber(int axisNumber) {
        this.axisNumber = axisNumber;
    }

    /**
     * @return Number of a physical axis or a lockstep group.
     */
    public int getAxisNumber() {
        return this.axisNumber;
    }

    private StreamAxisType axisType;

    /**
     * Defines the type of the axis.
     */
    public void setAxisType(StreamAxisType axisType) {
        this.axisType = axisType;
    }

    /**
     * @return Defines the type of the axis.
     */
    public StreamAxisType getAxisType() {
        return this.axisType;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("StreamAxisDefinition { ");
        sb.append("axisNumber: ");
        sb.append(this.axisNumber);
        sb.append(", ");
        sb.append("axisType: ");
        sb.append(this.axisType);
        sb.append(" }");
        return sb.toString();
    }

    public StreamAxisDefinition() {
    }

    public StreamAxisDefinition(
        int axisNumber) {
        this.axisNumber = axisNumber;
    }

    public StreamAxisDefinition(
        int axisNumber,
        StreamAxisType axisType) {
        this.axisNumber = axisNumber;
        this.axisType = axisType;
    }

    public static StreamAxisDefinition fromProtobuf(Main.StreamAxisDefinition pbData) {
        StreamAxisDefinition obj = new StreamAxisDefinition();
        obj.setAxisNumber(pbData.getAxisNumber());
        obj.setAxisType(StreamAxisType.valueOf(pbData.getAxisType()));
        return obj;
    }

    public static Main.StreamAxisDefinition toProtobuf(StreamAxisDefinition source) {

        Main.StreamAxisDefinition.Builder builder = Main.StreamAxisDefinition.newBuilder();

        builder = builder.setAxisNumber(source.getAxisNumber());
        builder = builder.setAxisType(source.getAxisType().getValue());
        return builder.build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy