From 74a38b365139b48dbb1a3e43db335a2b1e9f4bb0 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Tue, 12 Jun 2001 13:39:31 +0000 Subject: [PATCH] No longer separate Target interface and implementation. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269153 13f79535-47bb-0310-9956-ffa450edef68 --- .../components/model/DefaultTarget.java | 91 ------------------- .../myrmidon/components/model/Target.java | 64 +++++++++---- 2 files changed, 48 insertions(+), 107 deletions(-) delete mode 100644 proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultTarget.java diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultTarget.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultTarget.java deleted file mode 100644 index af7563848..000000000 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/DefaultTarget.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. - * - * This software is published under the terms of the Apache Software License - * version 1.1, a copy of which has been included with this distribution in - * the LICENSE file. - */ -package org.apache.myrmidon.components.model; - -import java.util.ArrayList; -import org.apache.avalon.framework.configuration.Configuration; - -/** - * Default implementation of target. - * - * @author Peter Donald - */ -public class DefaultTarget - implements Target -{ - private final ArrayList m_dependencies = new ArrayList(); - private final ArrayList m_tasks = new ArrayList(); - private final Condition m_condition; - - /** - * Constructor taking condition for target. - * - * @param condition the condition - */ - public DefaultTarget( final Condition condition ) - { - m_condition = condition; - } - - /** - * Constructor for target with no condition. - */ - public DefaultTarget() - { - this( null ); - } - - /** - * Get condition under which target is executed. - * - * @return the condition for target or null - */ - public Condition getCondition() - { - return m_condition; - } - /** - * Get dependencies of target - * - * @return the dependency list - */ - public String[] getDependencies() - { - return (String[])m_dependencies.toArray( new String[ 0 ] ); - } - - /** - * Get tasks in target - * - * @return the target list - */ - public Configuration[] getTasks() - { - return (Configuration[])m_tasks.toArray( new Configuration[ 0 ] ); - } - - /** - * Add a dependency to target. - * - * @param dependency the dependency - */ - public void addDependency( final String dependency ) - { - m_dependencies.add( dependency ); - } - - /** - * Add task to target. - * - * @param taskConfiguration the task representation - */ - public void addTask( final Configuration taskData ) - { - m_tasks.add( taskData ); - } -} diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Target.java b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Target.java index 6681a4ff9..096392e8e 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Target.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/components/model/Target.java @@ -7,39 +7,71 @@ */ package org.apache.myrmidon.components.model; -import org.apache.avalon.framework.component.Component; +import java.util.ArrayList; import org.apache.avalon.framework.configuration.Configuration; /** - * Interface to represent targets in build file. + * Targets in build file. * * @author Peter Donald */ -public interface Target - extends Component +public class Target { - String ROLE = "org.apache.myrmidon.components.model.Target"; + private final ArrayList m_dependencies = new ArrayList(); + private final ArrayList m_tasks = new ArrayList(); + private final Condition m_condition; /** - * Get dependencies of target + * Constructor taking condition for target. * - * @return the dependency list + * @param condition the condition */ - String[] getDependencies(); + public Target( final Condition condition, + final Configuration[] tasks, + final String[] dependencies ) + { + m_condition = condition; + + for( int i = 0; i < tasks.length; i++ ) + { + m_tasks.add( tasks[ i ] ); + } + + if( null != dependencies ) + { + for( int i = 0; i < dependencies.length; i++ ) + { + m_dependencies.add( dependencies[ i ] ); + } + } + } /** - * Get tasks in target + * Get condition under which target is executed. * - * @return the target list + * @return the condition for target or null */ - Configuration[] getTasks(); + public final Condition getCondition() + { + return m_condition; + } + /** + * Get dependencies of target + * + * @return the dependency list + */ + public final String[] getDependencies() + { + return (String[])m_dependencies.toArray( new String[ 0 ] ); + } /** - * Get condition under which target is executed. + * Get tasks in target * - * @return the condition for target or null + * @return the target list */ - Condition getCondition(); + public final Configuration[] getTasks() + { + return (Configuration[])m_tasks.toArray( new Configuration[ 0 ] ); + } } - -