Example usage for java.util ArrayList toArray

List of usage examples for java.util ArrayList toArray

Introduction

In this page you can find the example usage for java.util ArrayList toArray.

Prototype

public Object[] toArray() 

Source Link

Document

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

Usage

From source file:deck36.storm.plan9.php.DeludedKittenRobbersTopology.java

public static void main(String[] args) throws Exception {

    String env = null;// w  w  w. j  av  a2  s . co m

    if (args != null && args.length > 0) {
        env = args[0];
    }

    if (!"dev".equals(env))
        if (!"prod".equals(env)) {
            System.out.println("Usage: $0 (dev|prod)\n");
            System.exit(1);
        }

    // Topology config
    Config conf = new Config();

    // Load parameters and add them to the Config
    Map configMap = YamlLoader.loadYamlFromResource("config_" + env + ".yml");

    conf.putAll(configMap);

    log.info(JSONValue.toJSONString((conf)));

    // Set topology loglevel to DEBUG
    conf.put(Config.TOPOLOGY_DEBUG, JsonPath.read(conf, "$.deck36_storm.debug"));

    // Create Topology builder
    TopologyBuilder builder = new TopologyBuilder();

    // if there are not special reasons, start with parallelism hint of 1
    // and multiple tasks. By that, you can scale dynamically later on.
    int parallelism_hint = JsonPath.read(conf, "$.deck36_storm.default_parallelism_hint");
    int num_tasks = JsonPath.read(conf, "$.deck36_storm.default_num_tasks");

    // Create Stream from RabbitMQ messages
    // bind new queue with name of the topology
    // to the main plan9 exchange (from properties config)
    // consuming only CBT-related events by using the rounting key 'cbt.#'

    String badgeName = DeludedKittenRobbersTopology.class.getSimpleName();

    String rabbitQueueName = badgeName; // use topology class name as name for the queue
    String rabbitExchangeName = JsonPath.read(conf,
            "$.deck36_storm.DeludedKittenRobbersBolt.rabbitmq.exchange");
    String rabbitRoutingKey = JsonPath.read(conf,
            "$.deck36_storm.DeludedKittenRobbersBolt.rabbitmq.routing_key");

    // Get JSON deserialization scheme
    Scheme rabbitScheme = new SimpleJSONScheme();

    // Setup a Declarator to configure exchange/queue/routing key
    RabbitMQDeclarator rabbitDeclarator = new RabbitMQDeclarator(rabbitExchangeName, rabbitQueueName,
            rabbitRoutingKey);

    // Create Configuration for the Spout
    ConnectionConfig connectionConfig = new ConnectionConfig(
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.host"),
            (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.port"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.user"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.pass"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.vhost"),
            (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.heartbeat"));

    ConsumerConfig spoutConfig = new ConsumerConfigBuilder().connection(connectionConfig).queue(rabbitQueueName)
            .prefetch((Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.prefetch")).requeueOnFail()
            .build();

    // add global parameters to topology config - the RabbitMQSpout will read them from there
    conf.putAll(spoutConfig.asMap());

    // For production, set the spout pending value to the same value as the RabbitMQ pre-fetch
    // see: https://github.com/ppat/storm-rabbitmq/blob/master/README.md
    if ("prod".equals(env)) {
        conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING,
                (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.prefetch"));
    }

    // Add RabbitMQ spout to topology
    builder.setSpout("incoming", new RabbitMQSpout(rabbitScheme, rabbitDeclarator), parallelism_hint)
            .setNumTasks((Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.spout_tasks"));

    // construct command to invoke the external bolt implementation
    ArrayList<String> command = new ArrayList(15);

    // Add main execution program (php, hhvm, zend, ..) and parameters
    command.add((String) JsonPath.read(conf, "$.deck36_storm.php.executor"));
    command.addAll((List<String>) JsonPath.read(conf, "$.deck36_storm.php.executor_params"));

    // Add main command to be executed (app/console, the phar file, etc.) and global context parameters (environment etc.)
    command.add((String) JsonPath.read(conf, "$.deck36_storm.php.main"));
    command.addAll((List<String>) JsonPath.read(conf, "$.deck36_storm.php.main_params"));

    // Add main route to be invoked and its parameters
    command.add((String) JsonPath.read(conf, "$.deck36_storm.DeludedKittenRobbersBolt.main"));
    List boltParams = (List<String>) JsonPath.read(conf, "$.deck36_storm.DeludedKittenRobbersBolt.params");
    if (boltParams != null)
        command.addAll(boltParams);

    // Log the final command
    log.info("Command to start bolt for Deluded Kitten Robbers: " + Arrays.toString(command.toArray()));

    // Add constructed external bolt command to topology using MultilangAdapterTickTupleBolt
    builder.setBolt("badge", new MultilangAdapterTickTupleBolt(command,
            (Integer) JsonPath.read(conf, "$.deck36_storm.DeludedKittenRobbersBolt.attack_frequency_secs"),
            "badge"), parallelism_hint).setNumTasks(num_tasks).shuffleGrouping("incoming");

    builder.setBolt("rabbitmq_router", new Plan9RabbitMQRouterBolt(
            (String) JsonPath.read(conf, "$.deck36_storm.DeludedKittenRobbersBolt.rabbitmq.target_exchange"),
            "DeludedKittenRobbers" // RabbitMQ routing key
    ), parallelism_hint).setNumTasks(num_tasks).shuffleGrouping("badge");

    builder.setBolt("rabbitmq_producer", new Plan9RabbitMQPushBolt(), parallelism_hint).setNumTasks(num_tasks)
            .shuffleGrouping("rabbitmq_router");

    if ("dev".equals(env)) {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology(badgeName + System.currentTimeMillis(), conf, builder.createTopology());
        Thread.sleep(2000000);
    }

    if ("prod".equals(env)) {
        StormSubmitter.submitTopology(badgeName + "-" + System.currentTimeMillis(), conf,
                builder.createTopology());
    }

}

From source file:deck36.storm.plan9.php.RaiderOfTheKittenRobbersTopology.java

public static void main(String[] args) throws Exception {

    String env = null;/* www. ja  v  a2  s.co m*/

    if (args != null && args.length > 0) {
        env = args[0];
    }

    if (!"dev".equals(env))
        if (!"prod".equals(env)) {
            System.out.println("Usage: $0 (dev|prod)\n");
            System.exit(1);
        }

    // Topology config
    Config conf = new Config();

    // Load parameters and add them to the Config
    Map configMap = YamlLoader.loadYamlFromResource("config_" + env + ".yml");

    conf.putAll(configMap);

    log.info(JSONValue.toJSONString((conf)));

    // Set topology loglevel to DEBUG
    conf.put(Config.TOPOLOGY_DEBUG, JsonPath.read(conf, "$.deck36_storm.debug"));

    // Create Topology builder
    TopologyBuilder builder = new TopologyBuilder();

    // if there are not special reasons, start with parallelism hint of 1
    // and multiple tasks. By that, you can scale dynamically later on.
    int parallelism_hint = JsonPath.read(conf, "$.deck36_storm.default_parallelism_hint");
    int num_tasks = JsonPath.read(conf, "$.deck36_storm.default_num_tasks");

    // Create Stream from RabbitMQ messages
    // bind new queue with name of the topology
    // to the main plan9 exchange (from properties config)
    // consuming only CBT-related events by using the rounting key 'cbt.#'

    String badgeName = RaiderOfTheKittenRobbersTopology.class.getSimpleName();

    String rabbitQueueName = badgeName; // use topology class name as name for the queue
    String rabbitExchangeName = (String) JsonPath.read(conf,
            "$.deck36_storm.RaiderOfTheKittenRobbersBolt.rabbitmq.target_exchange");
    String rabbitRoutingKey = "#";

    // Get JSON deserialization scheme
    Scheme rabbitScheme = new SimpleJSONScheme();

    // Setup a Declarator to configure exchange/queue/routing key
    RabbitMQDeclarator rabbitDeclarator = new RabbitMQDeclarator(rabbitExchangeName, rabbitQueueName,
            rabbitRoutingKey);

    // Create Configuration for the Spout
    ConnectionConfig connectionConfig = new ConnectionConfig(
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.host"),
            (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.port"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.user"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.pass"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.vhost"),
            (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.heartbeat"));

    ConsumerConfig spoutConfig = new ConsumerConfigBuilder().connection(connectionConfig).queue(rabbitQueueName)
            .prefetch((Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.prefetch")).requeueOnFail()
            .build();

    // add global parameters to topology config - the RabbitMQSpout will read them from there
    conf.putAll(spoutConfig.asMap());

    // For production, set the spout pending value to the same value as the RabbitMQ pre-fetch
    // see: https://github.com/ppat/storm-rabbitmq/blob/master/README.md
    if ("prod".equals(env)) {
        conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING,
                (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.prefetch"));
    }

    // Add RabbitMQ spout to topology
    builder.setSpout("incoming", new RabbitMQSpout(rabbitScheme, rabbitDeclarator), parallelism_hint)
            .setNumTasks((Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.spout_tasks"));

    // construct command to invoke the external bolt implementation
    ArrayList<String> command = new ArrayList(15);

    // Add main execution program (php, hhvm, zend, ..) and parameters
    command.add((String) JsonPath.read(conf, "$.deck36_storm.php.executor"));
    command.addAll((List<String>) JsonPath.read(conf, "$.deck36_storm.php.executor_params"));

    // Add main command to be executed (app/console, the phar file, etc.) and global context parameters (environment etc.)
    command.add((String) JsonPath.read(conf, "$.deck36_storm.php.main"));
    command.addAll((List<String>) JsonPath.read(conf, "$.deck36_storm.php.main_params"));

    // Add main route to be invoked and its parameters
    command.add((String) JsonPath.read(conf, "$.deck36_storm.RaiderOfTheKittenRobbersBolt.main"));
    List boltParams = (List<String>) JsonPath.read(conf, "$.deck36_storm.RaiderOfTheKittenRobbersBolt.params");
    if (boltParams != null)
        command.addAll(boltParams);

    // Log the final command
    log.info("Command to start bolt for RaiderOfTheKittenRobbers badge: " + Arrays.toString(command.toArray()));

    // Add constructed external bolt command to topology using MultilangAdapterBolt
    builder.setBolt("badge", new MultilangAdapterBolt(command, "badge"), parallelism_hint)
            .setNumTasks(num_tasks).shuffleGrouping("incoming");

    builder.setBolt("rabbitmq_router",
            new Plan9RabbitMQRouterBolt(
                    (String) JsonPath.read(conf,
                            "$.deck36_storm.RaiderOfTheKittenRobbersBolt.rabbitmq.target_exchange"),
                    "RaiderOfTheKittenRobbers" // RabbitMQ routing key
            ), parallelism_hint).setNumTasks(num_tasks).shuffleGrouping("badge");

    builder.setBolt("rabbitmq_producer", new Plan9RabbitMQPushBolt(), parallelism_hint).setNumTasks(num_tasks)
            .shuffleGrouping("rabbitmq_router");

    if ("dev".equals(env)) {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology(badgeName + System.currentTimeMillis(), conf, builder.createTopology());
        Thread.sleep(2000000);
    }

    if ("prod".equals(env)) {
        StormSubmitter.submitTopology(badgeName + "-" + System.currentTimeMillis(), conf,
                builder.createTopology());
    }

}

From source file:deck36.storm.plan9.php.RecordBreakerBadgeTopology.java

public static void main(String[] args) throws Exception {

    String env = null;/*www .j  av  a  2 s.  com*/

    if (args != null && args.length > 0) {
        env = args[0];
    }

    if (!"dev".equals(env))
        if (!"prod".equals(env)) {
            System.out.println("Usage: $0 (dev|prod)\n");
            System.exit(1);
        }

    // Topology config
    Config conf = new Config();

    // Load parameters and add them to the Config
    Map configMap = YamlLoader.loadYamlFromResource("config_" + env + ".yml");

    conf.putAll(configMap);

    log.info(JSONValue.toJSONString((conf)));

    // Set topology loglevel to DEBUG
    conf.put(Config.TOPOLOGY_DEBUG, JsonPath.read(conf, "$.deck36_storm.debug"));

    // Create Topology builder
    TopologyBuilder builder = new TopologyBuilder();

    // if there are not special reasons, start with parallelism hint of 1
    // and multiple tasks. By that, you can scale dynamically later on.
    int parallelism_hint = JsonPath.read(conf, "$.deck36_storm.default_parallelism_hint");
    int num_tasks = JsonPath.read(conf, "$.deck36_storm.default_num_tasks");

    // Create Stream from RabbitMQ messages
    // bind new queue with name of the topology
    // to the main plan9 exchange (from properties config)
    // consuming only CBT-related events by using the rounting key 'cbt.#'

    String badgeName = RecordBreakerBadgeTopology.class.getSimpleName();

    String rabbitQueueName = badgeName; // use topology class name as name for the queue
    String rabbitExchangeName = JsonPath.read(conf, "$.deck36_storm.RecordBreakerBolt.rabbitmq.exchange");
    String rabbitRoutingKey = JsonPath.read(conf, "$.deck36_storm.RecordBreakerBolt.rabbitmq.routing_key");

    // Get JSON deserialization scheme
    Scheme rabbitScheme = new SimpleJSONScheme();

    // Setup a Declarator to configure exchange/queue/routing key
    RabbitMQDeclarator rabbitDeclarator = new RabbitMQDeclarator(rabbitExchangeName, rabbitQueueName,
            rabbitRoutingKey);

    // Create Configuration for the Spout
    ConnectionConfig connectionConfig = new ConnectionConfig(
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.host"),
            (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.port"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.user"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.pass"),
            (String) JsonPath.read(conf, "$.deck36_storm.rabbitmq.vhost"),
            (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.heartbeat"));

    ConsumerConfig spoutConfig = new ConsumerConfigBuilder().connection(connectionConfig).queue(rabbitQueueName)
            .prefetch((Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.prefetch")).requeueOnFail()
            .build();

    // add global parameters to topology config - the RabbitMQSpout will read them from there
    conf.putAll(spoutConfig.asMap());

    // For production, set the spout pending value to the same value as the RabbitMQ pre-fetch
    // see: https://github.com/ppat/storm-rabbitmq/blob/master/README.md
    if ("prod".equals(env)) {
        conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING,
                (Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.prefetch"));
    }

    // Add RabbitMQ spout to topology
    builder.setSpout("incoming", new RabbitMQSpout(rabbitScheme, rabbitDeclarator), parallelism_hint)
            .setNumTasks((Integer) JsonPath.read(conf, "$.deck36_storm.rabbitmq.spout_tasks"));

    // construct command to invoke the external bolt implementation
    ArrayList<String> command = new ArrayList(15);

    // Add main execution program (php, hhvm, zend, ..) and parameters
    command.add((String) JsonPath.read(conf, "$.deck36_storm.php.executor"));
    command.addAll((List<String>) JsonPath.read(conf, "$.deck36_storm.php.executor_params"));

    // Add main command to be executed (app/console, the phar file, etc.) and global context parameters (environment etc.)
    command.add((String) JsonPath.read(conf, "$.deck36_storm.php.main"));
    command.addAll((List<String>) JsonPath.read(conf, "$.deck36_storm.php.main_params"));

    // create command to execute the RecordBreakerBolt
    ArrayList<String> recordBreakerBoltCommand = new ArrayList<String>(command);

    // Add main route to be invoked and its parameters
    recordBreakerBoltCommand.add((String) JsonPath.read(conf, "$.deck36_storm.RecordBreakerBolt.main"));
    List boltParams = (List<String>) JsonPath.read(conf, "$.deck36_storm.RecordBreakerBolt.params");
    if (boltParams != null)
        recordBreakerBoltCommand.addAll(boltParams);

    // create command to execute the RecordMasterBolt
    ArrayList<String> recordMasterBoltCommand = new ArrayList<String>(command);

    // Add main route to be invoked and its parameters
    recordMasterBoltCommand.add((String) JsonPath.read(conf, "$.deck36_storm.RecordMasterBolt.main"));
    boltParams = (List<String>) JsonPath.read(conf, "$.deck36_storm.RecordMasterBolt.params");
    if (boltParams != null)
        recordMasterBoltCommand.addAll(boltParams);

    // Log the final commands
    log.info("Command to start bolt for RecordBreaker badge: "
            + Arrays.toString(recordBreakerBoltCommand.toArray()));
    log.info("Command to start bolt for RecordMaster badge: "
            + Arrays.toString(recordMasterBoltCommand.toArray()));

    // Add constructed external bolt command to topology using MultilangAdapterBolt
    // The RecordBreaker reads the incoming messages from the game application, i.e. the "incoming" spout
    builder.setBolt("record_breaker", new MultilangAdapterBolt(recordBreakerBoltCommand, "badge"),
            parallelism_hint).setNumTasks(num_tasks).shuffleGrouping("incoming");

    // The RecordMaster reads the badge messages generated by the RecordBreakerBolt
    builder.setBolt("record_master", new MultilangAdapterBolt(recordMasterBoltCommand, "badge"),
            parallelism_hint).setNumTasks(num_tasks).shuffleGrouping("record_breaker");

    // the RabbitMQ router bolt can read messages from both, RecordBreakerBolt and RecordMasterBolt,
    // and forward those messages to the broker
    builder.setBolt("rabbitmq_router",
            new Plan9RabbitMQRouterBolt(
                    (String) JsonPath.read(conf, "$.deck36_storm.RecordBreakerBolt.rabbitmq.target_exchange"),
                    "RecordBreakerMaster" // RabbitMQ routing key
            ), parallelism_hint).setNumTasks(num_tasks).shuffleGrouping("record_breaker")
            .shuffleGrouping("record_master");

    builder.setBolt("rabbitmq_producer", new Plan9RabbitMQPushBolt(), parallelism_hint).setNumTasks(num_tasks)
            .shuffleGrouping("rabbitmq_router");

    if ("dev".equals(env)) {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology(badgeName + System.currentTimeMillis(), conf, builder.createTopology());
        Thread.sleep(2000000);
    }

    if ("prod".equals(env)) {
        StormSubmitter.submitTopology(badgeName + "-" + System.currentTimeMillis(), conf,
                builder.createTopology());
    }

}

From source file:org.n52.oss.testdata.sml.GeneratorClient.java

/**
 * @param args// ww w  .j  a v  a  2  s .  c o m
 */
public static void main(String[] args) {
    if (sending)
        log.info("Starting insertion of test sensors into " + sirURL);
    else
        log.warn("Starting generation of test sensors, NOT sending!");

    TestSensorFactory factory = new TestSensorFactory();

    // create sensors
    List<TestSensor> sensors = new ArrayList<TestSensor>();

    for (int i = 0; i < nSensorsToGenerate; i++) {
        TestSensor s = factory.createRandomTestSensor();
        sensors.add(s);
        log.info("Added new random sensor: " + s);
    }

    ArrayList<String> insertedSirIds = new ArrayList<String>();

    // insert sensors to service
    int startOfSubList = 0;
    int endOfSubList = nSensorsInOneInsertRequest;
    while (endOfSubList <= sensors.size() + nSensorsInOneInsertRequest) {
        List<TestSensor> currentSensors = sensors.subList(startOfSubList,
                Math.min(endOfSubList, sensors.size()));

        if (currentSensors.isEmpty())
            break;

        try {
            String[] insertedSirIDs = insertSensorsInSIR(currentSensors);
            if (insertedSirIDs == null) {
                log.error("Did not insert dummy sensors.");
            } else {
                insertedSirIds.addAll(Arrays.asList(insertedSirIDs));
            }
        } catch (HttpException e) {
            log.error("Error inserting sensors.", e);
        } catch (IOException e) {
            log.error("Error inserting sensors.", e);
        }

        startOfSubList = Math.min(endOfSubList, sensors.size());
        endOfSubList = endOfSubList + nSensorsInOneInsertRequest;

        if (sending) {
            try {
                if (log.isDebugEnabled())
                    log.debug("Sleeping for " + SLEEP_BETWEEN_REQUESTS + " msecs.");
                Thread.sleep(SLEEP_BETWEEN_REQUESTS);
            } catch (InterruptedException e) {
                log.error("Interrupted!", e);
            }
        }
    }

    log.info("Added sensors (ids in sir): " + Arrays.toString(insertedSirIds.toArray()));
}

From source file:com.thoughtworks.go.util.ArrayUtil.java

public static <T> Object[] capitalizeContents(T[] array) {
    ArrayList<String> list = new ArrayList<String>();
    for (T t : array) {
        list.add(StringUtils.capitalize(t.toString()));
    }/*from   www .j ava2  s.c om*/
    return list.toArray();
}

From source file:com.groupon.odo.proxylib.Utils.java

public static HashMap<String, Object> getJQGridJSON(ArrayList<?> rows, String rowName) {
    return getJQGridJSON(rows.toArray(), rowName);
}

From source file:graphic.Grafico.java

private static javax.swing.JPanel pizza3D(ArrayList nome, ArrayList valor, String tituloGrafico,
        float transparencia, String tipo) {
    DefaultPieDataset data = new DefaultPieDataset();

    for (int i = 0; i < nome.toArray().length; i++) {
        data.setValue("" + nome.get(i).toString(), new Double(valor.get(i).toString()));
    }/*  ww w. j  a va 2  s .  c om*/

    JFreeChart chart = ChartFactory.createPieChart3D(tituloGrafico, data, true, true, true);

    java.awt.Color cor = new java.awt.Color(200, 200, 200);
    chart.setBackgroundPaint(cor);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setLabelLinksVisible(true);
    plot.setNoDataMessage("No existem dados para serem exibidos no grfico");

    plot.setStartAngle(90);
    plot.setDirection(Rotation.CLOCKWISE);

    plot.setForegroundAlpha(transparencia);
    plot.setInteriorGap(0.20);

    ChartPanel chartPanel = new ChartPanel(chart);

    return chartPanel;
}

From source file:br.com.ifpb.models.Grafico.java

/**
 * /*from ww w  . j av  a 2  s  .  c o m*/
 * @param nome
 * @param valor
 * @param tituloGrafico
 * @param transparencia
 * @param tipo
 * @return 
 */
private static javax.swing.JPanel pizza3D(ArrayList nome, ArrayList valor, String tituloGrafico,
        float transparencia, String tipo) {

    DefaultPieDataset data = new DefaultPieDataset();

    for (int i = 0; i < nome.toArray().length; i++) {
        data.setValue("" + nome.get(i).toString(), new Double(valor.get(i).toString()));
    }

    JFreeChart chart = ChartFactory.createPieChart3D(tituloGrafico, data, true, true, true);
    java.awt.Color cor = new java.awt.Color(200, 200, 200);
    chart.setBackgroundPaint(cor);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setLabelLinksVisible(true);
    plot.setNoDataMessage("No existem dados para serem exibidos ");

    plot.setStartAngle(90);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(transparencia);
    plot.setInteriorGap(0.20);

    ChartPanel chartPanel = new ChartPanel(chart);

    return chartPanel;
}

From source file:mpq.MpqUtil.java

private static ExtMpqArchive[] getMpqFilesFromDirRek(File[] listFiles) {
    ArrayList<ExtMpqArchive> archives = new ArrayList<ExtMpqArchive>();
    archives = getMpqFilesFromDirRekImpl(listFiles, archives);
    Object[] toArray = archives.toArray();
    ExtMpqArchive[] archs = new ExtMpqArchive[toArray.length];
    for (int i = 0; i < toArray.length; i++) {
        archs[i] = (ExtMpqArchive) toArray[i];
    }// w  w w. j a va 2  s.c o  m
    return archs;
}

From source file:Main.java

public static void invokeMethod(String paramString, Object paramObject, Object[] paramArrayOfObject)
        throws Exception {
    if (TextUtils.isEmpty(paramString))
        throw new RuntimeException("method name can not be empty");
    if (paramObject == null)
        throw new RuntimeException("target object can not be null");
    ArrayList localArrayList = new ArrayList();
    int i = paramArrayOfObject.length;
    for (int j = 0; j < i; j++)
        localArrayList.add(paramArrayOfObject[j].getClass());
    Method localMethod = paramObject.getClass().getDeclaredMethod(paramString,
            (Class[]) localArrayList.toArray());
    if (localMethod == null)
        throw new RuntimeException(
                "target object: " + paramObject.getClass().getName() + " do not have this method: "
                        + paramString + " with parameters: " + localArrayList.toString());
    localMethod.setAccessible(true);/* w ww .  ja v a 2 s.c o m*/
    localMethod.invoke(paramObject, paramArrayOfObject);
}