Examples of GeneralParameterDescriptor


Examples of com.pcmsolutions.device.EMU.E4.parameter.GeneralParameterDescriptor

        private final String[] valueStrings = new String[4];

        public Impl_MultiModeChannelSelection(MultiModeContext mmc, int[] selCols, int row) {
            channel = IntPool.get(row + 1);
            MultiModeDescriptor mmd = mmc.getMultiModeDescriptor();
            GeneralParameterDescriptor preset_pd = mmd.getPresetParameterDescriptor();
            GeneralParameterDescriptor vol_pd = mmd.getVolumeParameterDescriptor();
            GeneralParameterDescriptor pan_pd = mmd.getPanParameterDescriptor();
            GeneralParameterDescriptor submix_pd = mmd.getSubmixParameterDescriptor();

            MultiModeMap m = mmc.getMultimodeMap();

            for (int i = 0, n = selCols.length; i < n; i++) {
                if (selCols[i] == 0) {
                    try {
                        values[0] = m.getPreset(channel);
                        valueStrings[0] = preset_pd.getStringForValue(values[0]);
                    } catch (IllegalMidiChannelException e) {
                        e.printStackTrace();
                    } catch (ParameterValueOutOfRangeException e) {
                        e.printStackTrace();
                    }
                }

                if (selCols[i] == 1) {
                    try {
                        values[1] = m.getVolume(channel);
                        valueStrings[1] = vol_pd.getStringForValue(values[1]);
                    } catch (IllegalMidiChannelException e) {
                        e.printStackTrace();
                    } catch (ParameterValueOutOfRangeException e) {
                        e.printStackTrace();
                    }
                }
                if (selCols[i] == 2) {
                    try {
                        values[2] = m.getPan(channel);
                        valueStrings[2] = pan_pd.getStringForValue(values[2]);
                    } catch (IllegalMidiChannelException e) {
                        e.printStackTrace();
                    } catch (ParameterValueOutOfRangeException e) {
                        e.printStackTrace();
                    }
                }
                if (selCols[i] == 3) {
                    try {
                        values[3] = m.getSubmix(channel);
                        valueStrings[3] = submix_pd.getStringForValue(values[3]);
                    } catch (IllegalMidiChannelException e) {
                        e.printStackTrace();
                    } catch (ParameterValueOutOfRangeException e) {
                        e.printStackTrace();
                    }
View Full Code Here

Examples of com.pcmsolutions.device.EMU.E4.parameter.GeneralParameterDescriptor

        Integer id;
        for (int n = 0; n < len; n++) {
            id = ids[n];
            v = (Integer) params.get(id);
            if (v == null) {
                GeneralParameterDescriptor pd = parameterContext.getParameterDescriptor(id);
                if (pd == null)
                    throw new IllegalParameterIdException();
                v = pd.getDefaultValue();
            }
            retVals[n] = v;
        }
        return retVals;
    }
View Full Code Here

Examples of com.pcmsolutions.device.EMU.E4.parameter.GeneralParameterDescriptor

    protected void translateToParameterContext(ParameterContext pc) {
        this.parameterContext = pc;
        Map oldParams = (Map) params.clone();
        params.clear();
        Integer key;
        GeneralParameterDescriptor pd;
        Map newIds = pc.getIdsAndDefaultsAsMap();     // id(Integer) -> default value(Integer)
        for (Iterator i = newIds.keySet().iterator(); i.hasNext();) {
            key = (Integer) i.next();
            if (oldParams.containsKey(key)) {
                try {
View Full Code Here

Examples of com.pcmsolutions.device.EMU.E4.parameter.GeneralParameterDescriptor

            throw new IllegalArgumentException(this.getClass().toString() + ":initValues -> array not id/value pairs!");

        //params.clear();

        Integer id;
        GeneralParameterDescriptor pd;
        for (int n = 0; n < len; n += 2) {
            id = idValues[n];
            try {
                pd = parameterContext.getParameterDescriptor(id);
            } catch (IllegalParameterIdException e) {
View Full Code Here

Examples of com.pcmsolutions.device.EMU.E4.parameter.GeneralParameterDescriptor

    abstract protected void makeMaps();

    public boolean equals(Object obj) {
        if (obj instanceof GeneralParameterDescriptor) {
            GeneralParameterDescriptor pd = (GeneralParameterDescriptor) obj;
            if (pd.getId().equals(id) && pd.getMMD().equals(mmd))
                return true;
        } else if (obj instanceof Integer)
            return obj.equals(id);
        return false;
    }
View Full Code Here

Examples of com.pcmsolutions.device.EMU.E4.parameter.GeneralParameterDescriptor

    public static boolean tryToggleCellAt(JTable table, int row, int column) {
        Object o = table.getValueAt(row, column);
        if (o instanceof EditableParameterModel) {
            EditableParameterModel pm = ((EditableParameterModel) o);
            GeneralParameterDescriptor pd;
            pd = pm.getParameterDescriptor();
            if (pd.getMinValue().intValue() == pd.getMaxValue().intValue() - 1)
                try {
                    if (pm.getValue().equals(pd.getMinValue()))
                        pm.setValue(pd.getMaxValue());
                    else
                        pm.setValue(pd.getMinValue());
                    return true;
                } catch (ParameterUnavailableException e) {
                } catch (ParameterValueOutOfRangeException e) {
                }
        }
View Full Code Here

Examples of org.opengis.parameter.GeneralParameterDescriptor

        ArgumentChecks.ensureNonNull("name", name);
        final ParameterValueList values = this.values; // Protect against accidental changes.
        final List<ParameterValueGroup> groups = new ArrayList<ParameterValueGroup>(4);
        final int size = values.size();
        for (int i=0; i<size; i++) {
            final GeneralParameterDescriptor descriptor = values.descriptor(i);
            if (descriptor instanceof ParameterDescriptorGroup) {
                if (isHeuristicMatchForName(descriptor, name)) {
                    groups.add((ParameterValueGroup) values.get(i));
                }
            }
        }
        /*
         * No groups were found. Check if the group actually exists (i.e. is declared in the
         * descriptor). If it doesn't exists, then an exception is thrown. If it exists (i.e.
         * it is simply an optional group not yet defined), then returns an empty list.
         */
        if (groups.isEmpty()) {
            final ParameterDescriptorGroup descriptor = values.descriptor;
            if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
                throw new ParameterNotFoundException(Errors.format(
                        Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
            }
        }
        return groups;
    }
View Full Code Here

Examples of org.opengis.parameter.GeneralParameterDescriptor

    public ParameterValueGroup addGroup(final String name)
            throws ParameterNotFoundException, InvalidParameterCardinalityException
    {
        final ParameterValueList values = this.values; // Protect against accidental changes.
        final ParameterDescriptorGroup descriptor = values.descriptor;
        final GeneralParameterDescriptor child = descriptor.descriptor(name);
        if (!(child instanceof ParameterDescriptorGroup)) {
            throw new ParameterNotFoundException(Errors.format(
                    Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
        }
        final ParameterValueGroup value = ((ParameterDescriptorGroup) child).createValue();
View Full Code Here

Examples of org.opengis.parameter.GeneralParameterDescriptor

    @Override
    public GeneralParameterValue set(final int index, final GeneralParameterValue parameter) {
        ArgumentChecks.ensureValidIndex(size, index);
        final GeneralParameterValue value = values[index];
        ArgumentChecks.ensureNonNull("parameter", parameter);
        final GeneralParameterDescriptor desc = parameter.getDescriptor();
        if (!value.getDescriptor().equals(desc)) {
            ensureDescriptorExists(desc);
            ensureCanRemove(desc);
            ensureCanAdd(desc);
        }
View Full Code Here

Examples of org.opengis.parameter.GeneralParameterDescriptor

     *         than allowed by {@code maximumOccurs}.
     */
    @Override
    public boolean add(final GeneralParameterValue parameter) {
        ArgumentChecks.ensureNonNull("parameter", parameter);
        final GeneralParameterDescriptor desc = parameter.getDescriptor();
        ensureDescriptorExists(desc);
        /*
         * If we had an uninitialized parameter (a parameter created by the DefaultParameterValueGroup constructor
         * and never been queried or set by the user), then the given parameter will replace the uninitialized.
         * The intend is to allow users to set its own parameters by a call to group.values().addAll(myParam).
         * Otherwise the given parameter will be added, in which case we need to check the cardinality.
         */
        final ReferenceIdentifier name = desc.getName();
        int count = 0;
        for (int i=0; i<size; i++) {
            final GeneralParameterValue value = values[i];
            if (name.equals(value.getDescriptor().getName())) {
                if (value instanceof UninitializedParameter) {
                    values[i] = parameter;
                    return true;
                }
                count++;
            }
        }
        if (count >= desc.getMaximumOccurs()) {
            throw new InvalidParameterCardinalityException(Errors.format(
                    Errors.Keys.TooManyOccurrences_2, count, name), name.getCode());
        }
        addUnchecked(parameter);
        modCount++;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.