/* StringOperand.java (c) 2008-2013 Edward Swartz All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html */ package v9t9.tools.asm.operand.hl; import v9t9.common.asm.IInstruction; import v9t9.common.asm.ResolveException; import v9t9.tools.asm.IAssembler; import v9t9.tools.asm.operand.ll.LLOperand; /** * @author ejs * */ public class StringOperand extends BaseOperand { private String string; public StringOperand(String string) { this.string = string; } @Override public String toString() { return '"' + string + '"'; } public String getString() { return string; } /* (non-Javadoc) * @see v9t9.tools.asm.operand.hl.AssemblerOperand#isMemory() */ @Override public boolean isMemory() { return false; } /* (non-Javadoc) * @see v9t9.tools.asm.operand.hl.AssemblerOperand#isRegister() */ @Override public boolean isRegister() { return false; } /* (non-Javadoc) * @see v9t9.tools.asm.operand.hl.AssemblerOperand#isConst() */ @Override public boolean isConst() { return true; } /* (non-Javadoc) * @see v9t9.engine.cpu.Operand#resolve(v9t9.tools.asm.Assembler, v9t9.engine.cpu.RawInstruction) */ public LLOperand resolve(IAssembler assembler, IInstruction inst) throws ResolveException { throw new ResolveException(this, "Cannot resolve a string outside DB, BYTE, TEXT, etc."); } /* (non-Javadoc) * @see v9t9.tools.asm.operand.hl.AssemblerOperand#getChildren() */ @Override public AssemblerOperand[] getChildren() { return new AssemblerOperand[0]; } /* (non-Javadoc) * @see v9t9.tools.asm.operand.hl.AssemblerOperand#addOffset(int) */ @Override public AssemblerOperand addOffset(int i) { return null; } }