[jboss-svn-commits] JBL Code SVN: r19176 - labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 21 09:59:35 EDT 2008


Author: mingjin
Date: 2008-03-21 09:59:35 -0400 (Fri, 21 Mar 2008)
New Revision: 19176

Removed:
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/TupleSource.java
Log:
removed from trunk.

Deleted: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/TupleSource.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/TupleSource.java	2008-03-21 13:33:50 UTC (rev 19175)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/TupleSource.java	2008-03-21 13:59:35 UTC (rev 19176)
@@ -1,136 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Serializable;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-
-import org.drools.common.BaseNode;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-/**
- * A source of <code>ReteTuple</code> s for a <code>TupleSink</code>.
- *
- * <p>
- * Nodes that propagate <code>Tuples</code> extend this class.
- * </p>
- *
- * @see TupleSource
- * @see ReteTuple
- *
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public abstract class TupleSource extends BaseNode
-    implements
-    Externalizable {
-    // ------------------------------------------------------------
-    // Instance members
-    // ------------------------------------------------------------
-
-    /** The destination for <code>Tuples</code>. */
-    protected TupleSinkPropagator sink;
-
-    // ------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------
-    public TupleSource() {
-
-    }
-
-    /**
-     * Single parameter constructor that specifies the unique id of the node.
-     *
-     * @param id
-     */
-    TupleSource(final int id) {
-        super( id );
-        this.sink = EmptyTupleSinkAdapter.getInstance();
-    }
-
-    // ------------------------------------------------------------
-    // Instance methods
-    // ------------------------------------------------------------
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        super.readExternal(in);
-        sink    = (TupleSinkPropagator)in.readObject();
-    }
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-        out.writeObject(sink);
-    }
-
-    /**
-     * Adds the <code>TupleSink</code> so that it may receive
-     * <code>Tuples</code> propagated from this <code>TupleSource</code>.
-     *
-     * @param tupleSink
-     *            The <code>TupleSink</code> to receive propagated
-     *            <code>Tuples</code>.
-     */
-    protected void addTupleSink(final TupleSink tupleSink) {
-        if ( this.sink == EmptyTupleSinkAdapter.getInstance() ) {
-            this.sink = new SingleTupleSinkAdapter( tupleSink );
-        } else if ( this.sink instanceof SingleTupleSinkAdapter ) {
-            final CompositeTupleSinkAdapter sinkAdapter = new CompositeTupleSinkAdapter();
-            sinkAdapter.addTupleSink( this.sink.getSinks()[0] );
-            sinkAdapter.addTupleSink( tupleSink );
-            this.sink = sinkAdapter;
-        } else {
-            ((CompositeTupleSinkAdapter) this.sink).addTupleSink( tupleSink );
-        }
-    }
-
-    /**
-     * Removes the <code>TupleSink</code>
-     *
-     * @param tupleSink
-     *            The <code>TupleSink</code> to remove
-     */
-    protected void removeTupleSink(final TupleSink tupleSink) {
-        if ( this.sink == EmptyTupleSinkAdapter.getInstance() ) {
-            throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" );
-        }
-
-        if ( this.sink instanceof SingleTupleSinkAdapter ) {
-            this.sink = EmptyTupleSinkAdapter.getInstance();
-        } else {
-            final CompositeTupleSinkAdapter sinkAdapter = (CompositeTupleSinkAdapter) this.sink;
-            sinkAdapter.removeTupleSink( tupleSink );
-            if ( sinkAdapter.size() == 1 ) {
-                this.sink = new SingleTupleSinkAdapter( sinkAdapter.getSinks()[0] );
-            }
-        }
-    }
-
-    public TupleSinkPropagator getSinkPropagator() {
-        return this.sink;
-    }
-
-    public abstract void updateSink(TupleSink sink,
-                                    PropagationContext context,
-                                    InternalWorkingMemory workingMemory);
-
-    public boolean isInUse() {
-        return this.sink.size() > 0;
-    }
-}




More information about the jboss-svn-commits mailing list