Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright The Sett Ltd, 2005 to 2014.
  *
  * 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.
 */
package com.thesett.aima.logic.fol.wam.compiler;
WAMReservedLabel is an WAMCallPoint that is an address for a label. The label in question may be forward referenced, so its address cannot be resolved until the label is encountered as code is generated. In the situation that a forward reference to a label is encountered, a dummy invalid address can be substituted for the label, and the offset at which that dummy address is written can be recorded. Once the label has been resolved to a valid address, the dummy values can be re-visited and corrected. WAMReservedLabel is an WAMCallPoint that also maintains a list of referenced from address to be corrected, once the label address is known.

An WAMReservedLabel is created with an entry point of -1, which means that it has not been resolved to a known address yet. Once the entry point is set to a value other than -1, it is considered to have been resolved.

CRC Card
Responsibilities Collaborations
Maintain a list of referenced from address against a label.

Author(s):
Rupert Smith
public class WAMReservedLabel extends WAMCallPoint
{
    
The list of referenced from addresses.
    public List<IntegerreferenceList = new LinkedList<Integer>();

    
Creates a call table entry for the code with the specified entry address and length.

Parameters:
functorName The functors interned name.
    public WAMReservedLabel(int functorName)
    {
        super(-1, 0, functorName);
    }

    
Checks if this label has been resolved to a concrete address yet.

Returns:
true iff this label has been resolved to a concrete address.
    public boolean isResolved()
    {
        return  != -1;
    }
New to GrepCode? Check out our FAQ X