Package de.maramuse.soundcomp.process

Examples of de.maramuse.soundcomp.process.UnknownConnectionException


  @Override
  public void setSource(int connection, NamedSource source,
            int sourceIndex) throws UnknownConnectionException,
      TypeMismatchException {
  if(!source.getSourceTypes().containsKey(sourceIndex))
    throw new UnknownConnectionException("attempt to set invalid StateVariablefilter source");
  sourceStoreMap.put(connection, new SourceStore(source, sourceIndex));
  if(connection==StandardParameters.Q.i){
    qSource=source;
    qSourceIndex=sourceIndex;
  }else if(connection==StandardParameters.FREQUENCY.i){
    freqSource=source;
    freqSourceIndex=sourceIndex;
  }else if(connection==StandardParameters.IN.i){
    sigSource=source;
    sigSourceIndex=sourceIndex;
  }else
    throw new UnknownConnectionException(
      "attempt to set unknown parameter for StateVariableFilter");

  }
View Full Code Here


      throw new IllegalArgumentException(MessageFormat.format(
        "Element {0} does not have output {1} in {2}", cp.getElementName(),
        cp.getConnectionName(), cp.getLocationText()));
    return new SourceStore(src, param.i);
    }
    throw new UnknownConnectionException("Element "+cp.getElementName()+" in "+name.getText()
      +" not known in "
      +val.filename+" line "+val.line);
  }
  if(val instanceof NamelessSource){
    // a data source that has a stream whose name need not be given. NamelessSources by contract always
    // are NamedSources that connect to OUT
    // NamedSource src=subs.get(val);
    // return new SourceStore(src, StandardParameters.OUT.i);
  }
  if(val instanceof Element){
    // a single name appearing in a formula must refer to an interface input or a process variable
    String elementName=val.getText();
    Parameter param=inputsByName().get(elementName);
    if(param!=null){
    return getInputProxy(elementName);
    }
    Variable v=containedVariables.get(elementName);
    if(v != null){
    return new SourceStore(v, StandardParameters.OUT.i);
    }
    throw new UnknownConnectionException("Input "+elementName+" in "+name.getText()
      +" not known in "
      +val.filename+" line "+val.line);
  }
  if(val instanceof Connection){
    // TODO how to handle?
    Connection c=(Connection)val;
    @SuppressWarnings("unused")
    ConnectionPoint cp=c.source;

    throw new UnknownConnectionException("Connection "+c.getEndpoint()+" in "+name.getText()
      +" not known in "
      +val.filename+" line "+val.line);
  }
  if(val instanceof NamelessSource && val instanceof TemplateProvider){
    return new SourceStore(((TemplateProvider)val).getTemplate().clone(), StandardParameters.OUT.i);
  }
  if(val instanceof ConnectionPoint){
    // can this legally happen?
    ConnectionPoint cp=(ConnectionPoint)val;
    throw new UnknownConnectionException("ConnectionPoint "+
      cp.getElementName()+"."+cp.getConnectionName()+" in "+name.getText()
      +" of unknown type in "
        +val.filename+" line "+val.line);   
  }
  throw new UnknownConnectionException("Element "+val.getText()+" in "+name.getText()
    +" of unknown type in "
      +val.filename+" line "+val.line);
  }
View Full Code Here

  public void setSource(int connectionIndex, NamedSource source, int sourceIndex)
    throws UnknownConnectionException, TypeMismatchException {
  ValueType sourceType=source.getSourceTypes().get(sourceIndex);
  ValueType destType=destinationTypes.get(connectionIndex);
  if(destType==null)
    throw new UnknownConnectionException("Could not determine type of "+name+" input "
      +connectionIndex);
  if(sourceType==null)
    throw new UnknownConnectionException("Could not determine type of "+source.getAbstractName()
      +" output "+sourceIndex);
  if(!sourceType.equals(destType))
    throw new UnknownConnectionException("Connection end types "+name+"/"+connectionIndex+" and "
      +source.getAbstractName()+"/"+sourceIndex+" do not match");
  destinationMap.put(connectionIndex, new SourceStore(source, sourceIndex));
  }
View Full Code Here

  @Override
  public void setSource(int connectionIndex, NamedSource source,
            int sourceIndex) throws UnknownConnectionException,
      TypeMismatchException {
  if(!source.getSourceTypes().containsKey(sourceIndex))
    throw new UnknownConnectionException("attempt to get invalid source's output for SID6581");
  if(!destinationTypes.containsKey(connectionIndex))
    throw new UnknownConnectionException("attempt to set unkown parameter for SID6581");
    sourceStoreMap.put(connectionIndex, new SourceStore(source, sourceIndex));
    nsetSource(nativeSpace, connectionIndex, source.getNativeSpace(), sourceIndex);
  }
View Full Code Here

  if(connection==StandardParameters.FREQUENCY.i){
    if(source.getSourceTypes().containsKey(sourceIndex)){
    freq=new SourceStore(source, sourceIndex);
    sourceStoreMap.put(connection, freq);
    }else
    throw new UnknownConnectionException("unknown source for generator frequency");
  }else if(connection==StandardParameters.SYNC.i){
    if(source.getSourceTypes().containsKey(sourceIndex)){
    sync=new SourceStore(source, sourceIndex);
    sourceStoreMap.put(connection, sync);
    }else
    throw new UnknownConnectionException("unkown source for generator sync");
  }else if(connection==StandardParameters.SYNCPHASE.i){
    if(source.getSourceTypes().containsKey(sourceIndex)){
    syncphase=new SourceStore(source, sourceIndex);
    sourceStoreMap.put(connection, syncphase);
    }else
    throw new UnknownConnectionException("unkown source for generator syncphase");
  }else
    throw new UnknownConnectionException("attempt to set unknown generator parameter");
  }
View Full Code Here

  @Override
  public TableStream<Double> getTable(Double t, int index)
    throws UnknownConnectionException {
  if(index==StandardParameters.TABLE.i)
    return dts;
  throw new UnknownConnectionException(
    "unknown output from CustomWaveform requested");
  }
View Full Code Here

   * @throws TypeMismatchException
   */
  public void setSource(int connectionIndex, NamedSource source,
            int sourceIndex) throws UnknownConnectionException,
    TypeMismatchException {
    throw new UnknownConnectionException("attempt to provide parameter for inputless class");
  }
View Full Code Here

  @Override
  public void setSource(int connectionIndex, NamedSource source,
            int sourceIndex) throws UnknownConnectionException,
      TypeMismatchException {
  throw new UnknownConnectionException("no source can be set for PinkNoise");
  }
View Full Code Here

  public void setSource(int connectionIndex, NamedSource source,
      int sourceIndex) throws UnknownConnectionException,
      TypeMismatchException {
    if(connectionIndex==StandardParameters.FREQUENCY.i){
      if(source==null || (source.getSourceTypes().get(sourceIndex)!=ValueType.DOUBLE &&source.getSourceTypes().get(sourceIndex)!=ValueType.STREAM))
        throw new UnknownConnectionException("setting invalid CustomWave frequency source");
      super.setSource(connectionIndex, source, sourceIndex);
    }else{
      if(source==null || (!(source instanceof TableSource<?>)) ||
          source.getSourceTypes().get(sourceIndex)!=ValueType.CTABLE)
        throw new UnknownConnectionException("setting invalid CustomWave table source");
      try{
        table=(TableSource<Double>)source;
        tableIndex=sourceIndex;
      }catch(ClassCastException c){
        throw new UnknownConnectionException("setting invalid CustomWave table source type");
      }
    }
  }
View Full Code Here

      TypeMismatchException {
  if(connection==StandardParameters.DUTYCYCLE.i){
    if(source.getSourceTypes().containsKey(sourceIndex)){
    dc=new SourceStore(source, sourceIndex);
    }else
    throw new UnknownConnectionException("source for SawTooth dutycycle unknown");
  }else if(connection==StandardParameters.PHASEOFFSET.i){
    if(source.getSourceTypes().containsKey(sourceIndex)){
    po=new SourceStore(source, sourceIndex);
    }else
    throw new UnknownConnectionException("source for SawTooth phaseoffset unknown");
  }else
    super.setSource(connection, source, sourceIndex);
  }
View Full Code Here

TOP

Related Classes of de.maramuse.soundcomp.process.UnknownConnectionException

Copyright © 2018 www.massapicom. 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.