KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > kilim > description > Arity


1 /**
2  * Copyright (C) 2002 Kelua SA
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package org.objectweb.kilim.description;
20
21 /**
22  * @author horn
23  * Describes a Port's arity. Three values are presently defined :
24  * OPTIONAL : which means that a port can be unbound or bound to one element.
25  * REQUIRED : which means that a port must be bound to one and only one element.
26  * COLLECTION : which means that a port can be unbound or be bound to an arbitrary number of elements.
27  * @see Port
28  */

29
30 public final class Arity {
31     /** the singleton representing an optional port */
32     public static final Arity OPTIONAL = new Arity("?");
33     /** the singleton representing a required port */
34     public static final Arity REQUIRED = new Arity("1");
35     /** the singleton representing a multiple port binding */
36     public static final Arity COLLECTION = new Arity("*");
37     
38     private String JavaDoc description;
39     
40     /**
41      * The private constructor for arities.
42      * @param aDescription : a description which must be either "?" for optional, "1" for required, "*"
43      * for collections.
44      */

45     private Arity(String JavaDoc aDescription) {
46         description = aDescription;
47     }
48     
49     /**
50      * Returns a simple description of the arity. This description is either "?" (for OPTIONAL),
51      * "1" (for REQUIRED) or "*" (for COLLECTION) on the arity.
52      * @return String
53      */

54     public String JavaDoc getDescription() {
55         return description;
56     }
57 }
Popular Tags