Symbol.java
/**
* Copyright 2010,2021 Nikolas S Boyd.
Permission is granted to copy this work provided this copyright statement is retained in all copies.
*/
package Hoot.Collections;
import Hoot.Runtime.Functions.*;
import Hoot.Runtime.Faces.*;
import Hoot.Runtime.Values.*;
import Hoot.Runtime.Blocks.*;
import Smalltalk.Core.*;
import Smalltalk.Blocks.*;
import Smalltalk.Magnitudes.*;
import Hoot.Behaviors.*;
import Hoot.Behaviors.Nil;
import Hoot.Behaviors.Object;
import Hoot.Behaviors.True;
import Hoot.Behaviors.False;
import Hoot.Behaviors.Boolean;
import Hoot.Magnitudes.*;
import Hoot.Magnitudes.Integer;
import Hoot.Magnitudes.Character;
import Hoot.Magnitudes.Float;
import Hoot.Magnitudes.Double;
import Hoot.Runtime.Faces.Selector;
import Smalltalk.Core.Subject;
import Smalltalk.Magnitudes.Code;
import Smalltalk.Magnitudes.Ordinal;
public class Symbol extends CharacterString implements Selector
{
public static Metaclass type() { return (Metaclass)Metaclass.$class; }
@Override public Metaclass $class() { return (Metaclass)Metaclass.$class; }
public static class Metaclass extends CharacterString.Metaclass implements Selector.Metatype
{
static final Symbol.Metaclass $class = new Symbol.Metaclass();
public Metaclass() {
this(Symbol.Metaclass.class);
}
public Metaclass(java.lang.Class aClass) {
super(aClass);
}
@Override public java.lang.Class outerClass() { return Symbol.class; }
}
protected java.lang.String contents = "";
/**
* @return
*/
public static Symbol from(final java.lang.String aString)
{
java.lang.String exitID = "Symbol>>$from";
Frame f0 = new Frame(exitID);
return (Symbol)new Symbol(aString);
}
/**
*
*/
protected Symbol(final java.lang.String primitiveString)
{
java.lang.String exitID = "Symbol>>Symbol";
Frame f0 = new Frame(exitID);
contents = primitiveString.intern();
}
/**
* @return
*/
@Override public java.lang.String primitiveString()
{
java.lang.String exitID = "Symbol>>primitiveString";
Frame f0 = new Frame(exitID);
return (java.lang.String)contents;
}
/**
* @return
*/
@Override protected Character get(final int index)
{
java.lang.String exitID = "Symbol>>get";
Frame f0 = new Frame(exitID);
return (Character)Character.from(contents.charAt(index));
}
/**
* @return
*/
@Override public Character at_ifAbsent(final Ordinal index, final NiladicValuable aBlock)
{
java.lang.String exitID = "Symbol>>at_ifAbsent";
Frame f0 = new Frame(exitID);
this.checkIndex_ifAbsent(index, aBlock);
return (Character)Character.from(contents.charAt(index.intValue()));
}
/**
* @return
*/
@Override public Boolean equals(final CharacterString aString)
{
java.lang.String exitID = "Symbol>>equals";
Frame f0 = new Frame(exitID);
return (Boolean)Boolean.from(contents.equals(aString.primitiveString()));
}
/**
* @return
*/
@Override public Boolean isLiteral()
{
java.lang.String exitID = "Symbol>>isLiteral";
Frame f0 = new Frame(exitID);
return (Boolean)True.literal();
}
/**
* @return
*/
@Override public String printString()
{
java.lang.String exitID = "Symbol>>printString";
Frame f0 = new Frame(exitID);
return (String)((String)(String.from("#").append(this.asString())));
}
/**
* @return
*/
@Override public Character add(final Subject element)
{
java.lang.String exitID = "Symbol>>add";
Frame f0 = new Frame(exitID);
this.immutabilityError();
return (Character)element;
}
/**
* @return
*/
@Override protected Character add_at(final Object element, final int index)
{
java.lang.String exitID = "Symbol>>add_at";
Frame f0 = new Frame(exitID);
this.immutabilityError();
return (Character)element;
}
/**
* @return
*/
public Symbol removeAll()
{
java.lang.String exitID = "Symbol>>removeAll";
Frame f0 = new Frame(exitID);
this.immutabilityError();
return (Symbol)this;
}
/**
* @return
*/
public Code removeFirst()
{
java.lang.String exitID = "Symbol>>removeFirst";
Frame f0 = new Frame(exitID);
this.immutabilityError();
return (Code)SmallInteger.from(0).asCharacter();
}
/**
* @return
*/
public Code removeLast()
{
java.lang.String exitID = "Symbol>>removeLast";
Frame f0 = new Frame(exitID);
this.immutabilityError();
return (Code)SmallInteger.from(0).asCharacter();
}
/**
* @return
*/
public Code removeAtIndex(final Ordinal index)
{
java.lang.String exitID = "Symbol>>removeAtIndex";
Frame f0 = new Frame(exitID);
this.immutabilityError();
return (Code)SmallInteger.from(0).asCharacter();
}
}