~ubuntu-branches/ubuntu/precise/jcsp/precise

« back to all changes in this revision

Viewing changes to src/org/jcsp/lang/StandardConnectionFactory.java

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Landaeta
  • Date: 2010-06-20 18:12:26 UTC
  • Revision ID: james.westby@ubuntu.com-20100620181226-8yg8d9rjjjiuy7oz
Tags: upstream-1.1-rc4
ImportĀ upstreamĀ versionĀ 1.1-rc4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
    //////////////////////////////////////////////////////////////////////
 
2
    //                                                                  //
 
3
    //  JCSP ("CSP for Java") Libraries                                 //
 
4
    //  Copyright (C) 1996-2008 Peter Welch and Paul Austin.            //
 
5
    //                2001-2004 Quickstone Technologies Limited.        //
 
6
    //                                                                  //
 
7
    //  This library is free software; you can redistribute it and/or   //
 
8
    //  modify it under the terms of the GNU Lesser General Public      //
 
9
    //  License as published by the Free Software Foundation; either    //
 
10
    //  version 2.1 of the License, or (at your option) any later       //
 
11
    //  version.                                                        //
 
12
    //                                                                  //
 
13
    //  This library is distributed in the hope that it will be         //
 
14
    //  useful, but WITHOUT ANY WARRANTY; without even the implied      //
 
15
    //  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR         //
 
16
    //  PURPOSE. See the GNU Lesser General Public License for more     //
 
17
    //  details.                                                        //
 
18
    //                                                                  //
 
19
    //  You should have received a copy of the GNU Lesser General       //
 
20
    //  Public License along with this library; if not, write to the    //
 
21
    //  Free Software Foundation, Inc., 59 Temple Place, Suite 330,     //
 
22
    //  Boston, MA 02111-1307, USA.                                     //
 
23
    //                                                                  //
 
24
    //  Author contact: P.H.Welch@kent.ac.uk                             //
 
25
    //                                                                  //
 
26
    //                                                                  //
 
27
    //////////////////////////////////////////////////////////////////////
 
28
 
 
29
package org.jcsp.lang;
 
30
 
 
31
/**
 
32
 * <p>
 
33
 * Implements a factory for creating connections.
 
34
 * </p>
 
35
 *
 
36
 * @author Quickstone Technologies Limited
 
37
 */
 
38
public class StandardConnectionFactory
 
39
        implements ConnectionFactory, ConnectionArrayFactory
 
40
{
 
41
    /**
 
42
     * @see ConnectionFactory#createOne2One
 
43
     */
 
44
    public One2OneConnection createOne2One()
 
45
    {
 
46
        return new One2OneConnectionImpl();
 
47
    }
 
48
 
 
49
    /**
 
50
     * @see ConnectionFactory#createAny2One
 
51
     */
 
52
    public Any2OneConnection createAny2One()
 
53
    {
 
54
        return new Any2OneConnectionImpl();
 
55
    }
 
56
 
 
57
    /**
 
58
     * @see ConnectionFactory#createOne2Any
 
59
     */
 
60
    public One2AnyConnection createOne2Any()
 
61
    {
 
62
        return new One2AnyConnectionImpl();
 
63
    }
 
64
 
 
65
    /**
 
66
     * @see ConnectionFactory#createAny2Any
 
67
     */
 
68
    public Any2AnyConnection createAny2Any()
 
69
    {
 
70
        return new Any2AnyConnectionImpl();
 
71
    }
 
72
 
 
73
    /**
 
74
     * @see ConnectionArrayFactory#createOne2One
 
75
     */
 
76
    public One2OneConnection[] createOne2One(int n)
 
77
    {
 
78
        One2OneConnection[] toReturn = new One2OneConnection[n];
 
79
        for (int i = 0; i < n; i++)
 
80
            toReturn[i] = createOne2One();
 
81
        return toReturn;
 
82
    }
 
83
 
 
84
    /**
 
85
     * @see ConnectionArrayFactory#createAny2One
 
86
     */
 
87
    public Any2OneConnection[] createAny2One(int n)
 
88
    {
 
89
        Any2OneConnection[] toReturn = new Any2OneConnection[n];
 
90
        for (int i = 0; i < n; i++)
 
91
            toReturn[i] = createAny2One();
 
92
        return toReturn;
 
93
    }
 
94
 
 
95
    /**
 
96
     * @see ConnectionArrayFactory#createOne2Any
 
97
     */
 
98
    public One2AnyConnection[] createOne2Any(int n)
 
99
    {
 
100
        One2AnyConnection[] toReturn = new One2AnyConnection[n];
 
101
        for (int i = 0; i < n; i++)
 
102
            toReturn[i] = createOne2Any();
 
103
        return toReturn;
 
104
    }
 
105
 
 
106
    /**
 
107
     * @see ConnectionArrayFactory#createAny2Any
 
108
     */
 
109
    public Any2AnyConnection[] createAny2Any(int n)
 
110
    {
 
111
        Any2AnyConnection[] toReturn = new Any2AnyConnection[n];
 
112
        for (int i = 0; i < n; i++)
 
113
            toReturn[i] = createAny2Any();
 
114
        return toReturn;
 
115
    }
 
116
}