class CFFCharsetType1 implements CFFCharset
{
    private static final String EXCEPTION_MESSAGE = "Not a CIDFont";

    private final Map<Integer, Integer> sidOrCidToGid = new HashMap<>(250);
    private final Map<Integer, Integer> gidToSid = new HashMap<>(250);
    private final Map<String, Integer> nameToSid = new HashMap<>(250);

    // inverse
    private final Map<Integer, String> gidToName = new HashMap<>(250);

    @Override
    public boolean isCIDFont()
    {
        return false;
    }
    
    @Override
    public void addSID(int gid, int sid, String name)
    {
        sidOrCidToGid.put(sid, gid);
        gidToSid.put(gid, sid);
        nameToSid.put(name, sid);
        gidToName.put(gid, name);
    }

    @Override
    public void addCID(int gid, int cid)
    {
        throw new IllegalStateException(EXCEPTION_MESSAGE);
    }

    @Override
    public int getSIDForGID(int gid)
    {
        Integer sid = gidToSid.get(gid);
        if (sid == null)
        {
            return 0;
        }
        return sid;
    }

    @Override
    public int getGIDForSID(int sid)
    {<FILL_FUNCTION_BODY>}

    @Override
    public int getGIDForCID(int cid)
    {
        throw new IllegalStateException(EXCEPTION_MESSAGE);
    }

    @Override
    public int getSID(String name)
    {
        Integer sid = nameToSid.get(name);
        if (sid == null)
        {
            return 0;
        }
        return sid;
    }

    @Override
    public String getNameForGID(int gid)
    {
        return gidToName.get(gid);
    }

    @Override
    public int getCIDForGID(int gid)
    {
        throw new IllegalStateException(EXCEPTION_MESSAGE);
    }
}

        Integer gid = sidOrCidToGid.get(sid);
        if (gid == null)
        {
            return 0;
        }
        return gid;
    
<no_super_class>