List of usage examples for org.apache.commons.lang Validate notNull
public static void notNull(Object object, String message)
Validate an argument, throwing IllegalArgumentException
if the argument is null
.
Validate.notNull(myObject, "The object must not be null");
From source file:com.opengamma.analytics.financial.interestrate.MultipleYieldCurveFinderFunction.java
public MultipleYieldCurveFinderFunction(final MultipleYieldCurveFinderDataBundle data, final InstrumentDerivativeVisitor<YieldCurveBundle, Double> calculator) { Validate.notNull(data, "data"); Validate.notNull(calculator, "calculator"); _calculator = calculator;//from w ww. ja va2s .c o m _data = data; _curveBuilderFunction = new InterpolatedYieldCurveBuildingFunction(data.getUnknownCurveNodePoints(), data.getUnknownCurveInterpolators()); }
From source file:com.evolveum.midpoint.repo.sql.query.RQueryImpl.java
public RQueryImpl(org.hibernate.Query query) { Validate.notNull(query, "Query must not be null."); this.query = query; }
From source file:com.opengamma.analytics.financial.var.parametric.DeltaGammaCovarianceMatrixFisherKurtosisCalculator.java
public DeltaGammaCovarianceMatrixFisherKurtosisCalculator(final MatrixAlgebra algebra) { Validate.notNull(algebra, "algebra"); _algebra = algebra;/*ww w . ja v a 2s .co m*/ _std = new DeltaGammaCovarianceMatrixStandardDeviationCalculator(algebra); }
From source file:com.opengamma.analytics.financial.interestrate.bond.calculator.CleanPriceFromYieldCalculator.java
@Override public Double visitBondFixedSecurity(final BondFixedSecurity bond, final Double yield) { Validate.notNull(bond, "bond"); Validate.notNull(yield, "yield"); return BondSecurityDiscountingMethod.getInstance().cleanPriceFromYield(bond, yield); }
From source file:com.opengamma.analytics.financial.interestrate.bond.calculator.DirtyPriceFromYieldCalculator.java
@Override public Double visitBondFixedSecurity(final BondFixedSecurity bond, final Double yield) { Validate.notNull(bond, "bond"); Validate.notNull(yield, "yield"); return BondSecurityDiscountingMethod.getInstance().dirtyPriceFromYield(bond, yield); }
From source file:com.opengamma.analytics.financial.pnl.SensitivityAndReturnDataBundle.java
public SensitivityAndReturnDataBundle(final Sensitivity<?> sensitivity, final double value, final Map<UnderlyingType, DoubleTimeSeries<?>> underlyingReturnTS) { Validate.notNull(sensitivity, "sensitivity"); Validate.notNull(underlyingReturnTS, "underlying returns"); Validate.notEmpty(underlyingReturnTS, "underlying returns"); Validate.noNullElements(underlyingReturnTS.keySet(), "underlying return key set"); Validate.noNullElements(underlyingReturnTS.values(), "underlying return values"); _underlyings = sensitivity.getUnderlyingTypes(); Validate.isTrue(_underlyings.size() == underlyingReturnTS.size()); Validate.isTrue(_underlyings.containsAll(underlyingReturnTS.keySet())); _sensitivity = sensitivity;//from w ww . j a v a2 s .c o m _value = value; _underlyingReturnTS = underlyingReturnTS; }
From source file:net.sbfmc.world.particle.ParticleSpawner.java
public static void spawnParticle(World world, Location location, Particle particle, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) { Validate.notNull(location, "Location cannot be null"); Validate.notNull(location.getWorld(), "World cannot be null"); String particleName = CraftParticle.getParticle(particle); StringBuilder particleFullName = new StringBuilder(); particleFullName.append(particleName); if (particle.hasID()) { particleFullName.append('_').append(id); }//from w ww. ja va2 s.com if (particle.hasData()) { particleFullName.append('_').append(data); } Packet63WorldParticles packet = new Packet63WorldParticles(); // "constuctor" GeneralUtils.setField(packet, "a", particleFullName.toString()); GeneralUtils.setField(packet, "b", (float) location.getX()); GeneralUtils.setField(packet, "c", (float) location.getY()); GeneralUtils.setField(packet, "d", (float) location.getZ()); GeneralUtils.setField(packet, "e", offsetX); GeneralUtils.setField(packet, "f", offsetY); GeneralUtils.setField(packet, "g", offsetZ); GeneralUtils.setField(packet, "h", speed); GeneralUtils.setField(packet, "i", particleCount); int distance; radius *= radius; for (Player player : world.getPlayers()) { if (((CraftPlayer) player).getHandle().playerConnection == null) { continue; } if (!location.getWorld().equals(player.getWorld())) { continue; } distance = (int) player.getLocation().distanceSquared(location); if (distance <= radius) { ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); } } }
From source file:com.edmunds.etm.rules.api.AlphabeticUrlRuleComparator.java
@Override public int compare(UrlRule rule1, UrlRule rule2) { Validate.notNull(rule1, "rule1 is null"); Validate.notNull(rule2, "rule2 is null"); return rule1.getRule().compareTo(rule2.getRule()); }
From source file:com.opengamma.analytics.financial.var.parametric.DeltaGammaCovarianceMatrixMeanCalculator.java
@Override public Double evaluate(final Map<Integer, ParametricVaRDataBundle> data) { Validate.notNull(data, "data"); final ParametricVaRDataBundle firstOrderData = data.get(1); Validate.notNull(firstOrderData, "first order data"); final ParametricVaRDataBundle secondOrderData = data.get(2); if (secondOrderData == null) { return 0.; }/*from w w w . j a va 2 s . com*/ final Matrix<?> gamma = secondOrderData.getSensitivities(); if (gamma == null || gamma.getNumberOfElements() == 0) { return 0.; } final DoubleMatrix2D covariance = firstOrderData.getCovarianceMatrix(); return 0.5 * _algebra.getTrace(_algebra.multiply(gamma, covariance)); }
From source file:me.st28.flexseries.flexcore.util.PlayerUtils.java
/** * @return the name for the given UUID in green if the player is offline or red if the player is offline. *///from w w w.j a v a2 s . c om public static String getColoredName(UUID uuid) { Validate.notNull(uuid, "UUID cannot be null."); String name = new PlayerProfile(uuid).getName(); return (Bukkit.getPlayer(uuid) != null ? ChatColor.GREEN : ChatColor.RED) + name; }