Scores the {@link PascalTemplate} using the fields it contains which are relevant to the score.
(Ignores location and date fields.)
@param temp the full {@link PascalTemplate} to be scored
@return the model's score
543827
public double computeProb(PascalTemplate temp) {
    double prob = 1.0;

    String wsname = temp.getValue("workshopname");
    String confname = temp.getValue("conferencename");
    String wsacronym = temp.getValue("workshopacronym");
    String confacronym = temp.getValue("conferenceacronym");
    String wsurl = temp.getValue("workshophomepage");
    String confurl = temp.getValue("conferencehomepage");
    return computeProb(wsname, wsacronym,confname,confacronym, wsurl, confurl);
  }
511871
public static PascalTemplate mergeCliqueTemplates(DateTemplate dt, String location, InfoTemplate wi) {
    PascalTemplate pt = new PascalTemplate();
    pt.setValue("workshopnotificationofacceptancedate", dt.noadate);
    pt.setValue("workshopcamerareadycopydate", dt.crcdate);
    pt.setValue("workshopdate", dt.workdate);
    pt.setValue("workshoppapersubmissiondate", dt.subdate);
    pt.setValue("workshoplocation", location);
    pt.setValue("workshopacronym", wi.wacronym);
    pt.setValue("workshophomepage", wi.whomepage);
    pt.setValue("workshopname", wi.wname);
    pt.setValue("conferenceacronym", wi.cacronym);
    pt.setValue("conferencehomepage", wi.chomepage);
    pt.setValue("conferencename", wi.cname);
    return pt;
  }
282523
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByScoreThenByItem() {
    final Ordering<Scored<T>> byItem = Scoreds.<T>ByItemOnly();
    final Ordering<Scored<T>> byScore = Scoreds.<T>ByScoreOnly();

    return Ordering.compound(ImmutableList.of(byScore, byItem));
  }
978600
public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, String template, List<?> args) {
        return dateTimeTemplate(cl, createTemplate(template), args);
    }
58794
@Override
    public TemporaryTopic createTemporaryTopic() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTemporaryTopic");

        TemporaryTopic temptopic = null;
        try {
            temptopic = jmsSession.createTemporaryTopic();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createTemporaryTopic", new Object[] { temptopic });
        }

        return temptopic;
    }
477650
public static Template<?> createTemplate(Context context, MethodTree decl) {
    MethodSymbol declSym = ASTHelpers.getSymbol(decl);
    ImmutableClassToInstanceMap<Annotation> annotations = UTemplater.annotationMap(declSym);
    ImmutableMap<String, VarSymbol> freeExpressionVars = freeExpressionVariables(decl);
    Context subContext = new SubContext(context);
    final UTemplater templater = new UTemplater(freeExpressionVars, subContext);
    ImmutableMap<String, UType> expressionVarTypes =
        ImmutableMap.copyOf(
            Maps.transformValues(
                freeExpressionVars, (VarSymbol sym) -> templater.template(sym.type)));

    UType genericType = templater.template(declSym.type);
    List<UTypeVar> typeParameters;
    UMethodType methodType;
    if (genericType instanceof UForAll) {
      UForAll forAllType = (UForAll) genericType;
      typeParameters = forAllType.getTypeVars();
      methodType = (UMethodType) forAllType.getQuantifiedType();
    } else if (genericType instanceof UMethodType) {
      typeParameters = ImmutableList.of();
      methodType = (UMethodType) genericType;
    } else {
      throw new IllegalArgumentException(
          "Expected genericType to be either a ForAll or a UMethodType, but was " + genericType);
    }

    List<? extends StatementTree> bodyStatements = decl.getBody().getStatements();
    if (bodyStatements.size() == 1
        && Iterables.getOnlyElement(bodyStatements).getKind() == Kind.RETURN
        && context.get(REQUIRE_BLOCK_KEY) == null) {
      ExpressionTree expression =
          ((ReturnTree) Iterables.getOnlyElement(bodyStatements)).getExpression();
      return ExpressionTemplate.create(
          annotations,
          typeParameters,
          expressionVarTypes,
          templater.template(expression),
          methodType.getReturnType());
    } else {
      List<UStatement> templateStatements = new ArrayList<>();
      for (StatementTree statement : bodyStatements) {
        templateStatements.add(templater.template(statement));
      }
      return BlockTemplate.create(
          annotations, typeParameters, expressionVarTypes, templateStatements);
    }
  }
106242
public QuatSymmetryScores getScores() {
		QuatSymmetryScores scores = new QuatSymmetryScores();

		int n = rotations.size()-1;

		if (n > 0) {
			double[] values = new double[n];

			// minRmsd
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getMinRmsd();
			}
			scores.setMinRmsd(minScores(values));

			// maxRmsd
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getMaxRmsd();
			}
			scores.setMaxRmsd(maxScores(values));

			// Rmsd
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getRmsd();
			}
			scores.setRmsd(averageScores(values));

			// minTm
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getMinTm();
			}
			scores.setMinTm(minScores(values));

			// maxTm
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getMaxTm();
			}
			scores.setMaxTm(maxScores(values));

			// Tm
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getTm();
			}
			scores.setTm(averageScores(values));

			// Rmsd subunit centers
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getRmsdCenters();
			}
			scores.setRmsdCenters(averageScores(values));
			// TmIntra
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getTmIntra();
			}
			scores.setTmIntra(averageScores(values));

			// RmsdIntra
			for (int i = 1; i < rotations.size(); i++) {
				values[i-1] = rotations.get(i).getScores().getRmsdIntra();
			}
			scores.setRmsdIntra(averageScores(values));

			// SymDeviation
			scores.setSymDeviation(symmetryDeviation);
		}
		return scores;
	}
1274069
private Object loadObjectFromTemporary(String fieldname, String complete) throws Exception {
        String realName = fieldname.substring(1);
        if (!temporaryFields.containsKey(realName)) {
            String message = String.format("The temporary field %s doesn't exist.", complete);
            throw new IllegalArgumentException(message);
        }
        return temporaryFields.get(realName);
    }
204390
@Override
    public int score(ODataRequestContext requestContext, QueryResult data) {
        if (data.getType() == QueryResult.ResultType.NOTHING || data.getType() != QueryResult.ResultType.EXCEPTION) {
            return DEFAULT_SCORE;
        }

        if (data.getData() instanceof ODataBatchException) {
            return MAXIMUM_FORMAT_SCORE;
        }

        List<MediaType> accept = requestContext.getRequest().getAccept();
        int batchAcceptScore = scoreByMediaType(accept, MediaType.MULTIPART);
        int contentTypeScore = scoreByContentType(requestContext, MULTIPART);
        int resultScore = max(batchAcceptScore, contentTypeScore);

        return resultScore > 0 ? (resultScore + ERROR_EXTRA_SCORE) : DEFAULT_SCORE;
    }
316331
protected BigDecimal getFinalAveragedScore(final long eventCount, final long total) {
        val score = BigDecimal.valueOf(eventCount)
            .divide(BigDecimal.valueOf(total), 2, RoundingMode.HALF_UP);
        return HIGHEST_RISK_SCORE.subtract(score);
    }
1303213
@Deprecated
    public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl,
                                                                         Template template, ImmutableList<?> args) {
        return new DateTemplate<T>(cl, template, args);
    }
265352
@Override
  public ScoreWeight processWidgetScore(Widget widget, ScoreComponentSettings paramSettings) {

    if (!Utils.isScoreEnabled(paramSettings)) {
      return null;
    }

    //1. Init scores
    ScoreWeight scoreWidget = initWidgetScore(paramSettings);

    if (null == widget) {
      scoreWidget.setScore(paramSettings.getCriteria().getNoWidgetFound());
      scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed);
      scoreWidget.setMessage(Constants.SCORE_ERROR_NO_WIDGET_FOUND);
      processWidgetScoreChildren(scoreWidget);
      return scoreWidget;
    }

    //Set Reference Id as Widget Id
    scoreWidget.setRefId(widget.getId());

    //2. Calculate scores for each child category
    try {
      calculateCategoryScores(widget, paramSettings, scoreWidget.getChildren());
    } catch (DataNotFoundException ex) {
      scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed);
      scoreWidget.setScore(paramSettings.getCriteria().getNoDataFound());
      scoreWidget.setMessage(ex.getMessage());
      processWidgetScoreChildren(scoreWidget);
      return scoreWidget;
    } catch (ThresholdException ex) {
      setThresholdFailureWeight(ex, scoreWidget);
      processWidgetScoreChildren(scoreWidget);
      return scoreWidget;
    }

    LOGGER.debug("scoreWidget {}", scoreWidget);
    LOGGER.debug("scoreWidget.getChildren {}", scoreWidget.getChildren());
    //3. Calculate widget score
    calculateWidgetScore(scoreWidget);
    return scoreWidget;
  }
803244
public static <D>
	ScoreAssociation<D> defaultScore( Class<D> tupleType ) {
		if( NccFeature.class.isAssignableFrom(tupleType) ) {
			return (ScoreAssociation)new ScoreAssociateNccFeature();
		} else if( TupleDesc_F64.class.isAssignableFrom(tupleType) ) {
			return (ScoreAssociation)new ScoreAssociateEuclideanSq_F64();
		} else if( tupleType == TupleDesc_F32.class ) {
			return (ScoreAssociation)new ScoreAssociateEuclideanSq_F32();
		} else if( tupleType == TupleDesc_U8.class ) {
			return (ScoreAssociation)new ScoreAssociateSad_U8();
		} else if( tupleType == TupleDesc_B.class  ) {
			return (ScoreAssociation)new ScoreAssociateHamming_B();
		} else {
			throw new IllegalArgumentException("Unknown tuple type: "+tupleType);
		}
	}
850159
static <T> List<Template> getTemplates(T objectType) {
        try {
            List<Template> templates = new ArrayList<>();
            TEMP_FINDER.findAnnotations(templates, objectType);
            return templates;
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }
533001
@Override
	public int[][][] getScoreMatrix() {
		boolean tempStoringScoreMatrix = storingScoreMatrix;
		if (scores == null) {
			storingScoreMatrix = true;
			align();
			if (scores == null) {
				return null;
			}
		}
		int[][][] copy = scores;
		if (tempStoringScoreMatrix) {
			copy = new int[scores.length][scores[0].length][];
			for (int i = 0; i < copy.length; i++) {
				for (int j = 0; j < copy[0].length; j++) {
					copy[i][j] = Arrays.copyOf(scores[i][j], scores[i][j].length);
				}
			}
		}
		setStoringScoreMatrix(tempStoringScoreMatrix);
		return copy;
	}
243321
@SuppressWarnings("ConstantConditions")  // Complains that the code is too complex. Well duh!
  public static double scoreTree0(byte[] tree, double[] row, boolean computeLeafAssignment) {
    ByteBufferWrapper ab = new ByteBufferWrapper(tree);
    GenmodelBitSet bs = null;  // Lazily set on hitting first group test
    long bitsRight = 0;
    int level = 0;
    while (true) {
      int nodeType = ab.get1U();
      int colId = ab.get2();
      if (colId == 65535) return ab.get4f();
      int naSplitDir = ab.get1U();
      boolean naVsRest = naSplitDir == NsdNaVsRest;
      boolean leftward = naSplitDir == NsdNaLeft || naSplitDir == NsdLeft;
      int lmask = (nodeType & 51);
      int equal = (nodeType & 12);  // Can be one of 0, 8, 12
      assert equal != 4;  // no longer supported

      float splitVal = -1;
      if (!naVsRest) {
        // Extract value or group to split on
        if (equal == 0) {
          // Standard float-compare test (either < or ==)
          splitVal = ab.get4f();  // Get the float to compare
        } else {
          // Bitset test
          if (bs == null) bs = new GenmodelBitSet(0);
          if (equal == 8)
            bs.fill2(tree, ab);
          else
            bs.fill3_1(tree, ab);
        }
      }

      double d = row[colId];
      if (Double.isNaN(d)? !leftward : !naVsRest && (equal == 0? d >= splitVal : bs.contains0((int)d))) {
        // go RIGHT
        switch (lmask) {
          case 0:  ab.skip(ab.get1U());  break;
          case 1:  ab.skip(ab.get2());  break;
          case 2:  ab.skip(ab.get3());  break;
          case 3:  ab.skip(ab.get4());  break;
          case 48: ab.skip(4);  break;  // skip the prediction
          default:
            assert false : "illegal lmask value " + lmask + " in tree " + Arrays.toString(tree);
        }
        if (computeLeafAssignment && level < 64) bitsRight |= 1 << level;
        lmask = (nodeType & 0xC0) >> 2;  // Replace leftmask with the rightmask
      } else {
        // go LEFT
        if (lmask <= 3)
          ab.skip(lmask + 1);
      }

      level++;
      if ((lmask & 16) != 0) {
        if (computeLeafAssignment) {
          bitsRight |= 1 << level;  // mark the end of the tree
          return Double.longBitsToDouble(bitsRight);
        } else {
          return ab.get4f();
        }
      }
    }
  }
268942
public String explainScore(StringWrapper s, StringWrapper t) 
	{
		StringBuffer buf = new StringBuffer();
		BagOfTokens sBag = asBagOfTokens(s);
		BagOfTokens tBag = asBagOfTokens(t);
		double sumOverI = 0;
		for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) {
	    Token tokenI = (Token)i.next();
			buf.append("token="+tokenI);
			double maxOverJ = -Double.MAX_VALUE;
			Token closestToI = null;
			for (Iterator j = tBag.tokenIterator(); j.hasNext(); ) {
				Token tokenJ = (Token)j.next();
				double scoreItoJ = tokenDistance.score( tokenI.getValue(), tokenJ.getValue() );
				buf.append(" dist("+tokenJ.getValue()+")="+scoreItoJ);
				if (scoreItoJ >= maxOverJ) {
					maxOverJ = scoreItoJ;
					closestToI = tokenJ;
				}
			}
			sumOverI += maxOverJ;
			buf.append(" match="+closestToI+" score="+maxOverJ+"\n");
		}
		buf.append("total: "+sumOverI+"/"+sBag.size()+" = "+score(s,t)+"\n");
		return buf.toString();
	}