API java : SetOfIntegerSyntax


javax.print.attribute
Class SetOfIntegerSyntax

java.lang.Object
  extended by javax.print.attribute.SetOfIntegerSyntax
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
CopiesSupported, JobImpressionsSupported, JobKOctetsSupported, JobMediaSheetsSupported, NumberUpSupported, PageRanges

public abstract class SetOfIntegerSyntax
extends Object
implements Serializable, Cloneable

Class SetOfIntegerSyntax is an abstract base class providing the common implementation of all attributes whose value is a set of nonnegative integers. This includes attributes whose value is a single range of integers and attributes whose value is a set of ranges of integers.

You can construct an instance of SetOfIntegerSyntax by giving it in "string form." The string consists of zero or more comma-separated integer groups. Each integer group consists of either one integer, two integers separated by a hyphen (-), or two integers separated by a colon (:). Each integer consists of one or more decimal digits (0 through 9). Whitespace characters cannot appear within an integer but are otherwise ignored. For example: "", "1", "5-10", "1:2, 4".

You can also construct an instance of SetOfIntegerSyntax by giving it in "array form." Array form consists of an array of zero or more integer groups where each integer group is a length-1 or length-2 array of ints; for example, int[0][], int[][]{{1}}, int[][]{{5,10}}, int[][]{{1,2},{4}}.

In both string form and array form, each successive integer group gives a range of integers to be included in the set. The first integer in each group gives the lower bound of the range; the second integer in each group gives the upper bound of the range; if there is only one integer in the group, the upper bound is the same as the lower bound. If the upper bound is less than the lower bound, it denotes a null range (no values). If the upper bound is equal to the lower bound, it denotes a range consisting of a single value. If the upper bound is greater than the lower bound, it denotes a range consisting of more than one value. The ranges may appear in any order and are allowed to overlap. The union of all the ranges gives the set's contents. Once a SetOfIntegerSyntax instance is constructed, its value is immutable.

The SetOfIntegerSyntax object's value is actually stored in "canonical array form." This is the same as array form, except there are no null ranges; the members of the set are represented in as few ranges as possible (i.e., overlapping ranges are coalesced); the ranges appear in ascending order; and each range is always represented as a length-two array of ints in the form {lower bound, upper bound}. An empty set is represented as a zero-length array.

Class SetOfIntegerSyntax has operations to return the set's members in canonical array form, to test whether a given integer is a member of the set, and to iterate through the members of the set.

See Also:
Serialized Form

Constructor Summary
protected SetOfIntegerSyntax(int member)
          Construct a new set-of-integer attribute containing a single integer.
protected SetOfIntegerSyntax(int[][] members)
          Construct a new set-of-integer attribute with the given members in array form.
protected SetOfIntegerSyntax(int lowerBound, int upperBound)
          Construct a new set-of-integer attribute containing a single range of integers.
protected SetOfIntegerSyntax(String members)
          Construct a new set-of-integer attribute with the given members in string form.
 
Method Summary
 boolean contains(int x)
          Determine if this set-of-integer attribute contains the given value.
 boolean contains(IntegerSyntax attribute)
          Determine if this set-of-integer attribute contains the given integer attribute's value.
 boolean equals(Object object)
          Returns whether this set-of-integer attribute is equivalent to the passed in object.
 int[][] getMembers()
          Obtain this set-of-integer attribute's members in canonical array form.
 int hashCode()
          Returns a hash code value for this set-of-integer attribute.
 int next(int x)
          Determine the smallest integer in this set-of-integer attribute that is greater than the given value.
 String toString()
          Returns a string value corresponding to this set-of-integer attribute.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetOfIntegerSyntax

protected SetOfIntegerSyntax(String members)
Construct a new set-of-integer attribute with the given members in string form.

Parameters:
members - Set members in string form. If null, an empty set is constructed.
Throws:
IllegalArgumentException - (Unchecked exception) Thrown if members does not obey the proper syntax.

SetOfIntegerSyntax

protected SetOfIntegerSyntax(int[][] members)
Construct a new set-of-integer attribute with the given members in array form.

Parameters:
members - Set members in array form. If null, an empty set is constructed.
Throws:
NullPointerException - (Unchecked exception) Thrown if any element of members is null.
IllegalArgumentException - (Unchecked exception) Thrown if any element of members is not a length-one or length-two array or if any non-null range in members has a lower bound less than zero.

SetOfIntegerSyntax

protected SetOfIntegerSyntax(int member)
Construct a new set-of-integer attribute containing a single integer.

Parameters:
member - Set member.
Throws:
IllegalArgumentException - (Unchecked exception) Thrown if member is less than zero.

SetOfIntegerSyntax

protected SetOfIntegerSyntax(int lowerBound,
                             int upperBound)
Construct a new set-of-integer attribute containing a single range of integers. If the lower bound is greater than the upper bound (a null range), an empty set is constructed.

Parameters:
lowerBound - Lower bound of the range.
upperBound - Upper bound of the range.
Throws:
IllegalArgumentException - (Unchecked exception) Thrown if the range is non-null and lowerBound is less than zero.
Method Detail

getMembers

public int[][] getMembers()
Obtain this set-of-integer attribute's members in canonical array form. The returned array is "safe;" the client may alter it without affecting this set-of-integer attribute.

Returns:
This set-of-integer attribute's members in canonical array form.

contains

public boolean contains(int x)
Determine if this set-of-integer attribute contains the given value.

Parameters:
x - Integer value.
Returns:
True if this set-of-integer attribute contains the value x, false otherwise.

contains

public boolean contains(IntegerSyntax attribute)
Determine if this set-of-integer attribute contains the given integer attribute's value.

Parameters:
attribute - Integer attribute.
Returns:
True if this set-of-integer attribute contains theAttribute's value, false otherwise.

next

public int next(int x)
Determine the smallest integer in this set-of-integer attribute that is greater than the given value. If there are no integers in this set-of-integer attribute greater than the given value, -1 is returned. (Since a set-of-integer attribute can only contain nonnegative values, -1 will never appear in the set.) You can use the next() method to iterate through the integer values in a set-of-integer attribute in ascending order, like this:
  1. SetOfIntegerSyntax attribute = . . .;
  2. int i = -1;
  3. while ((i = attribute.next (i)) != -1)
  4. {
  5. foo (i);
  6. }

Parameters:
x - Integer value.
Returns:
The smallest integer in this set-of-integer attribute that is greater than x, or -1 if no integer in this set-of-integer attribute is greater than x.

equals

public boolean equals(Object object)
Returns whether this set-of-integer attribute is equivalent to the passed in object. To be equivalent, all of the following conditions must be true:
  1. object is not null.
  2. object is an instance of class SetOfIntegerSyntax.
  3. This set-of-integer attribute's members and object's members are the same.

Overrides:
equals in class Object
Parameters:
object - Object to compare to.
Returns:
True if object is equivalent to this set-of-integer attribute, false otherwise.
See Also:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
Returns a hash code value for this set-of-integer attribute. The hash code is the sum of the lower and upper bounds of the ranges in the canonical array form, or 0 for an empty set.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

toString

public String toString()
Returns a string value corresponding to this set-of-integer attribute. The string value is a zero-length string if this set is empty. Otherwise, the string value is a comma-separated list of the ranges in the canonical array form, where each range is represented as "i" if the lower bound equals the upper bound or "i-j" otherwise.

Overrides:
toString in class Object
Returns:
a string representation of the object.

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

7 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-3093
Document créé le 01/09/06 01:45, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/print/attribute/SetOfIntegerSyntax.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,45 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
J'ai commis bon nombre d'erreurs mais je n'ai aucun regret. Parfois c'est le seul moyen d'apprendre.

Nick Nolte
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 01:59, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)