/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

package com.pullenti.unitext.internal.word;

public class StyleCollection {

    public static final String PROPERTYNAMEPREFIX = "sprm";

    private Iterable<Prl[]> prls;

    public Object getIndexerItem(String name) throws IllegalArgumentException, Exception, UnsupportedOperationException, java.io.IOException {
        return this.get(name);
    }


    public StyleCollection(Iterable<Prl[]> _prls) {
        this.prls = _prls;
    }

    @Override
    public String toString() {
        StringBuilder res = new StringBuilder();
        for (Prl[] prlSet : prls) {
            for (Prl prl : prlSet) {
                String s = SinglePropertyModifiers.getSprmName(prl.sprm.sprm);
                if (s != null) 
                    res.append(s).append("; ");
            }
        }
        return res.toString();
    }

    public Object getByUshort(short sprm) throws Exception, UnsupportedOperationException, java.io.IOException {
        for (Prl[] prlSet : prls) {
            for (Prl prl : prlSet) {
                if (Integer.compareUnsigned(prl.sprm.sprm, sprm) == 0) 
                    return SinglePropertyValue.parseValue(Short.toUnsignedInt(sprm), prl.operand);
            }
        }
        return null;
    }

    public Object get(String name) throws IllegalArgumentException, Exception, UnsupportedOperationException, java.io.IOException {
        if (name == null) 
            throw new IllegalArgumentException("name");
        short sprm = SinglePropertyModifiers.getSprmByName(name);
        for (Prl[] prlSet : prls) {
            for (Prl prl : prlSet) {
                if (Integer.compareUnsigned(prl.sprm.sprm, sprm) == 0) 
                    return SinglePropertyValue.parseValue(Short.toUnsignedInt(sprm), prl.operand);
            }
        }
        return null;
    }

    public Iterable<Object> getAll(String name) throws IllegalArgumentException, Exception, UnsupportedOperationException, java.io.IOException {
        if (name == null) 
            throw new IllegalArgumentException("name");
        short sprm = SinglePropertyModifiers.getSprmByName(name);
        java.util.ArrayList<Object> res = new java.util.ArrayList<Object>();
        for (Prl[] prlSet : prls) {
            for (Prl prl : prlSet) {
                if (Integer.compareUnsigned(prl.sprm.sprm, sprm) == 0) 
                    res.add(SinglePropertyValue.parseValue(Short.toUnsignedInt(sprm), prl.operand));
            }
        }
        return res;
    }

    public Iterable<String> getNames() {
        return null;
    }
    public StyleCollection() {
    }
}
