Examples of Variable


Examples of ptolemy.data.expr.Variable

            // Ensure that the production rate is one.
            // FIXME: This may not be right if there is no
            // actual source of data for this port (e.g. no
            // SetVariable actor).
            Variable rate = (Variable) port.getAttribute("tokenProductionRate");

            if (rate == null) {
                try {
                    rate = new Variable(port, "tokenProductionRate");
                } catch (NameDuplicationException e) {
                    throw new InternalErrorException(e);
                }
            }

            rate.setToken(new IntToken(1));

            String portName = port.getName();
            Attribute attribute = getAttribute(portName);

            if (attribute == null) {
                try {
                    workspace().getWriteAccess();
                    attribute = new Variable(this, portName);
                } catch (NameDuplicationException ex) {
                    throw new InternalErrorException(ex);
                } finally {
                    workspace().doneWriting();
                }
View Full Code Here

Examples of railo.runtime.interpreter.ref.var.Variable

    @Override
    public Object getValue(PageContext pc) throws PageException {
      // if ref == null, it is val based Casting
      if(ref==null) return Caster.castTo(pc,type,strType,val);
      if(ref instanceof Variable && "queryColumn".equalsIgnoreCase(strType)) {
        Variable var=(Variable) ref;
        return Caster.castTo(pc,type,strType,var.getCollection(pc));
      }
      return Caster.castTo(pc,type,strType,ref.getValue(pc));
    }
View Full Code Here

Examples of railo.transformer.bytecode.expression.var.Variable

      if(d==null) throw cacheWithinException();
      return TimeSpanImpl.fromDays(d.doubleValue()).getMillis();
    }
    // createTimespan
    else if(val instanceof Variable) {
      Variable var=(Variable)val;
      if(var.getMembers().size()==1) {
        Member first = var.getFirstMember();
        if(first instanceof BIF) {
          BIF bif=(BIF) first;
          if("createTimeSpan".equalsIgnoreCase(bif.getFlf().getName())) {
            Argument[] args = bif.getArguments();
            int len=ArrayUtil.size(args);
View Full Code Here

Examples of solver.variables.Variable

    @Override
    public void explain(Deduction d, Explanation e) {
        e.add(solver.getExplainer().getPropagatorActivation(this));
        e.add(aCause);
        // the current deduction is due to the current domain of the involved variables
        Variable var = d.getVar();
        if (var.equals(x)) {
            // a deduction has been made on x ; this is related to y only
            y.explain(VariableState.LB, e);
        } else if (var.equals(y)) {
            x.explain(VariableState.UB, e);
        } else {
            super.explain(d, e);
        }
    }
View Full Code Here

Examples of ucar.nc2.Variable

        List<GradsVariable>  vars  = gradsDDF.getVariables();
        List<GradsAttribute> attrs = gradsDDF.getAttributes();
        //TODO: ensembles
        List<GradsDimension>       dims = gradsDDF.getDimensions();
        Variable                   v;
        int                        numZ  = 0;
        HashMap<String, Dimension> zDims = new HashMap<String, Dimension>();
        for (GradsDimension dim : dims) {
            String    name  = getVarName(dim);
            int       size  = dim.getSize();
            Dimension ncDim = new Dimension(name, size, true);
            ncFile.addDimension(null, ncDim);
            if (name.equals(ENS_VAR)) {
                v = new Variable(ncFile, null, null, name, DataType.STRING,
                                 name);
                v.addAttribute(new Attribute("standard_name", "ensemble"));
                v.addAttribute(new Attribute(_Coordinate.AxisType,
                                             AxisType.Ensemble.toString()));
                List<String> names =
                    gradsDDF.getEnsembleDimension().getEnsembleNames();
                String[] nameArray = new String[names.size()];
                for (int i = 0; i < nameArray.length; i++) {
                    nameArray[i] = names.get(i);
                }
                Array dataArray = Array.factory(DataType.STRING,
                                      new int[] { nameArray.length },
                                      nameArray);
                v.setCachedData(dataArray, false);
            } else {
                double[] vals = dim.getValues();
                v = new Variable(ncFile, null, null, name, DataType.DOUBLE,
                                 name);
                v.addAttribute(new Attribute("units", dim.getUnit()));
                if (name.equals(Y_VAR)) {
                    v.addAttribute(new Attribute("long_name", "latitude"));
                    v.addAttribute(new Attribute("standard_name",
                            "latitude"));
                    v.addAttribute(new Attribute("axis", "Y"));
                    sizeY = dim.getSize();
                    v.addAttribute(new Attribute(_Coordinate.AxisType,
                            AxisType.Lat.toString()));
                } else if (name.equals(X_VAR)) {
                    v.addAttribute(new Attribute("long_name", "longitude"));
                    v.addAttribute(new Attribute("standard_name",
                            "longitude"));
                    v.addAttribute(new Attribute("axis", "X"));
                    v.addAttribute(new Attribute(_Coordinate.AxisType,
                            AxisType.Lon.toString()));
                    sizeX = dim.getSize();
                } else if (name.equals(Z_VAR)) {
                    numZ = size;
                    zDims.put(name, ncDim);
                    v.addAttribute(new Attribute("long_name", "level"));
                    addZAttributes(dim, v);
                } else if (name.equals(TIME_VAR)) {
                    v.addAttribute(new Attribute("long_name", "time"));
                    v.addAttribute(new Attribute(_Coordinate.AxisType,
                            AxisType.Time.toString()));
                }
                ArrayDouble.D1 varArray = new ArrayDouble.D1(size);
                for (int i = 0; i < vals.length; i++) {
                    varArray.set(i, vals[i]);
                }
                v.setCachedData(varArray, false);
            }
            ncFile.addVariable(null, v);
        }
        if (numZ > 0) {
            GradsDimension zDim = gradsDDF.getZDimension();
            double[]       vals = zDim.getValues();
            for (GradsVariable var : vars) {
                int nl = var.getNumLevels();
                if ((nl > 0) && (nl != numZ)) {
                    String name = Z_VAR + nl;
                    if (zDims.get(name) == null) {
                        Dimension ncDim = new Dimension(name, nl, true);
                        ncFile.addDimension(null, ncDim);
                        Variable vz = new Variable(ncFile, null, null, name,
                                          DataType.DOUBLE, name);
                        vz.addAttribute(new Attribute("long_name", name));
                        vz.addAttribute(new Attribute("units",
                                zDim.getUnit()));
                        addZAttributes(zDim, vz);
                        ArrayDouble.D1 varArray = new ArrayDouble.D1(nl);
                        for (int i = 0; i < nl; i++) {
                            varArray.set(i, vals[i]);
                        }
                        vz.setCachedData(varArray, false);
                        ncFile.addVariable(null, vz);
                        zDims.put(name, ncDim);
                    }
                }
            }
        }
        zDims = null;
        for (GradsVariable var : vars) {
            String coords = "latitude longitude";
            int    nl     = var.getNumLevels();
            if (nl > 0) {
                if (nl == numZ) {
                    coords = "level " + coords;
                } else {
                    coords = Z_VAR + nl + " " + coords;
                }
            }
            coords = "time " + coords;
            if (gradsDDF.getEnsembleDimension() != null) {
                coords = "ensemble " + coords;
            }
            v = new Variable(ncFile, null, null, var.getName(),
                             DataType.FLOAT, coords);
            v.addAttribute(new Attribute("long_name", var.getDescription()));
            if (var.getUnitName() != null) {
                v.addAttribute(new Attribute("units", var.getUnitName()));
            }
View Full Code Here

Examples of urban.model.Variable

  @Test
  public void testVariable()  throws RecognitionException {
    String expected = "%var: \"foo\" A(),B()\n";
    UrbanParser parser = new UrbanParser(expected);
    Variable line = (Variable) parser.line();
    assertEquals(expected, line.toString())
  }
View Full Code Here

Examples of wyvern.tools.typedAST.core.expressions.Variable

    super(name, type);
  }

  public TypedAST getUse() {
    // throw new RuntimeException("this method should not be needed!!!");
    return new Variable(this, FileLocation.UNKNOWN); // FIXME: !!! Cannot replicate its use from outside!
  }
View Full Code Here

Examples of xbird.xquery.expr.var.Variable

            return clause;
        }

        @Override
        public XQExpression visit(VarRef ref, XQueryContext ctxt) throws XQueryException {
            final Variable var = ref.getValue();
            if(var instanceof BindingVariable) {
                if(!excludedVariableList.contains(var)) {
                    variablesHolder.add((BindingVariable) var);
                }
            }
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.