Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/hoodui/CDS.java

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * Basic class for the "Concreate Data Structure" datatype.
 *
 * Copyright 2000 Andy Gill
 *
 * $Revision: 1.1 $
 * $Date: 2000/09/15 16:14:17 $
 */

import java.util.*;
/**
  *
  * @author Andy Gill
  * @version 0.1
  */

public abstract class CDS implements PrettyStep {
    public int nodeId;    // The time this node got updated/created

    /* Adding a child to a specific node.
     */

    public abstract void addChild(CDS child,int portNo);

    /* trying to update *this* with a newChild
     * For WHNF object, this is an error
     * For Enter nodes, this is the update
     * For Fun nodes, this is just another instance.
     */

    protected abstract CDS adding(CDS newChild);

    /* build a single child, because sometimes 
     * you might want to wrap yourself in a Many
     */
    protected CDS singleton() {
	return this;
    }

    /* Adding the tag saying when you were entered.
     */
    protected abstract void addEnterId(int enterId);

    public void visitNodes(HoodVector nodes) {
	if (nodeId != -1) {
	    nodes.setElementAt(this,nodeId);
	}
    }

    public int getBirthId() { return nodeId; }

    protected abstract Pretty render(PrettyStep parent,int prec,boolean par);

    protected void getFn(PrettyStep ps,HoodColl ht,boolean isStatic) {
	// consider getFn using the parental step context
	ArgResList.singleton(render(ps,10,false),ht);
    }
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.