From 53ee29f4df914b2cdef5d817c021683048dd0b05 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Tue, 20 Feb 2001 08:09:25 +0000 Subject: [PATCH] Added in sketch of new item set type approach which is generalisation of current system. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268706 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/ant/util/ItemSet.java | 28 +++++++++++++++ .../src/java/org/apache/ant/util/Mapper.java | 35 +++++++++++++++++++ .../src/java/org/apache/ant/util/Scanner.java | 20 +++++++++++ 3 files changed, 83 insertions(+) create mode 100644 proposal/myrmidon/src/java/org/apache/ant/util/ItemSet.java create mode 100644 proposal/myrmidon/src/java/org/apache/ant/util/Mapper.java create mode 100644 proposal/myrmidon/src/java/org/apache/ant/util/Scanner.java diff --git a/proposal/myrmidon/src/java/org/apache/ant/util/ItemSet.java b/proposal/myrmidon/src/java/org/apache/ant/util/ItemSet.java new file mode 100644 index 000000000..685e8b03b --- /dev/null +++ b/proposal/myrmidon/src/java/org/apache/ant/util/ItemSet.java @@ -0,0 +1,28 @@ +/* + * 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.ant.util; + +import org.apache.ant.tasklet.DataType; + +/** + * Interface for ItemSet. + * An item set contains a number of items. Example item sets include + * PatternSets, FileSets, FilterSets etc. + * + * @author Peter Donald + */ +public interface ItemSet + extends DataType +{ + /** + * Returns an array containing the items(s) contained within set. + * + * Question: should ItemSet be context sensitive???? + */ + Object[] getItems( /* Context context??? */ ); +} diff --git a/proposal/myrmidon/src/java/org/apache/ant/util/Mapper.java b/proposal/myrmidon/src/java/org/apache/ant/util/Mapper.java new file mode 100644 index 000000000..a7dea8405 --- /dev/null +++ b/proposal/myrmidon/src/java/org/apache/ant/util/Mapper.java @@ -0,0 +1,35 @@ +/* + * 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.ant.util; + +import org.apache.ant.tasklet.DataType; + +/** + * Interface for Mappers. + * Mappers are responsible for mapping source items to targets items. + * Example mappers will map source files to destination files + * (ie A.java to A.class). + * + * @author Peter Donald + * @author Stefan Bodewig + */ +public interface Mapper + extends DataType +{ + /** + * Returns an array containing the target items(s) for the + * given source file. + * + *

if the given rule doesn't apply to the input item, + * implementation must return null. Scanner will then + * omit the item in question.

+ * + * @param item the item to be mapped + */ + Object[] mapItem( Object item ); +} diff --git a/proposal/myrmidon/src/java/org/apache/ant/util/Scanner.java b/proposal/myrmidon/src/java/org/apache/ant/util/Scanner.java new file mode 100644 index 000000000..9bffef5b0 --- /dev/null +++ b/proposal/myrmidon/src/java/org/apache/ant/util/Scanner.java @@ -0,0 +1,20 @@ +/* + * 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.ant.util; + +import org.apache.avalon.Component; + +/** + * Interface for Scanners. + * + * @author Peter Donald + */ +public interface Scanner + extends Component +{ +}