Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/gp/GPAtomicType.java @ 6152

Last change on this file since 6152 was 6152, checked in by bfarka, 13 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 1.2 KB
Line 
1/*
2  Copyright 2006 by Sean Luke
3  Licensed under the Academic Free License version 3.0
4  See the file "LICENSE" for more information
5*/
6
7
8package ec.gp;
9
10/*
11 * GPAtomicType.java
12 *
13 * Created: Fri Aug 27 21:16:45 1999
14 * By: Sean Luke
15 */
16
17/**
18 * A GPAtomicType is a simple, atomic GPType.  For more information, see GPType.
19 @see ec.gp.GPType
20 *
21 * @author Sean Luke
22 * @version 1.0
23 */
24
25public final class GPAtomicType extends GPType
26    {
27    /** Use this constructor for GPAtomic Type unless you know what you're doing */
28    public GPAtomicType(final String n) { name = n; }
29
30    /** Don't use this constructor unless you call setup(...) immediately after it. */
31    public GPAtomicType() { }
32
33    public final boolean compatibleWith(final GPInitializer initializer, final GPType t)
34        {
35        // if the type is me, then I'm compatible with it
36        if (t.type==type) return true;
37       
38        // if the type an atomic type, then return false
39        else if (t.type < initializer.numAtomicTypes) return false;
40       
41        // if the type is < 0 (it's a set type), then I'm compatible
42        // if I'm contained in it.  Use its sparse array.
43        else return ((GPSetType)t).types_sparse[type];
44        }
45    }
Note: See TracBrowser for help on using the repository browser.