package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */

{
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);
        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);
        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength()

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);
        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);
        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);

package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {

        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);
        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);

package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);

        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }

package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);
        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);


package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command


public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);
        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);
        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");

package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {

        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);
        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);
        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


package org.usb4java.javax.examples.adb;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 * The header of an ADB message.
 *
 * @author Klaus Reimer (k@ailis.de)
 */
public class MessageHeader {

    /**
     * Command for SYNC message.
     */
    public static final int CMD_SYNC = 0x434e5953;

    /**
     * Command for CONNECT

message.
     */
    public static final int CMD_CNXN = 0x4e584e43;

    /**
     * Command for AUTH message.
     */
    public static final int CMD_AUTH = 0x48545541;

    /**
     * Command for OPEN message.
     */
    public static final int CMD_OPEN = 0x4e45504f;

    /**
     * Command for OKAY message.
     */
    public static final int CMD_OKAY = 0x59414b4f;

    /**
     * Command for CLOSE message.
     */
    public static final int CMD_CLSE = 0x45534c43;

    /**
     * Command for WRITE message.
     */
    public static final int CMD_WRTE = 0x45545257;

    /**
     * The ADB message header size in bytes.
     */
    public static final int SIZE = 24;

    /**
     * The ADB message command.
     */
    private final int command;

    /**
     * First argument.
     */
    private final int arg0;

    /**
     * Second argument.
     */
    private final int arg1;

    /**
     * Length of payload (0 is allowed).
     */
    private final int dataLength;

    /**
     * Checksum of data payload (Sum of all bytes).
     */
    private final int dataChecksum;

    /**
     * Inverted command.
     */
    private final int magic;

    /**
     * Constructs a new ADB message.
     *
     * @param command
     *            The command.
     * @param arg0
     *            The first argument.
     * @param arg1
     *            The second argument.
     * @param dataLength
     *            The data length in bytes.
     * @param dataChecksum
     *            The data checksum. According to the documentation this is a
     *            CRC32 checksum but in reality it is just the sum of all data
     *            bytes.
     * @param magic
     *            The inverted command. Can be used for validating the message
     *            header.
     */
    public MessageHeader(int command, int arg0, int arg1, int dataLength, int dataChecksum, int magic) {
        this.command = command;
        this.arg0 = arg0;
        this.arg1 = arg1;
        this.dataLength = dataLength;
        this.dataChecksum = dataChecksum;
        this.magic = command ^ 0xffffffff;
    }

    /**
     * Constructs a new ADB message header from the specified byte array.
     *
     * @param bytes
     *            The ADB message header as bytes.
     */
    public MessageHeader(byte[] bytes) {
        if (bytes.length != SIZE)
            throw new IllegalArgumentException("ADB message header must be " + SIZE + " bytes large, not " + bytes.length + " bytes");
        ByteBuffer buffer = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
        this.command = buffer.getInt();
        this.arg0 = buffer.getInt();
        this.arg1 = buffer.getInt();
        this.dataLength = buffer.getInt();
        this.dataChecksum = buffer.getInt();
        this.magic = buffer.getInt();
    }

    /**
     * Returns the command.
     *
     * @return The command.
     */
    public int getCommand() {
        return this.command;
    }

    /**
     * Returns the first argument.
     *
     * @return The first argument.
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * Returns the second argument.
     *
     * @return The second argument.
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * Returns the data checksum.
     *
     * @return The data checksum.
     */
    public int getDataChecksum() {
        return this.dataChecksum;
    }

    /**
     * Returns the data length.
     *
     * @return The data length.
     */
    public int getDataLength() {
        return this.dataLength;
    }

    /**
     * Returns the inverted command.
     *
     * @return The inverted command.
     */
    public int getMagic() {
        return this.magic;
    }

    /**
     * Check if this message header is valid. This simply checks if the header
     * magic value is the inverted value of the command value.
     *
     * @return True if message header is valid, false if not.
     */
    public boolean isValid() {
        return this.magic == (this.command ^ 0xffffffff);
    }

    /**
     * Returns the message header as a byte array.
     *
     * @return The message header as a byte array.
     */
    public byte[] getBytes() {
        ByteBuffer buffer = ByteBuffer.allocate(SIZE);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putInt(this.command);
        buffer.putInt(this.arg0);
        buffer.putInt(this.arg1);
        buffer.putInt(this.dataLength);
        buffer.putInt(this.dataChecksum);
        buffer.putInt(this.magic);
        return buffer.array();
    }
}


package org.bouncycastle.jce.spec;

import java.math.BigInteger;
import java.security.spec.KeySpec;

/**
 * This class specifies a GOST3410-94 public key with its associated parameters.
 */
public class GOST3410PublicKeySpec implements KeySpec {

    private BigInteger y;

    private BigInteger p;

    private BigInteger q;

    private BigInteger a;

    /**
     * Creates a new GOST3410PublicKeySpec with the specified parameter values.
     *
     * @param y the public key.
     * @param p the prime.
     * @param q the sub-prime.
     * @param a the base.
     */
    public GOST3410PublicKeySpec(BigInteger y, BigInteger p, BigInteger q, BigInteger a) {
        this.y = y;
        this.p = p;
        this.q = q;
        this.a = a;
    }

    public BigInteger getY() {
        return this.y;
    }

    /**
     * Returns the prime p.
     *
     * @return the prime p.
     */
    public BigInteger getP() {
        return this.p;
    }

    /**
     * Returns the sub-prime q.
     *
     * @return the sub-prime q.
     */

{
        return this.q;
    }

    /**
     * Returns the base g.
     *
     * @return the base g.
     */
    public BigInteger getA() {
        return this.a;
    }
}


package org.bouncycastle.jce.spec;

import java.math.BigInteger;
import java.security.spec.KeySpec;

/**
 * This class specifies a GOST3410-94 public key with its associated parameters.
 */
public class GOST3410PublicKeySpec implements KeySpec {

    private BigInteger y;

    private BigInteger p;

    private BigInteger q;

    private BigInteger a;

    /**
     * Creates a new GOST3410PublicKeySpec with the specified parameter values.
     *
     * @param y the public key.
     * @param p the prime.
     * @param q the sub-prime.
     * @param a the base.
     */
    public GOST3410PublicKeySpec(BigInteger y, BigInteger p, BigInteger q, BigInteger a) {
        this.y = y;
        this.p = p;
        this.q = q;
        this.a = a;
    }

    public BigInteger getY() {
        return this.y;
    }

    /**
     * Returns the prime p.
     *
     * @return the prime p.
     */
    public BigInteger getP()

/**
     * Returns the sub-prime q.
     *
     * @return the sub-prime q.
     */
    public BigInteger getQ() {
        return this.q;
    }

    /**
     * Returns the base g.
     *
     * @return the base g.
     */
    public BigInteger getA() {
        return this.a;
    }
}


package org.bouncycastle.jce.spec;

import java.math.BigInteger;
import java.security.spec.KeySpec;

/**
 * This class specifies a GOST3410-94 public key with its associated parameters.
 */
public class GOST3410PublicKeySpec implements KeySpec {

    private BigInteger y;

    private BigInteger p;

    private BigInteger q;

    private BigInteger a;

    /**
     * Creates a new GOST3410PublicKeySpec with the specified parameter values.
     *
     * @param y the public key.
     * @param p the prime.
     * @param q the sub-prime.
     * @param a the base.
     */
    public GOST3410PublicKeySpec(BigInteger y, BigInteger p, BigInteger q, BigInteger a) {
        this.y = y;
        this.p = p;
        this.q = q;
        this.a = a;
    }

    public BigInteger getY() {
        r

}

    /**
     * Returns the prime p.
     *
     * @return the prime p.
     */
    public BigInteger getP() {
        return this.p;
    }

    /**
     * Returns the sub-prime q.
     *
     * @return the sub-prime q.
     */
    public BigInteger getQ() {
        return this.q;
    }

    /**
     * Returns the base g.
     *
     * @return the base g.
     */
    public BigInteger getA() {
        return this.a;
    }
}


public BigInteger getQ() {
        return this.q;
    }

/**
     * Returns the base g.
     *
     * @return the base g.
     */
    public BigInteger getA() {
        return this.a;
    }
}


package org.bouncycastle.jce.spec;

import java.math.BigInteger;
import java.security.spec.KeySpec;

/**
 * This class specifies a GOST3410-94 public key with its associated parameters.
 */
public class GOST3410PublicKeySpec implements KeySpec {

    private BigInteger y;

    private BigInteger p;

    private BigInteger q;

    private BigInteger a;

    /**
     * Creates a new GOST3410PublicKeySpec with the specified parameter values.
     *
     * @param y the public key.
     * @param p the prime.
     * @param q the sub-prime.
     * @param a the base.
     */
    public GOST3410PublicKeySpec(BigInteger y, BigInteger p, BigInteger q, BigInteger a) {
        this.y = y;
        this.p = p;
        this.q = q;
        this.a = a;
    }

    public BigInteger getY() {
        return this.y;
    }

    /**
     * Returns the prime p.
     *
     * @return the prime p.
     */
    public BigInteger getP() {
        return this.p;
    }

    /**
     * Returns the sub-prime q.
     *
     * @return the sub-prime q.
     */
    public BigInteger getQ() {
        return this.q;
    }

    /**
     * Returns the base g.
     *
     * @return the base <code

>g</code>.
     */
    public BigInteger getA() {
        return this.a;
    }
}


@Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException

package org.openforis.collect.context;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author M. Togna
 */
public class ApplicationContextAwareImpl implements ApplicationContextAware {

    public ApplicationContextAwareImpl() {
        super();
    }

{
        CollectContext.setApplicationContext(applicationContext);
    }
}


{
        CollectContext.setApplicationContext(applicationContext);
    }

package org.openforis.collect.context;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author M. Togna
 */
public class ApplicationContextAwareImpl implements ApplicationContextAware {

    public ApplicationContextAwareImpl() {
        super();
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException


package org.openforis.collect.context;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author M. Togna
 */
public class ApplicationContextAwareImpl implements ApplicationContextAware {

    public ApplicationContextAwareImpl() {
        super();
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        CollectContext.setApplicat


package org.openforis.collect.context;

import org.springframework.beans.BeansException;
import org.springf

ramework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author M. Togna
 */
public class ApplicationContextAwareImpl implements ApplicationContextAware {

    public ApplicationContextAwareImpl() {
        super();
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        CollectContext.setApplicationContext(applicationContext);
    }
}


package weka.classifiers.functions.neural;

import java.io.Serializable;

/**
 * This is an interface used to create classes that can be used by the
 * neuralnode to perform all it's computations.
 *
 * @author Malcolm Ware (example@nnthink.com)
 * @version $Revision: 8034 $
 */
public interface NeuralMethod extends Serializable {

    /**
     * This function calculates what the output value should be.
     * @param node The node to calculate the value for.
     * @return The value.
     */

    /**
     * This function calculates what the error value should be.
     * @param node The node to calculate the error for.
     * @return The error.
     */
    double errorValue(NeuralNode node);

    /**
     * This function will calculate what the change in weights should be
     * and also update them.
     * @param node The node to update the weights for.
     * @param learn The learning rate to use.
     * @param momentum The momentum to use.
     */
    void updateWeights(NeuralNode node, double learn, double momentum);
}


package weka.classifiers.functions.neural;

import java.io.Serializable;

/**
 * This is an interface used to create classes that can be used by the
 * neuralnode to perform all it's computations.
 *
 * @author Malcolm Ware (example@nnthink.com)
 * @version $Revision: 8034 $
 */
public interface NeuralMethod extends Serializable {

    /**
     * This function calculates what the output value should be.
     * @param node The node to calculate the value for.
     * @return The value.
     */
    double outputValue(NeuralNode node);

    /**
     * This function calculates what the error value should be.
     * @param node The node to calculate the error for.
     * @return The error.
     */
    double errorValue(NeuralNode node);

    /**
     * This function will calculate what the change in weights should be
     * and also update them.
     * @param node The nod

e to update the weights for.
     * @param learn The learning rate to use.
     * @param momentum The momentum to use.
     */
    void updateWeights(NeuralNode node, double learn, double momentum);
}


package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {
        SettingBuilder<T> builder = new SettingImplBuilder<>();
        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }
        return builder.build();
    }

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

{
        this.id = id;
    }

    public abstract String getName();
}


{
        SettingBuilder<T> builder = new SettingImplBuilder<>();
        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }
        return builder.build();
    }

package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments)

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

    void setId(SimpleUri id) {
        this.id = id;
    }

    public abstract String getName();
}


SettingBuilder<T> builder = new SettingImplBuilder<>();

package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {

        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }
        return builder.build();
    }

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

    void setId(SimpleUri id) {
        this.id = id;
    }

    public abstract String getName();
}


for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }

package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {
        SettingBuilder<T> builder = new SettingImplBuilder<>();

        return builder.build();
    }

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

    void setId(SimpleUri id) {
        this.id = id;
    }

    public abstract String getName();
}


package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {
        SettingBuilder<T> builder = new SettingImplBuilder<>();
        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }


package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), Ref

    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {
        SettingBuilder<T> builder = new SettingImplBuilder<>();
        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }
        return builder.build();
    }

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

    void setId(SimpleUri id) {
        this.id = id;
    }

    public abstract String getName();
}


try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }

package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    static Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {

        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {
        SettingBuilder<T> builder = new SettingImplBuilder<>();
        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }
        return builder.build();
    }

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

    void setId(SimpleUri id) {
        this.id = id;
    }

    public abstract String getName();
}


package org.terasology.engine.config.flexible;

import com.google.common.collect.ImmutableList;
import org.reflections.ReflectionUtils;
import org.terasology.engine.config.flexible.internal.SettingBuilder;
import org.terasology.engine.config.flexible.internal.SettingImplBuilder;
import org.terasology.engine.core.SimpleUri;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Represents a config class that will be automatically initialized and rendered by the engine.
 * All settings must be contained in {@code public static} fields of type {@link Setting}.
 */
public abstract class AutoConfig {

    private SimpleUri id;

    stati

c Set<Field> getSettingFieldsIn(Class<? extends AutoConfig> configType) {
        return ReflectionUtils.getFields(configType, ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withModifier(Modifier.FINAL), ReflectionUtils.withType(Setting.class));
    }

    public Set<Setting<?>> getSettings() {
        return getSettingFieldsIn(getClass()).stream().map(field -> {
            try {
                return (Setting<?>) field.get(this);
            } catch (IllegalAccessException e) {
                // Setting field will always be accessible, exception should never be thrown
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toSet());
    }

    private static <T> Setting<T> setting(Iterable<SettingArgument<?, T>> arguments) {
        SettingBuilder<T> builder = new SettingImplBuilder<>();
        for (SettingArgument<?, T> argument : arguments) {
            argument.setInBuilder(builder);
        }
        return builder.build();
    }

    @SafeVarargs
    protected static <T> Setting<T> setting(SettingArgument<TypeInfo<T>, T> valueType, SettingArgument<T, T> defaultValue, SettingArgument<?, T>... arguments) {
        return setting(ImmutableList.<SettingArgument<?, T>>builder().add(valueType).add(defaultValue).add(arguments).build());
    }

    public SimpleUri getId() {
        return id;
    }

    void setId(SimpleUri id) {
        this.id = id;
    }

    public abstract String getName();
}


String generateColumnLabel(CategoryDataset3D<S, R, C> dataset, C columnKey);

/* ===========================================================
 * Orson Charts : a 3D chart library for the Java(tm) platform
 * ===========================================================
 *
 *
 * http://example.com
 *
 *
 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
 * Other names may be trademarks of their respective owners.]
 *
 * commercial license can be purchased.  For details, please see visit the
 * Orson Charts home page:
 *
 * http://example.com
 *
 */
package org.jfree.chart3d.label;

import org.jfree.chart3d.data.category.CategoryDataset3D;
import org.jfree.chart3d.plot.CategoryPlot3D;

/**
 * A label generator for category charts, used to create labels for the axes
 * and for the chart legend.  The ({@link StandardCategoryLabelGenerator}) class
 * provides the default implementation.
 *

 * Note that a different generator is used for item labels in
 * a {@link CategoryPlot3D} - see the {@link CategoryItemLabelGenerator}
 * interface.
 *
 * @param <S> The series key type (must implement Comparable).
 * @param <R> The row key type (must implement Comparable).
 * @param <C> The column key type (must implement Comparable).
 *
 * @since 1.2
 */
public interface CategoryLabelGenerator<S extends Comparable<S>, R extends Comparable<R>, C extends Comparable<C>> {

    /**
     * Generates a label for one series in a {@link CategoryDataset3D}.
     *
     * @param dataset  the dataset ({@code null} not permitted).
     * @param seriesKey  the series key ({@code null} not permitted).
     *
     * @return The series label (possibly {@code null}).
     */
    String generateSeriesLabel(CategoryDataset3D<S, R, C> dataset, S seriesKey);

    /**
     * Generates a label for one row in a {@link CategoryDataset3D}.
     *
     * @param dataset  the dataset ({@code null} not permitted).
     * @param rowKey  the key ({@code null} not permitted).
     *
     * @return The row label (possibly {@code null}).
     */
    String generateRowLabel(CategoryDataset3D<S, R, C> dataset, R rowKey);

    /**
     * Generates a label for one column in a {@link CategoryDataset3D}.
     *
     * @param dataset  the dataset ({@code null} not permitted).
     * @param columnKey  the key ({@code null} not permitted).
     *
     * @return The column label (possibly {@code null}).
     */


/* ===========================================================
 * Orson Charts : a 3D chart library for the Java(tm) platform
 * ===========================================================
 *
 *
 * http://example.com
 *
 *
 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
 * Other names may be trademarks of their respective owners.]
 *
 * commercial license can be purchased.  For details, please see visit the
 * Orson Charts home page:
 *
 * http://example.com
 *
 */
package org.jfree.chart3d.label;

import org.jfree.chart3d.data.category.CategoryDataset3D;
import org.jfree.chart3d.plot.CategoryPlot3D;

/**
 * A label generator for category charts, used to create labels for the axes
 * and for the chart legend.  The ({@link StandardCategoryLabelGenerator}) class
 * provides the default implementation.
 *

 * Note that a different generator is used for item labels in
 * a {@link CategoryPlot3D} - see the {@link CategoryItemLabelGenerator}
 * interface.
 *
 * @param <S> The series key type (must implement Com

parable).
 * @param <R> The row key type (must implement Comparable).
 * @param <C> The column key type (must implement Comparable).
 *
 * @since 1.2
 */
public interface CategoryLabelGenerator<S extends Comparable<S>, R extends Comparable<R>, C extends Comparable<C>> {

    /**
     * Generates a label for one series in a {@link CategoryDataset3D}.
     *
     * @param dataset  the dataset ({@code null} not permitted).
     * @param seriesKey  the series key ({@code null} not permitted).
     *
     * @return The series label (possibly {@code null}).
     */
    String generateSeriesLabel(CategoryDataset3D<S, R, C> dataset, S seriesKey);

    /**
     * Generates a label for one row in a {@link CategoryDataset3D}.
     *
     * @param dataset  the dataset ({@code null} not permitted).
     * @param rowKey  the key ({@code null} not permitted).
     *
     * @return The row label (possibly {@code null}).
     */
    String generateRowLabel(CategoryDataset3D<S, R, C> dataset, R rowKey);

    /**
     * Generates a label for one column in a {@link CategoryDataset3D}.
     *
     * @param dataset  the dataset ({@code null} not permitted).
     * @param columnKey  the key ({@code null} not permitted).
     *
     * @return The column label (possibly {@code null}).
     */
    String generateColumnLabel(CategoryDataset3D<S, R, C> dataset, C columnKey);
}


void run(Object toRun, String[] options) throws IllegalArgumentException;

package weka.core;

/**
 * Interface to something that can be run from the command line.
 *
 * @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
 * @version $Revision: 8034 $
 */
public interface CommandlineRunnable {

    /**
     * Execute the supplied object.
     *
     * @param toRun the object to execute
     * @param options any options to pass to the object
     * @throws IllegalArgumentException if the object is not of the expected
     * type.
     */


package weka.core;

/**
 * Interface to something that can be run from the command line.
 *
 * @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
 * @version $Revision: 8034 $
 */
public interface CommandlineRunnable {

    /**
     * Execute the supplied object.
     *
     * @param toRun the object to execute
     * @param options any opt

ions to pass to the object
     * @throws IllegalArgumentException if the object is not of the expected
     * type.
     */
    void run(Object toRun, String[] options) throws IllegalArgumentException;
}


public InterestingProperties filterByCodeAnnotations(OptimizerNode node, int input)

package eu.stratosphere.compiler.dataproperties;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import eu.stratosphere.compiler.dag.OptimizerNode;

/**
 * The interesting properties that a node in the optimizer plan hands to its predecessors. It has the
 * purpose to tell the preceding nodes, which data properties might have the advantage, because they would
 * let the node fulfill its pact cheaper. More on optimization with interesting properties can be found
 * in the works on the volcano- and cascades optimizer framework.
 */
public class InterestingProperties implements Cloneable {

    // the global properties, i.e. properties across partitions
    private Set<RequestedGlobalProperties> globalProps;

    // the local properties, i.e. properties within partitions
    private Set<RequestedLocalProperties> localProps;

    public InterestingProperties() {
        this.globalProps = new HashSet<RequestedGlobalProperties>();
        this.localProps = new HashSet<RequestedLocalProperties>();
    }

    /**
     * Private constructor for cloning purposes.
     *
     * @param maxCostsGlobal The maximal costs for the global properties.
     * @param maxCostsLocal The maximal costs for the local properties.
     * @param globalProps  The global properties for this new object.
     * @param localProps The local properties for this new object.
     */
    private InterestingProperties(Set<RequestedGlobalProperties> globalProps, Set<RequestedLocalProperties> localProps) {
        this.globalProps = globalProps;
        this.localProps = localProps;
    }

    public void addGlobalProperties(RequestedGlobalProperties props) {
        this.globalProps.add(props);
    }

    public void addLocalProperties(RequestedLocalProperties props) {
        this.localProps.add(props);
    }

    public void addInterestingProperties(InterestingProperties other) {
        this.globalProps.addAll(other.globalProps);
        this.localProps.addAll(other.localProps);
    }

    /**
     * Gets the interesting local properties.
     *
     * @return The interesting local properties.
     */
    public Set<RequestedLocalProperties> getLocalProperties() {
        return this.localProps;
    }

    /**
     * Gets the interesting global properties.
     *
     * @return The interesting global properties.
     */
    public Set<RequestedGlobalProperties> getGlobalProperties() {
        return this.globalProps;
    }

{
        InterestingProperties iProps = new InterestingProperties();
        for (RequestedGlobalProperties rgp : this.globalProps) {
            RequestedGlobalProperties filtered = rgp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addGlobalProperties(filtered);
            }
        }
        for (RequestedLocalProperties rlp : this.localProps) {
            RequestedLocalProperties filtered = rlp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addLocalProperties(filtered);
            }
        }
        return iProps;
    }

    public void dropTrivials() {
        for (Iterator<RequestedGlobalProperties> iter = this.globalProps.iterator(); iter.hasNext(); ) {
            RequestedGlobalProperties gp = iter.next();
            if (gp.isTrivial()) {
                iter.remove();
                break;
            }
        }
        for (Iterator<RequestedLocalProperties> iter = this.localProps.iterator(); iter.hasNext(); ) {
            RequestedLocalProperties lp = iter.next();
            if (lp.isTrivial()) {
                iter.remove();
                break;
            }
        }
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((globalProps == null) ? 0 : globalProps.hashCode());
        result = prime * result + ((localProps == null) ? 0 : localProps.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof InterestingProperties) {
            InterestingProperties other = (InterestingProperties) obj;
            return this.globalProps.equals(other.globalProps) && this.localProps.equals(other.localProps);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "InterestingProperties [globalProps=" + this.globalProps + ", localProps=" + this.localProps + " ]";
    }

    @Override
    public InterestingProperties clone() {
        HashSet<RequestedGlobalProperties> globalProps = new HashSet<RequestedGlobalProperties>();
        for (RequestedGlobalProperties p : this.globalProps) {
            globalProps.add(p.clone());
        }
        HashSet<RequestedLocalProperties> localProps = new HashSet<RequestedLocalProperties>();
        for (RequestedLocalProperties p : this.localProps) {
            localProps.add(p.clone());
        }
        return new InterestingProperties(globalProps, localProps);
    }
}


{
        final int prime = 31;
        int result = 1;
        result = prime * result + ((globalProps == null) ? 0 : globalProps.hashCode());
        result = prime * result + ((localProps == null) ? 0 : localProps.hashCode());
        return result;
    }

package eu.stratosphere.compiler.dataproperties;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import eu.stratosphere.compiler.dag.OptimizerNode;

/**
 * The interesting properties that a node in the optimizer plan hands to its predecessors. It has the
 * purpose to tell the preceding nodes, which data properties might have the advantage, because they would
 * let the node fulfill its pact cheaper. More on optimization with interesting properties can be found
 * in the works on the volcano- and cascades optimizer framework.
 */
public class InterestingProperties implements Cloneable {

    // the global properties, i.e. properties across partitions
    private Set<RequestedGlobalProperties> globalProps;

    // the local properties, i.e. properties within partitions
    private Set<RequestedLocalProperties> localProps;

    public InterestingProperties() {
        this.globalProps = new HashSet<RequestedGlobalProperties>();
        this.localProps = new HashSet<RequestedLocalProperties>();
    }

    /**
     * Private constructor for cloning purposes.
     *
     * @param maxCostsGlobal The maximal costs for the global properties.
     * @param maxCostsLocal The maximal costs for the local properties.
     * @param globalProps  The global properties for this new object.
     * @param localProps The local properties for this new object.
     */
    private InterestingProperties(Set<RequestedGlobalProperties> globalProps, Set<RequestedLocalProperties> localProps) {
        this.globalProps = globalProps;
        this.localProps = localProps;
    }

    public void addGlobalProperties(RequestedGlobalProperties props) {
        this.globalProps.add(props);
    }

    public void addLocalProperties(RequestedLocalProperties props) {
        this.localProps.add(props);
    }

    public void addInterestingProperties(InterestingProperties other) {
        this.globalProps.addAll(other.globalProps);
        this.localProps.addAll(other.localProps);
    }

    /**
     * Gets the interesting local properties.
     *
     * @return The interesting local properties.
     */
    public Set<RequestedLocalProperties> getLocalProperties() {
        return this.localProps;
    }

    /**
     * Gets the interesting global properties.
     *
     * @return The interesting global properties.
     */
    public Set<RequestedGlobalProperties> getGlobalProperties() {
        return this.globalProps;
    }

    public InterestingProperties filterByCodeAnnotations(OptimizerNode node, int input) {
        InterestingProperties iProps = new InterestingProperties();
        for (RequestedGlobalProperties rgp : this.globalProps) {
            RequestedGlobalProperties filtered = rgp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addGlobalProperties(filtered);
            }
        }
        for (RequestedLocalProperties rlp : this.localProps) {
            RequestedLocalProperties filtered = rlp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addLocalProperties(filtered);
            }
        }
        return iProps;
    }

    public void dropTrivials() {
        for (Iterator<RequestedGlobalProperties> iter = this.globalProps.iterator(); iter.hasNext(); ) {
            RequestedGlobalProperties gp = iter.next();
            if (gp.isTrivial()) {
                iter.remove();
                break;
            }
        }
        for (Iterator<RequestedLocalProperties> iter = this.localProps.iterator(); iter.hasNext(); ) {
            RequestedLocalProperties lp = iter.next();
            if (lp.isTrivial()) {
                iter.remove();
                break;
            }
        }
    }

    @Override
    public int hashCode()

    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof InterestingProperties) {
            InterestingProperties other = (InterestingProperties) obj;
            return this.globalProps.equals(other.globalProps) && this.localProps.equals(other.localProps);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "InterestingProperties [globalProps=" + this.globalProps + ", localProps=" + this.localProps + " ]";
    }

    @Override
    public InterestingProperties clone() {
        HashSet<RequestedGlobalProperties> globalProps = new HashSet<RequestedGlobalProperties>();
        for (RequestedGlobalProperties p : this.globalProps) {
            globalProps.add(p.clone());
        }
        HashSet<RequestedLocalProperties> localProps = new HashSet<RequestedLocalProperties>();
        for (RequestedLocalProperties p : this.localProps) {
            localProps.add(p.clone());
        }
        return new InterestingProperties(globalProps, localProps);
    }
}


        HashSet<RequestedGlobalProperties> globalProps = new HashSet<RequestedGlobalProperties>();
        for (RequestedGlobalProperties p : this.globalProps) {
            globalProps.add(p.clone());
        }

package eu.stratosphere.compiler.dataproperties;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import eu.stratosphere.compiler.dag.OptimizerNode;

/**
 * The interesting properties that a node in the optimizer plan hands to its predecessors. It has the
 * purpose to tell the preceding nodes, which data properties might have the advantage, because they would
 * let the node fulfill its pact cheaper. More on optimization with interesting properties can be found
 * in the works on the volcano- and cascades optimizer framework.
 */
public class InterestingProperties implements Cloneable {

    // the global properties, i.e. properties across partitions
    private Set<RequestedGlobalProperties> globalProps;

    // the local properties, i.e. properties within partitions
    private Set<RequestedLocalProperties> localProps;

    public InterestingProperties() {
        this.globalProps = new HashSet<RequestedGlobalProperties>();
        this.localProps = new HashSet<RequestedLocalProperties>();
    }

    /**
     * Private constructor for cloning purposes.
     *
     * @param maxCostsGlobal The maximal costs for the global properties.
     * @param maxCostsLocal The maximal costs for the local properties.
     * @param globalProps  The global properties for this new object.
     * @param localProps The local properties for this new object.
     */
    private InterestingProperties(Set<RequestedGlobalProperties> globalProps, Set<RequestedLocalProperties> localProps) {
        this.globalProps = globalProps;
        this.localProps = localProps;
    }

    public void addGlobalProperties(RequestedGlobalProperties props) {
        this.globalProps.add(props);
    }

    public void addLocalProperties(RequestedLocalProperties props) {
        this.localProps.add(props);
    }

    public void addInterestingProperties(InterestingProperties other) {
        this.globalProps.addAll(other.globalProps);
        this.localProps.addAll(other.localProps);
    }

    /**
     * Gets the interesting local properties.
     *
     * @return The interesting local properties.
     */
    public Set<RequestedLocalProperties> getLocalProperties() {
        return this.localProps;
    }

    /**
     * Gets the interesting global properties.
     *
     * @return The interesting global properties.
     */
    public Set<RequestedGlobalProperties> getGlobalProperties() {
        return this.globalProps;
    }

    public InterestingProperties filterByCodeAnnotations(OptimizerNode node, int input) {
        InterestingProperties iProps = new InterestingProperties();
        for (RequestedGlobalProperties rgp : this.globalProps) {
            RequestedGlobalProperties filtered = rgp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addGlobalProperties(filtered);
            }
        }
        for (RequestedLocalProperties rlp : this.localProps) {
            RequestedLocalProperties filtered = rlp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addLocalProperties(filtered);
            }
        }
        return iProps;
    }

    public void dropTrivials() {
        for (Iterator<RequestedGlobalProperties> iter = this.globalProps.iterator(); iter.hasNext(); ) {
            RequestedGlobalProperties gp = iter.next();
            if (gp.isTrivial()) {
                iter.remove();
                break;
            }
        }
        for (Iterator<RequestedLocalProperties> iter = this.localProps.iterator(); iter.hasNext(); ) {
            RequestedLocalProperties lp = iter.next();
            if (lp.isTrivial()) {
                iter.remove();
                break;
            }
        }
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((globalProps == null) ? 0 : globalProps.hashCode());
        result = prime * result + ((localProps == null) ? 0 : localProps.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof InterestingProperties) {
            InterestingProperties other = (InterestingProperties) obj;
            return this.globalProps.equals(other.globalProps) && this.localProps.equals(other.localProps);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "InterestingProperties [globalProps=" + this.globalProps + ", localProps=" + this.localProps + " ]";
    }

    @Override
    public InterestingProperties clone() {

        HashSet<RequestedLocalProperties> localProps = new HashSet<RequestedLocalProperties>();
        for (RequestedLocalProperties p : this.localProps) {
            localProps.add(p.clone());
        }
        return new InterestingProperties(globalProps, localProps);
    }
}


HashSet<RequestedLocalProperties> localProps = new HashSet<RequestedLocalProperties>();
        for (RequestedLocalProperties p : this.localProps) {
            localProps.add(p.clone());
        }

package eu.stratosphere.compiler.dataproperties;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import eu.stratosphere.compiler.dag.OptimizerNode;

/**
 * The interesting properties that a node in the optimizer plan hands to its predecessors. It has the
 * purpose to tell the preceding nodes, which data properties might have the advantage, because they would
 * let the node fulfill its pact cheaper. More on optimization with interesting properties can be found
 * in the works on the volcano- and cascades optimizer framework.
 */
public class InterestingProperties implements Cloneable {

    // the global properties, i.e. properties across partitions
    private Set<RequestedGlobalProperties> globalProps;

    // the local properties, i.e. properties within partitions
    private Set<RequestedLocalProperties> localProps;

    public InterestingProperties() {
        this.globalProps = new HashSet<RequestedGlobalProperties>();
        this.localProps = new HashSet<RequestedLocalProperties>();
    }

    /**
     * Private constructor for cloning purposes.
     *
     * @param maxCostsGlobal The maximal costs for the global properties.
     * @param maxCostsLocal The maximal costs for the local properties.
     * @param globalProps  The global properties for this new object.
     * @param localProps The local properties for this new object.
     */
    private InterestingProperties(Set<RequestedGlobalProperties> globalProps, Set<RequestedLocalProperties> localProps) {
        this.globalProps = globalProps;
        this.localProps = localProps;
    }

    public void addGlobalProperties(RequestedGlobalProperties props) {
        this.globalProps.add(props);
    }

    public void addLocalProperties(RequestedLocalProperties props) {
        this.localProps.add(props);
    }

    public void addInterestingProperties(InterestingProperties other) {
        this.globalProps.addAll(other.globalProps);
        this.localProps.addAll(other.localProps);
    }

    /**
     * Gets the interesting local properties.
     *
     * @return The interesting local properties.
     */
    public Set<RequestedLocalProperties> getLocalProperties() {
        return this.localProps;
    }

    /**
     * Gets the interesting global properties.
     *
     * @return The interesting global properties.
     */
    public Set<RequestedGlobalProperties> getGlobalProperties() {
        return this.globalProps;
    }

    public InterestingProperties filterByCodeAnnotations(OptimizerNode node, int input) {
        InterestingProperties iProps = new InterestingProperties();
        for (RequestedGlobalProperties rgp : this.globalProps) {
            RequestedGlobalProperties filtered = rgp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addGlobalProperties(filtered);
            }
        }
        for (RequestedLocalProperties rlp : this.localProps) {
            RequestedLocalProperties filtered = rlp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addLocalProperties(filtered);
            }
        }
        return iProps;
    }

    public void dropTrivials() {
        for (Iterator<RequestedGlobalProperties> iter = this.globalProps.iterator(); iter.hasNext(); ) {
            RequestedGlobalProperties gp = iter.next();
            if (gp.isTrivial()) {
                iter.remove();
                break;
            }
        }
        for (Iterator<RequestedLocalProperties> iter = this.localProps.iterator(); iter.hasNext(); ) {
            RequestedLocalProperties lp = iter.next();
            if (lp.isTrivial()) {
                iter.remove();
                break;
            }
        }
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((globalProps == null) ? 0 : globalProps.hashCode());
        result = prime * result + ((localProps == null) ? 0 : localProps.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof InterestingProperties) {
            InterestingProperties other = (InterestingProperties) obj;
            return this.globalProps.equals(other.globalProps) && this.localProps.equals(other.localProps);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "InterestingProperties [globalProps=" + this.globalProps + ", localProps=" + this.localProps + " ]";
    }

    @Override
    public InterestingProperties clone() {
        HashSet<RequestedGlobalProperties> globalProps = new HashSet<RequestedGlobalProperties>();
        for (RequestedGlobalProperties p : this.globalProps) {
            globalProps.add(p.clone());
        }

        return new InterestingProperties(globalProps, localProps);
    }
}


return new InterestingProperties(globalProps, localProps);
    }

package eu.stratosphere.compiler.dataproperties;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import eu.stratosphere.compiler.dag.OptimizerNode;

/**
 * The interesting properties that a node in the optimizer plan hands to its predecessors. It has the
 * purpose to tell the preceding nodes, which data properties might have the advantage, because they would
 * let the node fulfill its pact cheaper. More on optimization with interesting properties can be found
 * in the works on the volcano- and cascades optimizer framework.
 */
public class InterestingProperties implements Cloneable {

    // the global properties, i.e. properties across partitions
    private Set<RequestedGlobalProperties> globalProps;

    // the local properties, i.e. properties within partitions
    private Set<RequestedLocalProperties> localProps;

    public InterestingProperties() {
        this.globalProps = new HashSet<RequestedGlobalProperties>();
        this.localProps = new HashSet<RequestedLocalProperties>();
    }

    /**
     * Private constructor for cloning purposes.
     *
     * @param maxCostsGlobal The maximal costs for the global properties.
     * @param maxCostsLocal The maximal costs for the local properties.
     * @param globalProps  The global properties for this new object.
     * @param localProps The local properties for this new object.
     */
    private InterestingProperties(Set<RequestedGlobalProperties> globalProps, Set<RequestedLocalProperties> localProps) {
        this.globalProps = globalProps;
        this.localProps = localProps;
    }

    public void addGlobalProperties(RequestedGlobalProperties props) {
        this.globalProps.add(props);
    }

    public void addLocalProperties(RequestedLocalProperties props) {
        this.localProps.add(props);
    }

    public void addInterestingProperties(InterestingProperties other) {
        this.globalProps.addAll(other.globalProps);
        this.localProps.addAll(other.localProps);
    }

    /**
     * Gets the interesting local properties.
     *
     * @return The interesting local properties.
     */
    public Set<RequestedLocalProperties> getLocalProperties() {
        return this.localProps;
    }

    /**
     * Gets the interesting global properties.
     *
     * @return The interesting global properties.
     */
    public Set<RequestedGlobalProperties> getGlobalProperties() {
        return this.globalProps;
    }

    public InterestingProperties filterByCodeAnnotations(OptimizerNode node, int input) {
        InterestingProperties iProps = new InterestingProperties();
        for (RequestedGlobalProperties rgp : this.globalProps) {
            RequestedGlobalProperties filtered = rgp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addGlobalProperties(filtered);
            }
        }
        for (RequestedLocalProperties rlp : this.localProps) {
            RequestedLocalProperties filtered = rlp.filterByNodesConstantSet(node, input);
            if (filtered != null && !filtered.isTrivial()) {
                iProps.addLocalProperties(filtered);
            }
        }
        return iProps;
    }

    public void dropTrivials() {
        for (Iterator<RequestedGlobalProperties> iter = this.globalProps.iterator(); iter.hasNext(); ) {
            RequestedGlobalProperties gp = iter.next();
            if (gp.isTrivial()) {
                iter.remove();
                break;
            }
        }
        for (Iterator<RequestedLocalProperties> iter = this.localProps.iterator(); iter.hasNext(); ) {
            RequestedLocalProperties lp = iter.next();
            if (lp.isTrivial()) {
                iter.remove();
                break;
            }
        }
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((globalProps == null) ? 0 : globalProps.hashCode());
        result = prime * result + ((localProps == null) ? 0 : localProps.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof InterestingProperties) {
            InterestingProperties other = (InterestingProperties) obj;
            return this.globalProps.equals(other.globalProps) && this.localProps.equals(other.localProps);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "InterestingProperties [globalProps=" + this.globalProps + ", localProps=" + this.localProps + " ]";
    }

    @Override
    public InterestingProperties clone() {
        HashSet<RequestedGlobalProperties> globalProps = new HashSet<RequestedGlobalProperties>();
        for (RequestedGlobalProperties p : this.globalProps) {
            globalProps.add(p.clone());
        }
        HashSet<RequestedLocalProperties> localProps = new HashSet<RequestedLocalProperties>();
        for (RequestedLocalProperties p : this.localProps) {
            localProps.add(p.clone());
        }