public Leg(Voyage voyage, Location loadLocation, Location unloadLocation, Date loadTime, Date unloadTime) { Validate.noNullElements(new Object[] {voyage, loadLocation, unloadLocation, loadTime, unloadTime}); this.voyage = voyage; this.loadLocation = loadLocation; this.unloadLocation = unloadLocation; this.loadTime = loadTime; this.unloadTime = unloadTime; }
/** * Constructor. * * @param departureLocation location of departure * @param arrivalLocation location of arrival * @param departureTime time of departure * @param arrivalTime time of arrival */ // TODO make package local public CarrierMovement(Location departureLocation, Location arrivalLocation, Date departureTime, Date arrivalTime) { Validate.noNullElements(new Object[]{departureLocation, arrivalLocation, departureTime, arrivalTime}); this.departureTime = departureTime; this.arrivalTime = arrivalTime; this.departureLocation = departureLocation; this.arrivalLocation = arrivalLocation; }
/** * Constructor. * * @param legs List of legs for this itinerary. */ public Itinerary(final List<Leg> legs) { Validate.notEmpty(legs); Validate.noNullElements(legs); this.legs = legs; }
Schedule(final List<CarrierMovement> carrierMovements) { Validate.notNull(carrierMovements); Validate.noNullElements(carrierMovements); Validate.notEmpty(carrierMovements); this.carrierMovements = carrierMovements; }
public EntityDamageEvent(final Entity damagee, final DamageCause cause, final Map<DamageModifier, Double> modifiers, final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) { super(damagee); Validate.isTrue(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing"); Validate.isTrue(!modifiers.containsKey(null), "Cannot have null DamageModifier"); Validate.noNullElements(modifiers.values(), "Cannot have null modifier values"); Validate.isTrue(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier"); Validate.noNullElements(modifierFunctions.values(), "Cannot have null modifier function"); this.originals = new EnumMap<DamageModifier, Double>(modifiers); this.cause = cause; this.modifiers = modifiers; this.modifierFunctions = modifierFunctions; }
/** * Creates a new color with its RGB components changed as if it was dyed * with the colors passed in, replicating vanilla workbench dyeing * * @param colors The DyeColors to dye with * @return A new color with the changed rgb components */ // TODO: Javadoc what this method does, not what it mimics. API != Implementation public Color mixDyes(DyeColor... colors) { Validate.noNullElements(colors, "Colors cannot be null"); Color[] toPass = new Color[colors.length]; for (int i = 0; i < colors.length; i++) { toPass[i] = colors[i].getColor(); } return mixColors(toPass); }
/** * Creates a new color with its RGB components changed as if it was dyed * with the colors passed in, replicating vanilla workbench dyeing * * @param colors The colors to dye with * @return A new color with the changed rgb components */ // TODO: Javadoc what this method does, not what it mimics. API != Implementation public Color mixColors(Color... colors) { Validate.noNullElements(colors, "Colors cannot be null"); int totalRed = this.getRed(); int totalGreen = this.getGreen(); int totalBlue = this.getBlue(); int totalMax = Math.max(Math.max(totalRed, totalGreen), totalBlue); for (Color color : colors) { totalRed += color.getRed(); totalGreen += color.getGreen(); totalBlue += color.getBlue(); totalMax += Math.max(Math.max(color.getRed(), color.getGreen()), color.getBlue()); } float averageRed = totalRed / (colors.length + 1); float averageGreen = totalGreen / (colors.length + 1); float averageBlue = totalBlue / (colors.length + 1); float averageMax = totalMax / (colors.length + 1); float maximumOfAverages = Math.max(Math.max(averageRed, averageGreen), averageBlue); float gainFactor = averageMax / maximumOfAverages; return Color.fromRGB((int) (averageRed * gainFactor), (int) (averageGreen * gainFactor), (int) (averageBlue * gainFactor)); }
private void noNullElements(Object... elements) { Validate.noNullElements(elements); }
public AbstractSampleGroupAnnotatedObject( ParameterlessAnnotatedObject<? extends JAXBElement<? extends PresentationDirectiveType>>... annotatedObjects) { Validate.noNullElements(annotatedObjects); this.annotatedObjects = annotatedObjects; }
@Override public void checkKeyValue(String key, String[] value) { Validate.notNull(key, "name can not be null"); Validate.noNullElements( value, "values can not be null or contain null elements"); } });
@Override public void checkKeyValue(String key, String[] value) { Validate.notNull(key, "name can not be null"); Validate.noNullElements( value, "values can not be null or contain null elements"); } });
public void removeCells(List/*TableCell*/ cells) { Validate.notNull(cells, "The cells must be not null"); Validate.noNullElements(cells, "The cells must not contain null elements"); for(Iterator it = cells.iterator();it.hasNext();) { TableCell cell = (TableCell)it.next(); removeCell(cell); } }
public void addCells(List/*TableCell*/ cells) { Validate.notNull(cells, "The cells must be not null"); Validate.noNullElements(cells, "The cells must not contain null elements"); for(Iterator it = cells.iterator();it.hasNext();) { TableCell cell = (TableCell)it.next(); addCell(cell); } }
/** * Removes any existing path elements and sets the provided elements as the path * * @param elements Path elements to set * @return this */ public UrlStringBuilder setPath(String... elements) { Validate.noNullElements(elements, "elements cannot be null"); this.path.clear(); this.addPath(elements); return this; }
/** * Removes any existing path elements and sets the provided elements as the path * * @param elements Path elements to set * @return this */ public UrlStringBuilder setPath(String... elements) { Validate.noNullElements(elements, "elements cannot be null"); this.path.clear(); this.addPath(elements); return this; }
public EntityDamageEvent(final Entity damagee, final DamageCause cause, final Map<DamageModifier, Double> modifiers, final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) { super(damagee); Validate.isTrue(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing"); Validate.isTrue(!modifiers.containsKey(null), "Cannot have null DamageModifier"); Validate.noNullElements(modifiers.values(), "Cannot have null modifier values"); Validate.isTrue(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier"); Validate.noNullElements(modifierFunctions.values(), "Cannot have null modifier function"); this.originals = new EnumMap<DamageModifier, Double>(modifiers); this.cause = cause; this.modifiers = modifiers; this.modifierFunctions = modifierFunctions; }
public void load(Document[] views) { Validate.noNullElements(views); lookupReferenceTable = new HashMap(); for (int i = 0; i < views.length; i++) { Element root = views[i].getRootElement(); List entityViews = root.getChildren("obj-entity-view"); for (Iterator j = entityViews.iterator(); j.hasNext();) { Element entityViewElement = (Element) j.next(); loadEntityView(entityViewElement); } } resolveLookupReferences(); lookupReferenceTable = null; }
public void load(InputStream[] xmlSources) throws IOException { Validate.noNullElements(xmlSources); SAXBuilder builder = new SAXBuilder(); Document[] documents = new Document[xmlSources.length]; for (int i = 0; i < xmlSources.length; i++) { try { documents[i] = builder.build(xmlSources[i]); } catch (JDOMException ex) { ex.printStackTrace(); } } load(documents); }
public void load(URL[] xmlSources) throws IOException { Validate.noNullElements(xmlSources); SAXBuilder builder = new SAXBuilder(); Document[] documents = new Document[xmlSources.length]; for (int i = 0; i < xmlSources.length; i++) { try { documents[i] = builder.build(xmlSources[i]); } catch (JDOMException ex) { ex.printStackTrace(); } } load(documents); }
public void pushAll(final Collection<Record> rs) { Validate.notNull(rs); Validate.noNullElements(rs); this.doPushAll(rs); this.statPush(rs.size(), this.getByteSize(rs)); }