diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..80d241e1d1a7d300a1f1fec955b5309592156f80 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/LICENSE.fr b/LICENSE.fr new file mode 100644 index 0000000000000000000000000000000000000000..30954b89a5e4587e20571df95cbf66eb796a9812 --- /dev/null +++ b/LICENSE.fr @@ -0,0 +1,146 @@ +Licence Publique Générale GNU +Benjamin Drieu, APRIL (bdrieu@april.org), Mélanie Clément-Fontaine (melanie@amberlab.net), Arnaud Fontaine (arnaud@crao.net), Loïc Dachary (loic@gnu.org), Frédéric Couchet (fcouchet@fsffrance.org). + + +This is an unofficial translation of the GNU General Public License into French. It was not published by the Free Software Foundation, and does not legally state the distribution terms for software that uses the GNU GPL--only the original English text of the GNU GPL does that. However, we hope that this translation will help French speakers understand the GNU GPL better. + +Ceci est une traduction non officielle de la GNU General Public License en français. Elle n'a pas été publiée par la Free Software Foundation, et ne détermine pas les termes de distribution pour les logiciels qui utilisent la GNU GPL, seul le texte anglais original de la GNU GPL déterminent ces termes. Cependant, nous espérons que cette traduction aidera les francophones à mieux comprendre la GNU GPL. + +Licence Publique Générale GNU +Les licences de la plupart des logiciels sont conçues pour vous enlever toute liberté de les partager et de les modifier. + +A contrario, la Licence Publique Générale est destinée à garantir votre liberté de partager et de modifier les logiciels libres, et à assurer que ces logiciels soient libres pour tous leurs utilisateurs. + +La présente Licence Publique Générale s'applique à la plupart des logiciels de la Free Software Foundation, ainsi qu'à tout autre programme pour lequel ses auteurs s'engagent à l'utiliser. + +(Certains autres logiciels de la Free Software Foundation sont couverts par la GNU Lesser General Public License à la place.) + +Vous pouvez aussi l'appliquer aux programmes qui sont les vôtres. + +Quand nous parlons de logiciels libres, nous parlons de liberté, non de prix. + +Nos licences publiques générales sont conçues pour vous donner l'assurance d'être libres de distribuer des copies des logiciels libres (et de facturer ce service, si vous le souhaitez), de recevoir le code source ou de pouvoir l'obtenir si vous le souhaitez, de pouvoir modifier les logiciels ou en utiliser des éléments dans de nouveaux programmes libres et de savoir que vous pouvez le faire. + +Pour protéger vos droits, il nous est nécessaire d'imposer des limitations qui interdisent à quiconque de vous refuser ces droits ou de vous demander d'y renoncer. + +Certaines responsabilités vous incombent en raison de ces limitations si vous distribuez des copies de ces logiciels, ou si vous les modifiez. + +Par exemple, si vous distribuez des copies d'un tel programme, à titre gratuit ou contre une rémunération, vous devez accorder aux destinataires tous les droits dont vous disposez. + +Vous devez vous assurer qu'eux aussi reçoivent ou puissent disposer du code source. + +Et vous devez leur montrer les présentes conditions afin qu'ils aient connaissance de leurs droits. + +Nous protégeons vos droits en deux étapes : (1) nous sommes titulaires des droits d'auteur du logiciel, et (2) nous vous délivrons cette licence, qui vous donne l'autorisation légale de copier, distribuer et/ou modifier le logiciel. + +En outre, pour la protection de chaque auteur ainsi que la nôtre, nous voulons nous assurer que chacun comprenne que ce logiciel libre ne fait l'objet d'aucune garantie. + +Si le logiciel est modifié par quelqu'un d'autre puis transmis à des tiers, nous voulons que les destinataires soient mis au courant que ce qu'ils ont reçu n'est pas le logiciel d'origine, de sorte que tout problème introduit par d'autres ne puisse entacher la réputation de l'auteur originel. + +En définitive, un programme libre restera à la merci des brevets de logiciels. + +Nous souhaitons éviter le risque que les redistributeurs d'un programme libre fassent des demandes individuelles de licence de brevet, ceci ayant pour effet de rendre le programme propriétaire. + +Pour éviter cela, nous établissons clairement que toute licence de brevet doit être concédée de façon à ce que l'usage en soit libre pour tous ou bien qu'aucune licence ne soit concédée. + +Les termes exacts et les conditions de copie, distribution et modification sont les suivants: + +Conditions de copie, distribution et modification de la Licence Publique Générale GNU. +0. La présente Licence s'applique à tout programme ou tout autre ouvrage contenant un avis, apposé par le titulaire des droits d'auteur, stipulant qu'il peut être distribué au titre des conditions de la présente Licence Publique Générale. + +Ci-après, le "Programme" désigne l'un quelconque de ces programmes ou ouvrages, et un "ouvrage fondé sur le Programme" désigne soit le Programme, soit un ouvrage qui en dérive au titre des lois sur le droit d'auteur : en d'autres termes, un ouvrage contenant le Programme ou une partie de ce dernier, soit à l'identique, soit avec des modifications et/ou traduit dans un autre langage. + +(Ci-après, le terme "modification" implique, sans s'y réduire, le terme traduction) + +Chaque concessionaire sera désigné par "vous". + +Les activités autres que la copie, la distribution et la modification ne sont pas couvertes par la présente Licence ; elles sont hors de son champ d'application. + +L'opération consistant à exécuter le Programme n'est soumise à aucune limitation et les sorties du programme ne sont couvertes que si leur contenu constitue un ouvrage fondé sur le Programme (indépendamment du fait qu'il ait été réalisé par l'exécution du Programme). + +La validité de ce qui précède dépend de ce que fait le Programme. + +1. Vous pouvez copier et distribuer des copies à l'identique du code source du Programme tel que vous l'avez reçu, sur n'importe quel support, du moment que vous apposiez sur chaque copie, de manière ad hoc et parfaitement visible, l'avis de droit d'auteur adéquat et une exonération de garantie ; que vous gardiez intacts tous les avis faisant référence à la présente Licence et à l'absence de toute garantie ; et que vous fournissiez à tout destinataire du Programme autre que vous-même un exemplaire de la présente Licence en même temps que le Programme. + +Vous pouvez faire payer l'acte physique de transmission d'une copie, et vous pouvez, à votre discrétion, proposer une garantie contre rémunération. + +2. Vous pouvez modifier votre copie ou des copies du Programme ou n'importe quelle partie de celui-ci, créant ainsi un ouvrage fondé sur le Programme, et copier et distribuer de telles modifications ou ouvrage selon les termes de l'Article 1 ci-dessus, à condition de vous conformer également à chacune des obligations suivantes : + +a) Vous devez munir les fichiers modifiés d'avis bien visibles stipulants que vous avez modifié ces fichiers, ainsi que la date de chaque modification ; + +b) Vous devez prendre les dispositions nécessaires pour que tout ouvrage que vous distribuez ou publiez, et qui, en totalité ou en partie, contient ou est fondé sur le Programme - ou une partie quelconque de ce dernier - soit concédé comme un tout, à titre gratuit, à n'importe quel tiers, au titre des conditions de la présente Licence. + +c) Si le programme modifié lit habituellement des instructions de façon interactive lorsqu'on l'exécute, vous devez, quand il commence son exécution pour ladite utilisation interactive de la manière la plus usuelle, faire en sorte qu'il imprime ou affiche une annonce comprenant un avis de droit d'auteur ad hoc, et un avis stipulant qu'il n'y a pas de garantie (ou bien indiquant que c'est vous qui fournissez la garantie), et que les utilisateurs peuvent redistribuer le programme en respectant les présentes obligations, et expliquant à l'utilisateur comment voir une copie de la présente Licence. + +(Exception : si le Programme est lui-même interactif mais n'imprime pas habituellement une telle annonce, votre ouvrage fondé sur le Programme n'est pas obligé d'imprimer une annonce). + +Ces obligations s'appliquent à l'ouvrage modifié pris comme un tout. + +Si des éléments identifiables de cet ouvrage ne sont pas fondés sur le Programme et peuvent raisonnablement être considérés comme des ouvrages indépendants distincts en eux mêmes, alors la présente Licence et ses conditions ne s'appliquent pas à ces éléments lorsque vous les distribuez en tant qu'ouvrages distincts. + +Mais lorsque vous distribuez ces mêmes éléments comme partie d'un tout, lequel constitue un ouvrage fondé sur le Programme, la distribution de ce tout doit être soumise aux conditions de la présente Licence, et les autorisations qu'elle octroie aux autres concessionnaires s'étendent à l'ensemble de l'ouvrage et par conséquent à chaque et toute partie indifférement de qui l'a écrite. + +Par conséquent, l'objet du présent article n'est pas de revendiquer des droits ou de contester vos droits sur un ouvrage entièrement écrit par vous; son objet est plutôt d'exercer le droit de contrôler la distribution d'ouvrages dérivés ou d'ouvrages collectifs fondés sur le Programme. + +De plus, la simple proximité du Programme avec un autre ouvrage qui n'est pas fondé sur le Programme (ou un ouvrage fondé sur le Programme) sur une partition d'un espace de stockage ou un support de distribution ne place pas cet autre ouvrage dans le champ d'application de la présente Licence. + +3. Vous pouvez copier et distribuer le Programme (ou un ouvrage fondé sur lui, selon l'Article 2) sous forme de code objet ou d'exécutable, selon les termes des Articles 1 et 2 ci-dessus, à condition que vous accomplissiez l'un des points suivants : + +a) L'accompagner de l'intégralité du code source correspondant, sous une forme lisible par un ordinateur, lequel doit être distribué au titre des termes des Articles 1 et 2 ci-dessus, sur un support habituellement utilisé pour l'échange de logiciels; ou, + +b) L'accompagner d'une proposition écrite, valable pendant au moins trois ans, de fournir à tout tiers, à un tarif qui ne soit pas supérieur à ce que vous coûte l'acte physique de réaliser une distribution source, une copie intégrale du code source correspondant sous une forme lisible par un ordinateur, qui sera distribuée au titre des termes des Articles 1 et 2 ci-dessus, sur un support habituellement utilisé pour l'échange de logiciels; ou, + +c) L'accompagner des informations reçues par vous concernant la proposition de distribution du code source correspondant. (Cette solution n'est autorisée que dans le cas d'une distribution non commerciale et seulement si vous avez reçu le programme sous forme de code objet ou d'exécutable accompagné d'une telle proposition - en conformité avec le sous-Article b ci-dessus.) + +Le code source d'un ouvrage désigne la forme favorite pour travailler à des modifications de cet ouvrage. Pour un ouvrage exécutable, le code source intégral désigne la totalité du code source de la totalité des modules qu'il contient, ainsi que les éventuels fichiers de définition des interfaces qui y sont associés, ainsi que les scripts utilisés pour contrôler la compilation et l'installation de l'exécutable. Cependant, par exception spéciale, le code source distribué n'est pas censé inclure quoi que ce soit de normalement distribué (que ce soit sous forme source ou binaire) avec les composants principaux (compilateur, noyau, et autre) du système d'exploitation sur lequel l'exécutable tourne, à moins que ce composant lui-même n'accompagne l'exécutable. + +Si distribuer un exécutable ou un code objet consiste à offrir un accès permettant leur copie depuis un endroit particulier, alors l'offre d'un accès équivalent pour copier le code source depuis le même endroit compte comme une distribution du code source - même si les tiers ne sont pas contraints de copier le source en même temps que le code objet. + +4. Vous ne pouvez copier, modifier, concéder en sous-licence, ou distribuer le Programme, sauf tel qu'expressément prévu par la présente Licence. Toute tentative de copier, modifier, concéder en sous-licence, ou distribuer le Programme d'une autre manière est réputée non valable, et met immédiatement fin à vos droits au titre de la présente Licence. Toutefois, les tiers ayant reçu de vous des copies, ou des droits, au titre de la présente Licence ne verront pas leurs autorisations résiliées aussi longtemps que ledits tiers se conforment pleinement à elle. + +5. Vous n'êtes pas obligé d'accepter la présente Licence étant donné que vous ne l'avez pas signée. Cependant, rien d'autre ne vous accorde l'autorisation de modifier ou distribuer le Programme ou les ouvrages fondés sur lui. Ces actions sont interdites par la loi si vous n'acceptez pas la présente Licence. En conséquence, en modifiant ou distribuant le Programme (ou un ouvrage quelconque fondé sur le Programme), vous signifiez votre acceptation de la présente Licence en le faisant, et de toutes ses conditions concernant la copie, la distribution ou la modification du Programme ou d'ouvrages fondés sur lui. + +6. Chaque fois que vous redistribuez le Programme (ou n'importe quel ouvrage fondé sur le Programme), une licence est automatiquement concédée au destinataire par le concédant originel de la licence, l'autorisant à copier, distribuer ou modifier le Programme, sous réserve des présentes conditions. Vous ne pouvez imposer une quelconque limitation supplémentaire à l'exercice des droits octroyés au titre des présentes par le destinataire. Vous n'avez pas la responsabilité d'imposer le respect de la présente Licence à des tiers. + +7. Si, conséquement à une décision de justice ou l'allégation d'une transgression de brevet ou pour toute autre raison (non limitée à un probleme de brevet), des obligations vous sont imposées (que ce soit par jugement, conciliation ou autre) qui contredisent les conditions de la présente Licence, elles ne vous excusent pas des conditions de la présente Licence. Si vous ne pouvez distribuer de manière à satisfaire simultanément vos obligations au titre de la présente Licence et toute autre obligation pertinente, alors il en découle que vous ne pouvez pas du tout distribuer le Programme. Par exemple, si une licence de brevet ne permettait pas une redistribution sans redevance du Programme par tous ceux qui reçoivent une copie directement ou indirectement par votre intermédiaire, alors la seule façon pour vous de satisfaire à la fois à la licence du brevet et à la présente Licence serait de vous abstenir totalement de toute distribution du Programme. + +Si une partie quelconque de cet article est tenue pour nulle ou inopposable dans une circonstance particulière quelconque, l'intention est que le reste de l'article s'applique. La totalité de la section s'appliquera dans toutes les autres circonstances. + +Cet article n'a pas pour but de vous induire à transgresser un quelconque brevet ou d'autres revendications à un droit de propriété ou à contester la validité de la moindre de ces revendications ; cet article a pour seul objectif de protéger l'intégrité du système de distribution du logiciel libre, qui est mis en oeuvre par la pratique des licenses publiques. De nombreuses personnes ont fait de généreuses contributions au large spectre de logiciels distribués par ce système en se fiant à l'application cohérente de ce système ; il appartient à chaque auteur/donateur de décider si il ou elle veut distribuer du logiciel par l'intermédiaire d'un quelconque autre système et un concessionaire ne peut imposer ce choix. + +Cet article a pour but de rendre totalement limpide ce que l'on pense être une conséquence du reste de la présente Licence. + +8. Si la distribution et/ou l'utilisation du Programme est limitée dans certains pays que ce soit par des brevets ou par des interfaces soumises au droit d'auteur, le titulaire originel des droits d'auteur qui décide de couvrir le Programme par la présente Licence peut ajouter une limitation géographique de distribution explicite qui exclue ces pays afin que la distribution soit permise seulement dans ou entre les pays qui ne sont pas ainsi exclus. Dans ce cas, la présente Licence incorpore la limitation comme si elle était écrite dans le corps de la présente Licence. + +9. La Free Software Foundation peut, de temps à autre, publier des versions révisées et/ou nouvelles de la Licence Publique Générale. De telles nouvelles versions seront similaires à la présente version dans l'esprit mais pourront différer dans le détail pour prendre en compte de nouvelles problématiques ou inquiétudes. + +Chaque version possède un numéro de version la distinguant. Si le Programme précise le numéro de version de la présente Licence qui s'y applique et "une version ultérieure quelconque", vous avez le choix de suivre les conditions de la présente version ou de toute autre version ultérieure publiée par la Free Software Foundation. Si le Programme ne spécifie aucun numéro de version de la présente Licence, vous pouvez choisir une version quelconque publiée par la Free Software Foundation à quelque moment que ce soit. + +10. Si vous souhaitez incorporer des parties du Programme dans d'autres programmes libres dont les conditions de distribution sont différentes, écrivez à l'auteur pour lui en demander l'autorisation. Pour les logiciels dont la Free Software Foundation est titulaire des droits d'auteur, écrivez à la Free Software Foundation ; nous faisons parfois des exceptions dans ce sens. Notre décision sera guidée par le double objectif de préserver le statut libre de tous les dérivés de nos logiciels libres et de promouvoir le partage et la réutilisation des logiciels en général. + +ABSENCE DE GARANTIE +11. COMME LA LICENCE DU PROGRAMME EST CONCEDEE A TITRE GRATUIT, AUCUNE GARANTIE NE S'APPLIQUE AU PROGRAMME, DANS LES LIMITES AUTORISEES PAR LA LOI APPLICABLE. SAUF MENTION CONTRAIRE ECRITE, LES TITULAIRES DU DROIT D'AUTEUR ET/OU LES AUTRES PARTIES FOURNISSENT LE PROGRAMME "EN L'ETAT", SANS AUCUNE GARANTIE DE QUELQUE NATURE QUE CE SOIT, EXPRESSE OU IMPLICITE, Y COMPRIS, MAIS SANS Y ETRE LIMITE, LES GARANTIES IMPLICITES DE COMMERCIABILITE ET DE LA CONFORMITE A UNE UTILISATION PARTICULIERE. VOUS ASSUMEZ LA TOTALITE DES RISQUES LIES A LA QUALITE ET AUX PERFORMANCES DU PROGRAMME. SI LE PROGRAMME SE REVELAIT DEFECTUEUX, LE COUT DE L'ENTRETIEN, DES REPARATIONS OU DES CORRECTIONS NECESSAIRES VOUS INCOMBENT INTEGRALEMENT. + +12. EN AUCUN CAS, SAUF LORSQUE LA LOI APPLICABLE OU UNE CONVENTION ECRITE L'EXIGE, UN TITULAIRE DE DROIT D'AUTEUR QUEL QU'IL SOIT, OU TOUTE PARTIE QUI POURRAIT MODIFIER ET/OU REDISTRIBUER LE PROGRAMME COMME PERMIS CI-DESSUS, NE POURRAIT ETRE TENU POUR RESPONSABLE A VOTRE EGARD DES DOMMAGES, INCLUANT LES DOMMAGES GENERIQUES, SPECIFIQUES, SECONDAIRES OU CONSECUTIFS, RESULTANT DE L'UTILISATION OU DE L'INCAPACITE D'UTILISER LE PROGRAMME (Y COMPRIS, MAIS SANS Y ETRE LIMITE, LA PERTE DE DONNEES, OU LE FAIT QUE DES DONNEES SOIENT RENDUES IMPRECISES, OU LES PERTES EPROUVEES PAR VOUS OU PAR DES TIERS, OU LE FAIT QUE LE PROGRAMME ECHOUE A INTEROPERER AVEC UN AUTRE PROGRAMME QUEL QU'IL SOIT) MEME SI LE DIT TITULAIRE DU DROIT D'AUTEUR OU LE PARTIE CONCERNEE A ETE AVERTI DE L'EVENTUALITE DE TELS DOMMAGES. + +FIN DES CONDITIONS +Comment appliquer ces conditions à vos nouveaux programmes +Si vous développez un nouveau programme, et si vous voulez qu'il soit de la plus grande utilité possible pour le public, le meilleur moyen d'y parvenir est d'en faire un logiciel libre que chacun peut redistribuer et modifier au titre des présentes conditions. + +Pour ce faire, munissez le programme des avis qui suivent. Le plus sûr est de les ajouter au début de chaque fichier source pour véhiculer le plus efficacement possible l'absence de toute garantie ; chaque fichier devrait aussi contenir au moins la ligne "copyright" et une indication de l'endroit où se trouve l'avis complet. + +[Une ligne donnant le nom du programme et une courte idée de ce qu'il fait.] Copyright (C) [année] [nom de l'auteur] Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier au titre des clauses de la Licence Publique Générale GNU, telle que publiée par la Free Software Foundation ; soit la version 2 de la Licence, ou (à votre discrétion) une version ultérieure quelconque. Ce programme est distribué dans l'espoir qu'il sera utile, mais SANS AUCUNE GARANTIE ; sans même une garantie implicite de COMMERCIABILITE ou DE CONFORMITE A UNE UTILISATION PARTICULIERE. Voir la Licence Publique Générale GNU pour plus de détails. Vous devriez avoir reçu un exemplaire de la Licence Publique Générale GNU avec ce programme ; si ce n'est pas le cas, écrivez à la Free Software Foundation Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Ajoutez aussi des informations sur la manière de vous contacter par courrier électronique et courrier postal. + +Si le programme est interactif, faites en sorte qu'il affiche un court avis tel que celui-ci lorsqu'il démarre en mode interactif : + +Gnomovision version 69, Copyright (C) année nom de l'auteur Gnomovision n'est accompagné d'ABSOLUMENT AUCUNE GARANTIE ; pour plus de détails tapez "show w". Ceci est un logiciel libre et vous êtes invité à le redistribuer en respectant certaines obligations ; pour plus de détails tapez "show c". + +Les instructions hypothétiques "show w" et "show c" sont supposées montrer les parties ad hoc de la Licence Publique Générale. Bien entendu, les instructions que vous utilisez peuvent porter d'autres noms que "show w" et "show c" ; elles peuvent même être des clics de souris ou des éléments d'un menu ou tout ce qui convient à votre programme. + +Vous devriez aussi obtenir de votre employeur (si vous travaillez en tant que développeur) ou de votre école, si c'est le cas, qu'il (ou elle) signe une "renonciation aux droits d'auteur" concernant le programme, si nécessaire. Voici un exemple (changez les noms) : + +Yoyodyne, Inc., déclare par la présente renoncer à toute prétention sur les droits d'auteur du programme "Gnomovision" (qui fait des avances aux compilateurs) écrit par James Hacker. [signature de Ty Coon], 1er avril 1989 Ty Coon, Président du Vice + +La présente Licence Publique Générale n'autorise pas l'incorporation de votre programme dans des programmes propriétaires. Si votre programme est une bibliothèque de sous-programmes, vous pouvez considérer plus utile d'autoriser l'édition de liens d'applications propriétaires avec la bibliothèque. Si c'est ce que vous voulez faire, utilisez la GNU Lesser General Public License au lieu de la présente Licence. \ No newline at end of file diff --git a/com.patrikdufresne.planimod-installation-package/pom.xml b/com.patrikdufresne.planimod-installation-package/pom.xml index f41df7cbd680f03b338fced64e8014226f513c84..590afe9791688c310a2776a0c71a8003c02e6bb1 100644 --- a/com.patrikdufresne.planimod-installation-package/pom.xml +++ b/com.patrikdufresne.planimod-installation-package/pom.xml @@ -10,7 +10,6 @@ planimod-installation-package pom - Planimod Windows Installation package patrikdufresne.com maven @@ -241,9 +240,12 @@ if="sign.key.path" /> - + + Copyright (C) 2019 Patrik Dufresne Service Logiciel - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - http://www.apache.org/licenses/LICENSE-2.0 + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --> diff --git a/com.patrikdufresne.planimod/pom.xml b/com.patrikdufresne.planimod/pom.xml index 2c8b34e7a96174da16def3a117b056fbf903407a..f8bfce7ba5fafe1f5d3000bb293b2e8711979144 100644 --- a/com.patrikdufresne.planimod/pom.xml +++ b/com.patrikdufresne.planimod/pom.xml @@ -8,7 +8,6 @@ ${revision} planimod - Planimod UI linux_x86_64 @@ -96,14 +95,9 @@ 1.0.11 - com.patrikdufresne.ilp - com.patrikdufresne.ilp - 0.12 - - - com.patrikdufresne.ilp - com.patrikdufresne.ilp.glpk - 0.12 + com.patrikdufresne + ilp-glpk + ${project.version} com.googlecode.gettext-commons @@ -146,7 +140,6 @@ com.googlecode.maven-java-formatter-plugin maven-java-formatter-plugin - 0.3.1 @@ -155,7 +148,7 @@ - src/main/build-tools/formatter.xml + ${project.basedir}/../formatter.xml CRLF @@ -163,7 +156,6 @@ com.mycila.maven-license-plugin maven-license-plugin - 1.9.0 process-sources @@ -173,7 +165,7 @@ -
src/main/build-tools/license-header.txt
+
license-header.txt
diff --git a/com.patrikdufresne.planimod/src/main/build-tools/license-header.txt b/com.patrikdufresne.planimod/src/main/build-tools/license-header.txt deleted file mode 100644 index da306b8ed4f6fecfeaa6231d8b0cbc0afe2645ce..0000000000000000000000000000000000000000 --- a/com.patrikdufresne.planimod/src/main/build-tools/license-header.txt +++ /dev/null @@ -1,13 +0,0 @@ -Copyright(C) 2013 Patrik Dufresne Service Logiciel - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/AbstractCalendarEvent.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/AbstractCalendarEvent.java index 3399550ae4520b8d44ebfeb095673a070fa6355d..2ddd3433657bc24eaeff69d2b8ce7da05007e21c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/AbstractCalendarEvent.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/AbstractCalendarEvent.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSetting.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSetting.java index 2eb9e833a3c2e80c5b3b5e958b1ff7f53702d9a8..27ca691311f47afc91c5976d33d69868931f5251 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSetting.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSetting.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSettingManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSettingManager.java index 51bf8cd389096e413cd135440cb2ecd3b8b61fcc..43cb50aceea83faa3f3ce6752a81df31b77b2d51 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSettingManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ApplicationSettingManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -40,8 +42,11 @@ public class ApplicationSettingManager extends AbstractManager + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -30,8 +32,7 @@ public class ConcreteTimeRange implements TimeRange { private Date start; /** - * Create a new time range from a starting and ending date. The dates can't - * be null. + * Create a new time range from a starting and ending date. The dates can't be null. * * @param start * @param end @@ -72,8 +73,7 @@ public class ConcreteTimeRange implements TimeRange { } /** - * This implementation return a hash code using the starting and ending - * dates. + * This implementation return a hash code using the starting and ending dates. */ @Override public int hashCode() { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Employee.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Employee.java index 898394e27e6c06febd0c95355a5d108fd6e43ccd..d711323180f9a8f7472a1bd9838eeaeadb643f1e 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Employee.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Employee.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -23,8 +25,7 @@ import javax.persistence.Entity; import com.patrikdufresne.managers.ArchivableObject; /** - * The Employee class represent a physical person that has qualification and may - * fill a position. + * The Employee class represent a physical person that has qualification and may fill a position. */ @Entity public class Employee extends ArchivableObject { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeeManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeeManager.java index 28680b81afdd93a657df19b3afee3a80af0d38b8..e33ffbd34e129e0f2e8d44816682d12c8295f3cd 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeeManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeeManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -51,8 +53,7 @@ public class EmployeeManager extends AbstractArchivableManager { } /** - * This implementation remove the {@link Employee} and the - * {@link EmployeePreference} objects from the managers. + * This implementation remove the {@link Employee} and the {@link EmployeePreference} objects from the managers. * * @see com.patrikdufresne.managers.IManager#remove(java.util.Collection) */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreference.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreference.java index 1e8bc25f9ffda3d094b8c772625d49502b775eaa..b321348e3d705f95c44452ed605d98d14d6521f3 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreference.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreference.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreferenceManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreferenceManager.java index b0ca246b267d878a8525a0dda5da5fe419919a1b..8944e0d225a7fa98572fa975cde1d64a738afa9f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreferenceManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/EmployeePreferenceManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -32,8 +34,7 @@ import com.patrikdufresne.managers.Query; /** * Manage the employee preferences. *

- * This manager has a speficif implementation to handle the archivable state of - * the {@link Employee} object. + * This manager has a speficif implementation to handle the archivable state of the {@link Employee} object. * * @author Patrik Dufresne */ @@ -71,8 +72,11 @@ public class EmployeePreferenceManager extends AbstractManager() { @Override public EmployeePreference run() throws ManagerException { - return (EmployeePreference) ManagerContext.getDefaultSession().createCriteria(objectClass()).add( - Restrictions.eq(EmployeePreference.EMPLOYEE, employee)).uniqueResult(); + return (EmployeePreference) ManagerContext + .getDefaultSession() + .createCriteria(objectClass()) + .add(Restrictions.eq(EmployeePreference.EMPLOYEE, employee)) + .uniqueResult(); } }); @@ -92,8 +96,11 @@ public class EmployeePreferenceManager extends AbstractManager run() throws ManagerException { // FIXME This function return multiple EmployeePreference for // the same Employee. - List preferences = ManagerContext.getDefaultSession().createCriteria(objectClass()).add( - Restrictions.in(EmployeePreference.EMPLOYEE, employees)).list(); + List preferences = ManagerContext + .getDefaultSession() + .createCriteria(objectClass()) + .add(Restrictions.in(EmployeePreference.EMPLOYEE, employees)) + .list(); // Quick fix return new ArrayList(new HashSet(preferences)); } @@ -112,8 +119,12 @@ public class EmployeePreferenceManager extends AbstractManager run() throws ManagerException { // FIXME This function return multiple EmployeePreference for // the same Employee. - List preferences = ManagerContext.getDefaultSession().createCriteria(EmployeePreference.class).createCriteria( - EmployeePreference.EMPLOYEE).add(Restrictions.isNull(ArchivableObject.ARCHIVED_DATE)).list(); + List preferences = ManagerContext + .getDefaultSession() + .createCriteria(EmployeePreference.class) + .createCriteria(EmployeePreference.EMPLOYEE) + .add(Restrictions.isNull(ArchivableObject.ARCHIVED_DATE)) + .list(); // Quick fix return new ArrayList(new HashSet(preferences)); } @@ -121,8 +132,7 @@ public class EmployeePreferenceManager extends AbstractManager + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailability.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailability.java index 774b1dec313bc4e528c7239ec6c7346ddfe20d2e..7ca54a9b895c3d94335c894d42cd07c79230e51e 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailability.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailability.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -39,8 +41,8 @@ public class NonAvailability extends AbstractCalendarEvent { } /** - * Sets the visibility of this non availability. This field is used to - * determine which non-availabilities to be displayed on report. + * Sets the visibility of this non availability. This field is used to determine which non-availabilities to be + * displayed on report. * * @param visible * True to display the non availability diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailabilityManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailabilityManager.java index 367fefca7281119040c7186621a9e8c139dc3636..31e82cf96ef8cc02c10b11adc097a5dda17af234 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailabilityManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/NonAvailabilityManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -47,10 +49,11 @@ public class NonAvailabilityManager extends AbstractManager { // (start < event.end < end) // OU // (event.start < start ET event.end > end) - return Restrictions.or(Restrictions.or(Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), Restrictions.between( - AbstractCalendarEvent.END_DATE, - start, - end)), Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); + return Restrictions.or( + Restrictions.or( + Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), + Restrictions.between(AbstractCalendarEvent.END_DATE, start, end)), + Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); } public NonAvailabilityManager(PlanimodManagers managers) { @@ -78,8 +81,13 @@ public class NonAvailabilityManager extends AbstractManager { return getManagers().query(new Query>() { @Override public List run() throws ManagerException { - return ManagerContext.getDefaultSession().createCriteria(NonAvailability.class).add(startEndCriterion(start, end)).createCriteria( - NonAvailability.EMPLOYEE).add(Restrictions.isNull(ArchivableObject.ARCHIVED_DATE)).list(); + return ManagerContext + .getDefaultSession() + .createCriteria(NonAvailability.class) + .add(startEndCriterion(start, end)) + .createCriteria(NonAvailability.EMPLOYEE) + .add(Restrictions.isNull(ArchivableObject.ARCHIVED_DATE)) + .list(); } }); } @@ -100,8 +108,14 @@ public class NonAvailabilityManager extends AbstractManager { return getManagers().query(new Query>() { @Override public List run() throws ManagerException { - return ManagerContext.getDefaultSession().createCriteria(NonAvailability.class).add(Restrictions.eq(NonAvailability.VISIBLE, visibility)).add( - startEndCriterion(start, end)).createCriteria(NonAvailability.EMPLOYEE).add(Restrictions.isNull(ArchivableObject.ARCHIVED_DATE)).list(); + return ManagerContext + .getDefaultSession() + .createCriteria(NonAvailability.class) + .add(Restrictions.eq(NonAvailability.VISIBLE, visibility)) + .add(startEndCriterion(start, end)) + .createCriteria(NonAvailability.EMPLOYEE) + .add(Restrictions.isNull(ArchivableObject.ARCHIVED_DATE)) + .list(); } }); } @@ -110,8 +124,12 @@ public class NonAvailabilityManager extends AbstractManager { return getManagers().query(new Query>() { @Override public List run() throws ManagerException { - return ManagerContext.getDefaultSession().createCriteria(objectClass()).add(startEndCriterion(start, end)).add( - Restrictions.in(NonAvailability.EMPLOYEE, employees)).list(); + return ManagerContext + .getDefaultSession() + .createCriteria(objectClass()) + .add(startEndCriterion(start, end)) + .add(Restrictions.in(NonAvailability.EMPLOYEE, employees)) + .list(); } }); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PlanimodManagers.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PlanimodManagers.java index 25a323c1bc04f4714229352f3a7ab5ff55caf872..20c2368ed8f2f5ab05a6b9ec33ddd2e9fb73de9a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PlanimodManagers.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PlanimodManagers.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -346,6 +351,7 @@ public class PlanimodManagers extends Managers { /** * Set the copy mode. + * * @param copy */ public void setIsCopy(boolean copy) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Position.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Position.java index 7b75c7f159ebfcbc33a85fa09b0d9b18a31fb6c9..0b8b63e8738a01eb0fef6b151c557bf252428de2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Position.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Position.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -22,8 +24,8 @@ import javax.persistence.ManyToOne; import com.patrikdufresne.managers.ArchivableObject; /** - * This class represent a position that may be filled by an employee. The - * position is mostly use to keep track of the employee's qualification. + * This class represent a position that may be filled by an employee. The position is mostly use to keep track of the + * employee's qualification. */ @Entity public class Position extends ArchivableObject { @@ -71,8 +73,7 @@ public class Position extends ArchivableObject { private Section section; /** - * Define if the position is swappable. A swappable position allow - * associated tasks to be part of multiple shift. + * Define if the position is swappable. A swappable position allow associated tasks to be part of multiple shift. */ private boolean swappable; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PositionManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PositionManager.java index 851cffe85e2110791b4d81e32f726a60a209c362..b04efbe728adad0cf7ce7940b637a1cd14660b4d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PositionManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/PositionManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Product.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Product.java index a496c7dfd8d559349aff30822630a48ab0fa9929..ac250cb621f855ca7ab7beaeeb8d8a994ca252a0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Product.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Product.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -26,7 +28,7 @@ import com.patrikdufresne.managers.ArchivableObject; * The Product class represent one product that may be schedule. */ @Entity -@NamedQueries( { +@NamedQueries({ @NamedQuery(name = "listProductTableByShifts", query = "SELECT S, P, SUM(PP.number), S.team " + "FROM Product as P, Shift as S, ProductionEvent as PE, ProductPosition as PP " + "WHERE PP.product = P " diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductEntry.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductEntry.java index 4fd61d31ee3f2df4eef49690e79b4d7068838c86..8a95c22289b94f37185a0ef7e1eea752f2cc9a9f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductEntry.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductEntry.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductManager.java index debba0ee4fb52c38d893554cd00870b079427eb2..b9490037e6d362b60f9193a19298cb1ffa50191a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductManager.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPosition.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPosition.java index 4ac302300650e35abd7f9a1baaa96b314db34023..bd2d9c31ee467bc601afb0890a9236c5d2dc4ac3 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPosition.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPosition.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -44,8 +46,7 @@ public class ProductPosition extends ManagedObject { public static final String PRODUCT = "product"; /** - * Define the number of the given position required to produce the attached - * product. + * Define the number of the given position required to produce the attached product. * * @uml.property name="number" */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPositionManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPositionManager.java index 67e10463e302528886110cf81355b69edcbe4e16..818e834135cebb14906f51ae5958cc8581290da0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPositionManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductPositionManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEvent.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEvent.java index 23ef1a222a194fee33b79a98c24abb8475956b1f..50245f0b5b2ab4b7d20a9aaed96974028fe40177 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEvent.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEvent.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -24,14 +26,14 @@ import org.hibernate.annotations.NamedQuery; import com.patrikdufresne.managers.ManagedObject; /** - * A production class define an event that should normally occur once in a - * planif. The production involved a product being produce. + * A production class define an event that should normally occur once in a planif. The production involved a product + * being produce. * * @author Patrik Dufresne * */ @Entity -@NamedQueries( { @NamedQuery(name = "listProductionEventTableByShifts", query = "SELECT PE, SUM(PP.number), PE.product, PE.shift, S.team " +@NamedQueries({ @NamedQuery(name = "listProductionEventTableByShifts", query = "SELECT PE, SUM(PP.number), PE.product, PE.shift, S.team " + "FROM ProductPosition as PP, ProductionEvent as PE JOIN PE.product JOIN PE.shift as S JOIN S.team " + "WHERE PP.product = PE.product " + "AND PE.shift in (:shifts) " diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEventManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEventManager.java index 288309c39450929ce0038aebcc301561db21947c..ab08b5825f51e8f006c3e4fb7a9b64b28b5dc51a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEventManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ProductionEventManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -45,10 +47,11 @@ public class ProductionEventManager extends AbstractManager { // (start < event.end < end) // OU // (event.start < start ET event.end > end) - return Restrictions.or(Restrictions.or(Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), Restrictions.between( - AbstractCalendarEvent.END_DATE, - start, - end)), Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); + return Restrictions.or( + Restrictions.or( + Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), + Restrictions.between(AbstractCalendarEvent.END_DATE, start, end)), + Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); } public ProductionEventManager(PlanimodManagers managers) { @@ -155,8 +158,12 @@ public class ProductionEventManager extends AbstractManager { return getManagers().query(new Query>() { @Override public List run() throws ManagerException { - return ManagerContext.getDefaultSession().createCriteria(ProductionEvent.class).createCriteria(ProductionEvent.SHIFT).add( - startEndCriterion(start, end)).list(); + return ManagerContext + .getDefaultSession() + .createCriteria(ProductionEvent.class) + .createCriteria(ProductionEvent.SHIFT) + .add(startEndCriterion(start, end)) + .list(); } }); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Qualification.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Qualification.java index f9e1052d26503e0ea1d7a146713224dc7872c5a9..1d831aa2cef1e39d2de655a7e0cbf7a75c0055f1 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Qualification.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Qualification.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -30,7 +32,7 @@ import com.patrikdufresne.managers.ManagedObject; * */ @Entity -@NamedQueries( { @NamedQuery(name = "getQualificationTableByPositions", query = "SELECT E, Po, Se " +@NamedQueries({ @NamedQuery(name = "getQualificationTableByPositions", query = "SELECT E, Po, Se " + "FROM Qualification Q JOIN Q.employee as E JOIN Q.position as Po JOIN Po.section as Se " + "WHERE Q.position in :positions AND E.archivedDate is null") }) public class Qualification extends ManagedObject { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/QualificationManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/QualificationManager.java index 7fb39c9781f1b2a231b58993ee16e4626c6b7c33..a5f455e2ed2dd4cdf404ae38bb0c0dcb393f763c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/QualificationManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/QualificationManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -45,8 +47,7 @@ public class QualificationManager extends AbstractManager { } /** - * This function is used to set the qualification for a given pair of - * employee-position. + * This function is used to set the qualification for a given pair of employee-position. * * @param position * the position @@ -131,8 +132,7 @@ public class QualificationManager extends AbstractManager { } /** - * Create a BidiMultiMap to represent the qualification of the requested - * employees and positions. + * Create a BidiMultiMap to represent the qualification of the requested employees and positions. *

* The table contains only not archived employee. * @@ -174,8 +174,7 @@ public class QualificationManager extends AbstractManager { } /** - * This function is used to remove any qualification catching the given pair - * of employee-position. + * This function is used to remove any qualification catching the given pair of employee-position. * * @param position * the position diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Section.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Section.java index 4f9ca4c9bd5fff17d6f7e938623e5194bb7e0cd5..b3470f668b81d1454d09292162b70fefdb95c8ff 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Section.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Section.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/SectionManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/SectionManager.java index 21fc4908aa93bbbc2b5803149c1f83781a416c42..85191a0fb5e146a9a1a1cd499e6cafdd641a19b0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/SectionManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/SectionManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Shift.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Shift.java index e8226c210f975bb090f953174b5fe570f3b169ad..e0d5d575394ac8056419fbf4f50dcad0d09de977 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Shift.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Shift.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ShiftManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ShiftManager.java index 2352f351b62de3b8148d2d1b535f481c7c24ba3a..0ba819e969fc1c71fbde8f9a0eca33322ac105b8 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ShiftManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/ShiftManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -98,8 +100,7 @@ public class ShiftManager extends AbstractManager { } /** - * List calendar event related to shifts calendar entry for the given period - * of time. + * List calendar event related to shifts calendar entry for the given period of time. * * @param start * @param end @@ -126,8 +127,11 @@ public class ShiftManager extends AbstractManager { return getManagers().query(new Query>() { @Override public List run() throws ManagerException { - return ManagerContext.getDefaultSession().createCriteria(objectClass()).add( - Restrictions.and(Restrictions.eq(Shift.TEAM, team), startEndCriterion(start, end))).list(); + return ManagerContext + .getDefaultSession() + .createCriteria(objectClass()) + .add(Restrictions.and(Restrictions.eq(Shift.TEAM, team), startEndCriterion(start, end))) + .list(); } }); } @@ -192,15 +196,15 @@ public class ShiftManager extends AbstractManager { // (start < event.end < end) // OU // (event.start < start ET event.end > end) - return Restrictions.or(Restrictions.or(Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), Restrictions.between( - AbstractCalendarEvent.END_DATE, - start, - end)), Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); + return Restrictions.or( + Restrictions.or( + Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), + Restrictions.between(AbstractCalendarEvent.END_DATE, start, end)), + Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); } /** - * This implementation override the default behavior by also removing any - * related tasks. + * This implementation override the default behavior by also removing any related tasks. * * @param s * list of production event to remove diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Task.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Task.java index a66a82d72f174548033553580a978f2954c1e651..62c69fdb2437475870f620f2ab55138ef43f9440 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Task.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Task.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -22,26 +24,28 @@ import org.hibernate.annotations.NamedQueries; import org.hibernate.annotations.NamedQuery; /** - * A task represent a period in time where a position is filled by an employee. - * This task is directly related to a production event. + * A task represent a period in time where a position is filled by an employee. This task is directly related to a + * production event. * * @author Patrik Dufresne * */ @Entity -@NamedQueries( { - @NamedQuery(name = "listQualificationAndAvaibilityTable", query = "SELECT E, Ta, Po, Se, PE, Pr, S, Te " - + "FROM Employee E, Task Ta JOIN Ta.position as Po JOIN Po.section as Se JOIN Ta.productionEvent as PE JOIN PE.product as Pr JOIN PE.shift as S JOIN S.team as Te, Qualification Q " - + "WHERE E.id = Q.employee " - + "AND Q.position=Ta.position " - + "AND Ta.startDate >= :start " - + "AND Ta.endDate <= :end " - + "AND not exists ( " - + "FROM NonAvailability as NA " - + "WHERE NA.employee=E " - + "AND NA.startDate <= Ta.startDate " - + "AND NA.endDate >= Ta.endDate " - + ")"), +@NamedQueries({ + @NamedQuery( + name = "listQualificationAndAvaibilityTable", + query = "SELECT E, Ta, Po, Se, PE, Pr, S, Te " + + "FROM Employee E, Task Ta JOIN Ta.position as Po JOIN Po.section as Se JOIN Ta.productionEvent as PE JOIN PE.product as Pr JOIN PE.shift as S JOIN S.team as Te, Qualification Q " + + "WHERE E.id = Q.employee " + + "AND Q.position=Ta.position " + + "AND Ta.startDate >= :start " + + "AND Ta.endDate <= :end " + + "AND not exists ( " + + "FROM NonAvailability as NA " + + "WHERE NA.employee=E " + + "AND NA.startDate <= Ta.startDate " + + "AND NA.endDate >= Ta.endDate " + + ")"), @NamedQuery(name = "listQualifiedAndAvailableEmployees", query = "SELECT DISTINCT E " + "FROM Employee E, Qualification Q, ProductPosition PP, ProductionEvent PE " + "JOIN PE.shift as S " diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskManager.java index 662ff0079cd7e5d71b5b923ac85fd8288ada65aa..c37d10a24ca836e4dbabcd6d2a4df40cec566585 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -60,10 +62,11 @@ public class TaskManager extends AbstractManager { // (start < event.end < end) // OU // (event.start < start ET event.end > end) - return Restrictions.or(Restrictions.or(Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), Restrictions.between( - AbstractCalendarEvent.END_DATE, - start, - end)), Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); + return Restrictions.or( + Restrictions.or( + Restrictions.between(AbstractCalendarEvent.START_DATE, start, end), + Restrictions.between(AbstractCalendarEvent.END_DATE, start, end)), + Restrictions.and(Restrictions.lt(AbstractCalendarEvent.START_DATE, start), Restrictions.gt(AbstractCalendarEvent.END_DATE, end))); } public TaskManager(PlanimodManagers managers) { @@ -172,8 +175,12 @@ public class TaskManager extends AbstractManager { return getManagers().query(new Query>() { @Override public List run() throws ManagerException { - return ManagerContext.getDefaultSession().createCriteria(Task.class).add(startEndCriterion(start, end)).add( - Restrictions.eq(Task.EMPLOYEE, employee)).list(); + return ManagerContext + .getDefaultSession() + .createCriteria(Task.class) + .add(startEndCriterion(start, end)) + .add(Restrictions.eq(Task.EMPLOYEE, employee)) + .list(); } }); } @@ -206,8 +213,11 @@ public class TaskManager extends AbstractManager { // FIXME the list of events should be used to reduce the // size of the table Query database DetachedCriteria subSelectProducts = DetachedCriteria.forClass(ProductionEvent.class).setProjection(Property.forName(ProductionEvent.PRODUCT)); - List productPositions = ManagerContext.getDefaultSession().createCriteria(ProductPosition.class).add( - Property.forName(ProductPosition.PRODUCT).in(subSelectProducts)).list(); + List productPositions = ManagerContext + .getDefaultSession() + .createCriteria(ProductPosition.class) + .add(Property.forName(ProductPosition.PRODUCT).in(subSelectProducts)) + .list(); // Create the table. BidiMultiMap table = new BidiMultiHashMap(); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskNonAvailabilityTable.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskNonAvailabilityTable.java index e9e1b32e5cb12b27529fdfc70cfad3ddcc34cac9..320e6000478aba012dd125da563d550ebd145ccf 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskNonAvailabilityTable.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskNonAvailabilityTable.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskQualificationTable.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskQualificationTable.java index 622892ac251e98ade4abfd855008fc897f80f289..ab04d5d93bd197ea3bc39b5770645e4d6aeecfc9 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskQualificationTable.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TaskQualificationTable.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -25,8 +27,8 @@ import com.patrikdufresne.util.AbstractBidiMultiMap; import com.patrikdufresne.util.BidiMultiMap; /** - * This class is used to represent the qualification of an employee. If the - * employee is qualify to work on a task, an entry exists in this table. + * This class is used to represent the qualification of an employee. If the employee is qualify to work on a task, an + * entry exists in this table. * * @author Patrik Dufresne * @@ -50,8 +52,7 @@ public class TaskQualificationTable extends AbstractBidiMultiMap } /** - * This implementation does a cross product between the known employees - * and known tasks. + * This implementation does a cross product between the known employees and known tasks. */ @Override public Iterator> iterator() { @@ -84,8 +85,7 @@ public class TaskQualificationTable extends AbstractBidiMultiMap } /** - * This implementation always throw - * UnsupportedOperationException. + * This implementation always throw UnsupportedOperationException. */ @Override public void remove() { @@ -164,8 +164,7 @@ public class TaskQualificationTable extends AbstractBidiMultiMap } /** - * This implementation check if the entry exists using the qualification - * table. + * This implementation check if the entry exists using the qualification table. */ @Override public boolean containsEntry(Object key, Object value) { @@ -176,8 +175,7 @@ public class TaskQualificationTable extends AbstractBidiMultiMap } /** - * This implementation check if the key exists using the qualification - * table. + * This implementation check if the key exists using the qualification table. */ @Override public boolean containsKey(Object key) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Team.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Team.java index dc4201f84937088c51a7df8e95353c76ca4e163a..3bb4927b214e569636c11ade2be56f122bf9e592 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Team.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/Team.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TeamManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TeamManager.java index fff88af7773d1be802c0c9de6eafea77523af924..7021036d6d237603ccbfc07f6becc750ab63f4e3 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TeamManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TeamManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRange.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRange.java index 97b5089de4887a220fe5874921990400683fd364..bf081c5fe6ade7618bfc014d21ea5de05c2a6794 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRange.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRange.java @@ -1,25 +1,26 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; import java.util.Date; /** - * Concrete implementation of a time range define with a start date and a end - * date. This implementation is immutable. + * Concrete implementation of a time range define with a start date and a end date. This implementation is immutable. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRanges.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRanges.java index 6e6355be2880eccb556068bf69c3106f7b685b9d..76da7e0c6b0044bc6d4cd01e68809e5ed77027c8 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRanges.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/TimeRanges.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -56,8 +58,7 @@ public class TimeRanges { } /** - * Check if the first time range constraint or is equals to the second time - * range. + * Check if the first time range constraint or is equals to the second time range. * * @param s1 * @param e1 @@ -73,8 +74,7 @@ public class TimeRanges { } /** - * Check if the first time range constraint or is equals to the second time - * range. + * Check if the first time range constraint or is equals to the second time range. * * @param s1 * @param e1 @@ -87,8 +87,8 @@ public class TimeRanges { } /** - * Check if the event e1 contains or is equals to the time - * range specified by start and end. + * Check if the event e1 contains or is equals to the time range specified by start and + * end. * * @param e1 * the event @@ -122,8 +122,8 @@ public class TimeRanges { } /** - * Return the first days of the first week of the month. The first week of a - * month is define by {@link Calendar#getMinimalDaysInFirstWeek()}. + * Return the first days of the first week of the month. The first week of a month is define by + * {@link Calendar#getMinimalDaysInFirstWeek()}. * * @param date * The original date. @@ -226,11 +226,9 @@ public class TimeRanges { } /** - * This function is used to calculate the date value of a the time - * specified. + * This function is used to calculate the date value of a the time specified. *

- * This is used if you want the date value of a time (6:00 AM) but for a - * specific week. + * This is used if you want the date value of a time (6:00 AM) but for a specific week. * * @param time * the time value @@ -314,8 +312,7 @@ public class TimeRanges { } /** - * Check if the first time range happen before with the first time range and - * intersect with it. + * Check if the first time range happen before with the first time range and intersect with it. * * @param s1 * the first time range @@ -333,8 +330,7 @@ public class TimeRanges { } /** - * Check if the first time range happen before with the first time range and - * intersect with it. + * Check if the first time range happen before with the first time range and intersect with it. * * @param s1 * the first time range @@ -359,8 +355,8 @@ public class TimeRanges { } /** - * Check if the first time range intersect, contains or equals the second - * time range. Return true if and only if s2 < e1 And s1 < e2 + * Check if the first time range intersect, contains or equals the second time range. Return true if and only if + * s2 < e1 And s1 < e2 * * @param s1 * @param e1 @@ -376,8 +372,8 @@ public class TimeRanges { } /** - * Check if the first time range intersect, contains or equals the second - * time range. Return true if and only if s2 < e1 And s1 < e2 + * Check if the first time range intersect, contains or equals the second time range. Return true if and only if + * s2 < e1 And s1 < e2 * * @param s1 * @param e1 @@ -390,8 +386,8 @@ public class TimeRanges { } /** - * Check if the event intersect, constains, or equals the time range. Return - * true if and only if start < event.end And event.start < end + * Check if the event intersect, constains, or equals the time range. Return true if and only if + * start < event.end And event.start < end * * @param event * @param start @@ -403,8 +399,7 @@ public class TimeRanges { } /** - * Check if the first events intersect, contains, or equals the second time - * range. Return true if and only if + * Check if the first events intersect, contains, or equals the second time range. Return true if and only if * e2.start < e1.end And e1.start < e2.end * * @param e1 @@ -416,8 +411,8 @@ public class TimeRanges { } /** - * Check if two time range are intersecting. Two time range are intersecting - * if and only if s1 < s2 < e1 < e2 OR s2 < s1 < e2 < e1 + * Check if two time range are intersecting. Two time range are intersecting if and only if + * s1 < s2 < e1 < e2 OR s2 < s1 < e2 < e1 * * @param s1 * @param e1 @@ -433,8 +428,8 @@ public class TimeRanges { } /** - * Check if two time range are intersecting. Two time range are intersecting - * if and only if s1 < s2 < e1 < e2 OR s2 < s1 < e2 < e1 + * Check if two time range are intersecting. Two time range are intersecting if and only if + * s1 < s2 < e1 < e2 OR s2 < s1 < e2 < e1 * * @param s1 * @param e1 @@ -447,8 +442,7 @@ public class TimeRanges { } /** - * Check if the given calendar event intersect with the the start and end - * date. + * Check if the given calendar event intersect with the the start and end date. * * @param event * @param start diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeeComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeeComparators.java index 6dccf4488834ca9cefa9033d840d812b364fe056..2d0ab4844da0f70662df1ffe7ac78794251cc04d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeeComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeeComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -29,41 +31,44 @@ import com.planimod.core.Employee; public class EmployeeComparators { /** - * Seniority comparator. It use the hireDate and employee's name for - * comparison. The smaller hireDate is first. A null hireDate is last. + * Seniority comparator. It use the hireDate and employee's name for comparison. The smaller hireDate is first. A + * null hireDate is last. *

- * When used to sort, this comparator will sort the employee by increasing - * hire date. Meaning the first employee is the most senior. + * When used to sort, this comparator will sort the employee by increasing hire date. Meaning the first employee is + * the most senior. * * @return */ // TODO This comparator should be removed public static Comparator bySeniority() { ComparatorChain chain = new ComparatorChain(); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(ComparatorUtils - .naturalComparator()), new Transformer() { + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()), + new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Employee) arg0).getHireDate(); - } - }))); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(ComparatorUtils - .naturalComparator()), new Transformer() { + @Override + public Object transform(Object arg0) { + return ((Employee) arg0).getHireDate(); + } + }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()), + new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Employee) arg0).getFirstname(); - } - }))); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(ComparatorUtils - .naturalComparator()), new Transformer() { + @Override + public Object transform(Object arg0) { + return ((Employee) arg0).getFirstname(); + } + }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()), + new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Employee) arg0).getLastname(); - } - }))); + @Override + public Object transform(Object arg0) { + return ((Employee) arg0).getLastname(); + } + }))); return chain; } @@ -74,22 +79,24 @@ public class EmployeeComparators { */ public static Comparator byName() { ComparatorChain chain = new ComparatorChain(); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullLowComparator(ComparatorUtils - .nullHighComparator(ComparatorUtils.naturalComparator())), new Transformer() { + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullLowComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator())), + new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Employee) arg0).getFirstname(); - } - }))); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(ComparatorUtils - .naturalComparator()), new Transformer() { + @Override + public Object transform(Object arg0) { + return ((Employee) arg0).getFirstname(); + } + }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()), + new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Employee) arg0).getLastname(); - } - }))); + @Override + public Object transform(Object arg0) { + return ((Employee) arg0).getLastname(); + } + }))); return chain; } } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeePreferenceComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeePreferenceComparators.java index 5552cd6ecdcdb1c2f520ab7874f365159825b9ad..896aba7b9aecdd651e7d911c8e5932ae267e4e77 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeePreferenceComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/EmployeePreferenceComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -48,8 +50,8 @@ public class EmployeePreferenceComparators { } /** - * Comparator to sort employee by section and then by seniority. This - * comparator doesn't consider the field preferencialSeniority. + * Comparator to sort employee by section and then by seniority. This comparator doesn't consider the field + * preferencialSeniority. * * @return */ @@ -105,11 +107,11 @@ public class EmployeePreferenceComparators { } /** - * Seniority comparator. It use the hireDate and employee's name for - * comparison. The smaller hireDate is first. A null hireDate is last. + * Seniority comparator. It use the hireDate and employee's name for comparison. The smaller hireDate is first. A + * null hireDate is last. *

- * When used to sort, this comparator will sort the employee by increasing - * hire date. Meaning the first employee is the most senior. + * When used to sort, this comparator will sort the employee by increasing hire date. Meaning the first employee is + * the most senior. * * @return */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/HumanNaturalComparator.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/HumanNaturalComparator.java index 8154c3768fc5d553609bf6b1e6eb5df08e2b8bd6..76d7d773a311236b4b882411bbd34905a02da89d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/HumanNaturalComparator.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/HumanNaturalComparator.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* NaturalOrderComparator.java -- Perform 'natural order' comparisons of strings in Java. @@ -62,9 +64,8 @@ public class HumanNaturalComparator implements Comparator { /** * Gets the singleton instance of a HumanNaturalComparator. *

- * Developers are encouraged to use the comparator returned from this method - * instead of constructing a new instance to reduce allocation and GC - * overhead when multiple comparable comparators may be used in the same VM. + * Developers are encouraged to use the comparator returned from this method instead of constructing a new instance + * to reduce allocation and GC overhead when multiple comparable comparators may be used in the same VM. * * @return the singleton HumanNaturalComparator */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/NonAvailabilityComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/NonAvailabilityComparators.java index 302d9d6fee2733e6138bef34fa5b95931face02f..c83a6e911dc511a0d88c14f6b568a12929f3f154 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/NonAvailabilityComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/NonAvailabilityComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -42,21 +44,23 @@ public class NonAvailabilityComparators { ComparatorChain chain = new ComparatorChain(); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullLowComparator(ComparatorUtils - .naturalComparator()), new Transformer() { - @Override - public Object transform(Object arg0) { - return ((AbstractCalendarEvent) arg0).getStartDate(); - } - }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullLowComparator(ComparatorUtils.naturalComparator()), + new Transformer() { + @Override + public Object transform(Object arg0) { + return ((AbstractCalendarEvent) arg0).getStartDate(); + } + }))); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullLowComparator(EmployeeComparators - .byName()), new Transformer() { - @Override - public Object transform(Object arg0) { - return ((NonAvailability) arg0).getEmployee(); - } - }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullLowComparator(EmployeeComparators.byName()), + new Transformer() { + @Override + public Object transform(Object arg0) { + return ((NonAvailability) arg0).getEmployee(); + } + }))); return chain; } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/PositionComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/PositionComparators.java index 41c0a03531486299530d2935a409edd1bd7504b0..59928c5a2db80170be3dd5d31da5ccad6f56b1f8 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/PositionComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/PositionComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -65,8 +67,7 @@ public class PositionComparators { } /** - * Comparator to sort Position by classified position (first) and then by - * name. + * Comparator to sort Position by classified position (first) and then by name. * * @return */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductComparators.java index 2723b2254ce5cd957b1b18f1c4f7a1568fd746c5..bc9472101008e8171f13d5808ebc1b149c8e2b2b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -47,30 +49,33 @@ public class ProductComparators { public static Comparator byRefIdFamilyName() { ComparatorChain chain = new ComparatorChain(); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(HumanNaturalComparator - .getInstance()), new Transformer() { - @Override - public Object transform(Object arg0) { - String refId = ((Product) arg0).getRefId(); - return refId == null || refId.isEmpty() ? null : refId; - } - }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(HumanNaturalComparator.getInstance()), + new Transformer() { + @Override + public Object transform(Object arg0) { + String refId = ((Product) arg0).getRefId(); + return refId == null || refId.isEmpty() ? null : refId; + } + }))); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(ComparatorUtils - .naturalComparator()), new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Product) arg0).getFamily(); - } - }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()), + new Transformer() { + @Override + public Object transform(Object arg0) { + return ((Product) arg0).getFamily(); + } + }))); - chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator(ComparatorUtils.nullHighComparator(ComparatorUtils - .naturalComparator()), new Transformer() { - @Override - public Object transform(Object arg0) { - return ((Product) arg0).getName(); - } - }))); + chain.addComparator(ComparatorUtils.nullHighComparator(ComparatorUtils.transformedComparator( + ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()), + new Transformer() { + @Override + public Object transform(Object arg0) { + return ((Product) arg0).getName(); + } + }))); return chain; } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductionEventComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductionEventComparators.java index 60f46f8393b6a18e976bfd4a2adf0192f230c22c..e8b83c1f4253b0e929020f54aa974fb053e2ebc2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductionEventComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ProductionEventComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/SectionComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/SectionComparators.java index a0e18884645bf2c8c7c297e806ea699f2bc47234..58bab5e6fac1df44ef5bad6ad547fc9a195605f1 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/SectionComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/SectionComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ShiftComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ShiftComparators.java index 44e8ae45d0610e29edf3ddb2a721fae0c13fda45..f1226072a26ff1b3c6a5dcfbf3213483bfca815b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ShiftComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/ShiftComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TaskComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TaskComparators.java index e4b3b02d54736bf0ed5f0d130d0f7eb7636202e5..a3b06201955c55fb4282429a48ec6733c293feb2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TaskComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TaskComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TeamComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TeamComparators.java index 79c37862f3368fe7d1163dc0ee359542a272aca3..ce651d3c12bb5bae447ad79f2b9f22e3c6bb7847 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TeamComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TeamComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TimeRangeComparators.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TimeRangeComparators.java index e0b50a4e38d5a5f084834897a4522e21156b6961..5455be3e8869c33e3aa9140b3447f611cfd7ab43 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TimeRangeComparators.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/comparators/TimeRangeComparators.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/AbstractConstraintRunnable.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/AbstractConstraintRunnable.java index f61de9a62c8569f4e452604b52f9059cba10faa0..b00c5bcbfb3e820bc92d870b3b20dba5b91eb0b5 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/AbstractConstraintRunnable.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/AbstractConstraintRunnable.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckEmployeeNotWorking.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckEmployeeNotWorking.java index aac8d145d1ffea9fcdc43028ee4a0a85a3cdf231..b37b48598eebe23c7d47c9a3601d79262a84ec17 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckEmployeeNotWorking.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckEmployeeNotWorking.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckFeasible.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckFeasible.java index 3edf294b77e0a0ba3d2e28e4537f018bd7a4d74b..7031bdec92b2cdf8c517404a3ab39a8f2fee8638 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckFeasible.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckFeasible.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckPreferredTeam.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckPreferredTeam.java index 6019f168acac13ab3ca3a1587267431acfa8c52b..19d09e9e5e4b71be8c8aeb77a132571812fb3437 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckPreferredTeam.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckPreferredTeam.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckSwappableTask.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckSwappableTask.java index 3a53eff44ab372fe258e15bb98ff061362ef124e..5b0162d54e930503c72ba0f83aa7297e6e280685 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckSwappableTask.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckSwappableTask.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckTaskAssigned.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckTaskAssigned.java index 269ec55f6721d1fcfa3c71134613e36726b9c78b..a5de5b2840d09d4e99ee45f43c94fa7abe99b8b8 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckTaskAssigned.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CheckTaskAssigned.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CoefficientList.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CoefficientList.java index 71db136bcb424c14de50c18066363fd63fa82c45..bc5049405305dc8ede3b49434e1564a775f97d7b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CoefficientList.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/CoefficientList.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifContext.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifContext.java index b7afb8385e6e4ae321bdc9545e76b44b47c6e72d..0689dc46dafa6f3d0131c676ce26a14a12699fd2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifContext.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifContext.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; @@ -57,14 +59,11 @@ import com.planimod.core.TimeRanges; * * *

- * This class create a linear problem representing the employees, teams, and - * tasks and solve it. + * This class create a linear problem representing the employees, teams, and tasks and solve it. *

    *
  • x[i] take the value 1 if and only if the employee i is working.
  • - *
  • x[i,j] take the value 1 if an only if the employee i is working on team - * j.
  • - *
  • x[i,k] take the value 1 if an onl if the employee i is working on task k. - *
  • + *
  • x[i,j] take the value 1 if an only if the employee i is working on team j.
  • + *
  • x[i,k] take the value 1 if an onl if the employee i is working on task k.
  • *
* * @author Patrik Dufresne @@ -121,8 +120,7 @@ public class GeneratePlanifContext { public static final String WEEK = "week"; /** - * Check if any object within the array matches the given planif and or time - * range. + * Check if any object within the array matches the given planif and or time range. * * @param planif * the planif to matches against @@ -150,8 +148,8 @@ public class GeneratePlanifContext { } /** - * This function is used as a SELECT statement to retrieve the list of - * planification event related to a given event and position. + * This function is used as a SELECT statement to retrieve the list of planification event related to a given event + * and position. * * @param tasks * the collection of planification event to filter. @@ -193,9 +191,8 @@ public class GeneratePlanifContext { /** * Define the ending date of the planif. *

- * This value is cached between search. It's used to avoid recomputing the - * start date of the week. When null, this value can be recomputed using - * {@link #computeTimeRange()}. + * This value is cached between search. It's used to avoid recomputing the start date of the week. When null, this + * value can be recomputed using {@link #computeTimeRange()}. */ Date end; @@ -211,8 +208,7 @@ public class GeneratePlanifContext { /** * The non-availability table. *

- * This map is cached between search. It's used to compute the proposed - * task. + * This map is cached between search. It's used to compute the proposed task. */ TaskNonAvailabilityTable nonAvailabilityTable; @@ -233,17 +229,15 @@ public class GeneratePlanifContext { /** * The qualification table. *

- * This map is cached between search. It's used to provide fast access to - * different list. + * This map is cached between search. It's used to provide fast access to different list. */ TaskQualificationTable qualificationTable; /** * The starting date of this planif context. *

- * This value is cached between search. It's used to avoid recomputing the - * start date of the week. When null, this value can be recomputed using - * {@link #computeTimeRange()}. + * This value is cached between search. It's used to avoid recomputing the start date of the week. When null, this + * value can be recomputed using {@link #computeTimeRange()}. */ Date start; @@ -302,8 +296,7 @@ public class GeneratePlanifContext { } /** - * Check the context state. This function throw an exception is it's - * disposed. + * Check the context state. This function throw an exception is it's disposed. * * @throws ManagerException */ @@ -365,8 +358,7 @@ public class GeneratePlanifContext { List taskAddeds = new ArrayList(); /* - * From the production events list, we need to create (or find) planif - * events for each position. + * From the production events list, we need to create (or find) planif events for each position. */ for (ProductionEvent productionEvent : originalProductionEvents) { // The list of position required to produce the product @@ -380,42 +372,42 @@ public class GeneratePlanifContext { // event. List relatedTasks = selectTasksMatchingProduction(taskObsolets, productionEvent, null); - // if (splitedEvents.size() > 1 && relatedTasks.size() > 0) { - // // In case the original production event is split, the - // // associated task may required to be split too. Otherwise, the - // // tasks may not be recycle properly and the locking information - // // may be lost. - // List splitedTasks = new ArrayList(); - // for (Task t : relatedTasks) { - // // Check if the task start and end is matching the original - // // shift's start and end. - // if (!t.getStartDate().equals( - // productionEvent.getShift().getStartDate()) - // || !t.getEndDate().equals( - // productionEvent.getShift().getEndDate())) { - // continue; - // } - // // Since it's matches, duplicate the task - // for (int i = 0; i < splitedEvents.size(); i++) { - // Task t2; - // if (i == 0) { - // t2 = t; - // } else { - // t2 = new Task(); - // t2.setEmployee(t.getEmployee()); - // t2.setLocked(t.getLocked()); - // t2.setPosition(t.getPosition()); - // t2.setProductionEvent(productionEvent); - // splitedTasks.add(t2); - // } - // t.setStartDate(splitedEvents.get(i).getStartDate()); - // t.setEndDate(splitedEvents.get(i).getEndDate()); - // } - // } - // relatedTasks.addAll(splitedTasks); - // } - - // for (Shift splited : splitedEvents) { + // if (splitedEvents.size() > 1 && relatedTasks.size() > 0) { + // // In case the original production event is split, the + // // associated task may required to be split too. Otherwise, the + // // tasks may not be recycle properly and the locking information + // // may be lost. + // List splitedTasks = new ArrayList(); + // for (Task t : relatedTasks) { + // // Check if the task start and end is matching the original + // // shift's start and end. + // if (!t.getStartDate().equals( + // productionEvent.getShift().getStartDate()) + // || !t.getEndDate().equals( + // productionEvent.getShift().getEndDate())) { + // continue; + // } + // // Since it's matches, duplicate the task + // for (int i = 0; i < splitedEvents.size(); i++) { + // Task t2; + // if (i == 0) { + // t2 = t; + // } else { + // t2 = new Task(); + // t2.setEmployee(t.getEmployee()); + // t2.setLocked(t.getLocked()); + // t2.setPosition(t.getPosition()); + // t2.setProductionEvent(productionEvent); + // splitedTasks.add(t2); + // } + // t.setStartDate(splitedEvents.get(i).getStartDate()); + // t.setEndDate(splitedEvents.get(i).getEndDate()); + // } + // } + // relatedTasks.addAll(splitedTasks); + // } + + // for (Shift splited : splitedEvents) { for (ProductPosition productPosition : productPositions) { Position position = productPosition.getPosition(); @@ -447,7 +439,7 @@ public class GeneratePlanifContext { task.setPosition(position); } } - // } + // } } // Any remaining planif event in the list should be remove @@ -459,8 +451,7 @@ public class GeneratePlanifContext { } /** - * Calculate the planif time range (start date and ending date) according to - * application settings. + * Calculate the planif time range (start date and ending date) according to application settings. *

* This function does nothing if the week date it not set. * @@ -500,8 +491,7 @@ public class GeneratePlanifContext { } /** - * This function remove all the observer previously attach by - * {@link #attachObservers()}. + * This function remove all the observer previously attach by {@link #attachObservers()}. */ private void detachObservers() { this.managers.removeObserver(ManagerEvent.ALL, Qualification.class, this.observer); @@ -548,8 +538,7 @@ public class GeneratePlanifContext { } /** - * For the current planif and week, return a list of task offer to the given - * employee. + * For the current planif and week, return a list of task offer to the given employee. * * @param employee * the employee @@ -702,11 +691,9 @@ public class GeneratePlanifContext { } /** - * Check if this context is dirty. This context become dirty whenever the - * state of the planif event doesn't match the state of the database. To - * clear this context, the function - * {@link #searchSolution(IGeneratePlanifProgressMonitor)} should be called - * to compute the optimal solution. + * Check if this context is dirty. This context become dirty whenever the state of the planif event doesn't match + * the state of the database. To clear this context, the function + * {@link #searchSolution(IGeneratePlanifProgressMonitor)} should be called to compute the optimal solution. * * @return True if this context is dirty */ @@ -764,8 +751,7 @@ public class GeneratePlanifContext { } /** - * For the current planif and week, return a list of employee available and - * qualify at least for one task. + * For the current planif and week, return a list of employee available and qualify at least for one task. * * @return list of employee * @throws ManagerException @@ -811,8 +797,7 @@ public class GeneratePlanifContext { } /** - * For the current planif and week date, return a list of tasks currently in - * database. + * For the current planif and week date, return a list of tasks currently in database. * * @return the tasks * @throws ManagerException @@ -838,8 +823,7 @@ public class GeneratePlanifContext { } /** - * For the current planif and week date, return a list of tasks assigned to - * the given employee. + * For the current planif and week date, return a list of tasks assigned to the given employee. * * @param employee * the employee diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifException.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifException.java index 48e4ef04b1e87c9e720872721abcba68d1b6f5f0..e2f32a81a7e08f2bcace21333847892c4a01c1aa 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifException.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifException.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; @@ -21,8 +23,7 @@ import com.planimod.core.Task; import com.planimod.core.Team; /** - * Exception raised when an handle error occurred within the generate planif - * process. + * Exception raised when an handle error occurred within the generate planif process. * * @author Patrik Dufresne */ @@ -34,9 +35,8 @@ public class GeneratePlanifException extends ManagerException { public static final int CANCEL_BY_USER = 2; /** - * Reason code to identify an employee being locked on a task for which he - * is not qualied or available. The employee must be unlocked to generate a - * planif. + * Reason code to identify an employee being locked on a task for which he is not qualied or available. The employee + * must be unlocked to generate a planif. *

* Should be raised with an employee and a task. */ @@ -48,8 +48,8 @@ public class GeneratePlanifException extends ManagerException { private static final long serialVersionUID = 1L; /** - * Reason code raised when the problem is not feasible from the start. This - * is most probably due to an employee locked on conflicting task or team. + * Reason code raised when the problem is not feasible from the start. This is most probably due to an employee + * locked on conflicting task or team. */ public static final int STARTING_UNFEASIBLE = 5; @@ -73,10 +73,14 @@ public class GeneratePlanifException extends ManagerException { /** * Create a new exception with the reason specified. * - * @param message the detail message. - * @param reason the reason. - * @param employee the related employee or null - * @param task the related task or null + * @param message + * the detail message. + * @param reason + * the reason. + * @param employee + * the related employee or null + * @param task + * the related task or null */ public GeneratePlanifException(String message, int reason, Employee employee, Task task) { this(message, reason, employee, task, null); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifProgressMonitorStep.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifProgressMonitorStep.java index fb8ced976278635c5f593a7788f9c380c966204f..e5826bb8eecd46d784a511209261a89be91cca97 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifProgressMonitorStep.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/GeneratePlanifProgressMonitorStep.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/HasSeniorityToWorkOnPreferedTeamWarning.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/HasSeniorityToWorkOnPreferedTeamWarning.java index d97565a1e3e2e1645ed2d4ab7f586e60fb2c2f36..c9a50dcedf1b84d7a2b3cb8facc3c229264fb570 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/HasSeniorityToWorkOnPreferedTeamWarning.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/HasSeniorityToWorkOnPreferedTeamWarning.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ICallbackReason.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ICallbackReason.java index e881806e756733ed4d4a335aa873dbe0e512449e..56e6edef87a3fa8444bc644847c3568f8e12ba02 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ICallbackReason.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ICallbackReason.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/IGeneratePlanifProgressMonitor.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/IGeneratePlanifProgressMonitor.java index 13551862df79bcd25f7f4fe6ec706af2b2387a0e..6a855dab4bb4041e37e2765a025522f942bee5ab 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/IGeneratePlanifProgressMonitor.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/IGeneratePlanifProgressMonitor.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxAllTaskAssigned.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxAllTaskAssigned.java index b190ccb2848b18d6ce74a106ce758dbe3a445e34..16b4f28d16350935e6c0415b5445174d1ad284d2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxAllTaskAssigned.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxAllTaskAssigned.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxEmployeePreferences.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxEmployeePreferences.java index eec12730f1de971d4d53e6e7b67a1a333bb28c44..fee500e5961afa0084ceb8b687b069148715a642 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxEmployeePreferences.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxEmployeePreferences.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxImportantTaskAssigned.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxImportantTaskAssigned.java index b0651c705e00d7fca73c67aeff77045fae02c2b8..4ba40dcb26a87419167ef321b66e35e2cc1bf2c4 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxImportantTaskAssigned.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxImportantTaskAssigned.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredPosition.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredPosition.java index e7196a60fad31538d1773a501adbc47c95242ec5..675e86f28825ddda84eb38eb6007d9569a7bea99 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredPosition.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredPosition.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSection.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSection.java index dd37774ccf4c59173c34203fe08b3989a18e9bba..bf3afa6014ee4e6c7e789cd1131f3fcf0d9f32bc 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSection.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSection.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniorities.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniorities.java index 480db54dfd02825c170bc969950ba2e5a257085d..27a6d8f2cedcd856c23eafa4f800e05cd9fe6b62 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniorities.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniorities.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniority.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniority.java index c04309897ef4ed257cf3c982f02b87f73ba5a7e5..14f821ae769459470e5c7cd1ca7c6f57c921f7b2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniority.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredSeniority.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; @@ -77,7 +79,7 @@ public class MaxPreferredSeniority extends SolveRunnable { * * @param i * the employee - * + * * @return The preferred team of the employee i or null if the employee has no team. */ private Team getFirstPreferredTeam() { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredTeams.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredTeams.java index f94d6e59ea7cddf598f9460f72c9df1ea98aa30c..a113fb37d7fc9b1ff7dea2020fa7d4325937bf5a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredTeams.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxPreferredTeams.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxSeniorEmployee.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxSeniorEmployee.java index e30074279d4d90f1378e5b5ecd580672895db891..a9b257f99462bfa037102d58e29b01a846ed689d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxSeniorEmployee.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxSeniorEmployee.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxTaskAssigned.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxTaskAssigned.java index 634b43d79d1e629f0c9affb118434d636a5c2070..f3d2453ab7093dcacc88a93c0937866df884233a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxTaskAssigned.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MaxTaskAssigned.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinAllSwappableTask.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinAllSwappableTask.java index f931e53f88350a44067244f45e2c93404ae1f8ee..0da3f3b05bfff16cfc8c8ad598203423511914c5 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinAllSwappableTask.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinAllSwappableTask.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinEmployeeAssigned.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinEmployeeAssigned.java index 4c8ab21817ac5054172bde8b344f2bf9b5d1f89c..8ceebddace1d388acbf558367b1ce91abc79e482 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinEmployeeAssigned.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinEmployeeAssigned.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinSwappableTask.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinSwappableTask.java index 585f917c0349164cc3aa84d2d2a145584e4b38b7..0f609ca2544d3535d6346abb6811272a0e1ddf1f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinSwappableTask.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/MinSwappableTask.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityCallbackReason.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityCallbackReason.java index 2bbea67ecc2012bc80e59142b55a7ce07dbe532b..b84185083340cd7845dfa59067cdbe21f88c2715 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityCallbackReason.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityCallbackReason.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityWithoutPrefTeamCallbackReason.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityWithoutPrefTeamCallbackReason.java index 326110bcd92a35fbdbfd8b77e57f01548f14dee7..734d8cee8fd5293f8bd4f52402d3732e87c06109 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityWithoutPrefTeamCallbackReason.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/PreferedSeniorityWithoutPrefTeamCallbackReason.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProblemBuilder.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProblemBuilder.java index 1d19040fb409cb4e930fdcec42d6752e60ff9a08..533eb5d4f61f9965b4bb12890c60d0a7f55bc93b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProblemBuilder.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProblemBuilder.java @@ -1,12 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by - * applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific - * language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedTasks.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedTasks.java index 37ed11e80532fff4977815866ebdd1fe7094fb45..f8828a10b66b58cf0a24810879a8ee8a2f1bf187 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedTasks.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedTasks.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedWarning.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedWarning.java index b5884fb51b84309bd07c55268f53952c7547ee71..9890f62a94c9de8e7353d1ce075485d447fa62e1 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedWarning.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/ProposedWarning.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; @@ -33,7 +35,8 @@ public abstract class ProposedWarning { /** * - * @param the employee who is the target of the warning + * @param the + * employee who is the target of the warning */ public ProposedWarning(Employee employee) { if (employee == null) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SiTable.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SiTable.java index 90de4cf010a3aa74c32b11c55ae502ac6c81d421..4ab3bb92e8a79aefcad08f2f5e0a3651feed9844 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SiTable.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SiTable.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SolveRunnable.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SolveRunnable.java index f3e211032b6479212322dc73ffe28b62617b6364..a1f5f85db2e79c8ff3606b4a8b6956ce6dee9f37 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SolveRunnable.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/SolveRunnable.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/Table.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/Table.java index 54dae18a2d447ee6b0edf1bb4ad0486424c0446d..79dc41f17159daf2dd5954a39c6b6853181b5a88 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/Table.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/Table.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; @@ -232,8 +234,8 @@ class Table { } /** - * This function return a view on the Gl table. Each entry in this table represent one Gl. An entry is a - * coefficient list (zero or one) defining if a task is part of the Gl. + * This function return a view on the Gl table. Each entry in this table represent one Gl. An entry is a coefficient + * list (zero or one) defining if a task is part of the Gl. * * @return the Gl table. */ @@ -254,8 +256,8 @@ class Table { } /** - * Return every Gl intersecting with the task k specified. The integer list correspond to a - * coefficient list for the tasks. + * Return every Gl intersecting with the task k specified. The integer list correspond to a coefficient + * list for the tasks. * * @param k * the task @@ -397,8 +399,7 @@ class Table { * This function return a view on the Tj table. Each entry in this table represent one team. An entry is a * coefficient list (zero or one) defining if the task is part of the team. *

- * If a task k is part of the team j, then tj().get(j)[k] equals ONE, otherwise it's - * null. + * If a task k is part of the team j, then tj().get(j)[k] equals ONE, otherwise it's null. * * @return the Tj table */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/UnassignedTaskCallbackReason.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/UnassignedTaskCallbackReason.java index 944d2af7746c75d1eef58d841600c8769c0f235d..64ec7ae811e99d94fce0b5dd2c9a65827e715c99 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/UnassignedTaskCallbackReason.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/core/planif/UnassignedTaskCallbackReason.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/ApplicationSettingPreferenceStore.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/ApplicationSettingPreferenceStore.java index 939a45f7eff9914a9bc31c3382dc3a8c481fb741..0727e0ab802c545bb7f4b2db48af408662b6ee2c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/ApplicationSettingPreferenceStore.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/ApplicationSettingPreferenceStore.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui; @@ -33,9 +35,8 @@ import com.planimod.core.ApplicationSettingManager; import com.planimod.core.PlanimodManagers; /** - * This implementation of of the {@link PreferenceStore} replace the persistence - * functions to load and save the data using the - * {@link ApplicationSettingManager} + * This implementation of of the {@link PreferenceStore} replace the persistence functions to load and save the data + * using the {@link ApplicationSettingManager} * * @author Patrik Dufresne */ @@ -64,8 +65,10 @@ public class ApplicationSettingPreferenceStore extends EventManager implements I /** * Create a new preference store from the managers. * - * @param managers the managers. - * @throws ManagerException in case of error querying the database. + * @param managers + * the managers. + * @throws ManagerException + * in case of error querying the database. */ public ApplicationSettingPreferenceStore(PlanimodManagers managers) throws ManagerException { if (managers == null) { @@ -126,8 +129,7 @@ public class ApplicationSettingPreferenceStore extends EventManager implements I } /** - * Get the value for the given name either from the local cache or from the - * manager. + * Get the value for the given name either from the local cache or from the manager. * * @param name * @return @@ -293,8 +295,8 @@ public class ApplicationSettingPreferenceStore extends EventManager implements I } /** - * Sets the value in the property cache and in application setting. This - * function should generate an event and fire a property change. + * Sets the value in the property cache and in application setting. This function should generate an event and fire + * a property change. * * @param p * @param name @@ -359,8 +361,7 @@ public class ApplicationSettingPreferenceStore extends EventManager implements I } /** - * This implementation sets the setting to null. The application manager - * should handle the default value. + * This implementation sets the setting to null. The application manager should handle the default value. */ @Override public void setToDefault(String name) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/DatabaseSelectorDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/DatabaseSelectorDialog.java index 04947e81ee4e8e1ff950a8c007ba7e41dc4a2ffc..2dba8871293268c62cef74a391ff8cf532ce99d2 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/DatabaseSelectorDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/DatabaseSelectorDialog.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui; @@ -75,8 +80,11 @@ public class DatabaseSelectorDialog extends TitleAreaDialog { private static Image getTitleImage() { Image image = JFaceResources.getImage(TITLE_IMAGE); if (image == null) { - OverlayImageDescriptor icon = new OverlayImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DLG_IMG_TITLE_BANNER), Resources - .getImageDescriptor(Resources.APP_ICON_48), SWT.LEFT, SWT.CENTER); + OverlayImageDescriptor icon = new OverlayImageDescriptor( + JFaceResources.getImageRegistry().getDescriptor(DLG_IMG_TITLE_BANNER), + Resources.getImageDescriptor(Resources.APP_ICON_48), + SWT.LEFT, + SWT.CENTER); JFaceResources.getImageRegistry().put(TITLE_IMAGE, icon); image = JFaceResources.getImage(TITLE_IMAGE); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Localized.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Localized.java index 1931fc1eb0e60fcb53912b1cfb6f4d7e3aaea88d..afd6ef604fde4773e1f42dcab0b81370c60407e1 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Localized.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Localized.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Main.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Main.java index 2b827c80252babbab9c6714de6ee405b7de6a746..892f00c1e961fe714d88a842b017d82010cdf221 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Main.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/Main.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodMainWindow.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodMainWindow.java index b63d8fd9a391feee9eb07ec604cafcce3b5430ab..3d1cf35204de380d38b54b003c6c4b97d5dcc136 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodMainWindow.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodMainWindow.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodPolicy.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodPolicy.java index 535cf8dff2e10461370bb1d4cd3e1ef11a843952..8c934831aa3ccffbc7a8274976e5bd6a0a990bbc 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodPolicy.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/PlanimodPolicy.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui; @@ -25,8 +27,7 @@ import org.eclipse.jface.util.Policy; public class PlanimodPolicy { /** - * This function should be used when an operation want to display an - * unexpected runtime error. + * This function should be used when an operation want to display an unexpected runtime error. *

* This implementation use the JFace {@link Policy} class to show the error. * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/BeanComputedValueProperty.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/BeanComputedValueProperty.java index dfd316626da1074a27e28b61b2456355704c9146..a707c75bbbcf7daf03d3f362e9292335d0428067 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/BeanComputedValueProperty.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/BeanComputedValueProperty.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ComputedObservableTimeRange.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ComputedObservableTimeRange.java index d9e61bbaaa8e7f9fa93a85590a6ea9304e70aafc..9c15b377a45383cd409356a96ab604276c88e858 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ComputedObservableTimeRange.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ComputedObservableTimeRange.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; @@ -64,8 +66,8 @@ public class ComputedObservableTimeRange extends ComputedObservableValue { } /** - * This implementation create a new instance of a time range using the value - * of the observable start date and end date. + * This implementation create a new instance of a time range using the value of the observable start date and end + * date. */ @Override protected Object calculate() { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/Converters.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/Converters.java index 04c38894a6c147cf8e4d425826cc9e85c0525f07..5e6de94248ccc56bc8b749205622ae7f5d0f884f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/Converters.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/Converters.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; @@ -72,8 +74,7 @@ public class Converters { } /** - * Create a converter to convert a date value to a string value. i.e.: Mon - * 14h30. + * Create a converter to convert a date value to a string value. i.e.: Mon 14h30. *

* If the date value is null, an empty string is returned. * @@ -92,8 +93,7 @@ public class Converters { } /** - * Create a converter to convert a date into it's string representation. - * i.e.: 13 sep 2012. + * Create a converter to convert a date into it's string representation. i.e.: 13 sep 2012. *

* If the date value is null, an empty string is returned. * @@ -160,8 +160,8 @@ public class Converters { private static IConverter removeFrontNumber; /** - * Return a converter to remove the front number of the team or section's - * name. This function always return the same instance of the converter. + * Return a converter to remove the front number of the team or section's name. This function always return the same + * instance of the converter. * * @return the converter. */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateColorControlStyleSupport.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateColorControlStyleSupport.java index 1f50b358918bc80e4cd6138f24687f58d926f0f1..d0650200344367186c878545bc403c206a8428af 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateColorControlStyleSupport.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateColorControlStyleSupport.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; @@ -49,8 +51,7 @@ public class DateColorControlStyleSupport { private Color inPast; /** - * This implementation update the background color of the - * widget based on the status. + * This implementation update the background color of the widget based on the status. */ @Override public void update(Control control, Object status) { @@ -69,8 +70,10 @@ public class DateColorControlStyleSupport { private Color getInPastColor() { if (this.inPast == null) { if (!JFaceResources.getColorRegistry().hasValueFor(IN_PAST)) { - RGB rgb = ColorUtil.blend(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(), Display.getDefault().getSystemColor( - SWT.COLOR_WIDGET_BACKGROUND).getRGB(), 50); + RGB rgb = ColorUtil.blend( + Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(), + Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).getRGB(), + 50); JFaceResources.getColorRegistry().put(IN_PAST, rgb); } this.inPast = JFaceResources.getColorRegistry().get(IN_PAST); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateFormatRangeValueProperty.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateFormatRangeValueProperty.java index b56169983bdded290edd30d515eceaa971356303..9fbb69e661ad737abe442dc15878bbc8f1d773ea 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateFormatRangeValueProperty.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/DateFormatRangeValueProperty.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; @@ -24,8 +26,7 @@ import com.patrikdufresne.util.DateFormatRegistry; import com.planimod.core.AbstractCalendarEvent; /** - * This value property return a formated date time range using the - * DateFormatRegistry. + * This value property return a formated date time range using the DateFormatRegistry. * * @author Patrik Dufresne * @@ -60,8 +61,7 @@ public class DateFormatRangeValueProperty extends BeanComputedValueProperty { } /** - * Static function used to return the list of property descriptors for this - * computed value property. + * Static function used to return the list of property descriptors for this computed value property. * * @return */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/EmployeePreferredPositionValueProperty.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/EmployeePreferredPositionValueProperty.java index 4e5d72662caa262d962c75427e9ff3d277420667..1893680b1a618e3b7a24a999b2f76974f922f51d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/EmployeePreferredPositionValueProperty.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/EmployeePreferredPositionValueProperty.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; @@ -30,8 +32,7 @@ public class EmployeePreferredPositionValueProperty extends BeanComputedValuePro * Create a new property value. * * @param noneString - * define the string value when the employee doesn't have a - * preferred position. + * define the string value when the employee doesn't have a preferred position. */ public EmployeePreferredPositionValueProperty(String noneString) { super(properties(), String.class); @@ -46,8 +47,7 @@ public class EmployeePreferredPositionValueProperty extends BeanComputedValuePro } /** - * Static function used to return the list of property descriptors for this - * computed value property. + * Static function used to return the list of property descriptors for this computed value property. * * @return */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ListObservableValue.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ListObservableValue.java index 64c3ea4f1f08127b5eb226421cddf647c98240f8..b578d96a73cd72490c3677c128bf398a86ecf70e 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ListObservableValue.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ListObservableValue.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekEnd.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekEnd.java index fbaf2b163e07ca03c3e94bada2138ee24cd1ba07..4840d4af0c84f52738752dd051b16ee123265207 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekEnd.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekEnd.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekStart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekStart.java index 779935db04168adab2b511618788c3a9c3d5f0da..11eed8752da89103b995cc8b58b5ebe3055f9d6d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekStart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/ObservableWeekStart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/SetContainsPropertyValue.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/SetContainsPropertyValue.java index 3d14c68ceb0a3697cdcda34bacedb58bd2c9b954..f24eb3706da14b1f59b2ee6079c8cb17de3b6d7a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/SetContainsPropertyValue.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/SetContainsPropertyValue.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/PlanimodObservables.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/PlanimodObservables.java index fc4fd831d365b8c9f5789d6a0e401a4eb2132aaf..f2b0bbf617ae57fd1e9a1aeb1edc5cd8a87af997 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/PlanimodObservables.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/PlanimodObservables.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding.manager; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/ShiftComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/ShiftComputedSet.java index 810da752bc0e272b21e0148af672707c2043f702..27c0e96efaf459362eade1303a45187ed3d0c23b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/ShiftComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/manager/ShiftComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding.manager; @@ -30,8 +32,7 @@ import com.planimod.core.PlanimodManagers; import com.planimod.core.Shift; /** - * This computed set wrap the - * {@link NonAvailabilityManager#list(java.util.Date, java.util.Date)} . + * This computed set wrap the {@link NonAvailabilityManager#list(java.util.Date, java.util.Date)} . * * @author Patrik Dufresne * @@ -64,8 +65,7 @@ public class ShiftComputedSet extends ManagedObjectComputedSet { } /** - * This implementation is calling the function - * {@link NonAvailabilityManager#list(java.util.Date, java.util.Date)} . + * This implementation is calling the function {@link NonAvailabilityManager#list(java.util.Date, java.util.Date)} . */ @Override protected Collection doList() throws ManagerException { @@ -76,8 +76,7 @@ public class ShiftComputedSet extends ManagedObjectComputedSet { } /** - * This implementation check if the element is part of a shift calendar - * entry and is within the time range. + * This implementation check if the element is part of a shift calendar entry and is within the time range. */ @Override protected boolean doSelect(Object element) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateProperties.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateProperties.java index 6f5b91776235a59e1bec40612bc6c7bfedc00a8e..b023e4b846a8f2607d2d4e2f430d29053275f55b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateProperties.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateProperties.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding.state; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateValueProperty.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateValueProperty.java index 1aaf19c6502d49eafa502ed1263b4dbb7c5cbfc2..549edaff9d3bb1f449acaa797e781d4bf2926119 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateValueProperty.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/databinding/state/StateValueProperty.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.databinding.state; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/preference/PlanimodPreferences.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/preference/PlanimodPreferences.java index 17ba2d3abf4d03798abd35a1294c604e4a5b7496..1c718caf811d57679d6a0ba6490226dff57c8f1b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/preference/PlanimodPreferences.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/preference/PlanimodPreferences.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.preference; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintFactory.java index aa3c28c22b5053645968a2d004b7d1c241f38deb..a1ce7c8a47a02368a239fd3e424c8f3fe5370916 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.printing; @@ -35,13 +37,12 @@ import com.patrikdufresne.printing.MultipleHeaderSingleFooterPrintFactory; import com.patrikdufresne.util.DateFormatRegistry; /** - * Default implementation if {@link IPrintFactory} for Planimod application. - * This factory provide default header and footer based on the title. + * Default implementation if {@link IPrintFactory} for Planimod application. This factory provide default header and + * footer based on the title. *

- * Sub-classes must implement the abstract function {@link #createBodyArea()} to - * create the content of this print factory. Default header will be created if - * the title or the subtitle is sets. Default footer is added with printing date - * and page count. + * Sub-classes must implement the abstract function {@link #createBodyArea()} to create the content of this print + * factory. Default header will be created if the title or the subtitle is sets. Default footer is added with printing + * date and page count. * * @author Patrik Dufresne * @@ -49,9 +50,8 @@ import com.patrikdufresne.util.DateFormatRegistry; public abstract class PlanimodPrintFactory extends MultipleHeaderSingleFooterPrintFactory { /** - * Instance of this class represent a printing section with a different - * header. This implementation create header using the title and subtitle - * value. + * Instance of this class represent a printing section with a different header. This implementation create header + * using the title and subtitle value. * * @author Patrik Dufresne * @@ -74,8 +74,7 @@ public abstract class PlanimodPrintFactory extends MultipleHeaderSingleFooterPri } /** - * This implementation create header using the title and subtitle value - * if not null. + * This implementation create header using the title and subtitle value if not null. */ @Override public Print createHeaderArea(PageNumber pageNumber) { @@ -110,8 +109,7 @@ public abstract class PlanimodPrintFactory extends MultipleHeaderSingleFooterPri private String title; /** - * Create a new print factory. Subclasses should set default title and sub - * title. + * Create a new print factory. Subclasses should set default title and sub title. * * @param jobName * the job name @@ -150,8 +148,8 @@ public abstract class PlanimodPrintFactory extends MultipleHeaderSingleFooterPri } /** - * This function is called to create the text value for the left sided - * footer. This implementation return a label 'print in date'. + * This function is called to create the text value for the left sided footer. This implementation return a label + * 'print in date'. * * @param pageNumber * The page number @@ -169,8 +167,8 @@ public abstract class PlanimodPrintFactory extends MultipleHeaderSingleFooterPri } /** - * This function is called to create the text value for the right sided - * footer. This implementation return the page count. + * This function is called to create the text value for the right sided footer. This implementation return the page + * count. * * @param pageNumber * @return @@ -187,8 +185,8 @@ public abstract class PlanimodPrintFactory extends MultipleHeaderSingleFooterPri } /** - * This implementation is creating a single section using the function - * #createBodyPrint to create the body of the section. + * This implementation is creating a single section using the function #createBodyPrint to create the body of the + * section. */ @Override protected void createSections() { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintUtil.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintUtil.java index c53d34319f21e78f2c4c5bf7358b7e1d51ec8709..c2d9da7a9b17a3ad5f645097a2a4fe6803223939 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintUtil.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PlanimodPrintUtil.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.printing; @@ -62,8 +64,7 @@ public class PlanimodPrintUtil { } /** - * This function return the employee's comments if available. Otherwise, it - * return an empty string. + * This function return the employee's comments if available. Otherwise, it return an empty string. * * @param employee * @return @@ -76,8 +77,7 @@ public class PlanimodPrintUtil { } /** - * This function return the hire date of the employee if the employee has - * preferences. + * This function return the hire date of the employee if the employee has preferences. * * @param pref * the employee preferences. @@ -91,8 +91,7 @@ public class PlanimodPrintUtil { } /** - * This function return the employee's name if available. Otherwise, it - * return an empty string. + * This function return the employee's name if available. Otherwise, it return an empty string. * * @param employee * @return diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PrintActionMenuManager.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PrintActionMenuManager.java index 20a9d2a2338baf0ea30118a201056594094e9d80..c791121c75fe916824e56efda770e1276207e767 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PrintActionMenuManager.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/printing/PrintActionMenuManager.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/PlaySound.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/PlaySound.java index 6aca6e08e8e676f9d0d52d89617333e83df06733..1b9c54df7130215fe20a059be45ee549ba78955a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/PlaySound.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/PlaySound.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.theme; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/Resources.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/Resources.java index 21bd6510d125ce2682689bd0b8ecb718f84f2ba9..be3493b3bc83b134b7d83b5cf2a543531ceeb8b3 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/Resources.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/theme/Resources.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.theme; @@ -28,8 +30,8 @@ import org.eclipse.swt.widgets.Display; import com.patrikdufresne.jface.resource.OverlayImageDescriptor; /** - * Utility class used to access resources for Planimod application. This class - * provide functions to avoid repeating codes related to {@link JFaceResources}. + * Utility class used to access resources for Planimod application. This class provide functions to avoid repeating + * codes related to {@link JFaceResources}. * * @author Patrik Dufresne * @@ -83,8 +85,8 @@ public class Resources { } /** - * Returns the image associated with the given key, or null if none. The - * image returned by this function should not be disposed. + * Returns the image associated with the given key, or null if none. The image returned by this function should not + * be disposed. * * @param key * the key @@ -106,8 +108,8 @@ public class Resources { } /** - * Return a font used to draw the week title. This method use the JFace font - * registry to avoid allocating the same font date multiple time. + * Return a font used to draw the week title. This method use the JFace font registry to avoid allocating the same + * font date multiple time. * * @return the font */ @@ -152,8 +154,13 @@ public class Resources { ir.put(ICON_PRINT_16, ImageDescriptor.createFromFile(Resources.class, "printer-printing-16.png")); ir.put(ICON_PRINT_48, ImageDescriptor.createFromFile(Resources.class, "printer-printing-48.png")); // Composite images - ir.put(DLG_EDIT_TITLE_IMAGE, new OverlayImageDescriptor(ir.getDescriptor(TitleAreaDialog.DLG_IMG_TITLE_BANNER), Resources - .getImageDescriptor(Resources.ICON_EDIT_48), SWT.LEFT, SWT.CENTER)); + ir.put( + DLG_EDIT_TITLE_IMAGE, + new OverlayImageDescriptor( + ir.getDescriptor(TitleAreaDialog.DLG_IMG_TITLE_BANNER), + Resources.getImageDescriptor(Resources.ICON_EDIT_48), + SWT.LEFT, + SWT.CENTER)); } } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/EmployeeViewerUtils.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/EmployeeViewerUtils.java index f522615810faf94ebb4bcaaf37a2fb187a0ae440..d69b002de227d616e2f2955145cc5a368175da5a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/EmployeeViewerUtils.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/EmployeeViewerUtils.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.viewers; @@ -42,8 +44,8 @@ public class EmployeeViewerUtils { } /** - * Create a new converter to convert an employee object into a string. This - * implementation return the employee's fullname. + * Create a new converter to convert an employee object into a string. This implementation return the employee's + * fullname. * * @return the converter */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/ProductionEventViewerUtils.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/ProductionEventViewerUtils.java index ddff5da608ec804ca09e4868cc3bb50a349d80a5..8fb3d02b5fd3cf9b0585d064d34a1b2b0bf542e5 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/ProductionEventViewerUtils.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/ProductionEventViewerUtils.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.viewers; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/ObservableMapPlannerLabelProviderWithColor.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/ObservableMapPlannerLabelProviderWithColor.java index 44b57aeaf004950fe118f0625c215c8400d2a9c6..a0ea18db6d76ae89a792edd532e6039211745fe8 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/ObservableMapPlannerLabelProviderWithColor.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/ObservableMapPlannerLabelProviderWithColor.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.viewers.planner; @@ -27,8 +29,7 @@ import com.patrikdufresne.planner.databinding.ObservableMapPlannerLabelProvider; import com.patrikdufresne.ui.ColorUtil; /** - * This specific implementation provide a different background color for the - * shift. + * This specific implementation provide a different background color for the shift. * * @author Patrik Dufresne * @@ -130,8 +131,8 @@ public class ObservableMapPlannerLabelProviderWithColor extends ObservableMapPla } /** - * This function is used to get a color object from the RGB. If the color is - * already register in the map, this value is return. + * This function is used to get a color object from the RGB. If the color is already register in the map, this value + * is return. * * @param value * the RGB value diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/PlanimodPlannerLook.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/PlanimodPlannerLook.java index 604d7d3b3479bbb3f876479b7c4a661b3ecd8ce9..92064f0e187d846a73ea196a612e8fa014ddecd5 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/PlanimodPlannerLook.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/viewers/planner/PlanimodPlannerLook.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.viewers.planner; @@ -33,8 +35,7 @@ import com.planimod.ui.databinding.Converters; import com.planimod.ui.theme.Resources; /** - * Class defining the planner look. This implementation overwrite some of the - * default look. + * Class defining the planner look. This implementation overwrite some of the default look. * * @author Patrik Dufresne * @@ -91,8 +92,10 @@ public class PlanimodPlannerLook extends DefaultPlannerLook { public Color getItemColor(Planner planner) { if (this.itemColor == null) { if (!JFaceResources.getColorRegistry().hasValueFor(ITEM_COLOR)) { - RGB rgb = ColorUtil.blend(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(), Display.getDefault().getSystemColor( - SWT.COLOR_LIST_SELECTION).getRGB(), 75); + RGB rgb = ColorUtil.blend( + Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(), + Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(), + 75); JFaceResources.getColorRegistry().put(ITEM_COLOR, rgb); } this.itemColor = JFaceResources.getColorRegistry().get(ITEM_COLOR); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/AbstractViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/AbstractViewPart.java index a04f646127473ded4a2c4af7699e9835fdfcb69d..acdae913322294400f95a98c3855f13b4023c709 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/AbstractViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/AbstractViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views; @@ -95,9 +97,8 @@ public abstract class AbstractViewPart extends ViewPart { } /** - * Create controls composing the central area. The default implementation - * create a viewer by calling the {@link #createViewer(Composite)}. - * function. + * Create controls composing the central area. The default implementation create a viewer by calling the + * {@link #createViewer(Composite)}. function. * * @param parent * the composite parent @@ -144,8 +145,7 @@ public abstract class AbstractViewPart extends ViewPart { } /** - * Create the controls used for filtering. They are usually placed at the - * top-right corner of the view. + * Create the controls used for filtering. They are usually placed at the top-right corner of the view. * * @param parent * the composite parent @@ -163,7 +163,7 @@ public abstract class AbstractViewPart extends ViewPart { // // Create the label // // Label label = new Label(comp, SWT.NONE); // // label.setText(Localized.get(AbstractViewPart.class, - // // "AbstractViewPart.filter")); + // // "AbstractViewPart.filter")); // // label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, // // false)); // @@ -173,7 +173,7 @@ public abstract class AbstractViewPart extends ViewPart { // // Text textFilter = new Text(comp, SWT.BORDER); // textFilter.setToolTipText(Localized.get(AbstractViewPart.class, - // "AbstractViewPart.filter")); + // "AbstractViewPart.filter")); // textFilter.setLayoutData(layoutdata); // // this.dbc.bindValue(WidgetProperties.text(SWT.Modify) @@ -183,9 +183,8 @@ public abstract class AbstractViewPart extends ViewPart { // } /** - * Sub-classes may implement this function to create a specific viewer. - * After calling this function, the viewer should be accessible by calling - * {@link AbstractViewPart#getViewer()}. To do so, the sub-classes may call + * Sub-classes may implement this function to create a specific viewer. After calling this function, the viewer + * should be accessible by calling {@link AbstractViewPart#getViewer()}. To do so, the sub-classes may call * {@link AbstractViewPart#setViewer(Viewer)} * * @param parent @@ -217,8 +216,7 @@ public abstract class AbstractViewPart extends ViewPart { } /** - * This function may be called by subclasses to add a text filter to the - * toolbar. + * This function may be called by subclasses to add a text filter to the toolbar. */ protected void fillToolbarWithTextFilter() { // Set a value to pattern. @@ -301,8 +299,7 @@ public abstract class AbstractViewPart extends ViewPart { // } /** - * Return the viewer previously create by calling the - * createViewer. + * Return the viewer previously create by calling the createViewer. * * @return the viewer or null. */ @@ -359,8 +356,7 @@ public abstract class AbstractViewPart extends ViewPart { } /** - * Create a new SashForm handling the restore and save process of the - * preferred weight. + * Create a new SashForm handling the restore and save process of the preferred weight. * * @param parent * the parent composite diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/ChangeDateAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/ChangeDateAction.java index cca7530120a2ee3e49325c467179dd1d8f0f378c..fab551896f4aec5e0fe6645e40b865ada2fc7ce9 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/ChangeDateAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/ChangeDateAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AboutDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AboutDialog.java index d067cbc285f1a05d223894889344f66203496f05..6a03fc647869d5b994888d2d3aebb0af9248c9f4 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AboutDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AboutDialog.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminPageViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminPageViewPart.java index e7392ea81a56e15ff5cf9b6617c7e8be4bfbbe8f..593c1cc55235afffa6bcb2a0d1cf83e682589521 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminPageViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminPageViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; @@ -44,9 +46,8 @@ import com.planimod.ui.views.admin.section.SectionPageViewPart; import com.planimod.ui.views.admin.team.TeamPageViewPart; /** - * This view part is the main page displayed in the administration view. It - * provide an easy way to display other page like the position page or the - * product page. + * This view part is the main page displayed in the administration view. It provide an easy way to display other page + * like the position page or the product page. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminViewPart.java index 835241645fd198ca7fd9e3b34fe62cc7833b03d9..a3f1bc487748ccce1565c6c3081b4866adddf88b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AdminViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; @@ -24,8 +26,7 @@ import com.planimod.ui.views.admin.section.SectionPageViewPart; import com.planimod.ui.views.admin.team.TeamPageViewPart; /** - * This view part is used to administer the advance parameter of the - * application. + * This view part is used to administer the advance parameter of the application. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferenceNode.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferenceNode.java index 7b1928878e775fe05db951761f923e5e72123035..8195188b784be6101a372470e89930378b39403f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferenceNode.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferenceNode.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferencePage.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferencePage.java index 63256c2fd062af1c7f6ed3c47aee88e354fa2e51..5f9a50acdf46f6a0cadd72e931ae09f099ab7b3a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferencePage.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/AppearancePreferencePage.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferenceNode.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferenceNode.java index 99a957c195dba8261ceb0d8ab44bdd7a576de355..f6f52ec48cf3f6289a07751503abcbcff04075a7 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferenceNode.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferenceNode.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferencePage.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferencePage.java index fe4a234bda3d0aa23e98e4a4801189d232f316a2..44be982e2b4244394a2222eefb8188ba9dfd3876 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferencePage.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/GeneralPreferencePage.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/AddPositionAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/AddPositionAction.java index f00929bca5c2209537d6457f958b174f1010c8cf..3fa7f22b04c221e79b2c6363a146ca676dea8452 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/AddPositionAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/AddPositionAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @@ -51,8 +53,7 @@ public class AddPositionAction extends AbstractAddAction implements ISelectionCh * Create a new action. * * @param shellProvider - * a shell provider in case the action need to display a message - * box. + * a shell provider in case the action need to display a message box. */ public AddPositionAction(PlanimodManagers managers, IShellProvider shellProvider, ISelectionProvider provider) { super(managers, shellProvider, provider); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/PositionPageViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/PositionPageViewPart.java index dea8cc98bbb7ec5211d009c9fae20eeb0d8408d2..c164b558d965d22a60c02ad559e21f99e127373b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/PositionPageViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/position/PositionPageViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.position; @@ -177,17 +179,25 @@ public class PositionPageViewPart extends AbstractViewPart { protected void createColumns(TableViewer viewer, IObservableSet knownPositions) { // RefId IBeanValueProperty redIfProperty = BeanProperties.value(Position.class, Position.REFID, String.class); - ColumnSupport.create(viewer, _("No."), knownPositions, redIfProperty).setWidth(75).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("No."), knownPositions, redIfProperty) + .setWidth(75) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Name IBeanValueProperty nameProperty = BeanProperties.value(Position.class, Position.NAME, String.class); - ColumnSupport.create(viewer, _("Nom"), knownPositions, nameProperty).setWidth(150).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Nom"), knownPositions, nameProperty) + .setWidth(150) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Section IObservableSet proposedSections = PlanimodObservables.listSection(getSite().getService(PlanimodManagers.class)); @@ -216,20 +226,26 @@ public class PositionPageViewPart extends AbstractViewPart { // Classified IValueProperty classifiedProperty = BeanProperties.value(Position.class, Position.CLASSIFIED, Boolean.TYPE); IValueProperty classifiedLabel = classifiedProperty.value(BindingProperties.convertedValue(Converters.booleanConverter())); - ColumnSupport.create(viewer, _("Classifié"), knownPositions, classifiedLabel).addPropertySorting().addCheckboxEditingSupport( - getDbc(), - classifiedProperty, - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Classifié"), knownPositions, classifiedLabel) + .addPropertySorting() + .addCheckboxEditingSupport( + getDbc(), + classifiedProperty, + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Swappable IBeanValueProperty swappableProperty = BeanProperties.value(Position.class, Position.SWAPPABLE, Boolean.TYPE); IValueProperty swappablesLabel = swappableProperty.value(BindingProperties.convertedValue(Converters.booleanConverter())); - ColumnSupport.create(viewer, _("Permutable"), knownPositions, swappablesLabel).addPropertySorting().addCheckboxEditingSupport( - getDbc(), - swappableProperty, - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Permutable"), knownPositions, swappablesLabel) + .addPropertySorting() + .addCheckboxEditingSupport( + getDbc(), + swappableProperty, + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductAction.java index 0609faca6aebd4b39a0dc42efd4255f92f0454b1..69dffd5dee688849445b2445afc922420a09ed37 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @@ -43,8 +45,7 @@ public class AddProductAction extends AbstractAddAction { * Create a new action. * * @param shellProvider - * a shell provider in case the action need to display a message - * box. + * a shell provider in case the action need to display a message box. */ public AddProductAction(PlanimodManagers managers, IShellProvider shellProvider, ISelectionProvider selectionProvider) { super(managers, shellProvider, selectionProvider); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductPositionAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductPositionAction.java index a2e4f5568fd513277ff29dd3433e4bb17467aca5..515271d3b3162285e21c4905633645a298ca19aa 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductPositionAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/AddProductPositionAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @@ -57,8 +59,7 @@ public class AddProductPositionAction extends AbstractAddAction { * Create a new action. * * @param shellProvider - * a shell provider in case the action need to display a message - * box. + * a shell provider in case the action need to display a message box. */ public AddProductPositionAction(PlanimodManagers managers, IShellProvider shellProvider, ISelectionProvider selectionProvider) { super(managers, shellProvider, selectionProvider); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/DuplicateProductAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/DuplicateProductAction.java index c4ba2c71209896a3c75c6dea57096b5bfe174e44..1eb6dba664e32cb11d589bbf4042c75f58c485e5 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/DuplicateProductAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/DuplicateProductAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.product; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPageViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPageViewPart.java index e9c5cd6c56732aad4f3fc2713a5dfd4ff9a0066a..19755c65c0400ef4d2a69b6aead84c6de512ab5f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPageViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPageViewPart.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.product; @@ -200,8 +205,10 @@ public class ProductPageViewPart extends AbstractViewPart { createProductPositionColumns(this.productPositionViewer, productPositions); this.productPositionViewer.setInput(productPositions); // Bind editor actions - dbc.bindValue(JFaceProperties.value(AddProductPositionAction.class, AddProductPositionAction.PRODUCT, AddProductPositionAction.PRODUCT).observe( - this.addActionProductPosition), selectedProduct); + dbc.bindValue( + JFaceProperties.value(AddProductPositionAction.class, AddProductPositionAction.PRODUCT, AddProductPositionAction.PRODUCT).observe( + this.addActionProductPosition), + selectedProduct); dbc.bindValue( JFaceProperties.value(RemoveAction.class, RemoveAction.OBJECT, RemoveAction.OBJECT).observe(this.removeActionProductPosition), ViewerProperties.singleSelection().observe(this.productPositionViewer)); @@ -212,8 +219,10 @@ public class ProductPageViewPart extends AbstractViewPart { getDbc().bindValue( JFaceProperties.value(RemoveAction.class, RemoveAction.OBJECTS, RemoveAction.OBJECTS).observe(this.removeAction), new ListObservableValue(selections, AbstractCalendarEvent.class)); - dbc.bindValue(JFaceProperties.value(DuplicateProductAction.class, DuplicateProductAction.PRODUCT, DuplicateProductAction.PRODUCT).observe( - this.duplicateProductAction), selectedProduct); + dbc.bindValue( + JFaceProperties.value(DuplicateProductAction.class, DuplicateProductAction.PRODUCT, DuplicateProductAction.PRODUCT).observe( + this.duplicateProductAction), + selectedProduct); } @@ -228,22 +237,34 @@ public class ProductPageViewPart extends AbstractViewPart { protected void createColumns(TableViewer viewer, IObservableSet knownProducts) { // RefId IBeanValueProperty refIdProperty = BeanProperties.value(Product.class, Product.REFID); - ColumnSupport.create(viewer, _("No."), knownProducts, refIdProperty).setWidth(75).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("No."), knownProducts, refIdProperty) + .setWidth(75) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Name IBeanValueProperty nameProperty = BeanProperties.value(Product.class, Product.NAME); - ColumnSupport.create(viewer, _("Nom"), knownProducts, nameProperty).setWidth(250).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Nom"), knownProducts, nameProperty) + .setWidth(250) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Family IBeanValueProperty familyProperty = BeanProperties.value(Product.class, Product.FAMILY); - ColumnSupport.create(viewer, _("Famille"), knownProducts, familyProperty).setWidth(150).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Famille"), knownProducts, familyProperty) + .setWidth(150) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS); } @@ -320,10 +341,12 @@ public class ProductPageViewPart extends AbstractViewPart { PlanimodManagers managers = getSite().getService(PlanimodManagers.class); // Number final IValueProperty numberProperty = BeanProperties.value(ProductPosition.class, ProductPosition.NUMBER, Integer.class); - ColumnSupport.create(viewer, _("Nombre"), knownElements, numberProperty).addPropertySorting().addTextEditingSupport( - dbc, - new ManagerUpdateValueStrategy(managers, UpdateValueStrategy.POLICY_CONVERT), - null).setPixelLayoutData(25).setMoveable(false); + ColumnSupport + .create(viewer, _("Nombre"), knownElements, numberProperty) + .addPropertySorting() + .addTextEditingSupport(dbc, new ManagerUpdateValueStrategy(managers, UpdateValueStrategy.POLICY_CONVERT), null) + .setPixelLayoutData(25) + .setMoveable(false); // Position IObservableSet positionProposeds = PlanimodObservables.listPosition(managers); IObservableMap positionProposedLabels = BeanProperties.value(Position.class, Position.NAME).observeDetail(positionProposeds); @@ -333,12 +356,18 @@ public class ProductPageViewPart extends AbstractViewPart { proposalCellEditor.setInput(positionProposeds); IValueProperty positionProperty = BeanProperties.value(ProductPosition.class, ProductPosition.POSITION, Position.class); IValueProperty positionLabel = BeanProperties.value(ProductPosition.class, ProductPosition.POSITION + DOT + Position.NAME, Position.class); - ColumnSupport.create(viewer, _("Poste"), knownElements, positionLabel).setWidth(150).addViewerEditingSupport( - dbc, - positionProperty, - proposalCellEditor, - new ManagerUpdateValueStrategy(managers, UpdateValueStrategy.POLICY_CONVERT), - null).setWeightLayoutData(1, 75).setResizable(false).setMoveable(false); + ColumnSupport + .create(viewer, _("Poste"), knownElements, positionLabel) + .setWidth(150) + .addViewerEditingSupport( + dbc, + positionProperty, + proposalCellEditor, + new ManagerUpdateValueStrategy(managers, UpdateValueStrategy.POLICY_CONVERT), + null) + .setWeightLayoutData(1, 75) + .setResizable(false) + .setMoveable(false); ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_EDITOR_COLUMNS); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionByProductComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionByProductComputedSet.java index d3daa0a0e7e850d9eb9766537601603477847e26..9357e00af60da92bef5ce1a64736581833b26ccb 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionByProductComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionByProductComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.product; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintAction.java index 9b3350b415b9de723b3170fe868b62ba12b7457c..841b7395ac957c8f56863f3fc7ef79160d977ec5 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.product; @@ -28,8 +30,7 @@ import com.planimod.ui.PlanimodPolicy; import com.planimod.ui.preference.PlanimodPreferences; /** - * This action allow the user to print a list of product and it's associated - * position. + * This action allow the user to print a list of product and it's associated position. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintFactory.java index db8f3e56dc3f20df58af95f345d77848cf498387..4a23ee4b240621b3a2b4799453660f1f10de6820 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/product/ProductPositionPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.product; @@ -45,8 +47,7 @@ import com.planimod.core.comparators.ProductComparators; import com.planimod.ui.printing.PlanimodPrintFactory; /** - * This class create a Employee Print Factory. It create a print listing - * employees. + * This class create a Employee Print Factory. It create a print listing employees. * * @author patapouf * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/AddSectionAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/AddSectionAction.java index 52840d17b46aa04d2af928477cff1c606576698d..9c78ff496857465cd5b717d00227e7cdcb369976 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/AddSectionAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/AddSectionAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @@ -43,8 +45,7 @@ public class AddSectionAction extends AbstractAddAction { * Create a new action. * * @param shellProvider - * a shell provider in case the action need to display a message - * box. + * a shell provider in case the action need to display a message box. */ public AddSectionAction(PlanimodManagers managers, IShellProvider shellProvider, ISelectionProvider selectionProvider) { super(managers, shellProvider, selectionProvider); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/SectionPageViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/SectionPageViewPart.java index 58c548eb6162375c42a66077c32f16ec9b73ba44..1619ccf706303bbd6f7bc91609af507e0dfd9d8e 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/SectionPageViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/section/SectionPageViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.section; @@ -127,10 +129,16 @@ public class SectionPageViewPart extends AbstractViewPart { // Name IBeanValueProperty nameProperty = BeanProperties.value(Section.class, Section.NAME); - ColumnSupport.create(viewer, _("Nom"), knownSections, nameProperty).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null).setWeightLayoutData(1, 75).setResizable(false).setMoveable(false); + ColumnSupport + .create(viewer, _("Nom"), knownSections, nameProperty) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null) + .setWeightLayoutData(1, 75) + .setResizable(false) + .setMoveable(false); ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/AddTeamAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/AddTeamAction.java index 54f53fb3563c71d79d54b9e07900c6ffcb52dd8e..de2e4a0abe84b97f1d31022f89b73cf07f92da38 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/AddTeamAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/AddTeamAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @@ -43,8 +45,7 @@ public class AddTeamAction extends AbstractAddAction { * Create a new action. * * @param shellProvider - * a shell provider in case the action need to display a message - * box. + * a shell provider in case the action need to display a message box. */ public AddTeamAction(PlanimodManagers managers, IShellProvider shellProvider, ISelectionProvider selectionProvider) { super(managers, shellProvider, selectionProvider); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/TeamPageViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/TeamPageViewPart.java index b7422ab87aecff8c89c15f91a2d5c507d235dbab..5d11f2165621ec811c2ee09b4c25fb4b43ad5e41 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/TeamPageViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/admin/team/TeamPageViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.admin.team; @@ -163,10 +165,16 @@ public class TeamPageViewPart extends AbstractViewPart { protected void createColumns(TableViewer viewer, IObservableSet knownTeams) { // Name columns IBeanValueProperty nameProperty = BeanProperties.value(Team.class, Team.NAME, String.class); - ColumnSupport.create(viewer, _("Nom"), knownTeams, nameProperty).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null).setWeightLayoutData(1, 75).setResizable(false).setMoveable(false); + ColumnSupport + .create(viewer, _("Nom"), knownTeams, nameProperty) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null) + .setWeightLayoutData(1, 75) + .setResizable(false) + .setMoveable(false); // Attach column preference ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/AddEmployeeAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/AddEmployeeAction.java index ea84d291669a37dd7e7737f2e53ff14e99e9cb3a..1221ddf4b27b48cb94eba5eb066f9e4dc356ff15 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/AddEmployeeAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/AddEmployeeAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @@ -49,8 +51,7 @@ public class AddEmployeeAction extends AbstractAddAction { * Create a new action. * * @param shellProvider - * a shell provider in case the action need to display a message - * box. + * a shell provider in case the action need to display a message box. */ public AddEmployeeAction(PlanimodManagers managers, IShellProvider shellProvider, ISelectionProvider selectionProvider) { super(managers, shellProvider, selectionProvider); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/ClassifiedPositionComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/ClassifiedPositionComputedSet.java index f291d81723fb07815273714f70acbc0b24c02d12..7f73d86eb7d4345635bf8a5eb4aa0eaa23f34096 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/ClassifiedPositionComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/ClassifiedPositionComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -40,11 +42,9 @@ public class ClassifiedPositionComputedSet extends ManagedObjectComputedSet { } /** - * Check if the element should be selected. Default implementation always - * return true. + * Check if the element should be selected. Default implementation always return true. *

- * Subclasses should override this function if it's override - * {@link #doList()}. + * Subclasses should override this function if it's override {@link #doList()}. * * @param element * the element to check diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintAction.java index 4e684c3927498c24c42160be46931ab66807984e..b70feb0c48b24748f45b3d97686b97ac9f8c21dd 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintFactory.java index 44595c5062a3c9887b3f50957d494ca7c0c3ae60..319bfbbd52df68c20b7b8208fd4f34c35a840500 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySectionPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -49,8 +51,7 @@ import com.planimod.ui.printing.PlanimodPrintFactory; import com.planimod.ui.printing.PlanimodPrintUtil; /** - * This class create a Employee Print Factory. It create a print listing - * employees. + * This class create a Employee Print Factory. It create a print listing employees. * * @author patapouf * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintAction.java index 99a47bf73fe163b592d4a6058151d2ed4c9f3225..7938627075c8ee943a50962142aceef5f37e14fd 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintFactory.java index 8d73451a6adcff56544fac6cd27a3f636072d076..19f57e48f17227f88952b0bafc416361937bcf07 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeBySeniorityPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -36,8 +38,7 @@ import com.planimod.ui.printing.PlanimodPrintFactory; import com.planimod.ui.printing.PlanimodPrintUtil; /** - * This class create a Employee Print Factory. It create a print listing - * employees. + * This class create a Employee Print Factory. It create a print listing employees. * * @author patapouf * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeEditPreferredPositionAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeEditPreferredPositionAction.java index 9c3e3a6a1e68828d9f98a0023f1bc001ad57c7c9..6b32d87362ee09173be7c580473e5b4aea4794c1 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeEditPreferredPositionAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeEditPreferredPositionAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -27,8 +29,7 @@ import com.planimod.core.PlanimodManagers; import com.planimod.ui.PlanimodPolicy; /** - * Action to edit the preferred position of an employee. This action open a new - * dialog to edit the preferred position. + * Action to edit the preferred position of an employee. This action open a new dialog to edit the preferred position. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferenceComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferenceComputedSet.java index baf19466881e66e846441b04f04657565335a6e4..81fb596573ac4b6b7658207144473dba1e368aad 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferenceComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferenceComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -30,8 +32,7 @@ import com.planimod.core.EmployeePreference; import com.planimod.core.PlanimodManagers; /** - * A computed set to compute only the employee preferences for un-archived - * employee. + * A computed set to compute only the employee preferences for un-archived employee. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamAddAllAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamAddAllAction.java index cd54bb13491780e61ec511e1b663762eb95d7511..03f9156fc7acb71fa2d1c80495850bd0912a61d9 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamAddAllAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamAddAllAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamLabelProvider.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamLabelProvider.java index a086862c58223aa67045ab528c66f3b108e7f264..5594b75965ed7a8f69546ce7966960bc92ed159c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamLabelProvider.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamLabelProvider.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -33,8 +35,7 @@ import org.eclipse.swt.custom.CCombo; import com.planimod.ui.views.planif.EmployeeLabelWithAnnotation; /** - * This implementation of label provider display the item order in front of the - * team name. + * This implementation of label provider display the item order in front of the team name. *

* i.e.: 1. Jour semaine * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamMoveAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamMoveAction.java index 2e3c5b99e0685bcebb6a7e1398f06e9dd06d1069..220fa5fb6d1c9668853fb54820c20d7cc49fc8b7 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamMoveAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamMoveAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -33,8 +35,7 @@ import com.planimod.ui.PlanimodPolicy; import com.planimod.ui.theme.Resources; /** - * This class is used to change the order of the preferred team of an employee. - * This action required to be disposed. + * This class is used to change the order of the preferred team of an employee. This action required to be disposed. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamRemoveAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamRemoveAction.java index 7a201cd24043ad275dfae468ff6aa4f964b53071..522fa698d4456d4ff605ca5c03e02a4e90e24a12 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamRemoveAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeePreferredTeamRemoveAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -99,8 +101,7 @@ public class EmployeePreferredTeamRemoveAction extends Action { } /** - * This implementation remove the current shifts from the preferred shift - * list. + * This implementation remove the current shifts from the preferred shift list. */ @Override public void run() { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeViewPart.java index 040d5fffa0986c587eec570f8fedc899d7f9fcf3..6c3eea4bc66b911f502715a9abcc260b577e47e0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/EmployeeViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -235,8 +237,12 @@ public class EmployeeViewPart extends AbstractViewPart { // Bind Hire date IObservableValue hireDate = BeanProperties.value(Employee.class, Employee.HIRE_DATE, Date.class).observeDetail(employee); IObservableValue hireDateTime = new WritableValue(null, Date.class); - DateTimeSupport dts = DateTimeSupport.create(this.hireTime, dbc, hireDateTime, DateFormatRegistry.getFormat(DateFormatRegistry.TIME - | DateFormatRegistry.SHORT), DateTimeSupport.STEP_60); + DateTimeSupport dts = DateTimeSupport.create( + this.hireTime, + dbc, + hireDateTime, + DateFormatRegistry.getFormat(DateFormatRegistry.TIME | DateFormatRegistry.SHORT), + DateTimeSupport.STEP_60); if (this.hireTime.getLayoutData() instanceof GridData) { ((GridData) this.hireTime.getLayoutData()).widthHint = dts.getWidthHint(); } @@ -259,58 +265,73 @@ public class EmployeeViewPart extends AbstractViewPart { null); // Bind preferred position IObservableValue preferredPositionLabel = (new EmployeePreferredPositionValueProperty(_("Aucune préférence"))).observeDetail(selection); - dbc.bindValue(JFaceProperties.value( - EmployeeEditPreferredPositionAction.class, - EmployeeEditPreferredPositionAction.TEXT, - EmployeeEditPreferredPositionAction.TEXT).observe(this.preferredPositionAction), preferredPositionLabel); - dbc.bindValue(JFaceProperties.value( - EmployeeEditPreferredPositionAction.class, - EmployeeEditPreferredPositionAction.TOOL_TIP_TEXT, - EmployeeEditPreferredPositionAction.TOOL_TIP_TEXT).observe(this.preferredPositionAction), preferredPositionLabel); - dbc.bindValue(JFaceProperties.value( - EmployeeEditPreferredPositionAction.class, - EmployeeEditPreferredPositionAction.EMPLOYEE_PREFERENCE, - EmployeeEditPreferredPositionAction.EMPLOYEE_PREFERENCE).observe(this.preferredPositionAction), selection); + dbc.bindValue( + JFaceProperties.value( + EmployeeEditPreferredPositionAction.class, + EmployeeEditPreferredPositionAction.TEXT, + EmployeeEditPreferredPositionAction.TEXT).observe(this.preferredPositionAction), + preferredPositionLabel); + dbc.bindValue( + JFaceProperties.value( + EmployeeEditPreferredPositionAction.class, + EmployeeEditPreferredPositionAction.TOOL_TIP_TEXT, + EmployeeEditPreferredPositionAction.TOOL_TIP_TEXT).observe(this.preferredPositionAction), + preferredPositionLabel); + dbc.bindValue( + JFaceProperties.value( + EmployeeEditPreferredPositionAction.class, + EmployeeEditPreferredPositionAction.EMPLOYEE_PREFERENCE, + EmployeeEditPreferredPositionAction.EMPLOYEE_PREFERENCE).observe(this.preferredPositionAction), + selection); // Bind preferred team viewer // Avoid creating columns for this viewer Since the data will not // display properly. See bug #176. IObservableList preferredTeams = BeanProperties.list(EmployeePreference.class, EmployeePreference.PREFERRED_TEAM, Team.class).observeDetail(selection); this.preferredTeamViewer.setContentProvider(new ObservableListContentProvider()); - this.preferredTeamViewer.setLabelProvider(new EmployeePreferredTeamLabelProvider(BeanProperties.value(Team.class, Team.NAME).value( - BindingProperties.convertedValue(Converters.removeFrontNumber())).observeDetail(new ListToSetAdapter(preferredTeams)), preferredTeams)); + this.preferredTeamViewer.setLabelProvider(new EmployeePreferredTeamLabelProvider(BeanProperties + .value(Team.class, Team.NAME) + .value(BindingProperties.convertedValue(Converters.removeFrontNumber())) + .observeDetail(new ListToSetAdapter(preferredTeams)), preferredTeams)); this.preferredTeamViewer.setInput(preferredTeams); IObservableValue preferredTeamSelection = ViewerProperties.singleSelection().observe(this.preferredTeamViewer); IViewerObservableList preferredTeamSelections = ViewerProperties.multipleSelection().observe(this.preferredTeamViewer); // Add all - dbc.bindValue(JFaceProperties.value( - EmployeePreferredTeamAddAllAction.class, - EmployeePreferredTeamAddAllAction.EMPLOYEE_PREFERENCE, - EmployeePreferredTeamAddAllAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamAddAllAction), selection); + dbc.bindValue( + JFaceProperties.value( + EmployeePreferredTeamAddAllAction.class, + EmployeePreferredTeamAddAllAction.EMPLOYEE_PREFERENCE, + EmployeePreferredTeamAddAllAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamAddAllAction), + selection); // Remove action - dbc.bindValue(JFaceProperties.value( - EmployeePreferredTeamRemoveAction.class, - EmployeePreferredTeamRemoveAction.EMPLOYEE_PREFERENCE, - EmployeePreferredTeamRemoveAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamRemoveAction), selection); - dbc - .bindValue(JFaceProperties.value( + dbc.bindValue( + JFaceProperties.value( + EmployeePreferredTeamRemoveAction.class, + EmployeePreferredTeamRemoveAction.EMPLOYEE_PREFERENCE, + EmployeePreferredTeamRemoveAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamRemoveAction), + selection); + dbc.bindValue( + JFaceProperties.value( EmployeePreferredTeamRemoveAction.class, EmployeePreferredTeamRemoveAction.SHIFTS, - EmployeePreferredTeamRemoveAction.SHIFTS).observe(this.preferredTeamRemoveAction), new ListObservableValue( - preferredTeamSelections, - Team.class)); + EmployeePreferredTeamRemoveAction.SHIFTS).observe(this.preferredTeamRemoveAction), + new ListObservableValue(preferredTeamSelections, Team.class)); // Move up - dbc.bindValue(JFaceProperties.value( - EmployeePreferredTeamMoveAction.class, - EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE, - EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamMoveUpAction), selection); + dbc.bindValue( + JFaceProperties.value( + EmployeePreferredTeamMoveAction.class, + EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE, + EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamMoveUpAction), + selection); dbc.bindValue(JFaceProperties .value(EmployeePreferredTeamMoveAction.class, EmployeePreferredTeamMoveAction.SHIFT, EmployeePreferredTeamMoveAction.SHIFT) .observe(this.preferredTeamMoveUpAction), preferredTeamSelection); // Move down - dbc.bindValue(JFaceProperties.value( - EmployeePreferredTeamMoveAction.class, - EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE, - EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamMoveDownAction), selection); + dbc.bindValue( + JFaceProperties.value( + EmployeePreferredTeamMoveAction.class, + EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE, + EmployeePreferredTeamMoveAction.EMPLOYEE_PREFERENCE).observe(this.preferredTeamMoveDownAction), + selection); dbc.bindValue(JFaceProperties .value(EmployeePreferredTeamMoveAction.class, EmployeePreferredTeamMoveAction.SHIFT, EmployeePreferredTeamMoveAction.SHIFT) .observe(this.preferredTeamMoveDownAction), preferredTeamSelection); @@ -424,10 +445,10 @@ public class EmployeeViewPart extends AbstractViewPart { } /** - * Create the required column to display the preferred shifts and the - * associated order. + * Create the required column to display the preferred shifts and the associated order. * - * @param viewer the parent viewer + * @param viewer + * the parent viewer */ private void createPreferredTeamColumns(final TableViewer viewer, IObservableSet knownElements) { // Team @@ -438,34 +459,49 @@ public class EmployeeViewPart extends AbstractViewPart { /** * Create columns in the table viewer. * - * @param viewer the table viewer - * @param employeePreferences the known elements + * @param viewer + * the table viewer + * @param employeePreferences + * the known elements */ private void createViewerColumns(TableViewer viewer, IObservableSet employeePreferences) { // RedId IValueProperty refIdProperty = BeanProperties.value(EmployeePreference.class, EmployeePreference.EMPLOYEE + DOT + Employee.REFID); - ColumnSupport.create(viewer, _("No."), employeePreferences, refIdProperty).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("No."), employeePreferences, refIdProperty) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // FirstName IValueProperty firstnameProperty = BeanProperties.value(EmployeePreference.class, EmployeePreference.EMPLOYEE + DOT + Employee.FIRSTNAME); - ColumnSupport.create(viewer, ("Prénom"), employeePreferences, firstnameProperty).setWidth(150).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, ("Prénom"), employeePreferences, firstnameProperty) + .setWidth(150) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Lastname IValueProperty lastnameProperty = BeanProperties.value(EmployeePreference.class, EmployeePreference.EMPLOYEE + DOT + Employee.LASTNAME); - ColumnSupport.create(viewer, _("Nom"), employeePreferences, lastnameProperty).setWidth(150).addPropertySorting().addTextEditingSupport( - getDbc(), - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Nom"), employeePreferences, lastnameProperty) + .setWidth(150) + .addPropertySorting() + .addTextEditingSupport( + getDbc(), + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // HireDate IValueProperty hireDateLabelProperty = BeanProperties.value(EmployeePreference.class, EmployeePreference.EMPLOYEE + DOT + Employee.HIRE_DATE).value( BindingProperties.convertedValue(Converters.shortDateConverter())); - ColumnSupport.create(viewer, _("Date d'ancienneté"), employeePreferences, hireDateLabelProperty).setWidth(150).addPropertySorting( - new SelfValueProperty(EmployeePreference.class), - EmployeePreferenceComparators.bySeniority()).activateSorting(); + ColumnSupport + .create(viewer, _("Date d'ancienneté"), employeePreferences, hireDateLabelProperty) + .setWidth(150) + .addPropertySorting(new SelfValueProperty(EmployeePreference.class), EmployeePreferenceComparators.bySeniority()) + .activateSorting(); // Preferred Seniority IValueProperty preferredSeniorityProperty = BeanProperties.value(EmployeePreference.class, EmployeePreference.EMPLOYEE + DOT diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/PreferredPositionDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/PreferredPositionDialog.java index 75b3a3db97312a5f5c66b745ecbd73bd4ee6e12e..ca675ae3b10d4e9867fc3d47ed912b1949607bde 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/PreferredPositionDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/employees/PreferredPositionDialog.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.employees; @@ -200,8 +202,7 @@ public class PreferredPositionDialog extends TitleAreaDialog { } /** - * This implementation create the required widget to select the preferred - * position for an employee. + * This implementation create the required widget to select the preferred position for an employee. */ @Override protected Control createDialogArea(Composite parent) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/AddNonAvailabilityAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/AddNonAvailabilityAction.java index fb0b5a97ca9cc3b4b46fa8c47d37c6da7a8813ee..405e190c99e2b33aad8fd7f47d0c1ab11b24b117 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/AddNonAvailabilityAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/AddNonAvailabilityAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/EditNonAvailabilityAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/EditNonAvailabilityAction.java index f9fdc46d6e4ea24da12a1bcaaa05baed339e2ddc..4ceb3e237747d337b9e8366ee22695c8b8e9d24c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/EditNonAvailabilityAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/EditNonAvailabilityAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; @@ -40,9 +42,8 @@ import com.planimod.ui.theme.Resources; public class EditNonAvailabilityAction extends Action { /** - * Property name of this action non-availability event (value - * "nonAvailability"). The non-availability property is used to - * define the object to edit. + * Property name of this action non-availability event (value "nonAvailability"). The non-availability + * property is used to define the object to edit. */ public static final String NON_AVAILABILITY = "nonAvailability"; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesComputedSet.java index 131c224b5bf8863472dfa1eee224c792f38809da..98a9071efa2b7702882fb81a69d63432ddf20b2b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; @@ -36,9 +38,7 @@ import com.planimod.core.NonAvailabilityManager; import com.planimod.core.PlanimodManagers; /** - * This computed set wrap the - * {@link NonAvailabilityManager#listByVisibility(Date, Date, boolean)} - * function. + * This computed set wrap the {@link NonAvailabilityManager#listByVisibility(Date, Date, boolean)} function. * * @author Patrik Dufresne * @@ -114,8 +114,7 @@ public class NonAvailabilitiesComputedSet extends ManagedObjectComputedSet { } /** - * This implementation check if the element is part of a shift calendar - * entry and is within the time range. + * This implementation check if the element is part of a shift calendar entry and is within the time range. */ @Override protected boolean doSelect(Object element) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesViewPart.java index 54cb87ae2ab2996fd5245d6e01aa1e434bb35d2b..5252b6e7ff26fbedd53810590452f158d5fa4145 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilitiesViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityDialog.java index 9e72cfb94290c347cd44a3b6515c2cd848aaf036..0d0fbb1063fe8e1a8ff71bd4608e08e026fb4a98 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityDialog.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; @@ -164,8 +166,7 @@ public class NonAvailabilityDialog extends TitleAreaDialog { * Create a new dialog. * * @param parentShell - * the parent shell, or null to create a top-level - * shell + * the parent shell, or null to create a top-level shell */ public NonAvailabilityDialog(Shell parentShell, PlanimodManagers managers, int style) { super(parentShell); @@ -176,8 +177,7 @@ public class NonAvailabilityDialog extends TitleAreaDialog { } /** - * This function is called by {@link #bindValues()} to bind the values - * related to employee selection. + * This function is called by {@link #bindValues()} to bind the values related to employee selection. * * @param dbc */ @@ -216,8 +216,7 @@ public class NonAvailabilityDialog extends TitleAreaDialog { } /** - * This function is called by {@link #bindValues()} to bind the start and - * end values. + * This function is called by {@link #bindValues()} to bind the start and end values. * * @param dbc */ @@ -228,8 +227,12 @@ public class NonAvailabilityDialog extends TitleAreaDialog { // Bind start date time WritableValue startTimeValue = new WritableValue(null, Date.class); - DateTimeSupport startTimeSupport = DateTimeSupport.create(this.startTime, dbc, startTimeValue, DateFormatRegistry.getFormat(DateFormatRegistry.TIME - | DateFormatRegistry.MEDIUM), DateTimeSupport.STEP_60); + DateTimeSupport startTimeSupport = DateTimeSupport.create( + this.startTime, + dbc, + startTimeValue, + DateFormatRegistry.getFormat(DateFormatRegistry.TIME | DateFormatRegistry.MEDIUM), + DateTimeSupport.STEP_60); dbc.bindValue(new DateAndTimeObservableValue(SWTObservables.observeSelection(this.startDate), startTimeValue), middleStart); if (this.endTime.getLayoutData() instanceof GridData) { ((GridData) this.startTime.getLayoutData()).widthHint = startTimeSupport.getWidthHint(); @@ -237,8 +240,12 @@ public class NonAvailabilityDialog extends TitleAreaDialog { // Bind end date time WritableValue endTimeValue = new WritableValue(null, Date.class); - DateTimeSupport endTimeSupport = DateTimeSupport.create(this.endTime, dbc, endTimeValue, DateFormatRegistry.getFormat(DateFormatRegistry.TIME - | DateFormatRegistry.MEDIUM), DateTimeSupport.STEP_60); + DateTimeSupport endTimeSupport = DateTimeSupport.create( + this.endTime, + dbc, + endTimeValue, + DateFormatRegistry.getFormat(DateFormatRegistry.TIME | DateFormatRegistry.MEDIUM), + DateTimeSupport.STEP_60); if (this.endTime.getLayoutData() instanceof GridData) { ((GridData) this.endTime.getLayoutData()).widthHint = endTimeSupport.getWidthHint(); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintAction.java index 08aee9222c054a9ad27b66a34f22321dd4239f4b..15a2d482b50ccc8f341089582cbb10879e9c6b5c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; @@ -54,8 +56,8 @@ import com.planimod.ui.preference.PlanimodPreferences; public class NonAvailabilityPrintAction extends PrintAction { /** - * Property name of an action's date (value "date"). The date - * property is used to know the time range to be printed by this action. + * Property name of an action's date (value "date"). The date property is used to know the time range + * to be printed by this action. */ public static final String DATE = "date"; @@ -96,8 +98,10 @@ public class NonAvailabilityPrintAction extends PrintAction { /** * Create a new Print Employee Action * - * @param shell A Shell provider used to create new windows - * @param operation type of operation : PRINT or PREVIEW + * @param shell + * A Shell provider used to create new windows + * @param operation + * type of operation : PRINT or PREVIEW */ public NonAvailabilityPrintAction(PlanimodManagers managers, IShellProvider shell, int operation, IRunnableContext context) { super(shell, new NonAvailabilityPrintFactory(), operation, context); @@ -145,7 +149,8 @@ public class NonAvailabilityPrintAction extends PrintAction { /** * This implementation set the employee to print * - * @param factory the factory + * @param factory + * the factory */ @Override protected void initFactory(IPrintFactory factory) { @@ -238,8 +243,9 @@ public class NonAvailabilityPrintAction extends PrintAction { // Keep reference on the user selection. this.firstDayOfWeek = store.getInt(ApplicationSetting.FIRST_DAY_OF_WEEK); this.title = dlg.getPrintTitle(); - this.range = new ConcreteTimeRange(TimeRanges.getFirstDayOfFirstWeekOfMonth(dlg.getStart(), this.firstDayOfWeek), TimeRanges - .getLastDayOfLastWeekOfMonth(dlg.getEnd(), this.firstDayOfWeek)); + this.range = new ConcreteTimeRange( + TimeRanges.getFirstDayOfFirstWeekOfMonth(dlg.getStart(), this.firstDayOfWeek), + TimeRanges.getLastDayOfLastWeekOfMonth(dlg.getEnd(), this.firstDayOfWeek)); this.filter = dlg.getFilter(); // Generate the print. super.run(); @@ -266,7 +272,8 @@ public class NonAvailabilityPrintAction extends PrintAction { /** * Sets the date state to be updated. * - * @param date the state. + * @param date + * the state. */ public void setDate(Date date) { if ((this.date == null && date != null) || (this.date != null && date == null) || (this.date != null && date != null && !date.equals(this.date))) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintDialog.java index b594922069aac3c76595eeba100a491641f1ac6c..c11fd208e00c352c17bb27bd0224d363a1772863 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintDialog.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; @@ -56,15 +58,13 @@ import com.planimod.core.TimeRanges; import com.planimod.ui.theme.Resources; /** - * This dialog implementation is used to let the user select the printing time - * range for the non-availability print factory. + * This dialog implementation is used to let the user select the printing time range for the non-availability print + * factory. *

- * Notice, the time range provided by this dialog doesn't matches the expected - * time range of the print factory. This dialog, allow the user to select the - * months to be printed. The method {@link #getStart()} return the starting - * month to be printed inclusively. The method {@link #getEnd()} return the - * ending month to be printed inclusively. To print a single month, this class - * will then return the same date value as starting and ending date. + * Notice, the time range provided by this dialog doesn't matches the expected time range of the print factory. This + * dialog, allow the user to select the months to be printed. The method {@link #getStart()} return the starting month + * to be printed inclusively. The method {@link #getEnd()} return the ending month to be printed inclusively. To print a + * single month, this class will then return the same date value as starting and ending date. * * @author Patrik Dufresne */ @@ -83,8 +83,11 @@ public class NonAvailabilityPrintDialog extends TitleAreaDialog { private static Image getTitleImage() { Image image = JFaceResources.getImage(TITLE_IMAGE); if (image == null) { - OverlayImageDescriptor icon = new OverlayImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DLG_IMG_TITLE_BANNER), Resources - .getImageDescriptor(Resources.ICON_PRINT_48), SWT.LEFT, SWT.CENTER); + OverlayImageDescriptor icon = new OverlayImageDescriptor( + JFaceResources.getImageRegistry().getDescriptor(DLG_IMG_TITLE_BANNER), + Resources.getImageDescriptor(Resources.ICON_PRINT_48), + SWT.LEFT, + SWT.CENTER); JFaceResources.getImageRegistry().put(TITLE_IMAGE, icon); image = JFaceResources.getImage(TITLE_IMAGE); } @@ -133,7 +136,8 @@ public class NonAvailabilityPrintDialog extends TitleAreaDialog { /** * Create a new dialog. * - * @param parentShell the parent shell. + * @param parentShell + * the parent shell. */ public NonAvailabilityPrintDialog(Shell parentShell) { super(parentShell); @@ -313,7 +317,8 @@ public class NonAvailabilityPrintDialog extends TitleAreaDialog { /** * Sets the ending month (inclusive). * - * @param date the new date value or null to unset. + * @param date + * the new date value or null to unset. */ public void setEnd(Date date) { this.endDateValue.setValue(date); @@ -322,7 +327,8 @@ public class NonAvailabilityPrintDialog extends TitleAreaDialog { /** * Set the starting month (inclusive). * - * @param date the new date value or null to unset. + * @param date + * the new date value or null to unset. */ public void setStart(Date date) { this.startDateValue.setValue(date); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintFactory.java index c1c8c765f9f3c58f55a584eb7745dc7c10ff7668..1e624ec512ef66bba2b282e278ba879d20edc799 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/nonavailabilities/NonAvailabilityPrintFactory.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.nonavailabilities; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/CreateTasksAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/CreateTasksAction.java index f311f4a547f859347dabac226d4416aba264a336..751bdfd90be9c3767498f4edee25c41fa30d2294 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/CreateTasksAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/CreateTasksAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeByTaskProposedForContextComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeByTaskProposedForContextComputedSet.java index 6453ea686e7930bc3554b141b5e422a0a7e73362..f574b9fd2024358eea121d35aeef74b631ce85f0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeByTaskProposedForContextComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeByTaskProposedForContextComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -32,8 +34,7 @@ import com.planimod.core.planif.GeneratePlanifContext; import com.planimod.ui.PlanimodPolicy; /** - * This observable set provide collection of {@link Employee}. This function is - * wrapping the function + * This observable set provide collection of {@link Employee}. This function is wrapping the function * {@link GeneratePlanifContext#listEmployeeByTaskProposed(Task)}. * * @author Patrik Dufresne @@ -84,8 +85,7 @@ public class EmployeeByTaskProposedForContextComputedSet extends ManagedObjectCo } /** - * This implementation query the database to get the employees qualify for - * all null planif event. + * This implementation query the database to get the employees qualify for all null planif event. */ @Override protected Collection doList() throws ManagerException { @@ -101,8 +101,7 @@ public class EmployeeByTaskProposedForContextComputedSet extends ManagedObjectCo } /** - * Return the current task value or null if the observable doesn't contain - * an {@link Task} object. + * Return the current task value or null if the observable doesn't contain an {@link Task} object. * * @return the current Task or null. */ @@ -116,9 +115,8 @@ public class EmployeeByTaskProposedForContextComputedSet extends ManagedObjectCo /** * This function notify this class about manager update. *

- * This implementation can't determine what required to be updated in the - * cached, so a full update is required. to do so, the observable set is - * make dirty. + * This implementation can't determine what required to be updated in the cached, so a full update is required. to + * do so, the observable set is make dirty. */ @Override protected void notifyIfChanged(ManagerEvent event) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeForContextComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeForContextComputedSet.java index 007440ab5c46082e91acfd3266b326ee5bbf9f60..624854d386d9eb0c0125c847d834f76ae3cbeb6c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeForContextComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeForContextComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -27,8 +29,8 @@ import com.planimod.core.planif.GeneratePlanifContext; import com.planimod.ui.PlanimodPolicy; /** - * This observable set provide collection of employees. This function is - * wrapping the {@link GeneratePlanifContext#listEmployee()}. + * This observable set provide collection of employees. This function is wrapping the + * {@link GeneratePlanifContext#listEmployee()}. * * @author Patrik Dufresne * @@ -72,8 +74,7 @@ public class EmployeeForContextComputedSet extends ManagedObjectComputedSet { } /** - * This implementation query the database to get the employees qualify for - * all null planif event. + * This implementation query the database to get the employees qualify for all null planif event. */ @Override protected Collection doList() throws ManagerException { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeLabelWithAnnotation.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeLabelWithAnnotation.java index 84bc2cd2fcce10cdaf211f7362ce7fd5d6e5acec..d20c0ac11a93f21ed74db4e41d94a07995be6244 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeLabelWithAnnotation.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeeLabelWithAnnotation.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -26,8 +28,8 @@ import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; import org.eclipse.jface.viewers.LabelProviderChangedEvent; /** - * This label provide display a label using an IObserbale map and add an - * annotation if the element is part of an IObservable set. + * This label provide display a label using an IObserbale map and add an annotation if the element is part of an + * IObservable set. * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeesWithTaskProposedForContextComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeesWithTaskProposedForContextComputedSet.java index f3bc7c88e60a02cc2420cfa9cf55cce1f218bed1..8af29342c008b1eb9a5230922628b6782435e164 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeesWithTaskProposedForContextComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/EmployeesWithTaskProposedForContextComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -25,8 +27,8 @@ import com.planimod.core.Employee; import com.planimod.core.planif.GeneratePlanifContext; /** - * This observable set provide collection of employees with offer. This function - * is wrapping the {@link GeneratePlanifContext#listEmployeeWithTaskProposed()}. + * This observable set provide collection of employees with offer. This function is wrapping the + * {@link GeneratePlanifContext#listEmployeeWithTaskProposed()}. * * @author Patrik Dufresne * @@ -70,8 +72,7 @@ public class EmployeesWithTaskProposedForContextComputedSet extends ManagedObjec } /** - * This implementation query the database to get the employees qualify for - * all null planif event. + * This implementation query the database to get the employees qualify for all null planif event. */ @Override protected Collection doList() throws ManagerException { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/GeneratePlanifAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/GeneratePlanifAction.java index 48e964f8d242a1d5ae0ac18b994039aecd277dfd..1137b9ff3edaa5fc30ac16de6bdf558148c6e9a7 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/GeneratePlanifAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/GeneratePlanifAction.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/PlanifViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/PlanifViewPart.java index cd132505c4da51f1b2a4d828405dfd783a1d81e2..22c183cbc663307d6ce8635040afa21498584a31 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/PlanifViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/PlanifViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -102,8 +104,7 @@ public class PlanifViewPart extends PageBookViewPart { } /** - * This implementation bind the planimod state with the Generate planif - * context. + * This implementation bind the planimod state with the Generate planif context. */ protected void bindValues() { /** @@ -149,8 +150,8 @@ public class PlanifViewPart extends PageBookViewPart { } /** - * Return the generate planif context of this view part. This function - * should be used by the pages to share the same context. + * Return the generate planif context of this view part. This function should be used by the pages to share the same + * context. * * @return the generate planif context. */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedTaskViewPartPage.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedTaskViewPartPage.java index 61f923e4c04101f6ceaab7e97369ec59111684a9..52eb3707b66b4a12be7060ce023e0ce7f440eb1c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedTaskViewPartPage.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedTaskViewPartPage.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -231,8 +233,10 @@ public class ProposedTaskViewPartPage extends AbstractViewPart implements IViewP */ getDbc().bindValue( SWTObservables.observeText(this.dateLabel), - BeanProperties.value(GeneratePlanifContext.class, GeneratePlanifContext.START).value( - BindingProperties.convertedValue(Converters.weekTitleConverter())).observe(context)); + BeanProperties + .value(GeneratePlanifContext.class, GeneratePlanifContext.START) + .value(BindingProperties.convertedValue(Converters.weekTitleConverter())) + .observe(context)); /* * Bind the employee viewer to manager model */ @@ -258,8 +262,10 @@ public class ProposedTaskViewPartPage extends AbstractViewPart implements IViewP * Bind warnings */ ProposedWarningComputedSet proposedWarning = new ProposedWarningComputedSet(context, selectedEmployee); - IObservableValue warningsText = CollectionProperties.set().value(BindingProperties.convertedValue(new ProposedWarningsToStringConverter())).observe( - proposedWarning); + IObservableValue warningsText = CollectionProperties + .set() + .value(BindingProperties.convertedValue(new ProposedWarningsToStringConverter())) + .observe(proposedWarning); getDbc().bindValue(FormWidgetProperties.text(true, false).observe(this.warningsFormText), warningsText); ControlStyleSupport.create(this.warningsFormText, warningsText, new ControlStyleUpdater() { @@ -361,9 +367,11 @@ public class ProposedTaskViewPartPage extends AbstractViewPart implements IViewP IValueProperty teamLabel = BeanProperties .value(Task.class, Task.PRODUCTION_EVENT + DOT + ProductionEvent.SHIFT + DOT + Shift.TEAM + DOT + Team.NAME) .value(BindingProperties.convertedValue(Converters.removeFrontNumber())); - ColumnSupport.create(viewer, _("Équipe"), knownElements, teamLabel).setWidth(150).addPropertySorting( - new SelfValueProperty(Task.class), - TaskComparators.byTeam()).activateSorting(); + ColumnSupport + .create(viewer, _("Équipe"), knownElements, teamLabel) + .setWidth(150) + .addPropertySorting(new SelfValueProperty(Task.class), TaskComparators.byTeam()) + .activateSorting(); // Time Range IValueProperty timeRangeProperty = DateFormatRangeValueProperty.createTimeMedium(); IValueProperty startDateProperty = BeanProperties.value(Task.class, AbstractCalendarEvent.START_DATE); @@ -371,11 +379,14 @@ public class ProposedTaskViewPartPage extends AbstractViewPart implements IViewP // Locked IValueProperty lockedProperty = BeanProperties.value(Task.class, Task.LOCKED, Boolean.TYPE); IValueProperty lockedLabel = lockedProperty.value(BindingProperties.convertedValue(Converters.booleanConverter())); - ColumnSupport.create(viewer, _("Verrouillé"), knownElements, lockedLabel).addPropertySorting().addCheckboxEditingSupport( - getDbc(), - lockedProperty, - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Verrouillé"), knownElements, lockedLabel) + .addPropertySorting() + .addCheckboxEditingSupport( + getDbc(), + lockedProperty, + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Attach a column preference ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS_CURRENT_TASK); } @@ -414,19 +425,20 @@ public class ProposedTaskViewPartPage extends AbstractViewPart implements IViewP comboViewer.setInput(proposedEmployees); IValueProperty employeeProperty = BeanProperties.value(Task.class, Task.EMPLOYEE); IValueProperty employeeLabel = employeeProperty.value(BindingProperties.convertedValue(EmployeeViewerUtils.fullnameConverter())); - ColumnSupport.create(viewer, _("Employé"), knownElements, employeeLabel).setWidth(150).addPropertySorting().addViewerEditingSupport( - getDbc(), - employeeProperty, - employeeCellEditor, - new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), - null); + ColumnSupport + .create(viewer, _("Employé"), knownElements, employeeLabel) + .setWidth(150) + .addPropertySorting() + .addViewerEditingSupport(getDbc(), employeeProperty, employeeCellEditor, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null); // Team IValueProperty teamLabel = BeanProperties .value(Task.class, Task.PRODUCTION_EVENT + DOT + ProductionEvent.SHIFT + DOT + Shift.TEAM + DOT + Team.NAME) .value(BindingProperties.convertedValue(Converters.removeFrontNumber())); - ColumnSupport.create(viewer, _("Équipe"), knownElements, teamLabel).setWidth(150).addPropertySorting( - new SelfValueProperty(Task.class), - TaskComparators.byTeam()).activateSorting(); + ColumnSupport + .create(viewer, _("Équipe"), knownElements, teamLabel) + .setWidth(150) + .addPropertySorting(new SelfValueProperty(Task.class), TaskComparators.byTeam()) + .activateSorting(); // Time Range IValueProperty timeRangeProperty = DateFormatRangeValueProperty.createTimeMedium(); IValueProperty startDateProperty = BeanProperties.value(Task.class, AbstractCalendarEvent.START_DATE); @@ -435,11 +447,14 @@ public class ProposedTaskViewPartPage extends AbstractViewPart implements IViewP final IObservableValue selectedEmployee = ViewersObservables.observeSingleSelection(this.employeeViewer); IValueProperty lockedProperty = new TaskLockedValueProperty(selectedEmployee); IValueProperty lockedLabel = BeanProperties.value(Task.class, Task.LOCKED).value(BindingProperties.convertedValue(Converters.booleanConverter())); - ColumnSupport.create(viewer, _("Verrouillé"), knownElements, lockedLabel).addPropertySorting().addCheckboxEditingSupport( - getDbc(), - lockedProperty, - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Verrouillé"), knownElements, lockedLabel) + .addPropertySorting() + .addCheckboxEditingSupport( + getDbc(), + lockedProperty, + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Attach a column preference ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS_OFFER_TASK); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningComputedSet.java index b2dd87742410dbd2079f3ba5fa710cc4413f1aca..1350ab7b64a61b3bcf00bd5090b1621c0b848e1c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -95,8 +97,7 @@ public class ProposedWarningComputedSet extends ManagedObjectComputedSet { } /** - * This implementation query the database to get the employees qualify for - * all null planif event. + * This implementation query the database to get the employees qualify for all null planif event. */ @Override protected Collection doList() throws ManagerException { @@ -107,8 +108,7 @@ public class ProposedWarningComputedSet extends ManagedObjectComputedSet { } /** - * Return the current employee value or null if the observable doesn't - * contain an employee object. + * Return the current employee value or null if the observable doesn't contain an employee object. * * @return the current employee or null. */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningsToStringConverter.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningsToStringConverter.java index ef2d0f1f0ef70b2181ee9b5ace9e140ff26f3dc0..a61439e69cd7a83a8edb903b1971be35e47ce21b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningsToStringConverter.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/ProposedWarningsToStringConverter.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskByEmployeeForContextComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskByEmployeeForContextComputedSet.java index ff7ac80eb30260ba083e9412400ac367be5d414d..5f4d818068568ce60b971ef967875983bd85c077 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskByEmployeeForContextComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskByEmployeeForContextComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -32,8 +34,8 @@ import com.planimod.core.planif.GeneratePlanifContext; import com.planimod.ui.PlanimodPolicy; /** - * This observable set provide collection of {@link Task}. This function is - * wrapping the {@link GeneratePlanifContext#listTaskByEmployee(Employee)}. + * This observable set provide collection of {@link Task}. This function is wrapping the + * {@link GeneratePlanifContext#listTaskByEmployee(Employee)}. * * @author Patrik Dufresne * @@ -95,8 +97,7 @@ public class TaskByEmployeeForContextComputedSet extends ManagedObjectComputedSe } /** - * This implementation query the database to get the employees qualify for - * all null planif event. + * This implementation query the database to get the employees qualify for all null planif event. */ @Override protected Collection doList() throws ManagerException { @@ -112,8 +113,7 @@ public class TaskByEmployeeForContextComputedSet extends ManagedObjectComputedSe } /** - * Return the current employee value or null if the observable doesn't - * contain an employee object. + * Return the current employee value or null if the observable doesn't contain an employee object. * * @return the current employee or null. */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskComputedSet.java index 943a46079f9f34828bb3d514416074332c68b224..282290f6087cf49be7c9b246623e8ff1f1527d4b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -32,8 +34,7 @@ import com.planimod.core.PlanimodManagers; /** * This computed set is used to wrap the function - * {@link NonAvailabilityManager#listProductionEvents(Planif, Date, Date)} and - * make it observable. + * {@link NonAvailabilityManager#listProductionEvents(Planif, Date, Date)} and make it observable. * * @param managers * the managers to use @@ -70,9 +71,7 @@ public class TaskComputedSet extends ManagedObjectComputedSet { } /** - * This implementation run the - * {@link TaskManager#list(Planif, Date, Date)} - * function. + * This implementation run the {@link TaskManager#list(Planif, Date, Date)} function. */ @Override protected Collection doList() throws ManagerException { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskForContextComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskForContextComputedSet.java index d771c570cb44e4231df71877349453d96474378b..c691df524709e543da6ebaad46d7e9feeb67d741 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskForContextComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskForContextComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -31,8 +33,7 @@ import com.planimod.ui.PlanimodPolicy; /** * This computed set is used to wrap the function - * {@link NonAvailabilityManager#listProductionEvents(Planif, Date, Date)} and - * make it observable. + * {@link NonAvailabilityManager#listProductionEvents(Planif, Date, Date)} and make it observable. * */ public class TaskForContextComputedSet extends ManagedObjectComputedSet { @@ -73,8 +74,7 @@ public class TaskForContextComputedSet extends ManagedObjectComputedSet { } /** - * This implementation run the - * {@link TaskManager#listByPlanif(Planif, Date, Date) }. function. + * This implementation run the {@link TaskManager#listByPlanif(Planif, Date, Date) }. function. */ @Override protected Collection doList() throws ManagerException { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskLockedValueProperty.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskLockedValueProperty.java index 26762af8c60b789635fd45fad57d8d58d790f185..8a3b14da78c695ff0fa395fddc253b444a9c2cf0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskLockedValueProperty.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskLockedValueProperty.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -33,8 +35,7 @@ import com.planimod.ui.databinding.BeanComputedValueProperty; public class TaskLockedValueProperty extends BeanComputedValueProperty { /** - * Static function used to return the list of property descriptors for this - * computed value property. + * Static function used to return the list of property descriptors for this computed value property. * * @return */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskProposedByEmployeeForContextComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskProposedByEmployeeForContextComputedSet.java index 0f3d868e41cb5a028ec94f16720cd702cf4c1948..8ffc3d8cd6d2dd0f771a5e501d3f1bca0c9361c9 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskProposedByEmployeeForContextComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskProposedByEmployeeForContextComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -31,8 +33,7 @@ import com.planimod.core.planif.GeneratePlanifContext; import com.planimod.ui.PlanimodPolicy; /** - * This observable set provide collection of {@link Task}. This function wrap - * the function + * This observable set provide collection of {@link Task}. This function wrap the function * {@link GeneratePlanifContext#listTaskProposedByEmployee(Employee)}. * * @author Patrik Dufresne @@ -85,8 +86,7 @@ public class TaskProposedByEmployeeForContextComputedSet extends ManagedObjectCo } /** - * This implementation query the database to get the employees qualify for - * all null planif event. + * This implementation query the database to get the employees qualify for all null planif event. */ @Override protected Collection doList() throws ManagerException { @@ -102,8 +102,7 @@ public class TaskProposedByEmployeeForContextComputedSet extends ManagedObjectCo } /** - * Return the current employee value or null if the observable doesn't - * contain an employee object. + * Return the current employee value or null if the observable doesn't contain an employee object. * * @return the current employee or null. */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskViewPartPage.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskViewPartPage.java index 5ec07a7885f5a4884f92f4ca245a0773327b0e2b..f1669268a70ee9e80bb610b3b722c1284b2fcf2e 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskViewPartPage.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/TaskViewPartPage.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif; @@ -181,8 +183,10 @@ public class TaskViewPartPage extends AbstractViewPart implements IViewPartPage */ getDbc().bindValue( SWTObservables.observeText(this.dateLabel), - BeanProperties.value(GeneratePlanifContext.class, GeneratePlanifContext.START).value( - BindingProperties.convertedValue(Converters.weekTitleConverter())).observe(context)); + BeanProperties + .value(GeneratePlanifContext.class, GeneratePlanifContext.START) + .value(BindingProperties.convertedValue(Converters.weekTitleConverter())) + .observe(context)); /* * Bind the viewer content. @@ -211,8 +215,10 @@ public class TaskViewPartPage extends AbstractViewPart implements IViewPartPage /* * Bind remove action to production events */ - IObservableValue productionEvent = ViewerProperties.singleSelection().value(BeanProperties.value(Task.class, Task.PRODUCTION_EVENT)).observe( - this.viewer); + IObservableValue productionEvent = ViewerProperties + .singleSelection() + .value(BeanProperties.value(Task.class, Task.PRODUCTION_EVENT)) + .observe(this.viewer); getDbc().bindValue(JFaceProperties.value(RemoveAction.class, RemoveAction.OBJECT, RemoveAction.OBJECT).observe(this.removeAction), productionEvent); } @@ -246,20 +252,25 @@ public class TaskViewPartPage extends AbstractViewPart implements IViewPartPage IValueProperty employeeProperty = BeanProperties.value(Task.class, Task.EMPLOYEE); IValueProperty employeeLabel = employeeProperty.value(BindingProperties.convertedValue(EmployeeViewerUtils.fullnameConverter())); - ColumnSupport.create(viewer, _("Employé"), knownElements, employeeLabel).addPropertySorting().setWidth(150).addViewerEditingSupport( - getDbc(), - employeeProperty, - employeeCellEditor, - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Employé"), knownElements, employeeLabel) + .addPropertySorting() + .setWidth(150) + .addViewerEditingSupport( + getDbc(), + employeeProperty, + employeeCellEditor, + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Team IValueProperty teamLabel = BeanProperties .value(Task.class, Task.PRODUCTION_EVENT + DOT + ProductionEvent.SHIFT + DOT + Shift.TEAM + DOT + Team.NAME) .value(BindingProperties.convertedValue(Converters.removeFrontNumber())); - ColumnSupport.create(viewer, _("Équipe"), knownElements, teamLabel).setWidth(150).addPropertySorting( - new SelfValueProperty(Task.class), - TaskComparators.byTeam()); + ColumnSupport + .create(viewer, _("Équipe"), knownElements, teamLabel) + .setWidth(150) + .addPropertySorting(new SelfValueProperty(Task.class), TaskComparators.byTeam()); // Time Range IValueProperty timeRangeProperty = DateFormatRangeValueProperty.createTimeMedium(); @@ -269,11 +280,14 @@ public class TaskViewPartPage extends AbstractViewPart implements IViewPartPage // Locked IValueProperty lockedProperty = BeanProperties.value(Task.class, Task.LOCKED, Boolean.TYPE); IValueProperty lockedLabel = lockedProperty.value(BindingProperties.convertedValue(Converters.booleanConverter())); - ColumnSupport.create(viewer, _("Verrouillé"), knownElements, lockedLabel).addPropertySorting().addCheckboxEditingSupport( - getDbc(), - lockedProperty, - new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), - null); + ColumnSupport + .create(viewer, _("Verrouillé"), knownElements, lockedLabel) + .addPropertySorting() + .addCheckboxEditingSupport( + getDbc(), + lockedProperty, + new ManagerUpdateValueStrategy(getSite().getService(PlanimodManagers.class), UpdateValueStrategy.POLICY_CONVERT), + null); // Attach a column preference ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_COLUMNS); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/DataTable.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/DataTable.java index 32886904f9701e0114402d830e8c685e10903208..06c45f9fc62db0a653123790d360e17a33f2e0f4 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/DataTable.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/DataTable.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/GridHelper.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/GridHelper.java index 6591edd3eb16ddff4c721d4de4235249e2eb897e..87a56c5d63effe8d9ba6bb3394ed8555185a1c3c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/GridHelper.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/GridHelper.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; @@ -28,9 +30,8 @@ import net.sf.paperclips.TextPrint; import com.patrikdufresne.printing.FontDataUtil; /** - * This class is used to handle the creation of a grid printed on multiple - * column but with a minimum number of rows determine by the totla number if - * item in the grid. + * This class is used to handle the creation of a grid printed on multiple column but with a minimum number of rows + * determine by the totla number if item in the grid. *

* This class is intended to be used to print grid for the planif report. * @@ -52,8 +53,7 @@ public class GridHelper { int groupId; Print print; /** - * True to force the print to be display even if their is only one - * group. + * True to force the print to be display even if their is only one group. */ boolean force; } @@ -158,8 +158,7 @@ public class GridHelper { * @param string * the group name name * @param force - * True to force the group name to be displayed even if their is - * only one group in the print. + * True to force the group name to be displayed even if their is only one group in the print. */ public void addGroup(String string, boolean force) { addGroup(string == null ? null : new TextPrint(string, FontDataUtil.BOLD_SMALL), force); @@ -176,8 +175,8 @@ public class GridHelper { } /** - * Defaulot method to add an employee to the current section. This function - * is same as calling {@link #addItem(Print)} with a TextPrint. + * Defaulot method to add an employee to the current section. This function is same as calling + * {@link #addItem(Print)} with a TextPrint. * * @param nonAvailabilityDesc */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintAction.java index 1e86c5ebe1056b975554c8e37d1e064f8cc4f854..e44f56cfd74a62a3a8825599240b178abdf52d90 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; @@ -113,9 +115,10 @@ public class PlanifDaySummaryPrintAction extends PrintAction { ((PlanifDaySummaryPrintFactory) factory).setEmployeePreferences(this.context.listEmployeePreferences()); - ((PlanifDaySummaryPrintFactory) factory).setNonAvailabilties(this.context.getManagers().getNonAvailabilityManager().list( - this.context.getStart(), - this.context.getEnd())); + ((PlanifDaySummaryPrintFactory) factory).setNonAvailabilties(this.context + .getManagers() + .getNonAvailabilityManager() + .list(this.context.getStart(), this.context.getEnd())); } catch (ManagerException e) { PlanimodPolicy.showException(e); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintFactory.java index 6285d025f6f24314c0a80c34d1aac8dccb20370a..625f152bc8fc8fbba6feee51218283bae3420853 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifDaySummaryPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifSummaryHelper.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifSummaryHelper.java index 973e81581e6ce7873fc53abadf64d5e46bc7c6ce..5db533cbf0f522f136c15b0061a6fa069ca85128 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifSummaryHelper.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifSummaryHelper.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; @@ -42,8 +44,7 @@ import com.planimod.ui.viewers.EmployeeViewerUtils; public class PlanifSummaryHelper { /** - * Return a string representation of the production information with the - * number of required employee. + * Return a string representation of the production information with the number of required employee. * * @param production * @param count @@ -66,8 +67,7 @@ public class PlanifSummaryHelper { } /** - * Format the employee name as follow. - * [] [] + * Format the employee name as follow. [] [] * * @param count * the employee count @@ -138,8 +138,7 @@ public class PlanifSummaryHelper { } /** - * Return a string representation of the non-availability: - * -

() + * Return a string representation of the non-availability: - () * * @param na * the non-availability. @@ -199,16 +198,13 @@ public class PlanifSummaryHelper { /** * Return a string representation of the vacant tasks. *

- * The received collection should correspond to the same task with different - * day for the same team. If the collection doesn't represent the same task, - * this function return an unexpected value. + * The received collection should correspond to the same task with different day for the same team. If the + * collection doesn't represent the same task, this function return an unexpected value. * * @param tasks - * collection of tasks representing a position within one team - * being vacant. + * collection of tasks representing a position within one team being vacant. * - * @return the description of the task being vacant. e.g.: - - * + * @return the description of the task being vacant. e.g.: - */ public static String getVacantDesc(Collection tasks) { if (tasks.size() == 0) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintAction.java index c50c9187531729f95257f2af92041fd1e0c9467e..1c5b83bb07ef83bdf1ebafdc63f7c685ecd70541 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; @@ -112,9 +114,10 @@ public class PlanifWeekSummaryPrintAction extends PrintAction { ((PlanifWeekSummaryPrintFactory) factory).setEmployeePreferences(this.context.listEmployeePreferences()); - ((PlanifWeekSummaryPrintFactory) factory).setNonAvailabilties(this.context.getManagers().getNonAvailabilityManager().list( - this.context.getStart(), - this.context.getEnd())); + ((PlanifWeekSummaryPrintFactory) factory).setNonAvailabilties(this.context + .getManagers() + .getNonAvailabilityManager() + .list(this.context.getStart(), this.context.getEnd())); } catch (ManagerException e) { PlanimodPolicy.showException(e); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintFactory.java index 15182a6ac918284be6fa773620835b975780f080..858135a66ef5ffd0b14b2bc07c55b9c5983fa130 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekSummaryPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; @@ -57,8 +59,7 @@ import com.planimod.ui.printing.PlanimodPrintFactory; import com.planimod.ui.printing.PlanimodPrintUtil; /** - * This class is used to generate a planif report. This report intend to - * generalized the solution. + * This class is used to generate a planif report. This report intend to generalized the solution. * * @author Patrik Dufresne * @@ -306,8 +307,7 @@ public class PlanifWeekSummaryPrintFactory extends PlanimodPrintFactory { } /** - * Sets the non-availabilities to be printed. There is no filter on the data - * provided. + * Sets the non-availabilities to be printed. There is no filter on the data provided. * * @param nonAvailabilities */ diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintAction.java index 4cf32f7da48a04b96ddbacf344f645cb5bf0f892..a460a41e9bed6fe463b405594ef0db2d6e670b8f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintFactory.java index ec30c70c827151eb05102cc8029a14507304cfb7..bcaa3ea0c79ebd190ce24c1c35f792fdfdc4b4c0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintFactory.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintWizard.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintWizard.java index 632e1f74772db7f0a17cf1d46ca52ff3575f9e6b..c0515db4b87e3d48c88c0f1fe77c6bdfc1f09197 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintWizard.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertPrintWizard.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertWizardPage.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertWizardPage.java index 895750db466c075e2b7c64b193fdf9e1589e107d..303cef0749df7dda4f4fe0c4a8aae7adae75af8c 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertWizardPage.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/planif/printing/PlanifWeekTransfertWizardPage.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.planif.printing; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventAction.java index 1bfe181132210f317dca295de3cbf0db89fd6940..a04a9aef0d6746ddcab0172a137281a95f4eee28 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; @@ -37,8 +39,7 @@ import com.planimod.ui.PlanimodPolicy; import com.planimod.ui.theme.Resources; /** - * This action is used to duplicate the production events from one week to the - * other week. + * This action is used to duplicate the production events from one week to the other week. * * @author Patrik Dufresne * @@ -46,8 +47,8 @@ import com.planimod.ui.theme.Resources; public class DuplicateProductionEventAction extends Action { /** - * Property name of an action's date (value "date"). The date - * property is used to know the time range to be printed by this action. + * Property name of an action's date (value "date"). The date property is used to know the time range + * to be printed by this action. */ public static final String DATE = "date"; /** diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventDialog.java index b826df22f25effdce3b0eeadb6c2515a00ac621c..6a8084d4f96346918af97bf6fd79e5d4bb8d6013 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/DuplicateProductionEventDialog.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; @@ -71,8 +73,11 @@ public class DuplicateProductionEventDialog extends TitleAreaDialog { private static Image getTitleImage() { Image image = JFaceResources.getImage(TITLE_IMAGE); if (image == null) { - OverlayImageDescriptor icon = new OverlayImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DLG_IMG_TITLE_BANNER), Resources - .getImageDescriptor(Resources.ICON_DUPLICATE_48), SWT.LEFT, SWT.CENTER); + OverlayImageDescriptor icon = new OverlayImageDescriptor( + JFaceResources.getImageRegistry().getDescriptor(DLG_IMG_TITLE_BANNER), + Resources.getImageDescriptor(Resources.ICON_DUPLICATE_48), + SWT.LEFT, + SWT.CENTER); JFaceResources.getImageRegistry().put(TITLE_IMAGE, icon); image = JFaceResources.getImage(TITLE_IMAGE); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventAction.java index 700664f6ed573a7098745da5ccef055c0bd98828..9d8b150d331090efe0162757e172af3749432359 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventDialog.java index 94f787fde1be31587888c8273d04aecb1ad3166a..d335ad3e31f8430a8fa685fb5d026fd866126b3d 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/EditProductionEventDialog.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; @@ -196,14 +201,19 @@ public class EditProductionEventDialog extends TitleAreaDialog { /* * Bind the team label. */ - this.dbc.bindValue(WidgetProperties.text().observe(this.teamLabel), BeanProperties.value(Shift.class, Shift.TEAM + DOT + Team.NAME).value( - BindingProperties.convertedValue(Converters.removeFrontNumber())).observeDetail(this.shift)); + this.dbc.bindValue( + WidgetProperties.text().observe(this.teamLabel), + BeanProperties + .value(Shift.class, Shift.TEAM + DOT + Team.NAME) + .value(BindingProperties.convertedValue(Converters.removeFrontNumber())) + .observeDetail(this.shift)); /* * Bind date to date label */ - this.dbc.bindValue(SWTObservables.observeText(this.dateLabel), new DateFormatRangeValueProperty(DateFormatRegistry.TIME | DateFormatRegistry.LONG) - .observeDetail(this.shift)); + this.dbc.bindValue( + SWTObservables.observeText(this.dateLabel), + new DateFormatRangeValueProperty(DateFormatRegistry.TIME | DateFormatRegistry.LONG).observeDetail(this.shift)); /* * Bind product viewer diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductLabelObservableMap.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductLabelObservableMap.java index a614138e2f0bed4245d28e909316e686b95b39d0..171700649f435e69ccf8c593773a03d49532f584 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductLabelObservableMap.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductLabelObservableMap.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventComputedSet.java index 6fe88d4ed3929797900838ac9aa9935be161adc3..194e98781dc23d93633fb121c7b34a483f67eca7 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; @@ -31,8 +33,7 @@ import com.planimod.core.ProductionEventManager; /** * This computed set wrap the function - * {@link ProductionEventManager#listProductionEvents(com.planimod.core.Planif, java.util.Date, java.util.Date)} - * . + * {@link ProductionEventManager#listProductionEvents(com.planimod.core.Planif, java.util.Date, java.util.Date)} . * * @author Patrik Dufresne * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventLabelObservableMap.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventLabelObservableMap.java index b05bd1ea7599396418cb42e016d6881f916ceccc..0451c9afd36f6c243681d97192bfdf1e3011ee3f 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventLabelObservableMap.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionEventLabelObservableMap.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionViewPart.java index b053130270a520d277229095b5f57809b93df05c..4d1bbeb13d4cc64ecd799baf44548ee5d785dc7b 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ProductionViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; @@ -141,8 +143,10 @@ public class ProductionViewPart extends AbstractViewPart { IObservableMap shiftLabels = new ShiftProductionEventObservableMap(getSite().getService(PlanimodManagers.class), shifts); IObservableMap shiftStart = BeanProperties.value(AbstractCalendarEvent.class, AbstractCalendarEvent.START_DATE, Date.class).observeDetail(shifts); IObservableMap shiftEnd = BeanProperties.value(AbstractCalendarEvent.class, AbstractCalendarEvent.END_DATE, Date.class).observeDetail(shifts); - IObservableMap color = BeanProperties.value(Shift.class, Shift.TEAM + DOT + Team.COLOR).value( - BindingProperties.convertedValue(Converters.StringToRGB())).observeDetail(shifts); + IObservableMap color = BeanProperties + .value(Shift.class, Shift.TEAM + DOT + Team.COLOR) + .value(BindingProperties.convertedValue(Converters.StringToRGB())) + .observeDetail(shifts); this.viewer.setContentProvider(new ObservableSetContentProvider(new PlannerViewerUpdater(this.viewer))); this.viewer.setLabelProvider(new ObservableMapPlannerLabelProviderWithColor(shiftLabels, shiftStart, shiftEnd, color)); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/RemoveAllProductionEventAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/RemoveAllProductionEventAction.java index 18840ecf0742133f02abeae5af4ff13bf468b6ed..acc9c3694b77ddbf5eabc20346b0f20b9e6c9b1a 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/RemoveAllProductionEventAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/RemoveAllProductionEventAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; @@ -39,8 +41,8 @@ import com.planimod.ui.theme.Resources; public class RemoveAllProductionEventAction extends Action { /** - * Property name of an action's date (value "date"). The date - * property is used to know the time range to be printed by this action. + * Property name of an action's date (value "date"). The date property is used to know the time range + * to be printed by this action. */ public static final String DATE = "date"; private IRunnableContext context; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ShiftProductionEventObservableMap.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ShiftProductionEventObservableMap.java index 76df62b528bb1cb80cf7f30d4b18ff3b565423dc..d19c5ddd62ce4725268c9df2f781c27a25f3ebac 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ShiftProductionEventObservableMap.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/production/ShiftProductionEventObservableMap.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.production; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintAction.java index 25a9a907aa52a2c8b2b525c688523dae409f820f..bd30f77e5b3d2688ec347a3ba1fd3fd04c22f702 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.qualifs; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintFactory.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintFactory.java index 9243415d02823ec3436996810b74f6646b77bbd0..992aa9886560b228dbd7d38d9639f48b424c4092 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintFactory.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationPrintFactory.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.qualifs; @@ -193,8 +198,9 @@ public class QualificationPrintFactory extends PlanimodPrintFactory { // Get Positions List positions = new ArrayList(data.listPositions()); - Collections.sort(positions, this.orientation == SWT.HORIZONTAL ? Collections.reverseOrder(PositionComparators.byClassifiedName()) : PositionComparators - .byClassifiedName()); + Collections.sort( + positions, + this.orientation == SWT.HORIZONTAL ? Collections.reverseOrder(PositionComparators.byClassifiedName()) : PositionComparators.byClassifiedName()); // Create Grid holding the qualifications GridPrint grid = new GridPrint(); @@ -420,9 +426,11 @@ public class QualificationPrintFactory extends PlanimodPrintFactory { protected Print createMiddleFooterPrint(PageNumber pageNumber) { StyledTextPrint text = new StyledTextPrint(); text.setStyle(new TextStyle().font(FontDataUtil.SMALL)); - text.append(_("X : Formé pour le poste")).newline().append( - " X ", - new TextStyle().background(new RGB(0, 0, 0)).foreground(new RGB(255, 255, 255)).font(FontDataUtil.SMALL)).append(_(": Détient le poste")); + text + .append(_("X : Formé pour le poste")) + .newline() + .append(" X ", new TextStyle().background(new RGB(0, 0, 0)).foreground(new RGB(255, 255, 255)).font(FontDataUtil.SMALL)) + .append(_(": Détient le poste")); return text; } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationViewPart.java index d8213a08d6dc18694a57f2c0d4dec8dbccda4718..6fcb25ec06bbaba0a2b1e89a0b2829c40328bd96 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualificationViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.qualifs; @@ -200,9 +202,10 @@ public class QualificationViewPart extends AbstractViewPart { IObservableSet qualifiedPosition = new QualifyPositionComputedSet(getSite().getService(PlanimodManagers.class), selectedEmployee); IValueProperty employeeIsQualify = new SetContainsPropertyValue(qualifiedPosition); IValueProperty employeeIsQualifyLabel = employeeIsQualify.value(BindingProperties.convertedValue(Converters.booleanConverter())); - ColumnSupport.create(viewer, _("Formé"), knownElements, employeeIsQualifyLabel).addPropertySorting().addCheckboxEditingSupport( - getDbc(), - employeeIsQualify); + ColumnSupport + .create(viewer, _("Formé"), knownElements, employeeIsQualifyLabel) + .addPropertySorting() + .addCheckboxEditingSupport(getDbc(), employeeIsQualify); // Attach a columns preferences ColumnViewerPreferences.create(viewer, PlanimodPreferences.getPreferenceStore(), PREFERENCE_POSITION_COLUMNS); } diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualifyPositionComputedSet.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualifyPositionComputedSet.java index 301e0a268e9463ad1d8cbeeb5ce9ca5fa2460ac8..bf5b32058c9e7e04fb49f2072eb5d7ebf60f5c5e 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualifyPositionComputedSet.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/qualifs/QualifyPositionComputedSet.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.qualifs; @@ -32,8 +34,7 @@ import com.planimod.core.Qualification; import com.planimod.core.QualificationManager; /** - * This computed set wrap the function - * {@link QualificationManager#listQualifyPositionForEmployee(Collection)}. + * This computed set wrap the function {@link QualificationManager#listQualifyPositionForEmployee(Collection)}. * * @author Patrik Dufresne * @@ -56,8 +57,7 @@ public class QualifyPositionComputedSet extends ManagedObjectComputedSet { } /** - * This implementation is calling - * {@link QualificationManager#listQualifyPositionForEmployee(Collection)}. + * This implementation is calling {@link QualificationManager#listQualifyPositionForEmployee(Collection)}. */ @Override protected Collection doList() throws ManagerException { @@ -83,8 +83,7 @@ public class QualifyPositionComputedSet extends ManagedObjectComputedSet { } /** - * This implementation check if the qualification is related to this - * employee. + * This implementation check if the qualification is related to this employee. */ @Override protected boolean doSelect(Object element) { @@ -97,8 +96,7 @@ public class QualifyPositionComputedSet extends ManagedObjectComputedSet { } /** - * This implementation allows to add object to this set. The modification is - * then apply using the managers. + * This implementation allows to add object to this set. The modification is then apply using the managers. */ @Override public boolean add(Object o) { @@ -118,8 +116,7 @@ public class QualifyPositionComputedSet extends ManagedObjectComputedSet { } /** - * This implementation allows to remove object from this set. The - * modification is then apply using the managers API. + * This implementation allows to remove object from this set. The modification is then apply using the managers API. */ @Override public boolean remove(Object o) { diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/AddShiftAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/AddShiftAction.java index 2a4ff8eed0365ded81ed30b5dda2fac81e022951..332ab8caf3260ed046654378049d923c1d0d29a0 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/AddShiftAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/AddShiftAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/EditShiftAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/EditShiftAction.java index d0d8fff45e3d6cc35761f4942ec4f83d919ab67d..e110d048cd21a1b79e5c7840d2fb74cfd4381a91 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/EditShiftAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/EditShiftAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.shifts; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/RemoveAllShiftAction.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/RemoveAllShiftAction.java index d8ea5a6b88a1008ced9a3191f37ecb97e1a5b478..6bb557c8fef27cd7c8e56dc420f204045a69e9a3 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/RemoveAllShiftAction.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/RemoveAllShiftAction.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.shifts; @@ -45,8 +47,8 @@ import com.planimod.ui.theme.Resources; public class RemoveAllShiftAction extends Action { /** - * Property name of an action's date (value "date"). The date - * property is used to know the time range to be printed by this action. + * Property name of an action's date (value "date"). The date property is used to know the time range + * to be printed by this action. */ public static final String DATE = "date"; private IRunnableContext context; diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftDialog.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftDialog.java index a2ebf62e7f377660fe5338b4f9dd81596ff16aec..bc2fa81c568cb444c18b5963d0bca442abade6e7 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftDialog.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftDialog.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.shifts; @@ -148,8 +150,7 @@ public class ShiftDialog extends TitleAreaDialog { * Create a new dialog. * * @param parentShell - * the parent shell, or null to create a top-level - * shell + * the parent shell, or null to create a top-level shell */ public ShiftDialog(Shell parentShell, PlanimodManagers managers, int style) { super(parentShell); @@ -172,16 +173,24 @@ public class ShiftDialog extends TitleAreaDialog { */ WritableValue startTimeValue = new WritableValue(null, Date.class); WritableValue endTimeValue = new WritableValue(null, Date.class); - DateTimeSupport startTimeSupport = DateTimeSupport.create(this.startTime, this.dbc, startTimeValue, DateFormatRegistry - .getFormat(DateFormatRegistry.TIME | DateFormatRegistry.MEDIUM), DateTimeSupport.STEP_60); + DateTimeSupport startTimeSupport = DateTimeSupport.create( + this.startTime, + this.dbc, + startTimeValue, + DateFormatRegistry.getFormat(DateFormatRegistry.TIME | DateFormatRegistry.MEDIUM), + DateTimeSupport.STEP_60); this.dbc.bindValue(new DateAndTimeObservableValue(SWTObservables.observeSelection(this.startDate), startTimeValue), this.start); if (this.startTime.getLayoutData() instanceof GridData) { ((GridData) this.startTime.getLayoutData()).widthHint = startTimeSupport.getWidthHint(); } - DateTimeSupport endTimeSupport = DateTimeSupport.create(this.endTime, this.dbc, endTimeValue, DateFormatRegistry.getFormat(DateFormatRegistry.TIME - | DateFormatRegistry.MEDIUM), DateTimeSupport.STEP_60); + DateTimeSupport endTimeSupport = DateTimeSupport.create( + this.endTime, + this.dbc, + endTimeValue, + DateFormatRegistry.getFormat(DateFormatRegistry.TIME | DateFormatRegistry.MEDIUM), + DateTimeSupport.STEP_60); this.dbc.bindValue(new DateAndTimeObservableValue(SWTObservables.observeSelection(this.endDate), endTimeValue), this.end); if (this.endTime.getLayoutData() instanceof GridData) { ((GridData) this.endTime.getLayoutData()).widthHint = endTimeSupport.getWidthHint(); diff --git a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftViewPart.java b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftViewPart.java index f61cdb5f732a922f5e8078607040c11d83b242cf..180431c149ac407bdcc8b99409cbcf5988df1fd6 100644 --- a/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftViewPart.java +++ b/com.patrikdufresne.planimod/src/main/java/com/planimod/ui/views/shifts/ShiftViewPart.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.ui.views.shifts; @@ -151,8 +153,10 @@ public class ShiftViewPart extends AbstractViewPart { BeanProperties.value(Shift.class, Shift.TEAM + DOT + Team.NAME).observeDetail(shifts)); IObservableMap shiftStart = BeanProperties.value(AbstractCalendarEvent.class, AbstractCalendarEvent.START_DATE).observeDetail(shifts); IObservableMap shiftEnd = BeanProperties.value(AbstractCalendarEvent.class, AbstractCalendarEvent.END_DATE).observeDetail(shifts); - IObservableMap color = BeanProperties.value(Shift.class, Shift.TEAM + DOT + Team.COLOR).value( - BindingProperties.convertedValue(Converters.StringToRGB())).observeDetail(shifts); + IObservableMap color = BeanProperties + .value(Shift.class, Shift.TEAM + DOT + Team.COLOR) + .value(BindingProperties.convertedValue(Converters.StringToRGB())) + .observeDetail(shifts); this.viewer.setContentProvider(new ObservableSetContentProvider(new PlannerViewerUpdater(this.viewer))); this.viewer.setLabelProvider(new ObservableMapPlannerLabelProviderWithColor(shiftLabels, shiftStart, shiftEnd, color)); this.viewer.setComparator(new PropertyViewerComparator(ShiftComparators.byHourAndTeam())); diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/AllTests.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/AllTests.java index 41ec89b8ea83ee7b7ce043af20668b9eb692e92b..54ea550e716034c999a1bb3e6833295a3fa2080f 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/AllTests.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/AllTests.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -21,7 +23,7 @@ import org.junit.runners.Suite; import com.planimod.core.planif.TableTest; @RunWith(Suite.class) -@Suite.SuiteClasses( { +@Suite.SuiteClasses({ ApplicationSettingManagerTest.class, TimeRangesTest.class, EmployeeManagerTest.class, diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ApplicationSettingManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ApplicationSettingManagerTest.java index 1fbb6382a24c0c7406e5f21fca2f62b6e341848c..f0a81a140ee2bc8573664dd2309482f9db930e3e 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ApplicationSettingManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ApplicationSettingManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -26,8 +28,7 @@ import com.patrikdufresne.managers.ManagerEvent; import com.patrikdufresne.managers.ManagerException; /** - * This class intend to test the functionnalities provided by the - * {@link ApplicationSettingManager}. + * This class intend to test the functionnalities provided by the {@link ApplicationSettingManager}. * * @author ikus060 * diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeeManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeeManagerTest.java index dc83d4dd92519eb8127e01423fe234ffe5dc28f2..0e9d16fab2ec25e7c9a5975fd2dc789a6fda2fa6 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeeManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeeManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -40,8 +42,7 @@ import com.patrikdufresne.managers.ManagerException; public class EmployeeManagerTest extends ManagerTestCase { /** - * This test case intend to cover the requirement SR001 : permettre - * d'ajouter un employé ... + * This test case intend to cover the requirement SR001 : permettre d'ajouter un employé ... */ @Test public void AddEmployee() { @@ -87,8 +88,7 @@ public class EmployeeManagerTest extends ManagerTestCase { } /** - * This case intend to cover the requirement SR001 : ... modifier son - * profile (nom, prénom, date d'embauche) ... + * This case intend to cover the requirement SR001 : ... modifier son profile (nom, prénom, date d'embauche) ... */ @Test public void Update() { @@ -134,8 +134,7 @@ public class EmployeeManagerTest extends ManagerTestCase { } /** - * Check if an exception is raised when trying to update an archived - * employee object. + * Check if an exception is raised when trying to update an archived employee object. * * @throws ManagerException */ diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeePreferenceManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeePreferenceManagerTest.java index f0f7a923ef2dc7df9c02b24d6210a7255677e0f7..7362962fe13b56015e0a7db68d10262860ce86b4 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeePreferenceManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/EmployeePreferenceManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -119,9 +121,8 @@ public class EmployeePreferenceManagerTest extends ManagerTestCase { } /** - * Check if the Employee record is also removed when an EmployeePreference - * is removed. In this test case, the employee / employeePreference can't be - * removed because it's used. + * Check if the Employee record is also removed when an EmployeePreference is removed. In this test case, the + * employee / employeePreference can't be removed because it's used. * * @throws ManagerException */ @@ -169,9 +170,8 @@ public class EmployeePreferenceManagerTest extends ManagerTestCase { } /** - * Check if the Employee record is also removed when an EmployeePreference - * is removed. In this test case, the employee / employeePreference can't be - * removed because it's used. + * Check if the Employee record is also removed when an EmployeePreference is removed. In this test case, the + * employee / employeePreference can't be removed because it's used. * * @throws ManagerException */ @@ -235,8 +235,7 @@ public class EmployeePreferenceManagerTest extends ManagerTestCase { } /** - * Check if an exception is raised when trying to update the preference of - * an archived employee. + * Check if an exception is raised when trying to update the preference of an archived employee. * * @throws ManagerException */ diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ManagerTestCase.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ManagerTestCase.java index 998097ebe2d48e122b77c2e0652bf00c46cf5994..3b8e591c34e7bbaad2e289f6c5fac01b94b0b67c 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ManagerTestCase.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ManagerTestCase.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -526,8 +528,10 @@ public abstract class ManagerTestCase { Collection emp) { ProductionEvent[] a1 = new ProductionEvent[prodEvent.size()]; - int count = CollectionUtils.countMatches(events, new PlanifEventPredicate(prodEvent.toArray(a1), start, end, pos != null ? pos.toArray(new Position[pos - .size()]) : null, emp != null ? emp.toArray(new Employee[emp.size()]) : null)); + int count = CollectionUtils.countMatches( + events, + new PlanifEventPredicate(prodEvent.toArray(a1), start, end, pos != null ? pos.toArray(new Position[pos.size()]) : null, emp != null ? emp + .toArray(new Employee[emp.size()]) : null)); if (count < min || count > max) { StringBuilder buf = new StringBuilder(); if (prodEvent.size() > 1) { diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/NonAvailabilityEventManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/NonAvailabilityEventManagerTest.java index 30598eaed8e13b7a7ee6e9a3b63de4fbb9f30e3e..b2333854b985d606e00c69cc87fb2dd06fd4be48 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/NonAvailabilityEventManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/NonAvailabilityEventManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest.java index 6d772a81899b880878fcd136f18b2c9ad9f5b034..a094a4f95ae8d5892f5e8d44d5b1d547d5d4d26b 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20110925.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20110925.java index 490aa3fe7e50916bba74fdcf7f57aef8c3dfc78f..e433df13d715242fc1d720b198d0d6e32845563c 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20110925.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20110925.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -2965,11 +2967,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas // EMPLOYEEPREFERENCE_SHIFT.PREFERREDSHIFT_ID = SHIFT.ID) || ')','null') // || ');' FROM EMPLOYEE, EMPLOYEEPREFERENCE WHERE EMPLOYEE.ID = // EMPLOYEEPREFERENCE.EMPLOYEE_ID; - setEmployeePreference(managers, donaldTheriault, mecanicien, joursDeSemaine, maintenance, Arrays.asList( + setEmployeePreference( + managers, + donaldTheriault, + mecanicien, joursDeSemaine, - soirSemaine, - jourFinDeSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, soirSemaine, jourFinDeSemaine, soirFinDeSemaine)); setEmployeePreference(managers, louiseVeillette, null, null, null, null); setEmployeePreference(managers, caroleMorand, null, null, emballage, Arrays.asList( joursDeSemaine, @@ -3192,11 +3196,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementSemaine, joursRemplacementFinDeSemaine, soirRemplacementFinDeSemaine)); - setEmployeePreference(managers, michelMeunier, huileurGraisseurEntretienPreventif, joursDeSemaine, maintenance, Arrays.asList( + setEmployeePreference( + managers, + michelMeunier, + huileurGraisseurEntretienPreventif, joursDeSemaine, - soirSemaine, - jourFinDeSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, soirSemaine, jourFinDeSemaine, soirFinDeSemaine)); setEmployeePreference(managers, pierreLamarque, operateurEnsacheuseVerticalSnack, joursDeSemaine, snack, Arrays.asList( joursDeSemaine, soirSemaine, @@ -3508,11 +3514,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementSemaine, joursRemplacementFinDeSemaine, soirRemplacementFinDeSemaine)); - setEmployeePreference(managers, marcBellemare, mecanicien, joursDeSemaine, maintenance, Arrays.asList( + setEmployeePreference( + managers, + marcBellemare, + mecanicien, joursDeSemaine, - jourFinDeSemaine, - soirSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, jourFinDeSemaine, soirSemaine, soirFinDeSemaine)); setEmployeePreference(managers, michelineLegault, null, null, emballage, Arrays.asList( soirSemaine, soirRemplacementSemaine, @@ -3713,11 +3721,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementSemaine, nuitSemaineSalubrite, soirSemaine)); - setEmployeePreference(managers, lucRoy, mecanicien, joursDeSemaine, maintenance, Arrays.asList( + setEmployeePreference( + managers, + lucRoy, + mecanicien, joursDeSemaine, - soirSemaine, - jourFinDeSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, soirSemaine, jourFinDeSemaine, soirFinDeSemaine)); setEmployeePreference(managers, lucieCaron, null, null, emballage, Arrays.asList( joursDeSemaine, soirSemaine, @@ -3828,16 +3838,20 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementFinDeSemaine, nuitSemaineSalubrite, soirFinDeSemaine)); - setEmployeePreference(managers, sylvainJulien, electrotechniciens, joursDeSemaine, maintenance, Arrays.asList( + setEmployeePreference( + managers, + sylvainJulien, + electrotechniciens, joursDeSemaine, - jourFinDeSemaine, - soirSemaine, - soirFinDeSemaine)); - setEmployeePreference(managers, sylvainCarriere, mecanicien, joursDeSemaine, maintenance, Arrays.asList( + maintenance, + Arrays.asList(joursDeSemaine, jourFinDeSemaine, soirSemaine, soirFinDeSemaine)); + setEmployeePreference( + managers, + sylvainCarriere, + mecanicien, joursDeSemaine, - soirSemaine, - jourFinDeSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, soirSemaine, jourFinDeSemaine, soirFinDeSemaine)); setEmployeePreference(managers, richardVaillant, null, null, boulangerie, Arrays.asList( joursDeSemaine, jourFinDeSemaine, @@ -3898,11 +3912,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementFinDeSemaine, nuitSemaineSalubrite, soirFinDeSemaine)); - setEmployeePreference(managers, ivanhoeMaisonneuve, electrotechniciens, jourFinDeSemaine, maintenance, Arrays.asList( - joursDeSemaine, + setEmployeePreference( + managers, + ivanhoeMaisonneuve, + electrotechniciens, jourFinDeSemaine, - soirFinDeSemaine, - soirSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, jourFinDeSemaine, soirFinDeSemaine, soirSemaine)); setEmployeePreference(managers, mathieuGuy, operateurLigneAPain, jourFinDeSemaine, boulangerie, Arrays.asList( jourFinDeSemaine, joursDeSemaine, @@ -3913,11 +3929,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas joursRemplacementFinDeSemaine, soirRemplacementSemaine, nuitSemaineSalubrite)); - setEmployeePreference(managers, denisBerube, mecanicien, jourFinDeSemaine, maintenance, Arrays.asList( + setEmployeePreference( + managers, + denisBerube, + mecanicien, jourFinDeSemaine, - joursDeSemaine, - soirSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(jourFinDeSemaine, joursDeSemaine, soirSemaine, soirFinDeSemaine)); setEmployeePreference(managers, daisyBourget, null, null, emballage, Arrays.asList( joursDeSemaine, soirSemaine, @@ -3928,11 +3946,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementFinDeSemaine, soirFinDeSemaine, nuitSemaineSalubrite)); - setEmployeePreference(managers, mathewBellemare, mecanicien, soirSemaine, maintenance, Arrays.asList( - joursDeSemaine, - jourFinDeSemaine, + setEmployeePreference( + managers, + mathewBellemare, + mecanicien, soirSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, jourFinDeSemaine, soirSemaine, soirFinDeSemaine)); setEmployeePreference(managers, alexandreDube, preposeSalubrite, soirFinDeSemaine, salubrite, Arrays.asList( soirFinDeSemaine, joursDeSemaine, @@ -4023,11 +4043,13 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas soirRemplacementSemaine, soirRemplacementFinDeSemaine, joursRemplacementFinDeSemaine)); - setEmployeePreference(managers, ginoLemoine, electrotechniciens, soirSemaine, maintenance, Arrays.asList( - joursDeSemaine, - jourFinDeSemaine, + setEmployeePreference( + managers, + ginoLemoine, + electrotechniciens, soirSemaine, - soirFinDeSemaine)); + maintenance, + Arrays.asList(joursDeSemaine, jourFinDeSemaine, soirSemaine, soirFinDeSemaine)); setEmployeePreference(managers, ginetteLevesque, null, null, emballage, Arrays.asList( joursDeSemaine, jourRemplacementSemaine, @@ -4353,8 +4375,7 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas setTaskLocked(managers, lockedTask, jeanpierreAuger); /* - * Lock Normand Arsenault Pré-farine / Pré-mélange wednesday And - * Thrusday + * Lock Normand Arsenault Pré-farine / Pré-mélange wednesday And Thrusday */ lockedTask = addTask(managers, events[59], prefarinePremelange, null, null); setTaskLocked(managers, lockedTask, normandArsenault); @@ -4374,8 +4395,7 @@ public class PlanifEventManagerGeneratePlanifTest20110925 extends ManagerTestCas setTaskLocked(managers, lockedTask, michelJeanneau); /* - * Lock Lucie Leavey - Lun et Mardi Opérateur bag, Mer Opérateur - * remplacement snack, Jeudi Ensacheuse snack + * Lock Lucie Leavey - Lun et Mardi Opérateur bag, Mer Opérateur remplacement snack, Jeudi Ensacheuse snack */ lockedTask = addTask(managers, events[103], operateurLigneBiscottebagHorsDoeuvre, null, null); setTaskLocked(managers, lockedTask, lucieLeavey); diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20120930.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20120930.java index 8d994ea197042624d91530bff10e42a9ac6f8e08..be23395831997891d951348b986169934558d667 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20120930.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20120930.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -715,11 +720,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas * */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -973,11 +980,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1308,11 +1317,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1533,11 +1544,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVenSalubrite, team9NuitSemaineDimJeuSalubrite, @@ -1659,16 +1672,20 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1724,11 +1741,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1751,11 +1770,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1855,11 +1876,13 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -5343,21 +5366,23 @@ public class PlanifEventManagerGeneratePlanifTest20120930 extends ManagerTestCas assertAssignment(1, tasks, events1JoursDeSemaineTue, emballagePositions, empJohanneLemieux); assertAssignment(1, tasks, events1JoursDeSemaineWed, emballagePositions, empJohanneLemieux); assertAssignment(1, tasks, events1JoursDeSemaineThu, emballagePositions, empJohanneLemieux); - assertAssignment(2, tasks, events2JourRemplacementSemaineMon, emballagePositions, Arrays.asList( - empManonTremblay, - empClaudineRochefort, - empPierretteLamothe)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineMon, + emballagePositions, + Arrays.asList(empManonTremblay, empClaudineRochefort, empPierretteLamothe)); assertAssignment(1, tasks, events2JourRemplacementSemaineTue, emballagePositions, empManonTremblay); assertAssignment(1, tasks, events2JourRemplacementSemaineWed, emballagePositions, empManonTremblay); assertAssignment(1, tasks, events2JourRemplacementSemaineThu, emballagePositions, empManonTremblay); assertAssignment(1, tasks, events1JoursDeSemaineMon, posFournier, empBernardBerube); assertAssignment(1, tasks, events1JoursDeSemaineTue, posFournier, empBernardBerube); - assertAssignment(2, tasks, events1JoursDeSemaineWed, snackPositions, Arrays.asList( - empBernardBerube, - empLiseJoncas, - empMarioPaille, - empRachelMoise, - empFrancoisBeaulne)); + assertAssignment( + 2, + tasks, + events1JoursDeSemaineWed, + snackPositions, + Arrays.asList(empBernardBerube, empLiseJoncas, empMarioPaille, empRachelMoise, empFrancoisBeaulne)); assertAssignment(1, tasks, events1JoursDeSemaineThu, boulangeriePositions, empBernardBerube); assertAssignment(1, tasks, events3SoirSemaineMon, posOperateurGerbeuseVerification, empRobertLazure); assertAssignment(1, tasks, events3SoirSemaineTue, posOperateurGerbeuseVerification, empRobertLazure); diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121028.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121028.java index 0657a1ac4fe870d4c30c61dfdfa3029bc5d3b3e0..b9a376f56392ede64a8922764694abbb710c30c5 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121028.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121028.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -517,11 +522,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas * */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -775,11 +782,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1110,11 +1119,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1335,11 +1346,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVenSalubrite, team9NuitSemaineDimJeuSalubrite, @@ -1461,16 +1474,20 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1526,11 +1543,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1553,11 +1572,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1657,11 +1678,13 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -5802,47 +5825,55 @@ public class PlanifEventManagerGeneratePlanifTest20121028 extends ManagerTestCas assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteThu, group5Salubrite, empChristopheDeneault); assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteFri, group5Salubrite, empChristopheDeneault); - assertAssignment(2, tasks, events2JourRemplacementSemaineMon, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineTue, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineMon, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); - assertAssignment(2, tasks, events4SoirRemplacementSemaineMon, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); - assertAssignment(2, tasks, events4SoirRemplacementSemaineTue, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); - assertAssignment(2, tasks, events4SoirRemplacementSemaineWed, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); - assertAssignment(2, tasks, events4SoirRemplacementSemaineThu, group1Emballage, Arrays.asList( - empPierreLemelin, - empRobertShonfield, - empLouisCarlPage, - empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events4SoirRemplacementSemaineMon, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events4SoirRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events4SoirRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events4SoirRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empLouisCarlPage, empDanielGuillemette)); } } diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121104.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121104.java index cccc6a887a060a10a00672ceea1a56858c6da5e3..52fff9f49515000edda8e5b5d3ec7b4dd1ac6086 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121104.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121104.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -562,11 +564,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas * */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -820,11 +824,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1155,11 +1161,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1380,11 +1388,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVenSalubrite, team9NuitSemaineDimJeuSalubrite, @@ -1506,16 +1516,20 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1571,11 +1585,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1598,11 +1614,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1702,11 +1720,13 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -5535,7 +5555,7 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurBatonCompteuse, empMichelineDemers); assertAssignment(1, tasks, events1JoursDeSemaineThu, posOperateurEmballageFmc, empMichelineDemers); assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empDianeDugas); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group9Absent, empDianeDugas); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group9Absent, empDianeDugas); assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empDianeDugas); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empDianeDugas); assertAssignment(1, tasks, events1JoursDeSemaineMon, group3Boulangerie, empJeanpierreAuger); @@ -5570,7 +5590,7 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurEmballageTriangle, empLindaBoisvert); assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurEmballageTriangle, empLindaBoisvert); assertAssignment(1, tasks, events1JoursDeSemaineThu, posOperateurEmballageTriangle, empLindaBoisvert); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group9Absent, empSergeRobidoux); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group9Absent, empSergeRobidoux); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurLigneFourMelba, empSergeRobidoux); assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurLigneFourMelba, empSergeRobidoux); assertAssignment(1, tasks, events1JoursDeSemaineThu, posOperateurLigneFourMelba, empSergeRobidoux); @@ -5739,7 +5759,7 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurPetrisseurSnack, empLyndaLajoie); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empLyndaLajoie); assertAssignment(1, tasks, events5JourFinDeSemaineSun, posPetrisseurAPain, empJeanfrancoisBreton); - //assertAssignment(1, tasks, events5JourFinDeSemaineFri, group9Absent, empJeanfrancoisBreton); + // assertAssignment(1, tasks, events5JourFinDeSemaineFri, group9Absent, empJeanfrancoisBreton); assertAssignment(1, tasks, events5JourFinDeSemaineSat, posPetrisseurAPain, empJeanfrancoisBreton); assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empBrigitteBouchard); assertAssignment(1, tasks, events1JoursDeSemaineTue, group4Baton, empBrigitteBouchard); @@ -5802,7 +5822,7 @@ public class PlanifEventManagerGeneratePlanifTest20121104 extends ManagerTestCas assertAssignment(1, tasks, events3SoirSemaineWed, posMecanicien, empSylvainCarriere); assertAssignment(1, tasks, events3SoirSemaineThu, posMecanicien, empSylvainCarriere); assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empRichardVaillant); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group9Absent, empRichardVaillant); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group9Absent, empRichardVaillant); assertAssignment(1, tasks, events1JoursDeSemaineWed, group4Baton, empRichardVaillant); assertAssignment(1, tasks, events1JoursDeSemaineThu, group4Baton, empRichardVaillant); assertAssignment(1, tasks, events3SoirSemaineMon, group1Emballage, empFranceBoyer); diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121111.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121111.java index 51a0246524352370303c490ac1b1a89b82ca3882..7894668cf25911ac8321b8fcc0cebe8261e7b2c7 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121111.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121111.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -33,7 +35,7 @@ import com.planimod.core.planif.GeneratePlanifContext; import com.planimod.core.planif.MockGeneratePlanifMonitor; /** - * This test cases is a real scenario from Grissol Plant on Nov 11, 2012 + * This test cases is a real scenario from Grissol Plant on Nov 11, 2012 * * @author Patrik Dufresne */ @@ -343,10 +345,10 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas // Convert to non-availabilities // setTaskLocked(managers, prodAbsent, joursDeSemaineThu, posAbsent, empFrancoisBeaulne); - // setTaskLocked(managers, prodAbsent, joursDeSemaineMon, posAbsent, empNormandArsenault); - // setTaskLocked(managers, prodAbsent, joursDeSemaineMon, posAbsent, empLucieGuay); - // setTaskLocked(managers, prodAbsent, joursDeSemaineTue, posAbsent, empLucieGuay); - // setTaskLocked(managers, prodAbsent, joursDeSemaineWed, posAbsent, empLucieGuay); + // setTaskLocked(managers, prodAbsent, joursDeSemaineMon, posAbsent, empNormandArsenault); + // setTaskLocked(managers, prodAbsent, joursDeSemaineMon, posAbsent, empLucieGuay); + // setTaskLocked(managers, prodAbsent, joursDeSemaineTue, posAbsent, empLucieGuay); + // setTaskLocked(managers, prodAbsent, joursDeSemaineWed, posAbsent, empLucieGuay); // setTaskLocked(managers, prodAbsent, joursDeSemaineThu, posAbsent, empRachelBergevin); } @@ -546,11 +548,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas * */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -804,11 +808,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1139,11 +1145,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1364,11 +1372,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVenSalubrite, team9NuitSemaineDimJeuSalubrite, @@ -1490,16 +1500,20 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1555,11 +1569,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1582,11 +1598,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1686,11 +1704,13 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -5585,7 +5605,7 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurGrispac, empFrancoisBeaulne); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurGrispac, empFrancoisBeaulne); assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurGrispac, empFrancoisBeaulne); - //assertAssignment(1, tasks, events1JoursDeSemaineThu, group9Absent, empFrancoisBeaulne); + // assertAssignment(1, tasks, events1JoursDeSemaineThu, group9Absent, empFrancoisBeaulne); assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurDeLigneBaton, empFrancineGuerin); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurDeLigneBaton, empFrancineGuerin); assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurDeLigneBaton, empFrancineGuerin); @@ -5629,7 +5649,7 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas assertAssignment(1, tasks, events5JourFinDeSemaineSun, posOperateurEmballageMelba, empNicoleFortin); assertAssignment(1, tasks, events5JourFinDeSemaineFri, posOperateurEmballageMelba, empNicoleFortin); assertAssignment(1, tasks, events5JourFinDeSemaineSat, posOperateurEmballageMelba, empNicoleFortin); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group9Absent, empNormandArsenault); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group9Absent, empNormandArsenault); assertAssignment(1, tasks, events1JoursDeSemaineTue, posPrefarinePremelange, empNormandArsenault); assertAssignment(1, tasks, events1JoursDeSemaineWed, group3Boulangerie, empNormandArsenault); assertAssignment(1, tasks, events1JoursDeSemaineThu, posPrefarinePremelange, empNormandArsenault); @@ -5653,9 +5673,9 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas assertAssignment(1, tasks, events3SoirSemaineTue, group1Emballage, empDanielleBeaudry); assertAssignment(1, tasks, events3SoirSemaineWed, group1Emballage, empDanielleBeaudry); assertAssignment(1, tasks, events3SoirSemaineThu, group1Emballage, empDanielleBeaudry); - // assertAssignment(1, tasks, events1JoursDeSemaineMon, group9Absent, empLucieGuay); - // assertAssignment(1, tasks, events1JoursDeSemaineTue, group9Absent, empLucieGuay); - // assertAssignment(1, tasks, events1JoursDeSemaineWed, group9Absent, empLucieGuay); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group9Absent, empLucieGuay); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group9Absent, empLucieGuay); + // assertAssignment(1, tasks, events1JoursDeSemaineWed, group9Absent, empLucieGuay); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empLucieGuay); assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurLigneAPain, empRogerDagenais); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurLigneAPain, empRogerDagenais); @@ -5673,7 +5693,7 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurDeRemplacementSnack, empRachelBergevin); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurDeRemplacementSnack, empRachelBergevin); assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurDeRemplacementSnack, empRachelBergevin); - //assertAssignment(1, tasks, events1JoursDeSemaineThu, group9Absent, empRachelBergevin); + // assertAssignment(1, tasks, events1JoursDeSemaineThu, group9Absent, empRachelBergevin); assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurGerbeuseVerification, empRejeanRoy); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurGerbeuseVerification, empRejeanRoy); assertAssignment(1, tasks, events1JoursDeSemaineWed, posOperateurGerbeuseVerification, empRejeanRoy); @@ -5888,29 +5908,61 @@ public class PlanifEventManagerGeneratePlanifTest20121111 extends ManagerTestCas assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteWed, group5Salubrite, empChristopheDeneault); assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteThu, group5Salubrite, empChristopheDeneault); assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteFri, group5Salubrite, empChristopheDeneault); - assertAssignment(1, tasks, events4SoirRemplacementSemaineMon, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineTue, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineWed, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineThu, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineMon, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(1, tasks, events2JourRemplacementSemaineTue, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays - .asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineMon, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineMon, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 1, + tasks, + events2JourRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empPierreLemelin, empRobertShonfield, empDanielGuillemette)); assertAssignment(1, tasks, events1JoursDeSemaineMon, group8Formation, empLouisCarlPage); assertAssignment(1, tasks, events1JoursDeSemaineTue, group8Formation, empLouisCarlPage); assertAssignment(1, tasks, events1JoursDeSemaineWed, group8Formation, empLouisCarlPage); assertAssignment(1, tasks, events1JoursDeSemaineThu, group8Formation, empLouisCarlPage); - //assertAssignment(1, tasks, events2JourRemplacementSemaineMon, group1Emballage, empDanielGuillemette); - //assertAssignment(1, tasks, events2JourRemplacementSemaineTue, group1Emballage, empDanielGuillemette); - //assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, empDanielGuillemette); - //assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, empDanielGuillemette); + // assertAssignment(1, tasks, events2JourRemplacementSemaineMon, group1Emballage, empDanielGuillemette); + // assertAssignment(1, tasks, events2JourRemplacementSemaineTue, group1Emballage, empDanielGuillemette); + // assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, empDanielGuillemette); + // assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, empDanielGuillemette); } } diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121202.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121202.java index b0de78729a530431805dc24fc88e5e919200fdd5..ef310b6ece8d1f204cfa54b5c039f2e50298ebe5 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121202.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121202.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -534,11 +539,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -792,11 +799,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1127,11 +1136,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1352,11 +1363,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVenSalubrite, team9NuitSemaineDimJeuSalubrite, @@ -1478,16 +1491,20 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1543,11 +1560,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1570,11 +1589,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1674,11 +1695,13 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas team10NuitSemaineLunVenSalubrite, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -5829,12 +5852,12 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas assertAssignment(1, tasks, events9NuitSemaineDimJeuSalubriteWed, posPreposeSalubrite, empSolangeGirard); assertAssignment(1, tasks, events9NuitSemaineDimJeuSalubriteThu, posPreposeSalubrite, empSolangeGirard); assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empMartinLina); - assertAssignment(3, tasks, events1JoursDeSemaineTue, group2Snack, Arrays.asList( - empDanielDuquette, - empMartinLina, - empChristopheDeneault, - empRobertShonfield, - empSabrinaDupuis)); + assertAssignment( + 3, + tasks, + events1JoursDeSemaineTue, + group2Snack, + Arrays.asList(empDanielDuquette, empMartinLina, empChristopheDeneault, empRobertShonfield, empSabrinaDupuis)); assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, Arrays.asList(empMartinLina, empPierreLemelin)); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empMartinLina); assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurGrispac, empLiseJoncas); @@ -5882,19 +5905,18 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas assertAssignment(1, tasks, events7SoirDeFinDeSemaineSun, group5Salubrite, empAlexandreDube); assertAssignment(1, tasks, events7SoirDeFinDeSemaineFri, group5Salubrite, empAlexandreDube); assertAssignment(1, tasks, events7SoirDeFinDeSemaineSat, group5Salubrite, empAlexandreDube); - assertAssignment(2, tasks, events1JoursDeSemaineMon, group4Baton, Arrays.asList( - empRobertShonfield, - empNancyTheoret, - empRachelMoise, - empSabrinaDupuis, - empChristopheDeneault, - empDanielDuquette)); - assertAssignment(2, tasks, events1JoursDeSemaineTue, group4Baton, Arrays.asList( - empChristopheDeneault, - empMartinLina, - empDanielDuquette, - empRobertShonfield, - empSabrinaDupuis)); + assertAssignment( + 2, + tasks, + events1JoursDeSemaineMon, + group4Baton, + Arrays.asList(empRobertShonfield, empNancyTheoret, empRachelMoise, empSabrinaDupuis, empChristopheDeneault, empDanielDuquette)); + assertAssignment( + 2, + tasks, + events1JoursDeSemaineTue, + group4Baton, + Arrays.asList(empChristopheDeneault, empMartinLina, empDanielDuquette, empRobertShonfield, empSabrinaDupuis)); assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empDanielDuquette); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empDanielDuquette); assertAssignment(1, tasks, events9NuitSemaineDimJeuSalubriteSun, group5Salubrite, empJohanneDuval); @@ -5950,19 +5972,21 @@ public class PlanifEventManagerGeneratePlanifTest20121202 extends ManagerTestCas assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteThu, group5Salubrite, Arrays.asList(empLouisCarlPage, empDanielGuillemette)); assertAssignment(1, tasks, events10NuitSemaineLunVenSalubriteFri, group5Salubrite, Arrays.asList(empLouisCarlPage, empDanielGuillemette)); assertAssignment(1, tasks, events2JourRemplacementSemaineMon, group1Emballage, Arrays.asList(empLouisCarlPage, empDanielGuillemette)); - assertAssignment(1, tasks, events2JourRemplacementSemaineTue, group1Emballage, Arrays.asList( - empLouisCarlPage, - empDanielGuillemette, - empNathalieBedard, - empDavidWayne)); + assertAssignment( + 1, + tasks, + events2JourRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empLouisCarlPage, empDanielGuillemette, empNathalieBedard, empDavidWayne)); assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays.asList(empLouisCarlPage, empDanielGuillemette)); assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays.asList(empLouisCarlPage, empDanielGuillemette)); assertAssignment(1, tasks, events2JourRemplacementSemaineMon, group1Emballage, Arrays.asList(empNathalieBedard, empDavidWayne)); - assertAssignment(1, tasks, events1JoursDeSemaineTue, group1Emballage, Arrays.asList( - empNathalieBedard, - empLouisCarlPage, - empDanielGuillemette, - empDavidWayne)); + assertAssignment( + 1, + tasks, + events1JoursDeSemaineTue, + group1Emballage, + Arrays.asList(empNathalieBedard, empLouisCarlPage, empDanielGuillemette, empDavidWayne)); assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays.asList(empNathalieBedard, empDavidWayne)); assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays.asList(empNathalieBedard, empDavidWayne)); assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empPierreGagne); diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121209.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121209.java index e3056e9b267a3471ce31bb81b838a423ede03f97..916ab9f067283da50ed641bc0f98c8625812ae19 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121209.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20121209.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -567,11 +569,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -825,11 +829,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1160,11 +1166,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1385,11 +1393,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVen, team9NuitSemaineDimJeu, @@ -1511,16 +1521,20 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1576,11 +1590,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team10NuitSemaineLunVen, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1603,11 +1619,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVen, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1707,11 +1725,13 @@ public class PlanifEventManagerGeneratePlanifTest20121209 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130106.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130106.java index 9be596f9391644dbf07de15aa9226ac29ae0757d..d5f865e9c9f1f6cbd632fa02490481189ca14b9e 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130106.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130106.java @@ -1,14 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -566,11 +571,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -824,11 +831,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1159,11 +1168,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1384,11 +1395,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVen, team9NuitSemaineDimJeu, @@ -1510,16 +1523,20 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1575,11 +1592,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team10NuitSemaineLunVen, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1602,11 +1621,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVen, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1706,11 +1727,13 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -5845,11 +5868,12 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas assertAssignment(1, tasks, events5JourFinDeSemaineSat, posRecuperateurEmballage, empStephaneJacques); assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empBrigitteBouchard); assertAssignment(1, tasks, events1JoursDeSemaineTue, group4Baton, empBrigitteBouchard); - assertAssignment(1, tasks, events1JoursDeSemaineWed, group2Snack, Arrays.asList( - empBrigitteBouchard, - empRichardVaillant, - empRachelMoise, - empCatherinePiette)); + assertAssignment( + 1, + tasks, + events1JoursDeSemaineWed, + group2Snack, + Arrays.asList(empBrigitteBouchard, empRichardVaillant, empRachelMoise, empCatherinePiette)); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empBrigitteBouchard); assertAssignment(1, tasks, events5JourFinDeSemaineSun, posOperateurLigneFourMelba, empJoseeLapierre); assertAssignment(1, tasks, events5JourFinDeSemaineFri, posOperateurLigneFourMelba, empJoseeLapierre); @@ -5973,54 +5997,60 @@ public class PlanifEventManagerGeneratePlanifTest20130106 extends ManagerTestCas assertAssignment(1, tasks, events5JourFinDeSemaineSun, group3Boulangerie, empLouisCarlPage); assertAssignment(1, tasks, events5JourFinDeSemaineFri, group3Boulangerie, empLouisCarlPage); assertAssignment(1, tasks, events5JourFinDeSemaineSat, group3Boulangerie, empLouisCarlPage); - assertAssignment(1, tasks, events5JourFinDeSemaineSun, group1Emballage, Arrays.asList( - empPierreLemelin, - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(1, tasks, events5JourFinDeSemaineFri, group1Emballage, Arrays.asList( - empPierreLemelin, - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(1, tasks, events5JourFinDeSemaineSat, group1Emballage, Arrays.asList( - empPierreLemelin, - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(2, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays.asList( - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(2, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays.asList( - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineMon, group1Emballage, Arrays.asList( - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineTue, group1Emballage, Arrays.asList( - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineWed, group1Emballage, Arrays.asList( - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); - assertAssignment(1, tasks, events4SoirRemplacementSemaineThu, group1Emballage, Arrays.asList( - empDanielGuillemette, - empNathalieBedard, - empPierreGagne, - empWayneDavid)); + assertAssignment( + 1, + tasks, + events5JourFinDeSemaineSun, + group1Emballage, + Arrays.asList(empPierreLemelin, empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 1, + tasks, + events5JourFinDeSemaineFri, + group1Emballage, + Arrays.asList(empPierreLemelin, empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 1, + tasks, + events5JourFinDeSemaineSat, + group1Emballage, + Arrays.asList(empPierreLemelin, empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineMon, + group1Emballage, + Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); + assertAssignment( + 1, + tasks, + events4SoirRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); // assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, // Arrays.asList(empDanielGuillemette, empNathalieBedard, empPierreGagne, empWayneDavid)); // assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130113.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130113.java index 5e89c3678e91fc67ca16c8cb676f6718379b470f..71e07308a7f0a13afa8ee6dc4e59041683c125e5 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130113.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130113.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -569,11 +571,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -827,11 +831,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1162,11 +1168,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1387,11 +1395,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVen, team9NuitSemaineDimJeu, @@ -1513,16 +1523,20 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1578,11 +1592,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team10NuitSemaineLunVen, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1605,11 +1621,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVen, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1709,11 +1727,13 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -5902,7 +5922,7 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events10NuitSemaineLunVenThu, group5Salubrite, empLucieCaron); assertAssignment(1, tasks, events10NuitSemaineLunVenFri, group5Salubrite, empLucieCaron); assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empRachelMoise); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empRachelMoise); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empRachelMoise); assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empRachelMoise); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empRachelMoise); assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empCatherinePiette); @@ -5919,35 +5939,35 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events3SoirSemaineThu, posPrefarinePremelange, empDominicHoude); assertAssignment(1, tasks, events1JoursDeSemaineMon, group3Boulangerie, empFrancoisParent); assertAssignment(1, tasks, events1JoursDeSemaineTue, group3Boulangerie, empFrancoisParent); - assertAssignment(3, tasks, events1JoursDeSemaineWed, group1Emballage, Arrays.asList( - empMartinLina, - empFrancoisParent, - empRichardVaillant, - empDanielDuquette, - empRobertAllen)); - assertAssignment(1, tasks, events1JoursDeSemaineWed, group2Snack, Arrays.asList( - empMartinLina, - empFrancoisParent, - empRichardVaillant, - empDanielDuquette, - empRobertAllen)); - assertAssignment(1, tasks, events1JoursDeSemaineWed, group4Baton, Arrays.asList( - empMartinLina, - empFrancoisParent, - empRichardVaillant, - empDanielDuquette, - empRobertAllen)); - //assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empFrancoisParent); + assertAssignment( + 3, + tasks, + events1JoursDeSemaineWed, + group1Emballage, + Arrays.asList(empMartinLina, empFrancoisParent, empRichardVaillant, empDanielDuquette, empRobertAllen)); + assertAssignment( + 1, + tasks, + events1JoursDeSemaineWed, + group2Snack, + Arrays.asList(empMartinLina, empFrancoisParent, empRichardVaillant, empDanielDuquette, empRobertAllen)); + assertAssignment( + 1, + tasks, + events1JoursDeSemaineWed, + group4Baton, + Arrays.asList(empMartinLina, empFrancoisParent, empRichardVaillant, empDanielDuquette, empRobertAllen)); + // assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empFrancoisParent); assertAssignment(1, tasks, events1JoursDeSemaineThu, group3Boulangerie, empFrancoisParent); assertAssignment(1, tasks, events9NuitSemaineDimJeuSun, posPreposeSalubrite, empSolangeGirard); assertAssignment(1, tasks, events9NuitSemaineDimJeuMon, posPreposeSalubrite, empSolangeGirard); assertAssignment(1, tasks, events9NuitSemaineDimJeuTue, posPreposeSalubrite, empSolangeGirard); assertAssignment(1, tasks, events9NuitSemaineDimJeuWed, posPreposeSalubrite, empSolangeGirard); assertAssignment(1, tasks, events9NuitSemaineDimJeuThu, posPreposeSalubrite, empSolangeGirard); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empMartinLina); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group4Baton, empMartinLina); - //assertAssignment(1, tasks, events1JoursDeSemaineWed, group4Baton, empMartinLina); - //assertAssignment(3, tasks, events1JoursDeSemaineWed, group1Emballage, empMartinLina); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empMartinLina); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group4Baton, empMartinLina); + // assertAssignment(1, tasks, events1JoursDeSemaineWed, group4Baton, empMartinLina); + // assertAssignment(3, tasks, events1JoursDeSemaineWed, group1Emballage, empMartinLina); assertAssignment(1, tasks, events1JoursDeSemaineThu, group4Baton, Arrays.asList(empMartinLina, empRichardVaillant, empRobertAllen)); assertAssignment(1, tasks, events1JoursDeSemaineMon, posOperateurGrispac, empLiseJoncas); assertAssignment(1, tasks, events1JoursDeSemaineTue, posOperateurGrispac, empLiseJoncas); @@ -5963,13 +5983,14 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events3SoirSemaineTue, posMecanicien, empSylvainCarriere); assertAssignment(1, tasks, events3SoirSemaineWed, posMecanicien, empSylvainCarriere); assertAssignment(1, tasks, events3SoirSemaineThu, posMecanicien, empSylvainCarriere); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empRichardVaillant); - //assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empRichardVaillant); - assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, Arrays.asList( - empMartinLina, - empRichardVaillant, - empRobertAllen, - empDanielDuquette)); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empRichardVaillant); + // assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empRichardVaillant); + assertAssignment( + 1, + tasks, + events1JoursDeSemaineThu, + group1Emballage, + Arrays.asList(empMartinLina, empRichardVaillant, empRobertAllen, empDanielDuquette)); assertAssignment(1, tasks, events3SoirSemaineMon, group1Emballage, empFranceBoyer); assertAssignment(1, tasks, events3SoirSemaineTue, group1Emballage, empFranceBoyer); assertAssignment(1, tasks, events3SoirSemaineWed, group1Emballage, empFranceBoyer); @@ -5980,8 +6001,8 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events5JourFinDeSemaineSun, posOperateurLigneAPain, empFrancoisArcoite); assertAssignment(1, tasks, events5JourFinDeSemaineFri, posOperateurLigneAPain, empFrancoisArcoite); assertAssignment(1, tasks, events5JourFinDeSemaineSat, posOperateurLigneAPain, empFrancoisArcoite); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empSabrinaDupuis); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empSabrinaDupuis); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empSabrinaDupuis); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empSabrinaDupuis); assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empSabrinaDupuis); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empSabrinaDupuis); assertAssignment(1, tasks, events5JourFinDeSemaineSun, posElectrotechniciens, empIvanhoeMaisonneuve); @@ -5996,10 +6017,10 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events7SoirDeFinDeSemaineSun, group5Salubrite, empAlexandreDube); assertAssignment(1, tasks, events7SoirDeFinDeSemaineFri, group5Salubrite, empAlexandreDube); assertAssignment(1, tasks, events7SoirDeFinDeSemaineSat, group5Salubrite, empAlexandreDube); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empDanielDuquette); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group4Baton, empDanielDuquette); - //assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empDanielDuquette); - //assertAssignment(1, tasks, events1JoursDeSemaineThu, group2Snack, empDanielDuquette); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group4Baton, empDanielDuquette); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group4Baton, empDanielDuquette); + // assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empDanielDuquette); + // assertAssignment(1, tasks, events1JoursDeSemaineThu, group2Snack, empDanielDuquette); assertAssignment(1, tasks, events9NuitSemaineDimJeuSun, group5Salubrite, empJohanneDuval); assertAssignment(1, tasks, events9NuitSemaineDimJeuMon, group5Salubrite, empJohanneDuval); assertAssignment(1, tasks, events9NuitSemaineDimJeuTue, group5Salubrite, empJohanneDuval); @@ -6018,8 +6039,8 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events10NuitSemaineLunVenWed, group5Salubrite, empNicolasLegault); assertAssignment(1, tasks, events10NuitSemaineLunVenThu, group5Salubrite, empNicolasLegault); assertAssignment(1, tasks, events10NuitSemaineLunVenFri, group5Salubrite, empNicolasLegault); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empStefanieReynolds); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empStefanieReynolds); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empStefanieReynolds); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empStefanieReynolds); assertAssignment(1, tasks, events1JoursDeSemaineWed, group1Emballage, empStefanieReynolds); assertAssignment(1, tasks, events1JoursDeSemaineThu, group1Emballage, empStefanieReynolds); assertAssignment(1, tasks, events3SoirSemaineMon, posElectrotechniciens, empGinoLemoine); @@ -6029,9 +6050,9 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events5JourFinDeSemaineSun, posOperateurRemplacementBoul, empMarioLongtin); assertAssignment(1, tasks, events5JourFinDeSemaineFri, posOperateurRemplacementBoul, empMarioLongtin); assertAssignment(1, tasks, events5JourFinDeSemaineSat, posOperateurRemplacementBoul, empMarioLongtin); - //assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empRobertAllen); - //assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empRobertAllen); - //assertAssignment(1, tasks, events1JoursDeSemaineWed, group2Snack, empRobertAllen); + // assertAssignment(1, tasks, events1JoursDeSemaineMon, group2Snack, empRobertAllen); + // assertAssignment(1, tasks, events1JoursDeSemaineTue, group2Snack, empRobertAllen); + // assertAssignment(1, tasks, events1JoursDeSemaineWed, group2Snack, empRobertAllen); assertAssignment(2, tasks, events1JoursDeSemaineThu, group2Snack, Arrays.asList(empMartinLina, empRichardVaillant, empRobertAllen, empDanielDuquette)); assertAssignment(1, tasks, events5JourFinDeSemaineSun, group1Emballage, empChristopheDeneault); assertAssignment(1, tasks, events5JourFinDeSemaineFri, group1Emballage, empChristopheDeneault); @@ -6039,51 +6060,62 @@ public class PlanifEventManagerGeneratePlanifTest20130113 extends ManagerTestCas assertAssignment(1, tasks, events5JourFinDeSemaineSun, group1Emballage, empPierreLemelin); assertAssignment(1, tasks, events5JourFinDeSemaineFri, group1Emballage, empPierreLemelin); assertAssignment(1, tasks, events5JourFinDeSemaineSat, group1Emballage, empPierreLemelin); - assertAssignment(2, tasks, events5JourFinDeSemaineSun, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); - assertAssignment(2, tasks, events5JourFinDeSemaineFri, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); - assertAssignment(1, tasks, events5JourFinDeSemaineSat, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); + assertAssignment( + 2, + tasks, + events5JourFinDeSemaineSun, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); + assertAssignment( + 2, + tasks, + events5JourFinDeSemaineFri, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); + assertAssignment( + 1, + tasks, + events5JourFinDeSemaineSat, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); assertAssignment(1, tasks, events5JourFinDeSemaineSun, group3Boulangerie, empLouisCarlPage); assertAssignment(1, tasks, events5JourFinDeSemaineFri, group3Boulangerie, empLouisCarlPage); assertAssignment(1, tasks, events5JourFinDeSemaineSat, group3Boulangerie, empLouisCarlPage); - //assertAssignment(1, tasks, events5JourFinDeSemaineSun, group1Emballage, empDanielGuillemette); - //assertAssignment(1, tasks, events5JourFinDeSemaineFri, group1Emballage, empDanielGuillemette); + // assertAssignment(1, tasks, events5JourFinDeSemaineSun, group1Emballage, empDanielGuillemette); + // assertAssignment(1, tasks, events5JourFinDeSemaineFri, group1Emballage, empDanielGuillemette); assertAssignment(1, tasks, events5JourFinDeSemaineSat, group3Boulangerie, Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette)); - assertAssignment(2, tasks, events2JourRemplacementSemaineMon, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); - assertAssignment(2, tasks, events2JourRemplacementSemaineTue, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); - assertAssignment(2, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); - assertAssignment(2, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays.asList( - empRobertShonfield, - empPierreGagne, - empDanielGuillemette, - empNathalieBedard)); - //assertAssignment(1, tasks, events2JourRemplacementSemaineMon, group1Emballage, Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); - //assertAssignment(1, tasks, events2JourRemplacementSemaineTue, group1Emballage, Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); - //assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); - //assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineMon, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineTue, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineWed, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); + assertAssignment( + 2, + tasks, + events2JourRemplacementSemaineThu, + group1Emballage, + Arrays.asList(empRobertShonfield, empPierreGagne, empDanielGuillemette, empNathalieBedard)); + // assertAssignment(1, tasks, events2JourRemplacementSemaineMon, group1Emballage, + // Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); + // assertAssignment(1, tasks, events2JourRemplacementSemaineTue, group1Emballage, + // Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); + // assertAssignment(1, tasks, events2JourRemplacementSemaineWed, group1Emballage, + // Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); + // assertAssignment(1, tasks, events2JourRemplacementSemaineThu, group1Emballage, + // Arrays.asList(empRobertShonfield, empPierreGagne,empDanielGuillemette)); } } diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130120.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130120.java index adaed1d4c50dd0008c419ba28fcfcc0d38fd5fed..efd7a58783a3d6f86af6bc9bb415870f5be163b7 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130120.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PlanifEventManagerGeneratePlanifTest20130120.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -726,11 +728,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas */ private void createPreferences() throws ManagerException { - setEmployeePreference(managers, empDonaldTheriault, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empDonaldTheriault, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLouiseVeillette, null, null, sec1Emballage, Arrays.asList( team1JoursDeSemaine, team2JourRemplacementSemaine, @@ -984,11 +988,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team6JoursRemplacementFinDeSemaine, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMichelMeunier, posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMichelMeunier, + posHuileurGraisseurEntretienPreventif, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empPierreLamarque, posOperateurEnsacheuseVerticalSnack, team1JoursDeSemaine, sec2Snack, Arrays.asList( team1JoursDeSemaine, team3SoirSemaine, @@ -1319,11 +1325,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empMarcBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMarcBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMichelineLegault, null, null, sec1Emballage, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, @@ -1544,11 +1552,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team4SoirRemplacementSemaine, team3SoirSemaine)); - setEmployeePreference(managers, empLucRoy, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empLucRoy, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empLucieCaron, null, null, sec5Salubrite, Arrays.asList( team10NuitSemaineLunVen, team9NuitSemaineDimJeu, @@ -1670,16 +1680,20 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team9NuitSemaineDimJeu, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empSylvainJulien, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empSylvainJulien, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empSylvainCarriere, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); + setEmployeePreference( + managers, + empSylvainCarriere, + posMecanicien, team1JoursDeSemaine, - team3SoirSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team3SoirSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empRichardVaillant, null, null, sec3Boulangerie, Arrays.asList( team1JoursDeSemaine, team5JourFinDeSemaine, @@ -1735,11 +1749,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team10NuitSemaineLunVen, team8SoirRemplacementFinDeSemaine, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empIvanhoeMaisonneuve, posElectrotechniciens, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empIvanhoeMaisonneuve, + posElectrotechniciens, team1JoursDeSemaine, - team5JourFinDeSemaine, - team7SoirDeFinDeSemaine, - team3SoirSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team7SoirDeFinDeSemaine, team3SoirSemaine)); setEmployeePreference(managers, empMathieuGuy, posOperateurGerbeuseVerification, team5JourFinDeSemaine, sec3Boulangerie, Arrays.asList( team5JourFinDeSemaine, team1JoursDeSemaine, @@ -1762,11 +1778,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team8SoirRemplacementFinDeSemaine, team10NuitSemaineLunVen, team7SoirDeFinDeSemaine)); - setEmployeePreference(managers, empMathewBellemare, posMecanicien, team1JoursDeSemaine, sec7Maintenance, Arrays.asList( + setEmployeePreference( + managers, + empMathewBellemare, + posMecanicien, team1JoursDeSemaine, - team5JourFinDeSemaine, - team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empAlexandreDube, posPreposeSalubrite, team7SoirDeFinDeSemaine, sec5Salubrite, Arrays.asList( team7SoirDeFinDeSemaine, team1JoursDeSemaine, @@ -1866,11 +1884,13 @@ public class PlanifEventManagerGeneratePlanifTest20130120 extends ManagerTestCas team10NuitSemaineLunVen, team7SoirDeFinDeSemaine, team8SoirRemplacementFinDeSemaine)); - setEmployeePreference(managers, empGinoLemoine, posElectrotechniciens, team3SoirSemaine, sec7Maintenance, Arrays.asList( - team1JoursDeSemaine, - team5JourFinDeSemaine, + setEmployeePreference( + managers, + empGinoLemoine, + posElectrotechniciens, team3SoirSemaine, - team7SoirDeFinDeSemaine)); + sec7Maintenance, + Arrays.asList(team1JoursDeSemaine, team5JourFinDeSemaine, team3SoirSemaine, team7SoirDeFinDeSemaine)); setEmployeePreference(managers, empMarioLongtin, null, null, sec4Baton, Arrays.asList( team3SoirSemaine, team1JoursDeSemaine, diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PositionManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PositionManagerTest.java index 7dab67c63c19f206e33b2815ec1e80eb14ae8da5..53371c053f2ee04752694943df92c9b3e4127b1e 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PositionManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/PositionManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -28,9 +30,8 @@ import com.planimod.core.Position; import com.planimod.core.Section; /** - * This class contains test to cover operation done using position objects. - * SR102 : permettre d'ajouter et modifier les postes devant être pourvus lors - * de la production du produit. + * This class contains test to cover operation done using position objects. SR102 : permettre d'ajouter et modifier les + * postes devant être pourvus lors de la production du produit. * * @author patapouf * diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductManagerTest.java index 8bac81d5969f678a4366d5054f02631ced57a3d9..95d5f7416cc3ccb4fb4282ddec4d095c8286d632 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductPositionManagersTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductPositionManagersTest.java index c9c8fa6edcadad2094905b005ed7a91e227f7b10..c5e232c3f41e47c39f34ce1fba5b1c5703dfb981 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductPositionManagersTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductPositionManagersTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductionEventManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductionEventManagerTest.java index e48c64d8e0408d6f812b94f98962cc160e6b4608..d5971276ce37623e0f774510258404ed3d1b57e4 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductionEventManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ProductionEventManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -57,8 +59,7 @@ public class ProductionEventManagerTest extends ManagerTestCase { ProductionEvent event = (ProductionEvent) object; return event.getProduct().equals(product) && (shiftEvent == null && event.getShift().getStartDate().getTime() == start.getTime() && event.getShift().getEndDate().getTime() == end - .getTime()) - || (shiftEvent != null && event.getShift().equals(shiftEvent)); + .getTime()) || (shiftEvent != null && event.getShift().equals(shiftEvent)); } }); if (expected != count) { diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/QualificationManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/QualificationManagerTest.java index 0470a037c29458b98d9d8e638e26b3d037addac0..30adb9ab6aa5851897e0e8a6775a9c443be8fa2c 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/QualificationManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/QualificationManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -217,8 +219,7 @@ public class QualificationManagerTest extends ManagerTestCase { } /** - * Check if the listByPositionAndEmployee select the right qualification - * object. + * Check if the listByPositionAndEmployee select the right qualification object. */ @Test public void ListByPositionAndEmployee() { diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/SectionManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/SectionManagerTest.java index a5ae50df43c3ed4710fe52a607a166f4c39c118e..ed5c45dc441968b3289c907a16baaacaf15fb26c 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/SectionManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/SectionManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftManagerTest.java index 1f12a52d772f5c80b9f31f0c133a5a44095e910d..bb66f34fa58c1ca26048f4fd9b7eb6e8cba9ad4a 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftUtils.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftUtils.java index 129a66c9171951f8628a1e935fdddf9e46f2784e..15a011ee0071fa1ba5c65331413280238f540cdf 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftUtils.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/ShiftUtils.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TaskManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TaskManagerTest.java index fd0f596779137de053f266e938f486bd6c5f0e2b..118d1d7699f227ccd27c2f4c8c89f02e07a2ffb3 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TaskManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TaskManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -221,8 +223,7 @@ public class TaskManagerTest extends ManagerTestCase { } /** - * Check if the function getQualificationTable is returning the expected - * results. + * Check if the function getQualificationTable is returning the expected results. * * @throws ManagerException */ diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TeamManagerTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TeamManagerTest.java index 325365391d4d4e60b158d11b1b425202493c8e96..15e29d7af503f114035a0a4541dd04d65aaf9163 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TeamManagerTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TeamManagerTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeRangesTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeRangesTest.java index 8f8ff0bbbf13b9e1984b59ba2edf5cc48bf6c03f..3bdc396fd5a799a7ad7f2d8b20373332400d53ab 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeRangesTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeRangesTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; @@ -217,8 +219,7 @@ public class TimeRangesTest { } /** - * Check the result of previousWeek() function with a time range not - * corresponding to a week. + * Check the result of previousWeek() function with a time range not corresponding to a week. */ @Test public void testPreviousWeek_WithUnpreciseRange() { @@ -227,8 +228,7 @@ public class TimeRangesTest { } /** - * Check the result of previousWeek() function with a time range - * corresponding to a week. + * Check the result of previousWeek() function with a time range corresponding to a week. */ @Test public void testPreviousWeek_WithPreciseRange() { @@ -237,8 +237,7 @@ public class TimeRangesTest { } /** - * Check the result of previousWeek() function with a time range - * corresponding to a week. + * Check the result of previousWeek() function with a time range corresponding to a week. */ @Test public void testPreviousWeek_WithDaylightSaving() { diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeUtils.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeUtils.java index 2486556de56205970ca39bec6119eb5af1b89697..a177806c589fe37cf8215a8c8d4f0ba4fcf109ef 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeUtils.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/TimeUtils.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/AllTests.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/AllTests.java index 139c9b59ad98a28ddf7ed2efef822ccacaea3937..8206dba1806ee91b3ad764772fe6924304b1ac52 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/AllTests.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/AllTests.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -19,7 +21,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses( { EmployeeComparatorsTest.class, HumanNaturalComparatorTest.class }) +@Suite.SuiteClasses({ EmployeeComparatorsTest.class, HumanNaturalComparatorTest.class }) public class AllTests { } diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeeComparatorsTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeeComparatorsTest.java index 45f46d992390969ba057f3468bb14f73794a1d5a..b2bcbd8244573aaa91458e011fa35825061c811e 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeeComparatorsTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeeComparatorsTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeePreferenceComparatorsTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeePreferenceComparatorsTest.java index cb6e53a51a4dd5d84c636b42d9678b85c2b20a6f..67dbd6f18ce1983bb84de2a290ea716d8a8cdfe5 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeePreferenceComparatorsTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/EmployeePreferenceComparatorsTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/HumanNaturalComparatorTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/HumanNaturalComparatorTest.java index 68af5af1b727446b69ca3a9afaf93a3c24e66187..722d4ac1cc91aaeb1a8f1b94130d235b37cce8a9 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/HumanNaturalComparatorTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/comparators/HumanNaturalComparatorTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.comparators; @@ -31,7 +33,7 @@ public class HumanNaturalComparatorTest { // "pic4", "pic 4 else", "pic 5", "pic05", "pic 5", // "pic 5 something", "pic 6", "pic 7", "pic100", "pic100a", // "pic120", "pic121", "pic02000", "tom", "x2-g8", "x2-y7", - // "x2-y08", "x8-y8" }; + // "x2-y08", "x8-y8" }; assertTrue(comparator.compare("1-2", "1-02") == 0); assertTrue(comparator.compare("1-02", "1-20") < 0); diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/MockGeneratePlanifMonitor.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/MockGeneratePlanifMonitor.java index e09a39e6e8b2842a20821060099501593bce30c8..1bb87b3772d190f43c8c96d11a27d4e38a910df6 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/MockGeneratePlanifMonitor.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/MockGeneratePlanifMonitor.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/TableTest.java b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/TableTest.java index 327aefbf5f02d105da712f68d84952312ce77ecc..8f0c81336b63cdced064a2c3c2f250d61bb53f54 100644 --- a/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/TableTest.java +++ b/com.patrikdufresne.planimod/src/test/java/com/planimod/core/planif/TableTest.java @@ -1,17 +1,19 @@ /** - * Copyright(C) 2013 Patrik Dufresne Service Logiciel + * Copyright (C) 2019 Patrik Dufresne Service Logiciel * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.planimod.core.planif; diff --git a/com.patrikdufresne.planimod/src/test/resources/logback.xml b/com.patrikdufresne.planimod/src/test/resources/logback.xml index 84086f1a8bc97eb4647db04e539607c5ad757adc..94aadbe106af9f8e969fa9eda284aca2351f0e92 100644 --- a/com.patrikdufresne.planimod/src/test/resources/logback.xml +++ b/com.patrikdufresne.planimod/src/test/resources/logback.xml @@ -1,18 +1,20 @@ diff --git a/com.patrikdufresne.planimod/src/main/build-tools/formatter.xml b/formatter.xml similarity index 100% rename from com.patrikdufresne.planimod/src/main/build-tools/formatter.xml rename to formatter.xml diff --git a/ilp/ilp-cbc/.gitignore b/ilp/ilp-cbc/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0edeb17204d8dc92b6aa8346d01245511c0ebf33 --- /dev/null +++ b/ilp/ilp-cbc/.gitignore @@ -0,0 +1,2 @@ +/coucou.1.lp +/coucou2.lp diff --git a/ilp/ilp-cbc/pom.xml b/ilp/ilp-cbc/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..0ea1266db4385852bafac72f4d011cef29638537 --- /dev/null +++ b/ilp/ilp-cbc/pom.xml @@ -0,0 +1,102 @@ + + 4.0.0 + + com.patrikdufresne + ilp-parent + ${revision} + + ilp-cbc + + + linux_x86_64 + + + linux + amd64 + + + + + com.patrikdufresne.cbc4j + cbc4j-linux-x86_64 + 1.1 + provided + + + + + win_x86 + + + windows + amd64 + + + + + com.patrikdufresne.cbc4j + cbc4j-win-x86_64 + 1.1 + provided + + + + + + + junit + junit + 4.11 + test + + + com.patrikdufresne + ilp-core + ${project.parent.version} + + + + com.patrikdufresne + ilp-core + ${project.parent.version} + test-jar + test + + + + + + + com.googlecode.maven-java-formatter-plugin + maven-java-formatter-plugin + + + + format + + + + + ${project.basedir}/../../formatter.xml + CRLF + + + + + com.mycila.maven-license-plugin + maven-license-plugin + + + process-sources + + format + + + + +

license-header.txt
+ + + + + \ No newline at end of file diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcConstraint.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcConstraint.java new file mode 100644 index 0000000000000000000000000000000000000000..d94fe460e61567b05a3abce3bb650b38fd3bd9b3 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcConstraint.java @@ -0,0 +1,204 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.cbc4j.cbc4j; +import com.patrikdufresne.ilp.AbstractLinearProblem; +import com.patrikdufresne.ilp.ConcreteLinear; +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.Status; +import com.patrikdufresne.ilp.Term; + +public class CbcConstraint implements Constraint { + + /** + * Reference to the Cbc problem + */ + CbcLinearProblem parent; + /** + * Row index of this constraint in the problem. + */ + int row; + + /** + * Create a new constraint. + * + * @param parent + * reference to the CBC problem + * @param linear + * the linear or null + * @param row + * the constraint row index + */ + CbcConstraint(CbcLinearProblem parent, String name, Linear linear, Number lowerBound, Number upperBound) { + if (parent == null) { + throw new NullPointerException(); + } + parent.checkProblem(); + + // Call the parent function to complete the work + parent.addRow(this, name, linear, lowerBound, upperBound); + setName(name); + } + + /** + * Check if the constraint is disposed. + */ + void checkConstraint() { + if (isDisposed()) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + this.parent.checkProblem(); + } + + @Override + public void dispose() { + if (isDisposed()) { + return; + } + this.parent.removeRow(this); + } + + /** + * Returns the constraint linear expression. Need to rebuild the Linear object. + */ + @Override + public Linear getLinear() { + checkConstraint(); + // Rebuild the Linear object + int colCount = this.parent.variables.size(); + ConcreteLinear linear = new ConcreteLinear(); + for (int col = 0; col < colCount; col++) { + double coef = cbc4j.getCoefficient(this.parent.lp, this.row, col); + if (coef != 0) { + linear.add(this.parent.createTerm(coef, this.parent.getCol(col))); + } + } + // Return the Linear object + return linear; + } + + /** + * Return the row's lower bound or null if unbounded. + */ + @Override + public Double getLowerBound() { + checkConstraint(); + double value = cbc4j.getRowLower(this.parent.lp, this.row); + if (value == -this.parent.infinity) { + return null; + } + return Double.valueOf(value); + } + + /** + * Returns row name. + */ + @Override + public String getName() { + checkConstraint(); + return cbc4j.getRowName(this.parent.lp, this.row); + } + + /** + * Return the row's upper bound or null if unbounded. + */ + @Override + public Double getUpperBound() { + checkConstraint(); + double value = cbc4j.getRowUpper(this.parent.lp, this.row); + if (value == this.parent.infinity) { + return null; + } + return Double.valueOf(value); + } + + @Override + public Double getValue() { + checkConstraint(); + this.parent.checkSolution(); + // TODO implement this method. + throw new UnsupportedOperationException("don't know how to implement this"); + } + + @Override + public boolean isDisposed() { + return this.parent == null || this.row < 0; + } + + @Override + public boolean isEmpty() { + return getLinear().isEmpty(); + } + + @Override + public void setLinear(Linear linear) { + checkConstraint(); + AbstractLinearProblem.checkLinear(linear); + int[] columns; + double[] coefs; + if (linear != null) { + columns = new int[linear.size()]; + coefs = new double[linear.size()]; + int i = 0; + for (Term t : linear) { + columns[i] = ((CbcVariable) t.getVariable()).col; + coefs[i] = t.getCoefficient().doubleValue(); + i++; + } + } else { + columns = new int[0]; + coefs = new double[0]; + } + cbc4j.setCoefficients(this.parent.lp, this.row, columns.length, columns, coefs); + } + + @Override + public void setLowerBound(Number lb) { + checkConstraint(); + cbc4j.setRowLower(this.parent.lp, this.row, lb != null ? lb.doubleValue() : -this.parent.infinity); + } + + /** + * Sets the row name. + */ + private void setName(String name) { + checkConstraint(); + cbc4j.setRowName(this.parent.lp, this.row, name); + } + + /** + * Sets the row bounds and type. + */ + @Override + public void setUpperBound(Number ub) { + checkConstraint(); + cbc4j.setRowUpper(this.parent.lp, this.row, ub != null ? ub.doubleValue() : this.parent.infinity); + } + + @Override + public String toString() { + if (isDisposed()) { + return "CbcConstraint [disposed]"; //$NON-NLS-1$ + } + return "CbcConstraint [name=" + getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + } + +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcLinearProblem.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcLinearProblem.java new file mode 100644 index 0000000000000000000000000000000000000000..188580b5116fe4204bbbcc9446e4456971141d88 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcLinearProblem.java @@ -0,0 +1,509 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.patrikdufresne.cbc4j.SWIGTYPE_p_OsiClpSolverInterface; +import com.patrikdufresne.cbc4j.cbc4j; +import com.patrikdufresne.ilp.AbstractLinearProblem; +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.IPersistentLinearProblem; +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.Status; +import com.patrikdufresne.ilp.Term; +import com.patrikdufresne.ilp.VarType; +import com.patrikdufresne.ilp.Variable; + +public class CbcLinearProblem extends AbstractLinearProblem implements IPersistentLinearProblem { + + /** + * The scale for the returned value. + */ + private static final int SCALE = 9; + + /** + * Rounds the value, Implemented to solve the problems where the value was not returning an rounded number for close + * values value ex: 0.9999999999988346 instead of 1.0 + * + * @param value + * The double to be rounded + * @return The rounded value + */ + public static Double round(Double value) { + return new BigDecimal(value).setScale(SCALE, RoundingMode.HALF_EVEN).doubleValue(); + } + + /** + * Used to keep the best solution previously computed by the solver. + */ + double[] bestSolution; + /** + * The objective value. + */ + Double objValue; + + private Set constraintNames; + /** + * Need to keep reference on every constraint (row). + */ + private List constraints; + + final double infinity; + + /** + * Reference to the + */ + SWIGTYPE_p_OsiClpSolverInterface lp; + + String name; + + private String objName; + + /** + * The status of the problem. This value is sets the UNKNOWN when any variable or constraints is changed. + */ + Status status = Status.UNKNOWN; + + private Set variableNames; + + /** + * Need to keep reference on every variable (col). + */ + List variables; + + CbcLinearProblem() { + // Create a new lp + this.lp = cbc4j.newOsiClpSolverInterface(); + this.infinity = cbc4j.getInfinity(this.lp); + } + + /** + * Should be called for every new instance of CbcVariable + * + * @param var + * the variable to be added to the problem. + */ + synchronized void addCol(CbcVariable var, String name) { + if (this.variables == null) { + this.variables = new ArrayList(); + } + if (this.variableNames == null) { + this.variableNames = new HashSet(); + } + + // Create a new column using CBC API. + var.parent = this; + var.col = cbc4j.getNumCols(this.lp); + cbc4j.addCol(this.lp, 0, new int[0], new double[0], -this.infinity, this.infinity, 0); + cbc4j.setColName(this.lp, var.col, name); + if (var.col != this.variables.size()) { + throw new RuntimeException("CbcVariable.col is not set properly."); //$NON-NLS-1$ + } + this.variables.add(var); + this.variableNames.add(name); + } + + @Override + public Constraint addConstraint(String name) { + checkProblem(); + checkConstraintName(name); + CbcConstraint c = new CbcConstraint(this, name, null, null, null); + return c; + } + + /** + * To reduce the number of JNI call, this method will create the contrains in one step. + */ + @Override + public Constraint addConstraint(String name, Linear linear, Number lowerBound, Number upperBound) { + checkProblem(); + checkConstraintName(name); + checkLinear(linear); + CbcConstraint c = new CbcConstraint(this, name, linear, lowerBound, upperBound); + return c; + } + + /** + * Should be called for every instance of CbcConstraint. + * + * @param constraint + * the constraint to be added to the problem. + * @param upperBound + * @param lowerBound + * @param linear + */ + synchronized void addRow(CbcConstraint constraint, String name, Linear linear, Number lowerBound, Number upperBound) { + if (this.constraints == null) { + this.constraints = new ArrayList(); + } + if (this.constraintNames == null) { + this.constraintNames = new HashSet(); + } + constraint.parent = this; + constraint.row = cbc4j.getNumRows(this.lp); + int[] columns; + double[] coefs; + if (linear != null) { + columns = new int[linear.size()]; + coefs = new double[linear.size()]; + int i = 0; + for (Term t : linear) { + columns[i] = ((CbcVariable) t.getVariable()).col; + coefs[i] = t.getCoefficient().doubleValue(); + i++; + } + } else { + columns = new int[0]; + coefs = new double[0]; + } + cbc4j.addRow( + this.lp, + columns.length, + columns, + coefs, + lowerBound != null ? lowerBound.doubleValue() : -this.infinity, + upperBound != null ? upperBound.doubleValue() : this.infinity); + if (constraint.row != this.constraints.size()) { + throw new RuntimeException("CbcConstraint.row is not set properly."); //$NON-NLS-1$ + } + this.constraints.add(constraint); + this.constraintNames.add(name); + } + + /** + * Add a new variables to the problem. + */ + @Override + public Variable addVariable(String name, VarType type) { + checkProblem(); + checkVariableName(name); + CbcVariable v = new CbcVariable(this, name); + v.setType(type); + if (VarType.INTEGER.equals(type) || VarType.REAL.equals(type)) { + v.setLowerBound(null); + v.setUpperBound(null); + } + return v; + } + + /** + * Check if the constraint name is unique. Otherwise throw an exception. + * + * @param name + * the constraint name. + */ + void checkConstraintName(String name) { + if (name == null) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Undefined constraint name."); + } + if (this.constraintNames != null && this.constraintNames.contains(name)) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Duplicate constraint name: " + name); + } + } + + /** + * Check if the problem is disposed. + */ + void checkProblem() { + if (this.lp == null) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + } + + /** + * Check the solution state. Throw an exception if the solution is not available. + */ + void checkSolution() { + switch (this.status) { + case FEASIBLE: + case OPTIMAL: + break; + default: + throw new ILPException("solution not available"); //$NON-NLS-1$ + } + if (this.bestSolution == null) { + throw new ILPException("solution not available"); //$NON-NLS-1$ + } + } + + /** + * Check if the variable name is unique. Otherwise throw an exception. + * + * @param name + * the constraint name. + */ + void checkVariableName(String name) { + if (name == null) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Undefined variable name."); + } + if (this.variableNames != null && this.variableNames.contains(name)) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Duplicate variable name: " + name); + } + } + + @Override + public void dispose() { + // Free the lp problem. + if (this.lp != null) { + cbc4j.deleteOsiClpSolverInterface(this.lp); + } + this.lp = null; + this.bestSolution = null; + } + + /** + * Return the variable for the given column index. + * + * @param col + * the column index. + * @return the variable object + */ + Variable getCol(int col) { + CbcVariable var = this.variables.get(col); + if (var.col != col) { + throw new ILPException("Variables list corrupted"); //$NON-NLS-1$ + } + return var; + } + + /** + * Return an unmodifiable collection of constraints. + */ + @Override + public Collection getConstraints() { + if (this.constraints == null) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(this.constraints); + } + + /** + * Return the problem name. + */ + @Override + public String getName() { + checkProblem(); + return this.name; + } + + /** + * Return the problem's direction. + * + * @return + */ + @Override + public int getObjectiveDirection() { + checkProblem(); + double sense = cbc4j.getObjSense(this.lp); + return sense > 0 ? MINIMIZE : MAXIMIZE; + } + + /** + * This implementation rebuild the linear object. + * + * @return + */ + @Override + public Linear getObjectiveLinear() { + checkProblem(); + // Get the coefficient of each column. + Linear linear = createLinear(); + double[] coefs = cbc4j.getObjCoefficients(this.lp); + for (int col = 0; col < coefs.length; col++) { + if (coefs[col] != 0) { + linear.add(createTerm(coefs[col], getCol(col))); + } + } + if (linear.isEmpty()) { + return null; + } + return linear; + } + + /** + * This implementation return the objective value. + */ + @Override + public Double getObjectiveValue() { + checkProblem(); + checkSolution(); + if (this.objValue == null) return null; + return round(this.objValue); + } + + /** + * Get the problem status + */ + @Override + public Status getStatus() { + checkProblem(); + if (this.status == null) { + return Status.UNKNOWN; + } + return this.status; + } + + @Override + public Collection getVariables() { + if (this.variables == null) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(this.variables); + } + + /** + * Return true if lp is null. + */ + @Override + public boolean isDisposed() { + return this.lp == null; + } + + /** + * Load the problem from Mps file. + */ + @Override + public void load(File file) throws IOException { + checkProblem(); + cbc4j.readLp(this.lp, file.getAbsolutePath()); + } + + /** + * Remove the column from the linear problem. + * + * @param col + */ + synchronized void removeCol(CbcVariable var) { + int index; + if (this.variables == null || (index = this.variables.indexOf(var)) < 0) { + throw new RuntimeException("CbcVariable not in the variable list."); //$NON-NLS-1$ + } + + String varName = var.getName(); + cbc4j.deleteCols(this.lp, 1, new int[] { var.col }); + this.variables.remove(index); + this.variableNames.remove(varName); + + var.col = 0; + var.parent = null; + + // Adjust the bestSolution + if (this.bestSolution != null && this.bestSolution.length > 1) { + double[] newSolution = new double[this.bestSolution.length - 1]; + System.arraycopy(bestSolution, 0, newSolution, 0, index); + System.arraycopy(bestSolution, index + 1, newSolution, index, bestSolution.length - index - 1); + this.bestSolution = newSolution; + } + + for (; index < this.variables.size(); index++) { + CbcVariable sub = this.variables.get(index); + sub.col = index; + } + + } + + synchronized void removeRow(CbcConstraint constraint) { + int index; + if (this.constraints == null || (index = this.constraints.indexOf(constraint)) < 0) { + throw new RuntimeException("CbcConstraint not in the constraint list."); //$NON-NLS-1$ + } + String constName = constraint.getName(); + cbc4j.deleteRows(this.lp, 1, new int[] { constraint.row }); + this.constraints.remove(index); + this.constraintNames.remove(constName); + constraint.row = 0; + constraint.parent = null; + for (; index < this.constraints.size(); index++) { + CbcConstraint sub = this.constraints.get(index); + sub.row = index; + } + } + + /** + * This implementation write the lp into Mps. + */ + @Override + public void save(File file) throws IOException { + checkProblem(); + // Write the lp + cbc4j.writeLp(this.lp, file.getAbsolutePath()); + } + + /** + * Sets the problem's name + */ + void setName(String name) { + checkProblem(); + this.name = name; + } + + /** + * Sets the objective direction. + */ + @Override + public void setObjectiveDirection(int direction) { + checkProblem(); + switch (direction) { + case MAXIMIZE: + cbc4j.setObjSense(this.lp, -1.0); + break; + case MINIMIZE: + cbc4j.setObjSense(this.lp, 1.0); + break; + default: + throw new IllegalArgumentException(); + } + } + + /** + * This implementation sets the objective name and coefficient. + */ + @Override + public void setObjectiveLinear(Linear linear) { + checkProblem(); + checkLinear(linear); + int[] columns; + double[] coefs; + if (linear != null) { + columns = new int[linear.size()]; + coefs = new double[linear.size()]; + int i = 0; + for (Term t : linear) { + columns[i] = ((CbcVariable) t.getVariable()).col; + coefs[i] = t.getCoefficient().doubleValue(); + i++; + } + } else { + columns = new int[0]; + coefs = new double[0]; + } + cbc4j.setObjCoefficients(this.lp, columns.length, columns, coefs); + } + +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolver.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolver.java new file mode 100644 index 0000000000000000000000000000000000000000..009a974e4344907e62b09f45957fcfc3b90ab138 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolver.java @@ -0,0 +1,209 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import java.util.Arrays; +import java.util.List; + +import com.patrikdufresne.cbc4j.CBCLibrary; +import com.patrikdufresne.cbc4j.SWIGTYPE_p_CbcModel; +import com.patrikdufresne.cbc4j.cbc4j; +import com.patrikdufresne.ilp.ILPLogger; +import com.patrikdufresne.ilp.ILPPolicy; +import com.patrikdufresne.ilp.LinearProblem; +import com.patrikdufresne.ilp.Solver; +import com.patrikdufresne.ilp.SolverOption; +import com.patrikdufresne.ilp.Status; + +/** + * Cbc solver + * + * @author Patrik Dufresne + * + */ +public class CbcSolver implements Solver { + + static { + CBCLibrary.load(); + } + + /** + *
+     * 0 - none
+     * 1 - minimal
+     * 2 - normal low
+     * 3 - normal high
+     * 4 - verbose
+     * 
+ * + * @return + */ + private static int getCbcLogLevel() { + switch (ILPPolicy.getLog().getLevel()) { + case ILPLogger.TRACE: + return 4; + case ILPLogger.DEBUG: + return 3; + case ILPLogger.INFO: + return 2; + case ILPLogger.WARNING: + return 0; + case ILPLogger.ERROR: + default: + return 0; + } + } + + public CbcSolver() { + // Create a new reference to cbc solver. + } + + /** + *
+     * clp status
+     *   -1 - unknown e.g. before solve or if postSolve says not optimal
+     *   0 - optimal
+     *   1 - primal infeasible
+     *   2 - dual infeasible
+     *   3 - stopped on iterations or time
+     *   4 - stopped due to errors
+     *   5 - stopped by event handler (virtual int ClpEventHandler::event()) 
+     * cbc status
+     *   -1 before branchAndBound
+     *   0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
+     *   (or check value of best solution)
+     *   1 stopped - on maxnodes, maxsols, maxtime
+     *   2 difficulties so run was abandoned
+     *   (5 event user programmed event occurred) 
+     * clp secondary status of problem - may get extended
+     *   0 - none
+     *   1 - primal infeasible because dual limit reached OR probably primal
+     *   infeasible but can't prove it (main status 4)
+     *   2 - scaled problem optimal - unscaled problem has primal infeasibilities
+     *   3 - scaled problem optimal - unscaled problem has dual infeasibilities
+     *   4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities
+     *   5 - giving up in primal with flagged variables
+     *   6 - failed due to empty problem check
+     *   7 - postSolve says not optimal
+     *   8 - failed due to bad element check
+     *   9 - status was 3 and stopped on time
+     *   100 up - translation of enum from ClpEventHandler
+     *      
+     * cbc secondary status of problem
+     *   -1 unset (status_ will also be -1)
+     *   0 search completed with solution
+     *   1 linear relaxation not feasible (or worse than cutoff)
+     *   2 stopped on gap
+     *   3 stopped on nodes
+     *   4 stopped on time
+     *   5 stopped on user event
+     *   6 stopped on solutions
+     *   7 linear relaxation unbounded
+     *   8 stopped on iterations limit
+     * 
+ * + * @param status + * @param secondaryStatus + * @return + */ + Status checkStatus(SWIGTYPE_p_CbcModel cbcModel) { + int status = cbc4j.status(cbcModel); + if (status == 0) { + if (cbc4j.isProvenOptimal(cbcModel)) { + return Status.OPTIMAL; + } else if (cbc4j.isProvenInfeasible(cbcModel)) { + return Status.INFEASIBLE; + } + throw new IllegalStateException("cbc solver finish without a known status"); + } + return Status.UNKNOWN; + } + + @Override + public LinearProblem createLinearProblem() { + return new CbcLinearProblem(); + } + + @Override + public SolverOption createSolverOption() { + return new CbcSolverOption(); + } + + @Override + public void dispose() { + // Nothing to do. + } + + @Override + public boolean solve(LinearProblem lp, SolverOption option) { + // Check arguments value. + if (lp == null || !(lp instanceof CbcLinearProblem)) { + throw new IllegalArgumentException("invalid linear problem"); + } + if (!(option instanceof CbcSolverOption)) { + throw new IllegalArgumentException("invalid solver option"); + } + long start = 0; + boolean traceEnabled = ILPPolicy.getLog().getLevel() == ILPLogger.TRACE; + CbcLinearProblem cbclp = (CbcLinearProblem) lp; + + // Start the time counter; + if (traceEnabled) { + start = System.currentTimeMillis(); + } + + // Release the previous solution. + cbclp.bestSolution = null; + cbclp.objValue = null; + + // Flush java output. + System.out.flush(); + + // Build solver arguments. + ((CbcSolverOption) option).setLogLevel(getCbcLogLevel()); + ((CbcSolverOption) option).setSLogLevel(getCbcLogLevel()); + List list = ((CbcSolverOption) option).getArgs(); + String args[] = list.toArray(new String[list.size()]); + // Print the arguments. Should be removed. + ILPPolicy.getLog().log(ILPLogger.TRACE, "arguments: " + list); + + /* Call CBC solver. */ + // Make of copy of the original Lp to avoid side effect when solving the problem. + SWIGTYPE_p_CbcModel cbcModel = cbc4j.newCbcModel(cbclp.lp); + try { + cbc4j.callCbc0(cbcModel); + cbc4j.callCbc1(args.length, args, cbcModel); + + // Print the total time took to run CBC. + if (traceEnabled) { + ILPPolicy.getLog().log(ILPLogger.TRACE, "cbc solver took " + (System.currentTimeMillis() - start) + " ms"); + } + + // Check the status, retrieve the best solution, get the objective value. + cbclp.status = checkStatus(cbcModel); + cbclp.bestSolution = cbc4j.bestSolution(cbcModel); + cbclp.objValue = cbc4j.getObjValue(cbcModel); + + } finally { + // Release the cbcModel + cbc4j.deleteCbcModel(cbcModel); + } + + return Status.FEASIBLE.equals(cbclp.status) || Status.OPTIMAL.equals(cbclp.status); + } +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolverFactory.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolverFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..3dcdbb35484e5ee27ee7f93c77be8eaf33a55d7f --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolverFactory.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.ilp.Solver; +import com.patrikdufresne.ilp.SolverFactory; + +public class CbcSolverFactory implements SolverFactory { + + private static CbcSolverFactory instance; + + /** + * Return the unique instance of this class. + * + * @return + */ + public static CbcSolverFactory instance() { + if (instance == null) { + instance = new CbcSolverFactory(); + } + return instance; + } + + /** + * Private constructor for singleton. + */ + private CbcSolverFactory() { + // Nothing to do. + } + + @Override + public Solver createSolver() { + return new CbcSolver(); + } + +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolverOption.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolverOption.java new file mode 100644 index 0000000000000000000000000000000000000000..c2b7d2fad8be55a08a5a7eec606f089e69c147c6 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcSolverOption.java @@ -0,0 +1,425 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.patrikdufresne.ilp.SolverOption; + +/** + * Cbc solver options. + * + * @author Patrik Dufresne + * + */ +public class CbcSolverOption implements SolverOption { + + private static final String COMBINE_SOLUTIONS = "-combineSolutions"; + private static final String COST_STRATEGY = "costStrategy"; + private static final String CUTSONOFF = "-cutsonoff"; + private static final String FEASIBILITY_PUMP = "-feasibilityPump"; + private static final String GMI_CUTS = "GMICuts"; + private static final String HEURISTICS_ON_OFF = "-heuristicsOnOff"; + private static final String LATWOMIR_CUTS = "latwomirCuts"; + private static final String LOGLEVEL = "-logLevel"; + private static final String OFF = "off"; + private static final String ON = "on"; + private static final String PERTURBATION = "perturbation"; + private static final String PREPROCESS = "-preprocess"; + private static final String PRESOLVE = "presolve"; + private static final String PROBING_CUTS = "probingCuts"; + private static final String PROBNAME = "problem-name"; + private static final String REDUCE_AND_SPLIT_CUTS = "reduceAndSplitCuts"; + private static final String SLOGLEVEL = "-slogLevel"; + private static final String SOLVE = "-solve"; + private static final String STRATEGY = "-strategy"; + private static final String TRUST_PSEUDO_COST = "-trustPseudoCosts"; + + private Boolean combineSolutions; // Base at on + private CostStrategy costStrategy; // Base at off. + private Boolean cutsOnOff; // Base at on + private Boolean feasibilityPump; // Base at on + private GMICuts gmiCuts; + private Boolean heuristicsOnOff; // Base at on. + private LatwomirCuts latwomirCuts; + private Integer logLevel = 0; // Base at 1 + private Boolean perturbation; + private Preprocess preprocess; // Base at sos + private Presolve presolve; + private ProbingCuts probingCuts; + + private ReduceAndSplitCuts reduceAndSplitCuts; + + private Integer sLogLevel; // Base at 1 + private Integer strategy; // Base at 1 + private Integer trustPseudoCost; // Base at 5 + + /** + * Used to generate the list of argument to be passed to CbcMain. + * + * @return the argument list. + */ + public List getArgs() { + List args = new ArrayList(); + args.add(PROBNAME); + if (this.preprocess != null) { + args.addAll(Arrays.asList(PREPROCESS, this.preprocess.toString())); + } + if (this.feasibilityPump != null) { + args.addAll(Arrays.asList(FEASIBILITY_PUMP, this.feasibilityPump ? ON : OFF)); + } + if (this.cutsOnOff != null) { + args.addAll(Arrays.asList(CUTSONOFF, this.cutsOnOff ? ON : OFF)); + } + if (this.heuristicsOnOff != null) { + args.addAll(Arrays.asList(HEURISTICS_ON_OFF, this.heuristicsOnOff ? ON : OFF)); + } + if (this.combineSolutions != null) { + args.addAll(Arrays.asList(COMBINE_SOLUTIONS, this.combineSolutions ? ON : OFF)); + } + if (this.strategy != null) { + args.addAll(Arrays.asList(STRATEGY, Integer.toString(this.strategy))); + } + if (this.logLevel != null) { + args.addAll(Arrays.asList(LOGLEVEL, Integer.toString(this.logLevel))); + } + if (this.sLogLevel != null) { + args.addAll(Arrays.asList(SLOGLEVEL, Integer.toString(this.sLogLevel))); + } + if (this.trustPseudoCost != null) { + args.addAll(Arrays.asList(TRUST_PSEUDO_COST, Integer.toString(this.trustPseudoCost))); + } + if (this.costStrategy != null) { + args.addAll(Arrays.asList(COST_STRATEGY, this.costStrategy.toString())); + } + if (this.reduceAndSplitCuts != null) { + args.addAll(Arrays.asList(REDUCE_AND_SPLIT_CUTS, this.reduceAndSplitCuts.toString())); + } + if (this.gmiCuts != null) { + args.addAll(Arrays.asList(GMI_CUTS, this.gmiCuts.toString())); + } + if (this.latwomirCuts != null) { + args.addAll(Arrays.asList(LATWOMIR_CUTS, this.latwomirCuts.toString())); + } + if (this.probingCuts != null) { + args.addAll(Arrays.asList(PROBING_CUTS, this.probingCuts.toString())); + } + if (this.presolve != null) { + args.addAll(Arrays.asList(PRESOLVE, this.presolve.toString())); + } + if (this.perturbation != null) { + args.addAll(Arrays.asList(PERTURBATION, this.perturbation ? ON : OFF)); + } + args.add(SOLVE); + return args; + } + + /** + * Return the current cost strategy to be used or null to use default. + * + * @return + */ + public CostStrategy getCostStrategy() { + return costStrategy; + } + + /** + * Return the cutsOnOff value or null if undefined. Base value at on. + * + * @return cutsOnOff value or null + */ + public Boolean getCutsOnOff() { + return this.cutsOnOff; + } + + /** + * Return the feas(ibilityPump) value or null if undefined. Base value at on. + * + * @return feasibilityPump value or null + */ + public Boolean getFeasibilityPump() { + return this.feasibilityPump; + } + + public GMICuts getGmiCuts() { + return gmiCuts; + } + + /** + * Return the state of heur(isticsOnOff). + * + * @return True if the heur(isticsOnOff) is turn on, false to disable heuristic or null tu use default. + */ + public Boolean getHeuristicsOnOff() { + return heuristicsOnOff; + } + + public LatwomirCuts getLatwomirCuts() { + return latwomirCuts; + } + + /** + * Return the logLevel value or null if undefined. Base value at 1. + * + * @return logLevel value or null + */ + public Integer getLogLevel() { + return this.logLevel; + } + + public Boolean getPerturbation() { + return perturbation; + } + + /** + * Return the preprocess value or null if undefined. Base value at sos. + * + * @return preprocess value or null + */ + public Preprocess getPreprocess() { + return this.preprocess; + } + + public Presolve getPresolve() { + return presolve; + } + + public ProbingCuts getProbingCuts() { + return probingCuts; + } + + public ReduceAndSplitCuts getReduceAndSplit() { + return reduceAndSplitCuts; + } + + /** + * Return the sLogLevel value or null if undefined. Base value at 1. + * + * @return sLogLevel value or null + */ + public Integer getSLogLevel() { + return this.sLogLevel; + } + + /** + * Return the strategy value or null if undefined. Base value at 1. + * + * @return strategy value or null. + */ + public Integer getStrategy() { + return this.strategy; + } + + /** + * Return the trustPseudoCost value or null if undefined. Base value at 5. + * + * @return trustPseudoCost value or null + */ + public Integer getTrustPseudoCost() { + return this.trustPseudoCost; + } + + /** + * Return the combineSolution value or null if undefined. Base value at on. + * + * @return combineSolution value or null + */ + public Boolean isCombineSolutions() { + return this.combineSolutions; + } + + /** + * Sets or unset the combineSolution value. + * + * @param strategy + * the new combineSolution value or null. + */ + public void setCombineSolutions(Boolean combineSolutions) { + this.combineSolutions = combineSolutions; + } + + /** + * Sets how to use costs as priorities. This orders the variables in order of their absolute costs - with largest + * cost ones being branched on first. This primitive strategy can be surprsingly effective. The column order option + * is obviously not on costs but easy to code here. Default off. + * + * @param costStrategy + * off, pri(orities), column(Order?), 01f(irst?), 01l(ast?), singletons or nonzero + */ + public void setCostStrategy(CostStrategy costStrategy) { + this.costStrategy = costStrategy; + } + + /** + * Sets or unset the cutsOnOff value. + * + * @param strategy + * the new cutsOnOff value or null. + */ + public void setCutsOnOff(Boolean cutsOnOff) { + this.cutsOnOff = cutsOnOff; + } + + /** + * Sets or unset the feasibilityPump value. + * + * @param strategy + * the new feasibilityPump value or null. + */ + public void setFeasibilityPump(Boolean feasibilityPump) { + this.feasibilityPump = feasibilityPump; + } + + /** + * Sets whether to use alternative Gomory cuts. This switches on an alternative Gomory cut generator (either at root + * or in entire tree). This version is by Giacomo Nannicini and may be more robust. See branchAndCut for information + * on options. Default off. + * + * @param gmiCuts + */ + public void setGmiCuts(GMICuts gmiCuts) { + this.gmiCuts = gmiCuts; + } + + /** + * Switches most heuristics on or off. This can be used to switch on or off all heuristics. Then you can do + * individual ones off or on. CbcTreeLocal is not included as it dramatically alters search. + * + * @param heuristicsOnOff + * True to enable heuristics, false to disable heuristics, null to use default. + */ + public void setHeuristicsOnOff(Boolean heuristicsOnOff) { + this.heuristicsOnOff = heuristicsOnOff; + } + + /** + * Sets whether to use Lagrangean TwoMir cuts. This is a lagrangean relaxation for TwoMir cuts. See lagomoryCuts for + * description of options. Default off. + * + * @param latwomirCuts + */ + public void setLatwomirCuts(LatwomirCuts latwomirCuts) { + this.latwomirCuts = latwomirCuts; + } + + /** + * Sets or unset the logLevel value. + * + * @param strategy + * the new logLevel value or null. + */ + public void setLogLevel(Integer logLevel) { + this.logLevel = logLevel; + } + + /** + * Sets whether to perturb problem. Perturbation helps to stop cycling, but Clp uses other measures for this. + * However large problems and especially ones with unit elements and unit rhs or costs benefit from perturbation. + * Normally Clp tries to be intelligent, but you can switch this off. The Clp library has this off by default. + * Default on. + * + * @param perturbation + */ + public void setPerturbation(Boolean perturbation) { + this.perturbation = perturbation; + } + + /** + * Sets whether to use integer preprocessing. This tries to reduce size of model in a similar way to presolve and it + * also tries to strengthen the model - this can be very useful and is worth trying. + *
    + *
  • equal will turn <= cliques into ==.
  • + *
  • sos will create sos sets if all 0-1 in sets (well one extra is allowed) and no overlaps.
  • + *
  • trysos is same but allows any number extra.
  • + *
  • equalall will turn all valid inequalities into equalities with integer slacks.
  • + *
  • strategy is as on but uses CbcStrategy. + *
+ * Default sos + * + * @param strategy + * the new preprocess value or null. + */ + public void setPreprocess(Preprocess preprocess) { + this.preprocess = preprocess; + } + + /** + * Sets whether to presolve problem Presolve analyzes the model to find such things as redundant equations, + * equations which fix some variables, equations which can be transformed into bounds etc etc. For the initial solve + * of any problem this is worth doing unless you know that it will have no effect. on will normally do + * 5 passes while using more will do 10. If the problem is very large you may need to write the + * original to file using 'file'. Default on. + * + * @param presolve + */ + public void setPresolve(Presolve presolve) { + this.presolve = presolve; + } + + /** + * Sets whether to use Probing cuts. This switches on probing cuts (either at root or in entire tree). See + * branchAndCut for information on options. but strong options do more probing. Default on. + * + * @param probingCuts + */ + public void setProbingCuts(ProbingCuts probingCuts) { + this.probingCuts = probingCuts; + } + + /** + * Sets whether to use Reduce-and-Split cuts. This switches on reduce and split cuts (either at root or in entire + * tree). May be slow See branchAndCut for information on options. Default off. + * + * @param reduceAndSplitCuts + */ + public void setReduceAndSplit(ReduceAndSplitCuts reduceAndSplitCuts) { + this.reduceAndSplitCuts = reduceAndSplitCuts; + } + + /** + * Sets or unset the sLogLevel value. + * + * @param strategy + * the new sLogLevel value or null. + */ + public void setSLogLevel(Integer sLogLevel) { + this.sLogLevel = sLogLevel; + } + + /** + * Sets or unset the strategy value. + * + * @param strategy + * the new strategy value or null. + */ + public void setStrategy(Integer strategy) { + this.strategy = strategy; + } + + /** + * Sets or unset the trustPseudocost value. + * + * @param trustPseudocost + * the new trustPseudocost value or null. + */ + public void setTrustPseudoCost(Integer trustPseudoCost) { + this.trustPseudoCost = trustPseudoCost; + } +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcVariable.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcVariable.java new file mode 100644 index 0000000000000000000000000000000000000000..c6e7484dae9a481fee9a3a77ce719198de9b9179 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CbcVariable.java @@ -0,0 +1,173 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.cbc4j.cbc4j; +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.VarType; +import com.patrikdufresne.ilp.Variable; + +public class CbcVariable implements Variable { + /** + * The col index. + */ + int col; + + /** + * Reference to the problem. + */ + CbcLinearProblem parent; + + /** + * Create a new variable. + * + * @param parent + * the parent problem. + */ + CbcVariable(CbcLinearProblem parent, String name) { + if (parent == null) { + throw new NullPointerException(); + } + parent.checkProblem(); + + // Call the parent function to complete the opperation. + parent.addCol(this, name); + } + + /** + * Check if the variable is disposed. + */ + void checkVariable() { + if (isDisposed()) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + this.parent.checkProblem(); + } + + /** + * This implementation remove the column from the linear problem. + */ + @Override + public void dispose() { + if (isDisposed()) { + return; + } + // Call the parent function to complete the operation. + this.parent.removeCol(this); + } + + @Override + public Double getLowerBound() { + checkVariable(); + double value = cbc4j.getColLower(this.parent.lp, this.col); + if (value == -this.parent.infinity) { + return null; + } + return Double.valueOf(value); + } + + @Override + public String getName() { + this.parent.checkProblem(); + return cbc4j.getColName(this.parent.lp, this.col); + } + + @Override + public VarType getType() { + checkVariable(); + if (cbc4j.isBinary(this.parent.lp, this.col)) { + return VarType.BOOL; + } else if (cbc4j.isInteger(this.parent.lp, this.col)) { + return VarType.INTEGER; + } else if (cbc4j.isContinuous(this.parent.lp, this.col)) { + return VarType.REAL; + } + throw new ILPException("unknown var type returns invalid value"); //$NON-NLS-1$ + } + + @Override + public Double getUpperBound() { + checkVariable(); + double value = cbc4j.getColUpper(this.parent.lp, this.col); + if (value == this.parent.infinity) { + return null; + } + return Double.valueOf(value); + } + + /** + * Retrieve the column primal value. + */ + @Override + public Double getValue() { + checkVariable(); + this.parent.checkSolution(); + return CbcLinearProblem.round(this.parent.bestSolution[this.col]); + } + + /** + * This implementation check if the {@link #col} property is set to zero (0) and if the parent is nul. + */ + @Override + public boolean isDisposed() { + return this.parent == null || this.col < 0; + } + + /** + * Sets the columns bounding type and bounds. + */ + @Override + public void setLowerBound(Number lb) { + checkVariable(); + cbc4j.setColLower(this.parent.lp, this.col, lb != null ? lb.doubleValue() : -this.parent.infinity); + } + + /** + * Sets the variable type. + * + * @param type + */ + public void setType(VarType type) { + checkVariable(); + if (type.equals(VarType.BOOL)) { + cbc4j.setInteger(this.parent.lp, this.col); + cbc4j.setColBounds(this.parent.lp, this.col, 0, 1); + } else if (type.equals(VarType.INTEGER)) { + cbc4j.setInteger(this.parent.lp, this.col); + } else if (type.equals(VarType.REAL)) { + cbc4j.setContinuous(this.parent.lp, this.col); + } + } + + /** + * Sets the columns bounding type and bounds + */ + @Override + public void setUpperBound(Number ub) { + checkVariable(); + cbc4j.setColUpper(this.parent.lp, this.col, ub != null ? ub.doubleValue() : this.parent.infinity); + } + + @Override + public String toString() { + if (isDisposed()) { + return "GcbVariable [disposed]"; //$NON-NLS-1$ + } + return getName(); + } +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CostStrategy.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CostStrategy.java new file mode 100644 index 0000000000000000000000000000000000000000..f68c8132760e15bf3fbba4d718c56398b594ff8a --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/CostStrategy.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of cost strategy value. + * + * @author Patrik Dufresne + * + */ +public enum CostStrategy { + off("off"), + priorities("priorities"), + columnOrder("columnOrder"), + zeroOneFirst("01first"), + zeroOneLast("01last"), + length("length"), + singletons("singletons"), + nonzero("nonzero"); + + private String value; + + CostStrategy(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/GMICuts.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/GMICuts.java new file mode 100644 index 0000000000000000000000000000000000000000..cb38fa8a66579e1d040f2f92c403cec975fe0701 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/GMICuts.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of GMICuts value. + * + * @author Patrik Dufresne + * + */ +public enum GMICuts { + off, on, root, ifmove, forceOn, endonly, longroot, longifmove, forceLongOn, longendonly; +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/LatwomirCuts.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/LatwomirCuts.java new file mode 100644 index 0000000000000000000000000000000000000000..5dea0c55a2df1461cb4655a9aa7f549ca8475aff --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/LatwomirCuts.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of LatwomirCuts value. + * + * @author Patrik Dufresne + * + */ +public enum LatwomirCuts { + off, endonlyroot, endcleanroot, endbothroot, endonly, endclean, endboth, onlyaswell, cleanaswell, bothaswell, onlyinstead, cleaninstead, bothinstead; +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/Preprocess.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/Preprocess.java new file mode 100644 index 0000000000000000000000000000000000000000..6cf2e324aab5516f929b152efedacda20a9ebef0 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/Preprocess.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of preprocess value. + * + * @author Patrik Dufresne + * + */ +public enum Preprocess { + off, on, equal, sos, trysos, equalall, strategy, aggregate, forcesos; +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/Presolve.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/Presolve.java new file mode 100644 index 0000000000000000000000000000000000000000..b87a1b35ae886bc9bd75af8bd12c17d51327784e --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/Presolve.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of presolve value. + * + * @author Patrik Dufresne + * + */ +public enum Presolve { + on, off, more; +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/ProbingCuts.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/ProbingCuts.java new file mode 100644 index 0000000000000000000000000000000000000000..684a912d96b2ea72579d6442c4fb1976de3cb56c --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/ProbingCuts.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of ProbingCuts values. + * + * @author Patrik Dufresne + * + */ +public enum ProbingCuts { + off, on, root, ifmove, forceOn, onglobal, forceonglobal, forceOnBut, forceOnStrong, forceOnButStrong, strongRoot; +} diff --git a/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/ReduceAndSplitCuts.java b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/ReduceAndSplitCuts.java new file mode 100644 index 0000000000000000000000000000000000000000..58b874f3794fda69f01b8f5afb10651a04ec1bb7 --- /dev/null +++ b/ilp/ilp-cbc/src/main/java/com/patrikdufresne/ilp/cbc/ReduceAndSplitCuts.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +/** + * Enumeration of reduce and split cuts value. + * + * @author Patrik Dufresne + * + */ +public enum ReduceAndSplitCuts { + off, on, root, ifmove, forceOn; +} diff --git a/ilp/ilp-cbc/src/test/java/com/patrikdufresne/Main.java b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..5f9f609fc834598ce61d5b38ffcb101d3d4641d2 --- /dev/null +++ b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/Main.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne; + +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.LinearProblem; +import com.patrikdufresne.ilp.Solver; +import com.patrikdufresne.ilp.SolverOption; +import com.patrikdufresne.ilp.Variable; +import com.patrikdufresne.ilp.cbc.CbcSolverFactory; + +public class Main { + + public static void main(String[] args) { + // Create the solver. + Solver solver = CbcSolverFactory.instance().createSolver(); + LinearProblem lp = solver.createLinearProblem(); + + // Create the model + Variable x = lp.addIntegerVariable("x", 0, null); + Variable y = lp.addIntegerVariable("y", 0, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(1, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + Constraint constraint1 = lp.addConstraint("constraint1", new int[] { -2, 6 }, new Variable[] { x, y }, null, 6); + Constraint constraint2 = lp.addConstraint("constraint2", new int[] { 2, 6 }, new Variable[] { x, y }, null, 12); + + // Solve the problem. + SolverOption option = solver.createSolverOption(); + solver.solve(lp, option); + + // Out the data. + System.out.println("Status: " + lp.getStatus()); + System.out.println("Objective value:" + lp.getObjectiveValue().doubleValue()); + System.out.println("Solution:" + lp.toString()); + + } + +} diff --git a/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/AllTests.java b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/AllTests.java new file mode 100644 index 0000000000000000000000000000000000000000..16dbb65c76d01990569e7722a899e14c23228d39 --- /dev/null +++ b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/AllTests.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ CbcLinearProblemTest.class, CbcSolverTest.class, CbcVariableTest.class, CbcConstraintTest.class }) +public class AllTests { + +} diff --git a/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcConstraintTest.java b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcConstraintTest.java new file mode 100644 index 0000000000000000000000000000000000000000..75f3a6df6f85b6662d06c72d221a6e3be354ef1e --- /dev/null +++ b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcConstraintTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.ilp.ConstraintTest; +import com.patrikdufresne.ilp.SolverFactory; + +public class CbcConstraintTest extends ConstraintTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return CbcSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcLinearProblemTest.java b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcLinearProblemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c4673deda0f981873d5caac054bbed1d928299c5 --- /dev/null +++ b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcLinearProblemTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.ilp.LinearProblemTest; +import com.patrikdufresne.ilp.SolverFactory; + +public class CbcLinearProblemTest extends LinearProblemTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return CbcSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcSolverTest.java b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcSolverTest.java new file mode 100644 index 0000000000000000000000000000000000000000..70b30f9d98e8b3cc12bbdbcd76ee2ab89d70e747 --- /dev/null +++ b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcSolverTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.ilp.SolverFactory; +import com.patrikdufresne.ilp.SolverTest; + +public class CbcSolverTest extends SolverTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return CbcSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcVariableTest.java b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcVariableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..00ea21192471cf881ab01548795d68e5eb711300 --- /dev/null +++ b/ilp/ilp-cbc/src/test/java/com/patrikdufresne/ilp/cbc/CbcVariableTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.cbc; + +import com.patrikdufresne.ilp.SolverFactory; +import com.patrikdufresne.ilp.VariableTest; + +public class CbcVariableTest extends VariableTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return CbcSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-core/.gitignore b/ilp/ilp-core/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ea8c4bf7f35f6f77f75d92ad8ce8349f6e81ddba --- /dev/null +++ b/ilp/ilp-core/.gitignore @@ -0,0 +1 @@ +/target diff --git a/ilp/ilp-core/pom.xml b/ilp/ilp-core/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef761a62ea31e9917deb1ba60c6c5d255dea92c4 --- /dev/null +++ b/ilp/ilp-core/pom.xml @@ -0,0 +1,68 @@ + + 4.0.0 + + com.patrikdufresne + ilp-parent + ${revision} + + ilp-core + + + junit + junit + 4.11 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + test-jar + + + + + + + com.googlecode.maven-java-formatter-plugin + maven-java-formatter-plugin + + + + format + + + + + ${project.basedir}/../../formatter.xml + CRLF + + + + + com.mycila.maven-license-plugin + maven-license-plugin + + + process-sources + + format + + + + +
license-header.txt
+
+
+
+
+
\ No newline at end of file diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/AbstractLinearProblem.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/AbstractLinearProblem.java new file mode 100644 index 0000000000000000000000000000000000000000..1803b5a73a6687393059ba8921e0e503ccf86e4d --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/AbstractLinearProblem.java @@ -0,0 +1,340 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +/** + * Partial implementation of the {@link LinearProblem} interface. + * + * @author Patrik Dufresne + * + */ +public abstract class AbstractLinearProblem implements LinearProblem { + + /** + * Check if the linear reference disposed variables. + * + * @param linear + * the linear + */ + public static void checkLinear(Linear linear) { + if (linear == null || linear.isEmpty()) { + return; + } + for (Term term : linear) { + checkVariable(term.getVariable()); + } + } + + /** + * Throw an exception if the variable is disposed. + * + * @param variable + * the variable to validate or null. + */ + public static void checkVariable(Variable variable) { + if (variable != null && variable.isDisposed()) { + throw new IllegalArgumentException("variables is disposed."); + } + } + + /** + * This implementation is creating a new variable using {@link #addVariable()} and sets the name and type using the + * variable setters. + */ + @Override + public Variable addBinaryVariable(String name) { + return addVariable(name, VarType.BOOL); + } + + /** + * This implementation use the function {@link #createLinear(int[], Variable[])} to create a new Linear object for + * coefficients and variables. Then {@link #addConstraint(String, Linear, Number, Number)} + * is called to create the new constraint. + */ + @Override + public Constraint addConstraint(String name, int[] coefficients, Variable[] variables, int lowerBound, int upperBound) { + return addConstraint(name, createLinear(coefficients, variables), Integer.valueOf(lowerBound), Integer.valueOf(upperBound)); + } + + @Override + public Constraint addConstraint(String name, int[] coefficients, Variable[] variables, Number lowerBound, Number upperBound) { + return addConstraint(name, createLinear(coefficients, variables), lowerBound, upperBound); + } + + /** + * This implementation is calling {@link #addConstraint(String, Linear, Number, Number)} + */ + @Override + public Constraint addConstraint(String name, Linear linear, int lowerBound, int upperBound) { + return addConstraint(name, linear, Integer.valueOf(lowerBound), Integer.valueOf(upperBound)); + } + + /** + * This implementation is calling {@link #addConstraint()} and then sets the name, the linear expression and the + * bounds using the constraint setters. + */ + @Override + public Constraint addConstraint(String name, Linear linear, Number lowerBound, Number upperBound) { + Constraint constraint = addConstraint(name); + constraint.setLinear(linear); + constraint.setLowerBound(lowerBound); + constraint.setUpperBound(upperBound); + return constraint; + } + + @Override + public Variable addIntegerVariable(String name, Number lowerBound, Number upperBound) { + Variable var = addVariable(name, VarType.INTEGER); + var.setLowerBound(lowerBound); + var.setUpperBound(upperBound); + return var; + } + + /** + * This implementation return a {@link ConcreteLinear} object since GLPK doesn't support dynamic array. + */ + @Override + public Linear createLinear() { + return new ConcreteLinear(); + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficient and variable. + */ + @Override + public Linear createLinear(double coefficient, Variable variable) { + return createLinear(Double.valueOf(coefficient), variable); + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficients and variables. + */ + @Override + public Linear createLinear(double[] coefficients, Variable[] variables) { + Double[] list = new Double[coefficients.length]; + for (int i = 0; i < coefficients.length; i++) { + list[i] = Double.valueOf(coefficients[i]); + } + return createLinear(list, variables); + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficient and variable. + */ + @Override + public Linear createLinear(float coefficient, Variable variable) { + return createLinear(Float.valueOf(coefficient), variable); + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficients and variables. + */ + @Override + public Linear createLinear(float[] coefficients, Variable[] variables) { + Float[] list = new Float[coefficients.length]; + for (int i = 0; i < coefficients.length; i++) { + list[i] = Float.valueOf(coefficients[i]); + } + return createLinear(list, variables); + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficient and variable. + */ + @Override + public Linear createLinear(int coefficient, Variable variable) { + return createLinear(Integer.valueOf(coefficient), variable); + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficients and variables. + */ + @Override + public Linear createLinear(int[] coefficients, Variable[] variables) { + Integer[] list = new Integer[coefficients.length]; + for (int i = 0; i < coefficients.length; i++) { + list[i] = Integer.valueOf(coefficients[i]); + } + return createLinear(list, variables); + } + + /** + * This implementation is creating a new {@link Linear} instance for the current problem. This function make + * repetitive call to {@link #createTerm(Number, Variable)}. If the coefficient list contains null value or zero, + * the term is not added. If the variable list contains null value, the term is not added. + */ + @Override + public Linear createLinear(List coefficients, List variables) { + if (coefficients == null || variables == null) { + throw new NullPointerException(); + } + if (coefficients.size() != variables.size()) { + throw new IllegalArgumentException("coefficients size != variables size"); //$NON-NLS-1$ + } + + Linear linear = createLinear(); + Iterator iter1 = coefficients.iterator(); + Iterator iter2 = variables.iterator(); + while (iter1.hasNext() && iter2.hasNext()) { + Number coef = iter1.next(); + Variable var = iter2.next(); + if (coef != null && coef.doubleValue() != 0 && var != null) { + linear.add(createTerm(coef, var)); + } + } + + return linear; + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficient and variable. + */ + @Override + public Linear createLinear(Number coefficient, Variable variable) { + if (coefficient == null || variable == null) { + throw new NullPointerException(); + } + Linear linear = createLinear(); + linear.add(createTerm(coefficient, variable)); + return linear; + } + + /** + * This implementation is creating a new Linear object for the current problem using {@link #createLinear()} and + * then add the new coefficients and variables. + */ + @Override + public Linear createLinear(Number[] coefficients, Variable[] variables) { + return createLinear(Arrays.asList(coefficients), Arrays.asList(variables)); + } + + /** + * This implementation is calling the function {@link #createTerm(Number, Variable)}. + */ + @Override + public Term createTerm(double coefficient, Variable variable) { + return createTerm(Double.valueOf(coefficient), variable); + } + + /** + * This implementation is calling the function {@link #createTerm(Number, Variable)}. + */ + @Override + public Term createTerm(float coefficient, Variable variable) { + return createTerm(Float.valueOf(coefficient), variable); + } + + /** + * This implementation is calling the function {@link #createTerm(Number, Variable)}. + */ + @Override + public Term createTerm(int coefficient, Variable variable) { + return createTerm(Integer.valueOf(coefficient), variable); + } + + @Override + public Term createTerm(Number coefficient, Variable variable) { + return new ConcreteTerm(coefficient, variable); + } + + /** + * This implementation used the value return by {@link #getStatus()} to determine if a solution is available. + */ + @Override + public boolean isFeasible() { + switch (getStatus()) { + case FEASIBLE: + case OPTIMAL: + return true; + default: + return false; + } + } + + /** + * This implementation check each variable type to determine their types. + */ + @Override + public boolean isMIP() { + for (Variable var : getVariables()) { + if (var.getType().equals(VarType.REAL)) { + return false; + } + } + return true; + } + + @Override + public String toString() { + + StringBuilder buf = new StringBuilder(); + + // Print the solution + Status status = getStatus(); + boolean solutionAvailable = status.equals(Status.OPTIMAL) || status.equals(Status.FEASIBLE); + if (solutionAvailable) { + buf.append("ObjValue="); + buf.append(getObjectiveValue()); + buf.append("\r\n"); //$NON-NLS-1$ + } + if (solutionAvailable) { + for (Variable var : getVariables()) { + buf.append(var.getName()); + buf.append("="); //$NON-NLS-1$ + buf.append(var.getValue()); + buf.append("\r\n"); //$NON-NLS-1$ + } + for (Constraint constraint : getConstraints()) { + buf.append("Constraint["); //$NON-NLS-1$ + buf.append(constraint.getName()); + buf.append("]\r\n"); //$NON-NLS-1$ + } + } else { + for (Variable var : getVariables()) { + buf.append(var.getName()); + buf.append(":{"); //$NON-NLS-1$ + buf.append(var.getLowerBound()); + buf.append(".."); //$NON-NLS-1$ + buf.append(var.getUpperBound()); + buf.append("}\r\n"); //$NON-NLS-1$ + } + for (Constraint constraint : getConstraints()) { + buf.append("Constraint["); //$NON-NLS-1$ + buf.append(constraint.getName()); + buf.append("]:{"); //$NON-NLS-1$ + buf.append(constraint.getLowerBound()); + buf.append(".."); //$NON-NLS-1$ + buf.append(constraint.getUpperBound()); + buf.append("}\r\n"); //$NON-NLS-1$ + } + } + return buf.toString(); + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ConcreteLinear.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ConcreteLinear.java new file mode 100644 index 0000000000000000000000000000000000000000..09da49bcd0ea0be57baaa7a1e5e5c5716a2dfa85 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ConcreteLinear.java @@ -0,0 +1,119 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; + +/** + * This class is a complete implementation of the {@link Linear} interface. This implementation store all the data in + * memory. + * + * @author Patrik Dufresne + * + */ +public class ConcreteLinear implements Linear { + + @Override + public String toString() { + if (this.terms == null || this.terms.isEmpty()) { + return "[]"; //$NON-NLS-1$ + } + + Iterator i = this.terms.iterator(); + StringBuilder sb = new StringBuilder(); + sb.append('['); + for (;;) { + Term e = i.next(); + sb.append(e); + if (!i.hasNext()) return sb.append(']').toString(); + sb.append(" + "); //$NON-NLS-1$ + } + } + + private Set terms; + + @Override + public Iterator iterator() { + if (this.terms == null) { + return Collections.EMPTY_LIST.iterator(); + } + return this.terms.iterator(); + } + + @Override + public void add(Term term) { + if (this.terms == null) { + this.terms = new LinkedHashSet(); + } + this.terms.add(term); + } + + @Override + public void remove(Term term) { + if (this.terms == null) { + return; + } + this.terms.remove(term); + } + + @Override + public void clear() { + if (this.terms == null) { + return; + } + this.terms.clear(); + } + + @Override + public int size() { + if (this.terms == null) { + return 0; + } + return this.terms.size(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.terms == null) ? 0 : this.terms.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + ConcreteLinear other = (ConcreteLinear) obj; + if (this.terms == null) { + if (other.terms != null) return false; + } else if (!this.terms.equals(other.terms)) return false; + return true; + } + + @Override + public boolean isEmpty() { + return this.size() == 0; + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ConcreteTerm.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ConcreteTerm.java new file mode 100644 index 0000000000000000000000000000000000000000..6de482098fc42c59c9e937d7948ca2d21205202a --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ConcreteTerm.java @@ -0,0 +1,86 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This class provide a complter implementation of the {@link Term} interface. + * + * @author Patrik Dufresne + * + */ +public class ConcreteTerm implements Term { + /** + * The coefficient value. + */ + private Double coefficient; + + /** + * The variable. + */ + private Variable variable; + + /** + * Create a new term. + * + * @param coefficient + * @param variable + */ + public ConcreteTerm(Number coefficient, Variable variable) { + if (coefficient == null || variable == null) { + throw new NullPointerException(); + } + this.coefficient = Double.valueOf(coefficient.doubleValue()); + this.variable = variable; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + ConcreteTerm other = (ConcreteTerm) obj; + if (!this.coefficient.equals(other.coefficient)) return false; + if (!this.variable.equals(other.variable)) return false; + return true; + } + + @Override + public Double getCoefficient() { + return this.coefficient; + } + + @Override + public Variable getVariable() { + return this.variable; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + this.coefficient.hashCode(); + result = prime * result + this.variable.hashCode(); + return result; + } + + @Override + public String toString() { + return this.coefficient + " * " + this.variable; //$NON-NLS-1$ + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Constraint.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Constraint.java new file mode 100644 index 0000000000000000000000000000000000000000..a8b59bf51916eef0f6a432427b94a2bbae82d2bc --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Constraint.java @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * The class Constraint represent a linear constraint. + * + * @author Patrik Dufresne + * + */ +public interface Constraint { + + /** + * Returns the linear expression. + * + * @return the constraint linear expression or null if empty. + */ + Linear getLinear(); + + /** + * Returns the lower bound. + * + * @return the lower bound or null if not bounded + */ + Double getLowerBound(); + + /** + * Returns the constraint name. + * + * @return the name or null if not set + */ + String getName(); + + /** + * Returns the solution value for this constraint. This value is only available after solving the linear problem. + *

+ * If the problem was solved using simplex algorithm, this function return the primal solution value. + * + * @return the solution value + * + * @throws ILPException + * if the solution is not available. + */ + Double getValue(); + + /** + * Returns the upper bound. + * + * @return the upper bound or null if unbounded + */ + Double getUpperBound(); + + /** + * Sets the constraint linear expression. + * + * @param linear + * the new linear expression or null to reset it + */ + void setLinear(Linear linear); + + /** + * Sets the constraint lower bound. + * + * @param bound + * the new lower bound value or null for −∞ + */ + void setLowerBound(Number bound); + + /** + * Sets the constraint upper bound. + * + * @param bound + * the new upper bound or null for +∞ + */ + void setUpperBound(Number bound); + + /** + * Check if the constraint is disposed. + * + * @return True if the problem is disposed. + */ + boolean isDisposed(); + + /** + * Check if the linear expression is empty. + * + * @return True if the linear expression is empty. + */ + boolean isEmpty(); + + /** + * Remove the constraint from the linear problem. + */ + void dispose(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IBranchingTechniqueLast.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IBranchingTechniqueLast.java new file mode 100644 index 0000000000000000000000000000000000000000..ed8852e963ba2c537f1c98a9507318b905eb228f --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IBranchingTechniqueLast.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This interface force the solver to use a specific algorithm to select the next node and it's direction within the + * branch-and-bound algorithm. + *

+ * This branching technique will select the last fractional variables and round to the nearest integer value. + * + * @author Patrik Dufresne + * + */ +public interface IBranchingTechniqueLast extends SolverOption { + + /** + * Enable or disable this branching technique. + * + * @param enabled + * True to enable + */ + void setBranchingLast(boolean enabled); + + /** + * Check if this branching technique is enabled. + * + * @return True if enabled. + */ + boolean getBranchingLast(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IBranchingTechniqueLastAlwaysDown.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IBranchingTechniqueLastAlwaysDown.java new file mode 100644 index 0000000000000000000000000000000000000000..8dc7e8d93dbceefc9362b69fa967b4aa0d21ede2 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IBranchingTechniqueLastAlwaysDown.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This interface force the solver to use a specific algorithm to select the next node and it's direction within the + * branch-and-bound algorithm. + *

+ * This branching technique will select the last fractional variables and round it down. + * + * @author Patrik Dufresne + * + */ +public interface IBranchingTechniqueLastAlwaysDown extends SolverOption { + + /** + * Enable or disable this branching technique. + * + * @param enabled + * True to enable + */ + void setBranchingLastAlwaysDown(boolean enabled); + + /** + * Check if this branching technique is enabled. + * + * @return True if enabled. + */ + boolean getBranchingLastAlwaysDown(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IFeasibilityPumpHeuristic.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IFeasibilityPumpHeuristic.java new file mode 100644 index 0000000000000000000000000000000000000000..8a13600b5ccd6112b5f624659b38989f761552c6 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IFeasibilityPumpHeuristic.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This interface force the solver to use the feasibility pump heuristic. + *

+ * The feasibility pump is a heuristic that finds an initial feasible solution even in certain very hard mixed integer + * programming problems (MIPs). + * + * @author Patrik Dufresne + * + */ +public interface IFeasibilityPumpHeuristic extends SolverOption { + + /** + * Enabled or disable the feasibility pump heuristic. + * + * @param enabled + * True to enabled the heuristic + */ + void setFeasibilityPumpHeuristic(boolean enabled); + + /** + * Check if feasibility pump heuristic is enabled + * + * @return True if the heuristic is enabled + */ + boolean getFeasibilityPumpHeuristic(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPError.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPError.java new file mode 100644 index 0000000000000000000000000000000000000000..db98958fa6f81d4fd0113496cc25d096ff1dfb61 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPError.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This error is thrown whenever an unrecoverable error occurs internally. The message text provide a further + * description of the problem. The exception has a throwable field which holds the underlying throwable + * that caused the problem (if this information is available (i.e. it may be null)). + * + * @see IPLException + */ +public class ILPError extends Error { + + public ILPError(String message, Throwable cause) { + super(message, cause); + } + +} \ No newline at end of file diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPException.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPException.java new file mode 100644 index 0000000000000000000000000000000000000000..2d796174a2ba89ca7d1d40249f05343711262571 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPException.java @@ -0,0 +1,124 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This runtime exception is thrown whenever a recoverable error occurs internally in SWT. The message text and error + * code provide a further description of the problem. The exception has a throwable field which holds the + * underlying exception that caused the problem (if this information is available (i.e. it may be null)). + *

+ * SWTExceptions are thrown when something fails internally, but SWT is left in a known stable state (eg. a widget call + * was made from a non-u/i thread, or there is failure while reading an Image because the source file was corrupt). + *

+ * + * @see SWTError + * @see Sample code and further information + */ +public class ILPException extends RuntimeException { + + /** + * ILP error constant indicating that no error number was specified (value is 1). + */ + public static final int ERROR_UNSPECIFIED = 1; + + /** + * ILP error constant indicating that no more handles are available (value is 2). + */ + public static final int ERROR_NO_HANDLES = 2; + + /** + * ILP error constant indicating that an attempt was made to invoke an object which had already been disposed (value + * is 3). + */ + public static final int ERROR_RESOURCE_DISPOSED = 3; + + /** + * ILP error constant throws when trying to create a variable or a constraint with a name that already exists. + */ + public static final int ERROR_DUPLICATE_NAME = 4; + + public int code; + + /** + * Constructs a new instance of this class with its stack trace filled in. The error code is set to an unspecified + * value. + */ + public ILPException() { + this(ILPException.ERROR_UNSPECIFIED); + } + + /** + * Constructs a new instance of this class with its stack trace and message filled in. The error code is set to an + * unspecified value. Specifying null as the message is equivalent to specifying an empty string. + * + * @param message + * the detail message for the exception + */ + public ILPException(String message) { + this(ILPException.ERROR_UNSPECIFIED, message); + } + + /** + * Constructs a new instance of this class with its stack trace and error code filled in. + * + * @param code + * the ILP error code + */ + public ILPException(int code) { + this(code, ILPException.findErrorText(code)); + } + + /** + * Constructs a new instance of this class with its stack trace, error code and message filled in. Specifying + * null as the message is equivalent to specifying an empty string. + * + * @param code + * the ILP error code + * @param message + * the detail message for the exception + */ + public ILPException(int code, String message) { + super(message); + this.code = code; + } + + /** + * Answers a concise, human readable description of the error code. + * + * @param code + * the SWT error code. + * @return a description of the error code. + * + * @see SWT + */ + private static String findErrorText(int code) { + switch (code) { + case ERROR_UNSPECIFIED: + return "Unspecified error"; //$NON-NLS-1$ + case ERROR_NO_HANDLES: + return "No more handles"; //$NON-NLS-1$ + case ERROR_RESOURCE_DISPOSED: + return "Resource is disposed"; //$NON-NLS-1$ + case ERROR_DUPLICATE_NAME: + return "Name already exist"; //$NON-NLS-1$ + default: + return "Unknown error"; //$NON-NLS-1$ + } + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPLogger.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..00b1a67fd9349f351b765b92f88d41b4e861c901 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPLogger.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * A mechanism to log errors throughout ILP. + *

+ * Clients may provide their own implementation to change how errors are logged from within ILP. + *

+ * + * @see ILPPolicy#getLog() + * @see ILPPolicy#setLog(ILogger) + */ +public interface ILPLogger { + + public static final int DEBUG = 0x01; + + public static final int INFO = 0x02; + + public static final int WARNING = 0x03; + + public static final int ERROR = 0x04; + + public static final int TRACE = 0x05; + + /** + * Logs the given status. + * + * @param status + * the status to log + */ + public void log(int severity, String message); + + /** + * Return the current log level. + * + * @return One of the DEBUG, INFO, WARNING, ERROR constants. + */ + public int getLevel(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPPolicy.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPPolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..54766c121dc65528e3db0de0ff0d05bdf0a6ad9d --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ILPPolicy.java @@ -0,0 +1,91 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * The policy class handles settings for behavior, debug flags and logging within ILP. + * + * @author Patrik Dufresne + * + */ +public class ILPPolicy { + + private static ILPLogger log; + + /** + * Private constructor for utility class. + */ + private ILPPolicy() { + // Nothing to do + } + + /** + * Returns the logger used by ILP to log messages. + *

+ * The default logger prints the status to System.err. + *

+ * + * @return the logger + */ + public static ILPLogger getLog() { + if (ILPPolicy.log == null) { + ILPPolicy.log = getDummyLog(); + } + return ILPPolicy.log; + } + + private static ILPLogger getDummyLog() { + return new ILPLogger() { + @Override + public void log(int severity, String message) { + System.out.println(message); + } + + @Override + public int getLevel() { + return ILPLogger.ERROR; + } + }; + } + + /** + * Sets the logger used by ILP to log messages. + * + * @param logger + * the logger to use, or null to use the default logger + */ + + public static void setLog(ILPLogger logger) { + ILPPolicy.log = logger; + } + + /** + * Same as calling getLog().log(severity, message). + * + * @param debug + * @param message + */ + public static void log(int severity, String message) { + if (ILPPolicy.log == null) { + getLog().log(severity, message); + } else { + ILPPolicy.log.log(severity, message); + } + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IPersistentLinearProblem.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IPersistentLinearProblem.java new file mode 100644 index 0000000000000000000000000000000000000000..280cb901a3fc9d66d5190f398184cd5b1fa06372 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IPersistentLinearProblem.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import java.io.File; +import java.io.IOException; + +/** + * IPersistentLinearProblem is a linear problem that can be load from file and save to file. + * + * @author Patrik Dufresne + * + */ +public interface IPersistentLinearProblem extends LinearProblem { + + /** + * Load the linear problem from a file + * + * @param file + * the file to load data from + * @throws IOException + */ + public void load(File file) throws IOException; + + /** + * Save the linear problem to a file + * + * @param file + * the file + * @throws IOException + */ + public void save(File file) throws IOException; + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IPreProcessorPass.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IPreProcessorPass.java new file mode 100644 index 0000000000000000000000000000000000000000..034883d81225561e5f8e5dbf19a34d07cdff6100 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/IPreProcessorPass.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * Interface used to sets the number of pass to be run by the pre-processor. + * + * @author Patrik Dufresne + * + */ +public interface IPreProcessorPass { + + /** + * Sets the number of pass. + * + * @param pass + */ + public void setPreProcessorPassCount(int pass); + + /** + * Return the number of pass. + * + * @return + */ + public int getPreProcessorPassCount(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ImmutableLinear.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ImmutableLinear.java new file mode 100644 index 0000000000000000000000000000000000000000..d8bafd33a866a48ff7be2bb759ea50a302b38b84 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/ImmutableLinear.java @@ -0,0 +1,98 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +/** + * Immutable linear. + * + * @author Patrik Dufresne + * + */ +public class ImmutableLinear implements Linear { + + /** + * Immutable list of terms. + */ + private List terms; + + /** + * Create a new immutable linear + * + * @param terms + * a collection of terms. + */ + public ImmutableLinear(Collection terms) { + this.terms = Collections.unmodifiableList(new ArrayList(terms)); + } + + /** + * Create a new immutable linear from an existing linear. + * + * @param linear + */ + public ImmutableLinear(Linear linear) { + this.terms = new ArrayList(); + for (Term term : linear) { + this.terms.add(term); + } + this.terms = Collections.unmodifiableList(this.terms); + } + + /** + * Return an un-modifiable iterator. + */ + @Override + public Iterator iterator() { + return this.terms.iterator(); + } + + /** + * Throw an exception. + */ + @Override + public void add(Term term) { + throw new UnsupportedOperationException(); + } + + @Override + public void remove(Term term) { + throw new UnsupportedOperationException(); + } + + @Override + public void clear() { + throw new UnsupportedOperationException(); + } + + @Override + public int size() { + return this.terms.size(); + } + + @Override + public boolean isEmpty() { + return this.size() == 0; + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Linear.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Linear.java new file mode 100644 index 0000000000000000000000000000000000000000..9ee7216932eafb972261011ce50739998e3cb8a6 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Linear.java @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * The interface is a linear expression consisting of variables and their coefficients. + * + * @author Patrik Dufresne + * + */ +public interface Linear extends Iterable { + + /** + * Add a new term to the linear expression. + * + * @param term + * the term to be added + */ + void add(Term term); + + /** + * Remove a term from the linear expression. + * + * @param term + * the term to remove + */ + void remove(Term term); + + /** + * Remove all terms from this linear expression. + */ + void clear(); + + /** + * Returns the number of term in the linear expression. + * + * @return the number of term + */ + int size(); + + /** + * Returns true if the size of the linear is 0 + * + * @return true if the linear is empty + */ + boolean isEmpty(); +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/LinearProblem.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/LinearProblem.java new file mode 100644 index 0000000000000000000000000000000000000000..4666797743db11fb12a39aa487ed45dc98327f1b --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/LinearProblem.java @@ -0,0 +1,396 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import java.util.Collection; +import java.util.List; + +/** + * The class {@link LinearProblem} represents a linear problem consisting of multiple constraints and up to one + * objective function. + *

+ * If the model contains integer or boolean variables, the model is referred to as a mixed integer program (MIP). You + * can query whether the active model is a MIP with the method {@link #isMIP()}. + *

+ * After a called to {@link Solver#solve(LinearProblem, SolverOption)}, further information about the solution can be + * queried with the method {@link #getStatus()}. The return code of type {@link Status} reports whether the solution is + * feasible, bounded, or optimal, or whether the model has been proven to be infeasible or unbounded. See {@link Status} + * for more information. + *

+ * The methods {@link #isFeasible()} determine whether a primal feasible solution has been found and can be queried. + * + * @author Patrik Dufresne + * + */ +public interface LinearProblem { + /** + * Constant used to sets the objective direction. + */ + public static final int MAXIMIZE = 0; + /** + * Constant used to sets the objective direction. + */ + public static final int MINIMIZE = 1; + + /** + * Create a new binary variable. + * + * @param name + * the variable name + * @return the variable + */ + Variable addBinaryVariable(String name); + + /** + * Create a new unbounded constraint for this problem. + * + * @param name + * the constraint name (can't be changed) + * @return the new constraint + */ + Constraint addConstraint(String name); + + /** + * Create a new constraint for this problem with the given name, coefficients, variables and bounds. + * + * @param name + * the constraint name + * @param coefficients + * the coefficients of the linear expression + * @param variables + * the variables of the linear expression + * @param lowerBound + * the lower bound + * @param upperBound + * the upper bound + * @return a new constraint object + */ + Constraint addConstraint(String name, int[] coefficients, Variable[] variables, int lowerBound, int upperBound); + + /** + * Create a new constraint for this problem with the given name, coefficients, variables and bounds. + * + * @param name + * the constraint name + * @param coefficients + * the coefficients of the linear expression + * @param variables + * the variables of the linear expression + * @param lowerBound + * the lower bound or null for unbounded + * @param upperBound + * the upper bound or null for unbounded + * @return a new constraint object + */ + Constraint addConstraint(String name, int[] coefficients, Variable[] variables, Number lowerBound, Number upperBound); + + /** + * Create a new constraint for this problem with the given name, linear expression and bounds. + * + * @param name + * the constraint name or null + * @param linear + * the constraint linear expression + * @param lowerBound + * the lower bound + * @param upperBound + * the upper bound + * @return the constraint object + */ + Constraint addConstraint(String name, Linear linear, int lowerBound, int upperBound); + + /** + * Create a new constraint for this problem. + * + * @param name + * the constraint name or null + * @param linear + * the constraint linear expression + * @param lowerBound + * the lower bound or null for unbounded + * @param upperBound + * the upper bound or null for unbounded + * @return the constraint object + */ + Constraint addConstraint(String name, Linear linear, Number lowerBound, Number upperBound); + + /** + * Create a new unbounded variable for this problem with the given name and type. + * + * @param name + * the variable name (can't be changed) + * @param type + * the variable type (can't be changed) + * @return the variable instance. + */ + Variable addVariable(String name, VarType type); + + /** + * Create a new bounded integer variable. + * + * @param name + * the variable name + * @param lowerBound + * the lower bound or null for unbounded + * @param upperBound + * the upper bound or null for unbounded + * @return + */ + Variable addIntegerVariable(String name, Number lowerBound, Number upperBound); + + /** + * Create a Linear object. + * + * @return the Linear object + */ + Linear createLinear(); + + /** + * Create a {@link Linear} object for this problem. + *

+ * If the coefficient is zero or the variable is null, the term is not added to the linear expression. + * + * @param coefficient + * the coefficient value + * @param variable + * the variable + * @return the new {@link Linear} + */ + Linear createLinear(int coefficient, Variable variable); + + Linear createLinear(float coefficient, Variable variable); + + Linear createLinear(double coefficient, Variable variable); + + Linear createLinear(Number coefficient, Variable variable); + + /** + * Create a {@link Linear} object for this problem. If the coefficient of the variable is zero (0), the term is not + * added to the the Linear expression. + *

+ * If the coefficient is zero or the variable is null, the term is not added to the linear expression. + * + * + * @param coefficients + * the coefficients value. + * @param variables + * the variables + * @return the {@link Linear} object. + */ + Linear createLinear(int[] coefficients, Variable[] variables); + + /** + * Create a {@link Linear} object for this problem. If the coefficient of is zero (0), the term is not added to the + * the Linear expression. + * + * @param coefficients + * the coefficients value. + * @param variables + * the variables + * @return the {@link Linear} object. + */ + Linear createLinear(float[] coefficients, Variable[] variables); + + /** + * Create a {@link Linear} object for this problem. If the coefficient of is zero (0), the term is not added to the + * the Linear expression. + * + * + * @param coefficients + * the coefficients value. + * @param variables + * the variables + * @return the {@link Linear} object. + */ + Linear createLinear(double[] coefficients, Variable[] variables); + + /** + * Create a {@link Linear} object for this problem. If the coefficient of is zero (0), the term is not added to the + * the Linear expression. + * + * + * @param coefficients + * the coefficients value. + * @param variables + * the variables + * @return the {@link Linear} object. + */ + Linear createLinear(Number[] coefficients, Variable[] variables); + + /** + * Create a {@link Linear} object for this problem. If the coefficient of is zero (0) or null, the term is not added + * to the the Linear expression. + * + * + * @param coefficients + * the coefficients value, may contain null + * @param variables + * the variables + * @return the {@link Linear} object. + */ + Linear createLinear(List coefficients, List variables); + + /** + * Create a new Term for this problem. + *

+ * If the coefficient is zero or the variable is null, an exception is thrown. + * + * + * @param coefficient + * the coefficient value + * @param variable + * the variable, can't be null + * @return the new Term object + */ + Term createTerm(int coefficient, Variable variable); + + /** + * Create a new Term for this problem. + *

+ * If the coefficient is null or the variable is null, an exception is thrown. + * + * @param coefficient + * the coefficient value + * @param variable + * the variable, can't be null + * @return the new Term object + */ + Term createTerm(float coefficient, Variable variable); + + /** + * Create a new Term for this problem. + *

+ * If the coefficient is null or the variable is null, an exception is thrown. + * + * @param coefficient + * the coefficient value + * @param variable + * the variable, can't be null + * @return the new Term object + */ + Term createTerm(double coefficient, Variable variable); + + /** + * Create a new Term + * + * @param coefficient + * the coefficient value, can't be null + * @param variable + * the variable variable, can't be null + * @return the new Term object + */ + Term createTerm(Number coefficient, Variable variable); + + /** + * Dispose any resource allocated by this problem. + */ + void dispose(); + + /** + * Returns the contraints. + * + * @return the contraints + */ + Collection getConstraints(); + + /** + * Returns the problem name + * + * @return the name + */ + String getName(); + + /** + * Returns the objective direction. + * + * @return + */ + int getObjectiveDirection(); + + /** + * Returns the objective. + * + * @return the objective linear expression or null if not set. + */ + Linear getObjectiveLinear(); + + /** + * Returns the objective value. Only valid after solving the problem. + * + * @return the objective value. + */ + Double getObjectiveValue(); + + /** + * Returns the solution status of the linear problem. This value is only relevant after solving the linear problem. + * + * @return return the status. + * @see Status + */ + Status getStatus(); + + /** + * Returns the variables. + * + * @return the variables + */ + Collection getVariables(); + + /** + * Check if the problem is disposed. + * + * @return true if the problem is disposed. + */ + boolean isDisposed(); + + /** + * Returns true if a primal feasible solution is available. May or may not be proven optimal. + *

+ * If false is returned, the solution may still be primal feasible, but the algorithm did not determine the + * feasibility before it terminated. + * + * @return True if a primal solution is available. + */ + boolean isFeasible(); + + /** + * Check if the active model is a MIP. + * + * @return true if the active model is a MIP + */ + boolean isMIP(); + + /** + * Sets the objective direction. + * + * @param direction + * the new direction value. Should be one of the MAXIMIZE or MINIMIZE constant. + * @throws IllegalArgumentException + * if the direction is not MAXIMIZE or MINIMIZE + */ + void setObjectiveDirection(int direction); + + /** + * Sets the objective linear expression + * + * @param objective + * the new objective linear expression, may be empty or null to remove the objective function. + */ + void setObjectiveLinear(Linear objective); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Solver.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Solver.java new file mode 100644 index 0000000000000000000000000000000000000000..3ac63ba7846b4b60c0de70aca854841828ea8e36 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Solver.java @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * The Solver class is used to create new problem instance and solve it. + * + * @author Patrik Dufresne + * + */ +public interface Solver { + + /** + * Create a new linear problem. + * + * @return the linear problem. + */ + LinearProblem createLinearProblem(); + + /** + * Create a new solver option with default parameters. + * + * @return + */ + SolverOption createSolverOption(); + + /** + * This function should be called to free any resources allocated by the solver. + */ + void dispose(); + + /** + * Solve the linear problem. + * + * @param lp + * the linear problem. + * @param option + * the solver option. + * @return A Boolean value reporting whether a feasible solution has been found. This solution is not necessarily + * optimal. If false is returned, a feasible solution may still be present, but the solver has + * not been able to prove its feasibility. + */ + boolean solve(LinearProblem lp, SolverOption option); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/SolverFactory.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/SolverFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..ea08ce8eaed5e7fd33c3ed3f74cecd0024abdbe8 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/SolverFactory.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * ISolverFactory instances manufacture {@link Solver}. + * + * @author Patrik Dufresne + * + */ +public interface SolverFactory { + + /** + * Create a new solver object. + * + * @return the solver + */ + Solver createSolver(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/SolverOption.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/SolverOption.java new file mode 100644 index 0000000000000000000000000000000000000000..8e0512223b7f3d5af7e7c34e415e33974ae23eeb --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/SolverOption.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * This interface represent the solver options. Each solver provide it's own implementation of option. + * + * @author Patrik Dufresne + * + */ +public interface SolverOption { + // Nothing to do. +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Status.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Status.java new file mode 100644 index 0000000000000000000000000000000000000000..fdc27ec3969e4a4ef1ba7e279d4f9acbcba6285e --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Status.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * The Status class is an enumeration of the possible solution status values. + * + * @author Patrik Dufresne + * + */ +public enum Status { + /** + * The solver has found an optimal solution that can be queried with the method {@link Variable#getValue()}. + */ + OPTIMAL, + /** + * The solver has found a feasible solution that can be queried with the method {@link Variable#getValue()}. + * However, its optimality (or non-optimality) has not been proven, perhaps due to premature termination of the + * search. + */ + FEASIBLE, + /** + * The solver has determined that the problem is infeasible. + */ + INFEASIBLE, + /** + * The solver has determined that the problem is unbounded. + */ + UNBOUNDED, + /** + * The solver has determine the solution is undefined. + */ + UNKNOWN + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Term.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Term.java new file mode 100644 index 0000000000000000000000000000000000000000..ea90a98ca8cc22a2892aa1c1665a849224f9d550 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Term.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * Immutable object representing the variable and it's coefficient. + * + * @author Patrik Dufresne + * + */ +public interface Term { + + /** + * Return the variable object. + * + * @return the variable. + */ + public Variable getVariable(); + + /** + * Return the coefficient value. + * + * @return the value + */ + public Double getCoefficient(); + + @Override + public int hashCode(); + + @Override + public boolean equals(Object obj); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/VarType.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/VarType.java new file mode 100644 index 0000000000000000000000000000000000000000..d53884eb902411b183c9e9624eb17ab945473e1d --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/VarType.java @@ -0,0 +1,73 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * The variable type. + * + * @author Patrik Dufresne + * + */ +public class VarType { + + /** + * Used for binary variable. + */ + public static final VarType BOOL = new VarType("BOOL"); //$NON-NLS-1$ + /** + * Used for integer variable. + */ + public static final VarType INTEGER = new VarType("INT"); //$NON-NLS-1$ + /** + * Used for continuous variable. + */ + public static final VarType REAL = new VarType("REAL"); //$NON-NLS-1$ + + /** + * The internal variable type. + */ + private String type; + + /** + * Private constructor. + */ + private VarType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "VarType [" + this.type + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Override + public int hashCode() { + return this.type.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + VarType other = (VarType) obj; + if (!this.type.equals(other.type)) return false; + return true; + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Variable.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Variable.java new file mode 100644 index 0000000000000000000000000000000000000000..23d71a6b2e46433cf9d0b7ff9a0d4b93600a068b --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/Variable.java @@ -0,0 +1,99 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +/** + * Represent a variable in the linear problem. + * + * @author Patrik Dufresne + * + */ +public interface Variable { + + /** + * Returns the lower bound. + * + * @return the lower bound or null if not bounded + */ + Double getLowerBound(); + + /** + * Returns the variable name. + * + * @return the name. + */ + String getName(); + + /** + * Returns the solution value for a variable. + *

+ * If the problem was solved using the simplex algorithm value or the variable. The dual value may be retrieved + * using {@link #getDual()}. + *

+ * + * @return the solution value or null if the solution is not available + * @throws ILPException + * is no solution are available + */ + Double getValue(); + + /** + * Returns the variable type. + * + * @return the variable type. + */ + VarType getType(); + + /** + * Returns the upper bound. + * + * @return the upper bound or null if unbounded + */ + Double getUpperBound(); + + /** + * Sets the variable lower bound. + * + * @param bound + * the new lower bound value or null for −∞ + */ + void setLowerBound(Number bound); + + /** + * Sets the variable upper bound. + * + * @param bound + * the new upper bound or null for +∞ + */ + void setUpperBound(Number bound); + + /** + * Check if the variable object is disposed. + * + * @return True if the variable is disposed. + */ + public boolean isDisposed(); + + /** + * Remove the variable from the linear problem. Does nothing if the variable is already disposed. + *

+ * Sub classes must consider the case when this function is called multiple time for the same object. + */ + void dispose(); + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Bound.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Bound.java new file mode 100644 index 0000000000000000000000000000000000000000..b3ed8e0e9a1909715cc21f759642617e59ea1fb0 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Bound.java @@ -0,0 +1,133 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.Variable; + +/** + * A structure used to store the variable bound. + * + * @author Patrik Dufresne + * + */ +public class Bound { + + /** + * Create a new bound object from the given constraint bounds. + * + * @param constraint + * the constraint to be capture + * @return the bound + */ + public static Bound create(Constraint constraint) { + return new Bound(constraint.getLowerBound(), constraint.getUpperBound()); + } + + /** + * Create a new bound object from the given variable bounds. + */ + public static Bound create(Variable variable) { + return new Bound(variable.getLowerBound(), variable.getUpperBound()); + } + + private Double lower; + + private Double upper; + + /** + * Create a new bound instance. + * + * @param lower + * the lower bound + * @param upper + * the upper bound + */ + public Bound(Double lower, Double upper) { + this.lower = lower; + this.upper = upper; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + Bound other = (Bound) obj; + if (this.lower == null) { + if (other.lower != null) return false; + } else if (!this.lower.equals(other.lower)) return false; + if (this.upper == null) { + if (other.upper != null) return false; + } else if (!this.upper.equals(other.upper)) return false; + return true; + } + + /** + * Return the lower bound + * + * @return the lower bound value. + */ + public Double getLower() { + return this.lower; + } + + /** + * Return the upper bound + * + * @return the upper bound value + */ + public Double getUpper() { + return this.upper; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.lower == null) ? 0 : this.lower.hashCode()); + result = prime * result + ((this.upper == null) ? 0 : this.upper.hashCode()); + return result; + } + + /** + * Apply the bound to the given constraint + * + * @param constraint + */ + public void restore(Constraint constraint) { + constraint.setLowerBound(lower); + constraint.setUpperBound(upper); + } + + /** + * Apply the bound to the given variable. + * + * @param variable + * the variable + */ + public void restore(Variable variable) { + variable.setLowerBound(lower); + variable.setUpperBound(upper); + } + + @Override + public String toString() { + return "Bound:[" + this.lower + ".." + this.upper + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} \ No newline at end of file diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/BoundSnapshot.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/BoundSnapshot.java new file mode 100644 index 0000000000000000000000000000000000000000..2e102f1f27404b76d968f855a38b58a51b11c618 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/BoundSnapshot.java @@ -0,0 +1,143 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.patrikdufresne.ilp.Variable; + +/** + * Immutable class storing a snapshot. + * + * @author Patrik Dufresne + * + */ +public class BoundSnapshot extends HashMap { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Store the bound of the variable in a snapshot. + * + * @param vars + * the input variable + * @return the snapshot value + */ + public static BoundSnapshot create(Collection vars) { + Map snapshot = new HashMap(vars.size()); + for (Variable var : vars) { + snapshot.put(var, new Bound(var.getLowerBound(), var.getUpperBound())); + } + return new BoundSnapshot(snapshot); + } + + /** + * Create a new snapshot with the given map. + * + * @param snapshot + */ + protected BoundSnapshot(Map snapshot) { + super(snapshot); + } + + @Override + public void clear() { + throw new UnsupportedOperationException(); + } + + @Override + public Set> entrySet() { + return Collections.unmodifiableSet(super.entrySet()); + } + + /** + * Return the lower bound value stored in the snapshot for the given variable. + * + * @param var + * the variable + * @return the lower bound value for this variable, also return null if this snapshot doesn't contain the variable + * specified. + */ + public Double getLower(Variable var) { + Bound bound = get(var); + if (bound == null) { + return null; + } + return bound.getLower(); + } + + /** + * Return the lower bound value stored in the snapshot for the given variable. + * + * @param var + * the variable + * @return the value for this variable. + */ + public Double getUpper(Variable var) { + Bound bound = get(var); + if (bound == null) { + return null; + } + return bound.getUpper(); + } + + @Override + public Set keySet() { + return Collections.unmodifiableSet(super.keySet()); + } + + @Override + public Bound put(Variable key, Bound value) { + throw new UnsupportedOperationException(); + } + + @Override + public void putAll(Map m) { + throw new UnsupportedOperationException(); + } + + @Override + public Bound remove(Object key) { + throw new UnsupportedOperationException(); + } + + @Override + public Collection values() { + return Collections.unmodifiableCollection(super.values()); + } + + /** + * Restore the variables bound according to this snapshot. + */ + public void restore() { + // Loop on each entry + for (Entry e : this.entrySet()) { + e.getKey().setLowerBound(e.getValue().getLower()); + e.getKey().setUpperBound(e.getValue().getUpper()); + } + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/ConstraintSnapshot.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/ConstraintSnapshot.java new file mode 100644 index 0000000000000000000000000000000000000000..f23e3eb29de7491f309579560ee77e1808054af3 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/ConstraintSnapshot.java @@ -0,0 +1,134 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.ImmutableLinear; +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.LinearProblem; + +/** + * This class represent a snapshot of a constraint. This may be used to temporarily release a constraint and restore it + * later on. + * + * @author Patrik Dufresne + * + */ +public class ConstraintSnapshot { + + /** + * Create a snapshot from the given constraint object. + * + * @param constraint + * the constraint to be snapshot. + * + * @return the snaptshot. + */ + public static ConstraintSnapshot create(Constraint constraint) { + if (constraint == null || constraint.isDisposed()) { + throw new IllegalArgumentException(); + } + // Capture the name + String name = constraint.getName(); + // Capture the bounds + Bound bound = new Bound(constraint.getLowerBound(), constraint.getUpperBound()); + // Capture the linear + Linear linear = constraint.getLinear(); + return new ConstraintSnapshot(name, linear, bound); + } + + private Bound bound; + + private ImmutableLinear linear; + + private String name; + + /** + * Create a new snapshot. + * + * @param name + * the constraint's name + * @param linear + * the constraint's linear or null if empty + * @param bound + * the constraint bounds. + */ + public ConstraintSnapshot(String name, Linear linear, Bound bound) { + // The linear may be null if the constraint was empty. It's strange, but + // we don't want to throw exception for this reason. + if (bound == null) { + throw new IllegalArgumentException(); + } + if (linear == null) { + throw new IllegalArgumentException(); + } + this.name = name; + this.linear = new ImmutableLinear(linear); + this.bound = bound; + } + + /** + * Return the linear representing the constraints. + */ + public ImmutableLinear getLinear() { + return this.linear; + } + + /** + * Return the lower bound of this snapshot. + * + * @return the lower bound value. + */ + public Double getLower() { + return this.bound.getLower(); + } + + /** + * Return the name of of this snapshot. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Return the upper bound of this snapshot. + * + * @return the upper bound value. + */ + public Double getUpper() { + return this.bound.getUpper(); + } + + /** + * Create a new constraints to represent the snapshot within the given linear problem. + * + * @param lp + * the linear problem where to create the constraint. + * @return the constraint + */ + public Constraint restore(LinearProblem lp) { + if (lp == null) { + throw new IllegalArgumentException(); + } + // Create the constraint + return lp.addConstraint(this.name, this.linear, this.bound.getLower(), this.bound.getUpper()); + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Constraints.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Constraints.java new file mode 100644 index 0000000000000000000000000000000000000000..ed8491b7ee734a26f924cd3bd547210c51188339 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Constraints.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.Linear; + +/** + * Utility class to manipulates constraints and associated snapshot. + * + * @author Patrik Dufresne + * + */ +public class Constraints { + + /** + * Check if the constraint is already feasible with the given value snapshot. + * + * @param constraint + * the constraint to check + * @param snapshot + * the value snapshot used to evaluate the feasibility + * @return True if the constraint is satisfied + */ + public static boolean isSatisfied(Constraint constraint, ValueSnapshot snapshot) { + if (constraint == null || snapshot == null) { + throw new IllegalArgumentException(); + } + // Compute the linear value + Linear linear = constraint.getLinear(); + double value = linear == null ? 0 : Linears.compute(linear, snapshot).doubleValue(); + // Check if the value is in range + return (constraint.getLowerBound() == null || constraint.getLowerBound().doubleValue() <= value) + && (constraint.getUpperBound() == null || constraint.getUpperBound().doubleValue() >= value); + } + + /** + * Take a snapshot of the given constraints and then dispose it. + * + * @param constraint + * the constraint to be release. + * @return the snapshot representing the constraints + */ + public static ConstraintSnapshot release(Constraint constraint) { + if (constraint == null || constraint.isDisposed()) { + throw new IllegalArgumentException(); + } + ConstraintSnapshot snapshot = ConstraintSnapshot.create(constraint); + constraint.dispose(); + return snapshot; + } + + /** + * Private constructor to avoid creating instances of utility class. + */ + private Constraints() { + + } +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Linears.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Linears.java new file mode 100644 index 0000000000000000000000000000000000000000..5240d56f5dc281c7a79e6385680f9906cb2cb644 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Linears.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.Term; + +/** + * Utility class to manipulate linears. + * + * @author Patrik Dufresne + * + */ +public class Linears { + + /** + * Private constructor to avoid creating instances of utility class. + */ + private Linears() { + + } + + /** + * Compute the value of a linear using the variable value from a snapshot. + * + * @param linear + * the linear to be computed + * @param snapshot + * the value snapshot + * @return the computed value. + * @throws NullPointerException + * if the snapshot doesn't contains a variable from the linear. + */ + public static Double compute(Linear linear, ValueSnapshot snapshot) { + double value = 0; + for (Term term : linear) { + value += term.getCoefficient().doubleValue() * snapshot.get(term.getVariable()).doubleValue(); + } + return Double.valueOf(value); + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/ValueSnapshot.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/ValueSnapshot.java new file mode 100644 index 0000000000000000000000000000000000000000..c014dc28309cc2c0b4ea86f3c46443b98e4cfa17 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/ValueSnapshot.java @@ -0,0 +1,98 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.patrikdufresne.ilp.Variable; + +/** + * Class storing a snapshot of the variable's value. + * + * @author Patrik Dufresne + * + */ +public class ValueSnapshot extends HashMap { + + private static final long serialVersionUID = 1L; + + /** + * Create a new value snapshot for the variables specified. + * + * @param vars + * the input variable + * @return the snapshot value + */ + public static ValueSnapshot create(Collection vars) { + Map snapshot = new HashMap(vars.size()); + for (Variable var : vars) { + snapshot.put(var, var.getValue()); + } + return new ValueSnapshot(snapshot); + } + + /** + * Create a new snapshot with the given map. + * + * @param snapshot + */ + protected ValueSnapshot(Map snapshot) { + super(snapshot); + } + + @Override + public void clear() { + throw new UnsupportedOperationException(); + } + + @Override + public Set> entrySet() { + return Collections.unmodifiableSet(super.entrySet()); + } + + @Override + public Set keySet() { + return Collections.unmodifiableSet(super.keySet()); + } + + @Override + public Double put(Variable key, Double value) { + throw new UnsupportedOperationException(); + } + + @Override + public void putAll(Map m) { + throw new UnsupportedOperationException(); + } + + @Override + public Double remove(Object key) { + throw new UnsupportedOperationException(); + } + + @Override + public Collection values() { + return Collections.unmodifiableCollection(super.values()); + } + +} diff --git a/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Variables.java b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Variables.java new file mode 100644 index 0000000000000000000000000000000000000000..da1311b9e4f7a0cfa5ceba1c180393e94fd46c70 --- /dev/null +++ b/ilp/ilp-core/src/main/java/com/patrikdufresne/ilp/util/Variables.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.util; + +import com.patrikdufresne.ilp.Variable; + +/** + * Utility class for {@link Variable}. + * + * @author Patrik Dufresne + * + */ +public class Variables { + + /** + * Check if the variable bound is fixed. + * + * @param var + * the variable + * @return True if lower bound and the upper bound is fixed. + */ + public static boolean isFixed(Variable var) { + return var.getLowerBound() != null && var.getLowerBound().equals(var.getUpperBound()); + } + + /** + * Private constructor for utility class. + */ + private Variables() { + + } + +} diff --git a/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/ConstraintTest.java b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/ConstraintTest.java new file mode 100644 index 0000000000000000000000000000000000000000..efb32cf9be66f1fe8f8b8ddb18826075df082b2d --- /dev/null +++ b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/ConstraintTest.java @@ -0,0 +1,230 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public abstract class ConstraintTest { + + private static final Double ONE = Double.valueOf(1); + + private static final Double ZERO = Double.valueOf(1); + + protected LinearProblem lp; + + protected Solver solver; + + @Before + public void createEmptyLP() { + SolverFactory solverFactory = doGetSolverFactory(); + solver = solverFactory.createSolver(); + lp = solver.createLinearProblem(); + } + + protected abstract SolverFactory doGetSolverFactory(); + + @After + public void releaseLP() { + if (lp != null) { + lp.dispose(); + } + } + + /** + * Check bounds setter and getters for an integer variable. + */ + @Test + public void testBounds() { + + Constraint myConstraint = lp.addConstraint("my_constraint"); + + // By default expect null..null bounds + assertEquals(null, myConstraint.getLowerBound()); + assertEquals(null, myConstraint.getUpperBound()); + + // Sets fixed bounds + myConstraint.setLowerBound(Integer.valueOf(10)); + myConstraint.setUpperBound(Integer.valueOf(20)); + assertEquals(Double.valueOf(10), myConstraint.getLowerBound()); + assertEquals(Double.valueOf(20), myConstraint.getUpperBound()); + + // Set unbounded lower bound. + myConstraint.setLowerBound(null); + assertEquals(null, myConstraint.getLowerBound()); + + // Set unbounded upper bound. + myConstraint.setUpperBound(null); + assertEquals(null, myConstraint.getUpperBound()); + + } + + /** + * Check if it's possible to create two constraint with the same name. + */ + @Test + public void testCreate_WithSameName() { + Linear linear = lp.createLinear(); + lp.addConstraint("test2", linear, ONE, null); + try { + lp.addConstraint("test2", linear, ONE, null); + fail("Should throw an exception"); + } catch (ILPException e) { + assertEquals(ILPException.ERROR_DUPLICATE_NAME, e.code); + } + } + + @Test + public void testCreate_WithoutName() { + + Linear linear = lp.createLinear(); + try { + lp.addConstraint(null, linear, ONE, null); + fail("Should throw an exception"); + } catch (ILPException e) { + assertEquals(ILPException.ERROR_DUPLICATE_NAME, e.code); + } + + } + + @Test + public void testDispose() { + + /* + * Add variables. + */ + Variable var1 = lp.addBinaryVariable("dummy1"); + assertNotNull(var1); + Variable var2 = lp.addBinaryVariable("dummy2"); + assertNotNull(var2); + assertEquals(2, lp.getVariables().size()); + assertEquals(var1, lp.getVariables().toArray()[0]); + assertEquals(var2, lp.getVariables().toArray()[1]); + + /* + * Add constraint + */ + Constraint const1 = lp.addConstraint("const1", lp.createLinear(new int[] { 1, 2 }, new Variable[] { var1, var2 }), null, 5); + assertNotNull(const1); + Constraint const2 = lp.addConstraint("const2", lp.createLinear(new int[] { 3, 4 }, new Variable[] { var1, var2 }), null, 5); + assertNotNull(const2); + + assertEquals(2, lp.getConstraints().size()); + assertEquals(const1, lp.getConstraints().toArray()[0]); + assertEquals(const2, lp.getConstraints().toArray()[1]); + + /* + * Dispose first constraint. + */ + const1.dispose(); + + assertEquals(1, lp.getConstraints().size()); + assertEquals(const2, lp.getConstraints().toArray()[0]); + assertEquals("const2", const2.getName()); + + /* + * Dispose variables + */ + var1.dispose(); + var2.dispose(); + assertEquals(0, lp.getVariables().size()); + + /* + * Check constraint value. + */ + Linear linear = const2.getLinear(); + assertNotNull(linear); + assertEquals(0, linear.size()); + + /* + * Dispose the last linear + */ + const2.dispose(); + assertEquals(0, lp.getConstraints().size()); + + } + + /** + * Check usage of getLinear function. + */ + @Test + public void testGetLinear() { + + /* + * Add variables. + */ + Variable var1 = lp.addBinaryVariable("dummy1"); + assertNotNull(var1); + Variable var2 = lp.addBinaryVariable("dummy2"); + assertNotNull(var2); + assertEquals(2, lp.getVariables().size()); + assertEquals(var1, lp.getVariables().toArray()[0]); + assertEquals(var2, lp.getVariables().toArray()[1]); + + /* + * Set linear / Get linear + */ + Linear linear = lp.createLinear(new int[] { 1, 2 }, new Variable[] { var1, var2 }); + Constraint constraint = lp.addConstraint("test1", linear, ONE, null); + assertEquals(linear, constraint.getLinear()); + + /* + * Set empty linear + */ + linear = lp.createLinear(); + constraint = lp.addConstraint("test2", linear, ONE, null); + linear = constraint.getLinear(); + assertNotNull(linear); + assertEquals(0, linear.size()); + + /* + * Sets the linear with different vars + */ + linear = lp.createLinear(new int[] { 1, 2 }, new Variable[] { var1, var2 }); + constraint = lp.addConstraint("test3", linear, ONE, null); + assertEquals(linear, constraint.getLinear()); + // Update the linear + linear = lp.createLinear(new int[] { 4, 5 }, new Variable[] { var1, var2 }); + constraint.setLinear(linear); + assertEquals(linear, constraint.getLinear()); + // Update the linear + linear = lp.createLinear(new int[] { 3 }, new Variable[] { var1 }); + constraint.setLinear(linear); + assertEquals(linear, constraint.getLinear()); + // Update the linear + linear = lp.createLinear(new int[] { 5 }, new Variable[] { var2 }); + constraint.setLinear(linear); + assertEquals(linear, constraint.getLinear()); + + } + + /** + * Check if it's possible to re-create a constraint with the same name if the original constraint as been disposed. + */ + @Test + public void testCreateDispose_WithSameName() { + Linear linear = lp.createLinear(); + Constraint c = lp.addConstraint("test2", linear, ONE, null); + c.dispose(); + c = lp.addConstraint("test2", linear, ONE, null); + } + +} diff --git a/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/LinearProblemTest.java b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/LinearProblemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..087244a0310762394998295f85967afeea0f16f7 --- /dev/null +++ b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/LinearProblemTest.java @@ -0,0 +1,198 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +/** + * + */ +package com.patrikdufresne.ilp; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Collection; +import java.util.Iterator; + +import org.junit.Before; +import org.junit.Test; + +/** + * @author Patrik Dufresne + * + */ +public abstract class LinearProblemTest { + + private static final Double ZERO = Double.valueOf(0); + + protected LinearProblem lp; + + protected Solver solver; + + @Before + public void createEmptyLP() { + SolverFactory solverFactory = doGetSolverFactory(); + solver = solverFactory.createSolver(); + lp = solver.createLinearProblem(); + } + + protected abstract SolverFactory doGetSolverFactory(); + + @Test + public void testAddConstraints() { + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear l = lp.createLinear(new int[] { 23, 15 }, new Variable[] { x, y }); + Constraint c1 = lp.addConstraint("name1", l, -45, 78); + assertEquals("name1", c1.getName()); + assertEquals(l, c1.getLinear()); + assertEquals(-45, c1.getLowerBound().doubleValue(), 0.0001); + assertEquals(78, c1.getUpperBound().doubleValue(), 0.0001); + } + + /** + * Test method for {@link com.patrikdufresne.ilp.LinearProblem#addBinaryVariable(java.lang.String)} . + */ + @Test + public void testAddBinaryVariable() { + + Variable var = lp.addBinaryVariable("x"); + + assertEquals(VarType.BOOL, var.getType()); + assertEquals(0, var.getLowerBound().intValue()); + assertEquals(1, var.getUpperBound().intValue()); + + } + + /** + * Test method for {@link com.patrikdufresne.ilp.LinearProblem#getConstraints()}. + */ + @Test + public void testGetConstraints() { + Constraint c1 = lp.addConstraint("c1"); + Constraint c2 = lp.addConstraint("c2"); + + Collection collection = lp.getConstraints(); + + assertEquals("Wrong number of constraint", 2, collection.size()); + + assertTrue("Constraint object not found.", collection.contains(c1)); + + assertTrue("Constraint object not found.", collection.contains(c2)); + + } + + /** + * Check if an invalid direction is throwing exception. + */ + @Test(expected = IllegalArgumentException.class) + public void testSetObjectiveDirection_WithInvalidDirection() { + + this.lp.setObjectiveDirection(2); + + } + + /** + * Test method for {@link com.patrikdufresne.ilp.LinearProblem#setObjectiveLinear(com.patrikdufresne.ilp.Linear)} . + */ + @Test + public void testSetObjectiveLinear() { + + // Set dummy objective + Variable dummy1 = lp.addBinaryVariable("dummy1"); + Variable dummy2 = lp.addBinaryVariable("dummy2"); + Variable dummy3 = lp.addBinaryVariable("dummy3"); + double[] coef = new double[] { 13, 24 }; + Variable[] var = new Variable[] { dummy1, dummy3 }; + lp.setObjectiveLinear(lp.createLinear(coef, var)); + Linear linear; + assertNotNull(linear = lp.getObjectiveLinear()); + assertEquals(2, linear.size()); + Iterator iter = linear.iterator(); + while (iter.hasNext()) { + boolean found = false; + Term t = iter.next(); + for (int i = 0; i < coef.length; i++) { + found |= t.getVariable().equals(var[i]) && t.getCoefficient().doubleValue() == coef[i]; + } + assertTrue(found); + } + + // Set empty objective + lp.setObjectiveLinear(lp.createLinear()); + assertNull(lp.getObjectiveLinear()); + + // Remove objective + lp.setObjectiveLinear(null); + assertNull(lp.getObjectiveLinear()); + + } + + /** + * Check if an invalid direction is throwing exception. + */ + @Test + public void testSetObjectiveDirection() { + + this.lp.setObjectiveDirection(LinearProblem.MINIMIZE); + assertEquals(LinearProblem.MINIMIZE, this.lp.getObjectiveDirection()); + + this.lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + assertEquals(LinearProblem.MAXIMIZE, this.lp.getObjectiveDirection()); + + } + + /** + * Check if the status of the linear problem is unchanged after touching the bound of a variable. + */ + @Test + public void testGetStatus_AfterTouchingVariable() { + + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(17, x)); + linear.add(lp.createTerm(12, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + lp.addConstraint("10 x + 7 y <= 40", new int[] { 10, 7 }, new Variable[] { x, y }, null, 40); + lp.addConstraint(" x + y <= 5", new int[] { 11, 1 }, new Variable[] { x, y }, null, 5); + + assertTrue(solver.solve(lp, solver.createSolverOption())); + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + assertEquals(0, x.getValue().intValue()); + assertEquals(5, y.getValue().intValue()); + + // Touch a variable. + x.setLowerBound(null); + x.setUpperBound(null); + + // Check if the state is unchanged. + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + + // Dispose a variable + y.dispose(); + + // Check if the state is unchanged. + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + } + +} diff --git a/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/SolverTest.java b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/SolverTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a3c91ed7b60a60af7c44cdd803f20afe6d9083a4 --- /dev/null +++ b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/SolverTest.java @@ -0,0 +1,338 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author Patrik Dufresne + * + */ +public abstract class SolverTest { + + private static final Integer ONE = Integer.valueOf(1); + + private static final Integer ZERO = Integer.valueOf(0); + + LinearProblem lp; + Solver solver; + + @Before + public void createEmptyLP() { + SolverFactory solverFactory = doGetSolverFactory(); + solver = solverFactory.createSolver(); + lp = solver.createLinearProblem(); + } + + protected abstract SolverFactory doGetSolverFactory(); + + /** + *

+     * Maximize 17 * x + 12* y
+     *     subject to
+     *       10 x + 7 y <= 40
+     *          x +   y <=  5
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * 
+ * + * @throws InterruptedException + */ + @Test + public void testSolve_UsedTwoThread_ExpectSameResult() throws InterruptedException { + + for (int i = 0; i < 2; i++) { + + Thread t = new Thread(new Runnable() { + + @Override + public void run() { + + SolverFactory solverFactory = doGetSolverFactory(); + solver = solverFactory.createSolver(); + lp = solver.createLinearProblem(); + + // Create a linear problem. + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(17, x)); + linear.add(lp.createTerm(12, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + lp.addConstraint("10 x + 7 y <= 40", new int[] { 10, 7 }, new Variable[] { x, y }, null, 40); + lp.addConstraint(" x + y <= 5", new int[] { 11, 1 }, new Variable[] { x, y }, null, 5); + + // Solve the problem. + assertTrue(solver.solve(lp, solver.createSolverOption())); + + // Dispose problem and solver + lp.dispose(); + solver.dispose(); + lp = null; + solver = null; + + } + + }); + t.start(); + + while (t.isAlive()) { + Thread.currentThread().sleep(50); + } + + } + + } + + /** + *
+     * Maximize y
+     *     subject to
+     *       -2x + 3y <= 6
+     *       2x + 3y <= 12
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * 
+ */ + @Test + public void testSolve_withCustomBranchingHeuristic_primalFeasibleOptimalProblem() { + + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(1, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + + lp.addConstraint("-2x + 3y <= 6", new int[] { -2, 3 }, new Variable[] { x, y }, null, 6); + lp.addConstraint("2x + 3y <= 12", new int[] { 2, 3 }, new Variable[] { x, y }, null, 12); + + SolverOption option = solver.createSolverOption(); + + if (option instanceof IBranchingTechniqueLast) { + + ((IBranchingTechniqueLast) option).setBranchingLast(true); + + assertTrue(solver.solve(lp, option)); + + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + + assertEquals(2, y.getValue().intValue()); + + } + } + + /** + *
+     * Maximize 17 * x + 12* y
+     *     subject to
+     *       10 x + 7 y <= 40
+     *          x +   y <=  5
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * Solution:
+     *     obj: 60.0
+     *     x:   0
+     *     y:   5
+     * 
+ */ + @Test + public void testSolve_withFPump() { + + // Create the problem. + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(17, x)); + linear.add(lp.createTerm(12, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + lp.addConstraint("10 x + 7 y <= 40", new int[] { 10, 7 }, new Variable[] { x, y }, null, 40); + lp.addConstraint(" x + y <= 5", new int[] { 11, 1 }, new Variable[] { x, y }, null, 5); + System.out.println(lp.toString()); + + // Enable FPump. + SolverOption op = solver.createSolverOption(); + if (op instanceof IFeasibilityPumpHeuristic) { + ((IFeasibilityPumpHeuristic) op).setFeasibilityPumpHeuristic(true); + } + + // Solve + assertTrue(solver.solve(lp, op)); + + // Check results + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + assertEquals(0, x.getValue().intValue()); + assertEquals(5, y.getValue().intValue()); + assertEquals(60.0, lp.getObjectiveValue().doubleValue(), 0.0001); + + } + + /** + *
+     * Maximize 17 * x + 12* y
+     *     subject to
+     *       10 x + 7 y <= 40
+     *          x +   y <=  5
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * Solution:
+     *     obj: 60.0
+     *     x:   0
+     *     y:   5
+     * 
+ */ + @Test + public void testSolve_withMIP_primalFeasibleOptimalProblem() { + + // Create the problem. + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(17, x)); + linear.add(lp.createTerm(12, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + lp.addConstraint("10 x + 7 y <= 40", new int[] { 10, 7 }, new Variable[] { x, y }, null, 40); + lp.addConstraint(" x + y <= 5", new int[] { 11, 1 }, new Variable[] { x, y }, null, 5); + System.out.println(lp.toString()); + + // Solve + assertTrue(solver.solve(lp, solver.createSolverOption())); + + // Check results + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + assertEquals(0, x.getValue().intValue()); + assertEquals(5, y.getValue().intValue()); + assertEquals(60.0, lp.getObjectiveValue().doubleValue(), 0.0001); + + } + + /** + *
+     * Minimize y
+     *     subject to
+     *          x +   y >= 4
+     *       -1 x +   y >= -1
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * Solution:
+     *     obj: 2
+     *     x: 2 ou 3
+     *     y: 2
+     * 
+     * Then update the problem
+     *     subject to:
+     *         -x + 2 y >= 4
+     * 
+     * 
+ * + * @throws IOException + */ + @Test + public void testSolve_withMIP_reuseProblem() throws IOException { + + ILPPolicy.setLog(new ILPLogger() { + @Override + public void log(int severity, String message) { + System.out.println(message); + } + + @Override + public int getLevel() { + return ILPLogger.TRACE; + } + }); + + // Create the first version of the problem. + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(1, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MINIMIZE); + lp.addConstraint("x+y>=4", new int[] { 1, 1 }, new Variable[] { x, y }, 4, null); + lp.addConstraint("-x + y >= -1", new int[] { -1, 1 }, new Variable[] { x, y }, -1, null); + System.out.println(lp.toString()); + if (lp instanceof IPersistentLinearProblem) { + ((IPersistentLinearProblem) lp).save(new File("coucou.1")); + } + + // Solve the problem. + assertTrue(solver.solve(lp, solver.createSolverOption())); + + // Check the results. + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + assertTrue(Math.abs(x.getValue() - 2) < 0.0001 || Math.abs(x.getValue() - 3) < 0.0001); + assertEquals(2.0, y.getValue().doubleValue(), 0.0001); + assertEquals(2.0, lp.getObjectiveValue().doubleValue(), 0.0001); + + // Update the problem by adding constrain + lp.addConstraint("-x + 2y >= 4", new int[] { -1, 2 }, new Variable[] { x, y }, 4, null); + System.out.println(lp.toString()); + if (lp instanceof IPersistentLinearProblem) { + ((IPersistentLinearProblem) lp).save(new File("coucou2")); + } + + // Solve the problem again + assertTrue(solver.solve(lp, solver.createSolverOption())); + + // Check the result. + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + assertTrue(Math.abs(x.getValue() - 1) < 0.0001 || Math.abs(x.getValue() - 2) < 0.0001); + assertEquals(3.0, y.getValue().doubleValue(), 0.0001); + assertEquals(3.0, lp.getObjectiveValue().doubleValue(), 0.0001); + + } + + @Test + public void testSolve_withMIP_unfeasibleProblem() { + + Variable var = lp.addBinaryVariable("x"); + + Linear linear = lp.createLinear(1, var); + Constraint constraint = lp.addConstraint("x eq 0.5", linear, 0.5, 0.5); + + assertFalse(solver.solve(lp, solver.createSolverOption())); + + assertTrue(lp.getStatus() == Status.INFEASIBLE || lp.getStatus() == Status.UNKNOWN); + assertFalse(lp.isFeasible()); + + } +} diff --git a/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/VariableTest.java b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/VariableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b94513150381d2204ca52b731404719b3d5a7ba4 --- /dev/null +++ b/ilp/ilp-core/src/test/java/com/patrikdufresne/ilp/VariableTest.java @@ -0,0 +1,258 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.Before; +import org.junit.Test; + +public abstract class VariableTest { + + private static final Double ONE = Double.valueOf(1); + + private static final Double ZERO = Double.valueOf(0); + + protected LinearProblem lp; + + protected Solver solver; + + @Before + public void createEmptyLP() { + SolverFactory solverFactory = doGetSolverFactory(); + solver = solverFactory.createSolver(); + lp = solver.createLinearProblem(); + } + + protected abstract SolverFactory doGetSolverFactory(); + + /** + * Check if an exception is thrown when creating two variables with the same name. + */ + @Test + public void testCreate_WithSameName() { + lp.addBinaryVariable("test"); + try { + lp.addBinaryVariable("test"); + fail("Should throw an exception"); + } catch (ILPException e) { + assertEquals(ILPException.ERROR_DUPLICATE_NAME, e.code); + } + } + + @Test + public void testCreate_WithoutName() { + try { + lp.addBinaryVariable(null); + fail("Should throw an exception"); + } catch (ILPException e) { + assertEquals(ILPException.ERROR_DUPLICATE_NAME, e.code); + } + } + + @Test + public void testBounds_withFixedValue_TypeShouldBeFixed() { + + Variable var = lp.addBinaryVariable("test"); + + assertEquals(VarType.BOOL, var.getType()); + + var.setLowerBound(ONE); + var.setUpperBound(ONE); + + assertEquals(ONE, var.getLowerBound()); + + assertEquals(ONE, var.getUpperBound()); + + assertTrue(VarType.INTEGER.equals(var.getType()) || VarType.BOOL.equals(var.getType())); + + } + + /** + * Check bounds setter and getters for an integer variable. + */ + @Test + public void testBounds_WithIntegerVariable() { + + Variable myVar = lp.addVariable("my_var", VarType.INTEGER); + assertNotNull(myVar); + assertEquals(VarType.INTEGER, myVar.getType()); + + // By default expect null..null bounds + assertEquals(null, myVar.getLowerBound()); + assertEquals(null, myVar.getUpperBound()); + + // Sets fixed bounds + myVar.setLowerBound(Integer.valueOf(10)); + myVar.setUpperBound(Integer.valueOf(20)); + assertEquals(Double.valueOf(10), myVar.getLowerBound()); + assertEquals(Double.valueOf(20), myVar.getUpperBound()); + + // Set unbounded lower bound. + myVar.setLowerBound(null); + assertEquals(null, myVar.getLowerBound()); + + // Set unbounded upper bound. + myVar.setUpperBound(null); + assertEquals(null, myVar.getUpperBound()); + + } + + @Test + public void testDispose() { + + /* + * Add variables. + */ + Variable var1 = lp.addBinaryVariable("dummy1"); + assertNotNull(var1); + + Variable var2 = lp.addBinaryVariable("dummy2"); + assertNotNull(var2); + + assertEquals(2, lp.getVariables().size()); + assertEquals(var1, lp.getVariables().toArray()[0]); + assertEquals(var2, lp.getVariables().toArray()[1]); + + /* + * Dispose first variable. + */ + var1.dispose(); + + assertEquals(1, lp.getVariables().size()); + assertEquals(var2, lp.getVariables().toArray()[0]); + assertEquals("dummy2", var2.getName()); + + } + + /** + * Check if getting a value after some modification to the problem still work. + * + *
+     * Maximize y
+     *     subject to
+     *       -2x + 3y <= 6
+     *       2x + 3y <= 12
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * 
+ */ + @Test + public void testGetValue_AfterDispose() { + + // Create the model + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(1, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + Constraint constraint1 = lp.addConstraint("-2x + 6y <= 6", new int[] { -2, 6 }, new Variable[] { x, y }, null, 6); + Constraint constraint2 = lp.addConstraint("2x + 6y <= 12", new int[] { 2, 6 }, new Variable[] { x, y }, null, 12); + + SolverOption option = solver.createSolverOption(); + + System.out.println(lp.toString()); + + // Solve the model + assertTrue(solver.solve(lp, option)); + assertEquals(Status.OPTIMAL, lp.getStatus()); + assertTrue(lp.isFeasible()); + assertEquals(1.0, lp.getObjectiveValue().doubleValue(), 0); + + double xval = x.getValue().doubleValue(); + double yval = y.getValue().doubleValue(); + + assertTrue(-2 * xval + 3 * yval <= 6); + assertTrue(2 * xval + 3 * yval <= 12); + + assertTrue(x.getValue().equals(2.0d) || x.getValue().equals(3.0d)); + assertEquals(1, y.getValue().doubleValue(), 0.0001); + + // Dispose constraints + constraint1.dispose(); + constraint2.dispose(); + // Check if value of 'x' changed. + assertTrue(x.getValue().equals(2.0d) || x.getValue().equals(3.0d)); + // Dispose variables + x.dispose(); + // Check if the value of 'y' changed + assertEquals(1, y.getValue().doubleValue(), 0.0001); + + } + + /** + *
+     * Maximize y
+     *     subject to
+     *       -2x + 3y <= 6
+     *       2x + 3y <= 12
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * 
+ */ + @Test(expected = ILPException.class) + public void testGetValue_AfterUnfeasibleSolve() { + + // Build the problem + Variable var = lp.addBinaryVariable("x"); + Linear linear = lp.createLinear(1, var); + Constraint constraint = lp.addConstraint("x=0.5", linear, 0.5, 0.5); + + // solve the problem + assertFalse(solver.solve(lp, solver.createSolverOption())); + assertTrue(lp.getStatus() == Status.INFEASIBLE || lp.getStatus() == Status.UNKNOWN); + assertFalse(lp.isFeasible()); + var.getValue(); + + } + + /** + *
+     * Maximize y
+     *     subject to
+     *       -2x + 3y <= 6
+     *       2x + 3y <= 12
+     *     where,
+     *       0.0 <= x  integer
+     *       0.0 <= y  integer
+     * 
+ */ + @Test(expected = ILPException.class) + public void testGetValue_BeforeSolve() { + + // Create the model + Variable x = lp.addIntegerVariable("x", ZERO, null); + Variable y = lp.addIntegerVariable("y", ZERO, null); + Linear linear = lp.createLinear(); + linear.add(lp.createTerm(1, y)); + lp.setObjectiveLinear(linear); + lp.setObjectiveDirection(LinearProblem.MAXIMIZE); + Constraint constraint1 = lp.addConstraint("-2x + 3y <= 6", new int[] { -2, 3 }, new Variable[] { x, y }, null, 6); + Constraint constraint2 = lp.addConstraint("2x + 3y <= 12", new int[] { 2, 3 }, new Variable[] { x, y }, null, 12); + + y.getValue(); + + } +} diff --git a/ilp/ilp-glpk/.gitignore b/ilp/ilp-glpk/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a2ae83f76bfbb6570f62c8231937f93249a11078 --- /dev/null +++ b/ilp/ilp-glpk/.gitignore @@ -0,0 +1,2 @@ +/coucou.1 +/coucou2 diff --git a/ilp/ilp-glpk/pom.xml b/ilp/ilp-glpk/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..7bbe2fcce1340aa29ba5c36d349e133b0e190b80 --- /dev/null +++ b/ilp/ilp-glpk/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.patrikdufresne + ilp-parent + ${revision} + + ilp-glpk + + + XypronRelease + Xypron Release + http://rsync.xypron.de/repository + default + + + + + org.gnu.glpk + glpk-java + 1.0.29 + + + junit + junit + 4.11 + test + + + com.patrikdufresne + ilp-core + ${project.parent.version} + + + + com.patrikdufresne + ilp-core + ${project.parent.version} + test-jar + test + + + + + + + com.googlecode.maven-java-formatter-plugin + maven-java-formatter-plugin + + + + format + + + + + ${project.basedir}/../../formatter.xml + CRLF + + + + + com.mycila.maven-license-plugin + maven-license-plugin + + + process-sources + + format + + + + +
license-header.txt
+
+
+
+
+
\ No newline at end of file diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKConstraint.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKConstraint.java new file mode 100644 index 0000000000000000000000000000000000000000..4afa67e065546ddf126a5e48a54772d0df24a399 --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKConstraint.java @@ -0,0 +1,264 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import org.gnu.glpk.GLPK; +import org.gnu.glpk.SWIGTYPE_p_double; +import org.gnu.glpk.SWIGTYPE_p_int; + +import com.patrikdufresne.ilp.AbstractLinearProblem; +import com.patrikdufresne.ilp.ConcreteLinear; +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.Status; +import com.patrikdufresne.ilp.Term; + +/** + * This class is a complete implementation of the {@link Constraint} interface for GLPK solver. + *

+ * Setting the constraint's bound required adjustment for glp_set_row_bnds(). Here is a description of the parameters. + * + *

+ * Type     Bounds        Comment
+ * GLP_FR   −∞ < x < +∞   Free (unbounded) variable
+ * GLP_LO   lb ≤ x < +∞   Variable with lower bound
+ * GLP_UP   −∞ < x ≤ ub   Variable with upper bound
+ * GLP_DB   lb ≤ x ≤ ub   Double-bounded variable
+ * GLP_FX   lb = x = ub   Fixed variable
+ * 
+ * + * @author Patrik Dufresne + * + */ +public class GLPKConstraint implements Constraint { + + /** + * Reference to the GLPK problem + */ + GLPKLinearProblem parent; + /** + * row index of this constraint in the problem. + */ + int row; + + /** + * Create a new constraint. + * + * @param parent + * reference to the glpk problem + * @param row + * the constraint row index + */ + GLPKConstraint(GLPKLinearProblem parent, String name) { + if (parent == null) { + throw new NullPointerException(); + } + parent.checkProblem(); + + // Call the parent function to complete the work + parent.addRow(this, name); + setName(name); + } + + /** + * Check if the constraint is disposed. + */ + void checkConstraint() { + if (isDisposed()) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + this.parent.checkProblem(); + } + + @Override + public void dispose() { + if (isDisposed()) { + return; + } + this.parent.removeRow(this); + } + + /** + * Returns the constraint linear expression. Need to rebuild the Linear object. + */ + @Override + public Linear getLinear() { + checkConstraint(); + + // First call to get the length + int len = GLPK.glp_get_mat_row(this.parent.lp, this.row, null, null); + + if (len == 0) { + return new ConcreteLinear(); + } + + // Second call to get the array value + SWIGTYPE_p_double coefs = GLPK.new_doubleArray(len + 1); + SWIGTYPE_p_int cols = GLPK.new_intArray(len + 1); + GLPK.glp_get_mat_row(this.parent.lp, this.row, cols, coefs); + + // Rebuild the Linear object + ConcreteLinear linear = new ConcreteLinear(); + for (int i = 1; i <= len; i++) { + + int col = GLPK.intArray_getitem(cols, i); + double coef = GLPK.doubleArray_getitem(coefs, i); + + linear.add(this.parent.createTerm(Double.valueOf(coef), this.parent.getCol(col))); + } + + // Return the Linear object + return linear; + } + + /** + * Return the row's lower bound or null if unbounded. + */ + @Override + public Double getLowerBound() { + checkConstraint(); + + double value = GLPK.glp_get_row_lb(this.parent.lp, this.row); + if (value == -GLPKLinearProblem.DBL_MAX) { + return null; + } + + return Double.valueOf(value); + } + + /** + * Returns GLPK row name. + */ + @Override + public String getName() { + checkConstraint(); + + return GLPK.glp_get_row_name(this.parent.lp, this.row); + } + + /** + * Return the row's upper bound or null if unbounded. + */ + @Override + public Double getUpperBound() { + checkConstraint(); + double value = GLPK.glp_get_row_ub(this.parent.lp, this.row); + + if (value == GLPKLinearProblem.DBL_MAX) { + return null; + } + return Double.valueOf(value); + } + + @Override + public Double getValue() { + checkConstraint(); + this.parent.checkSolution(); + if (this.parent.isMIP()) { + return Double.valueOf(GLPK.glp_mip_row_val(this.parent.lp, this.row)); + } + return Double.valueOf(GLPK.glp_get_row_prim(this.parent.lp, this.row)); + } + + @Override + public boolean isDisposed() { + return this.parent == null || this.row == 0; + } + + @Override + public boolean isEmpty() { + checkConstraint(); + // First call to get the length + int len = GLPK.glp_get_mat_row(this.parent.lp, this.row, null, null); + return len == 0; + } + + /** + * Sets the constraint linear expression. Since GLPK implementation is using ConcreteLinear object, the linear need + * to be converted into an array. + */ + @Override + public void setLinear(Linear linear) { + checkConstraint(); + AbstractLinearProblem.checkLinear(linear); + + int size = linear != null ? linear.size() : 0; + SWIGTYPE_p_double coefs = GLPK.new_doubleArray(size + 1); + SWIGTYPE_p_int cols = GLPK.new_intArray(size + 1); + + int idx = 0; + if (linear != null) { + for (Term term : linear) { + idx++; + // Sets the coefficient value + GLPK.doubleArray_setitem(coefs, idx, term.getCoefficient().doubleValue()); + // Sets the columns index + GLPK.intArray_setitem(cols, idx, ((GLPKVariable) term.getVariable()).col); + } + } + + // Sets the row matrix + GLPK.glp_set_mat_row(this.parent.lp, this.row, size, cols, coefs); + } + + @Override + public void setLowerBound(Number lb) { + checkConstraint(); + + Double ub = getUpperBound(); + int type = GLPKLinearProblem.boundedType(lb, ub); + + GLPK.glp_set_row_bnds(this.parent.lp, this.row, type, lb != null ? lb.doubleValue() : 0, ub != null ? ub.doubleValue() : 0); + } + + /** + * Sets the GLPK row name. + */ + private void setName(String name) { + checkConstraint(); + + if (name != null && name.length() > 255) { + throw new IllegalArgumentException("name > 255"); //$NON-NLS-1$ + } + + GLPK.glp_set_row_name(this.parent.lp, this.row, name); + } + + /** + * Sets the row bounds and type. + */ + @Override + public void setUpperBound(Number ub) { + checkConstraint(); + + Double lb = getLowerBound(); + int type = GLPKLinearProblem.boundedType(lb, ub); + + GLPK.glp_set_row_bnds(this.parent.lp, this.row, type, lb != null ? lb.doubleValue() : 0, ub != null ? ub.doubleValue() : 0); + } + + @Override + public String toString() { + if (isDisposed()) { + return "GLPKConstraint [disposed]"; //$NON-NLS-1$ + } + return "GLPKConstraint [name=" + getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + } + +} diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKLibrary.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKLibrary.java new file mode 100644 index 0000000000000000000000000000000000000000..ae1e8a35aa525a1740e4c11576f4b618dc48c770 --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKLibrary.java @@ -0,0 +1,333 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Arrays; + +import org.gnu.glpk.GLPK; + +import com.patrikdufresne.ilp.ILPLogger; +import com.patrikdufresne.ilp.ILPPolicy; + +/** + * Used to load GLPK native library. + * + * @author Patrik Dufresne + * + */ +class GLPKLibrary { + /** + * New line char + */ + private static final String DELIMITER; + /** + * GLPK java library name. + */ + private static final String GLPK_JAVA_LIBNAME = "glpk_java"; + /** + * Relative GLPK path according to current architecture. + */ + private static final String GLPK_LIB_DIR; + /** + * GLPK library name. + */ + private static final String GLPK_LIBNAME = "glpk"; + /** + * GLPK library path. + */ + private static final String GLPK_LIBRARY_PATH = "glpk.library.path"; + /** + * GLPK Major version number (must be >= 0) + */ + private static int MAJOR_VERSION = 4; + /** + * GLPK Minor version number (must be in the range 0..999) + */ + private static int MINOR_VERSION = 51; + /** + * The file separator. + */ + private static final String SEPARATOR; + + /** + * The resource class path separator. + *

+ * This separator is used with getResource() + */ + private static final String RES_SEPARATOR = "/"; + + static { + /* Initialize the constant */ + DELIMITER = System.getProperty("line.separator"); //$NON-NLS-1$ + SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$ + GLPK_LIB_DIR = ".glpk" + SEPARATOR + "lib" + SEPARATOR + os() + SEPARATOR + arch(); //$NON-NLS-1$ $NON-NLS-2$ + } + + /** + * Adds the specified path to the java library path + * + * @param newPath + * the path to add + * @throws NoSuchFieldException + * @throws SecurityException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + static void addLibraryPath(String newPath) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { + final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); + usrPathsField.setAccessible(true); + + // get array of paths + final String[] usrpaths = (String[]) usrPathsField.get(null); + + // check if the path to add is already present + for (String path : usrpaths) { + if (path.equals(newPath)) { + return; + } + } + + // add the new path + final String[] newPaths = Arrays.copyOf(usrpaths, usrpaths.length + 1); + newPaths[newPaths.length - 1] = newPath; + usrPathsField.set(null, newPaths); + } + + private static String arch() { + String osArch = System.getProperty("os.arch"); //$NON-NLS-1$ + if (osArch.equals("i386") || osArch.equals("i686")) return "x86"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + if (osArch.equals("amd64")) return "x86_64"; //$NON-NLS-1$ $NON-NLS-2$ + if (osArch.equals("IA64N")) return "ia64_32"; //$NON-NLS-1$ $NON-NLS-2$ + if (osArch.equals("IA64W")) return "ia64"; //$NON-NLS-1$ $NON-NLS-2$ + return osArch; + } + + /** + * Check the execution mode of the given file. + *

+ * This function does nothing for Windows platform. + * + * @param permision + * the new permission mode. + * @param path + * the file. + */ + private static void chmod(String permision, String path) { + if (os().equals("win")) return; //$NON-NLS-1$ + try { + Runtime.getRuntime().exec(new String[] { "chmod", permision, path }).waitFor(); //$NON-NLS-1$ + } catch (Throwable e) { + // Swallow. + } + } + + /** + * Used to extract a library from a jar and load it. + * + * @param libname + * the library name to be loaded e.g.: glpk_java + * @param fileName + * an absolute path where to extract the library. + * @param resourceName + * the resource location to be extracted + * @param message + * @return + */ + private static boolean extractAndLoad(String libname, String fileName, String resourceName, StringBuffer message) { + FileOutputStream os = null; + InputStream is = null; + File file = new File(fileName); + boolean extracted = false; + try { + if (!file.exists()) { + is = GLPKLibrary.class.getResourceAsStream(RES_SEPARATOR + resourceName); //$NON-NLS-1$ + if (is != null) { + extracted = true; + int read; + byte[] buffer = new byte[4096]; + os = new FileOutputStream(fileName); + while ((read = is.read(buffer)) != -1) { + os.write(buffer, 0, read); + } + os.close(); + is.close(); + chmod("755", fileName); + if (load(file.getParent(), libname, message)) return true; + } + } + } catch (Throwable e) { + try { + if (os != null) os.close(); + } catch (IOException e1) { + } + try { + if (is != null) is.close(); + } catch (IOException e1) { + } + if (extracted && file.exists()) file.delete(); + } + return false; + } + + /** + * Load the GLPK library. + * + * @throws UnsatisfiedLinkError + * is the library can't be loaded. + */ + public static void load() { + // Load the glpk library. + ILPPolicy.log(ILPLogger.DEBUG, "Loading " + GLPK_LIBNAME); + loadLibrary(GLPK_LIBNAME); + // Load the glpk_java library + ILPPolicy.log(ILPLogger.DEBUG, "Loading " + GLPK_JAVA_LIBNAME); + loadLibrary(GLPK_JAVA_LIBNAME); + // Check GLPK Version + String version = GLPK.glp_version(); + String expected = MAJOR_VERSION + "." + MINOR_VERSION; + if (!version.equals(expected)) { + throw new UnsatisfiedLinkError("Could not load GLPK library. Current version (" + version + ") doesn't match expected version (" + expected + ")"); + } + } + + /** + * This function will update the java.library.path dynamically and then try to load the library. The advantage of + * using this function is the ability to change the search path of the library. + * + * @param path + * the search path to be added to java.library.path. + * @param libName + * the library name to be loaded. + * @param message + * @return True is the library is loaded. + */ + private static boolean load(String path, String libName, StringBuffer message) { + try { + if (path != null) { + // append the path to the library path + addLibraryPath(path); + } + System.loadLibrary(libName); + return true; + } catch (Throwable e) { + if (message.length() == 0) message.append(DELIMITER); + message.append('\t'); + message.append(e.getMessage()); + message.append(DELIMITER); + } + return false; + } + + /** + * Loads the shared library that matches the version of the Java code which is currently running. GLPK-java shared + * libraries follow an encoding scheme where the major, minor and revision numbers are embedded in the library name + * and this along with name is used to load the library. If this fails, name is used in + * another attempt to load the library, this time ignoring the GLPK version encoding scheme. + * + * @param name + * the name of the library to load (without-java or _java). + */ + private static void loadLibrary(String name) { + /* Compute the library names */ + String libName1, libName2; + String version = System.getProperty("glpk.version"); //$NON-NLS-1$ + if (version == null) { + version = "" + MAJOR_VERSION; //$NON-NLS-1$ + version += "_"; + version += MINOR_VERSION; + } + if (GLPK_JAVA_LIBNAME.equals(name)) { + libName1 = "glpk_" + version + "_java"; //$NON-NLS-1$ //$NON-NLS-2$ + libName2 = name; //$NON-NLS-1$ + } else { + libName1 = name + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$ + libName2 = name; //$NON-NLS-1$ + } + + StringBuffer message = new StringBuffer(); + + /* Try loading library from glpk library path */ + String path = System.getProperty(GLPK_LIBRARY_PATH); + if (path != null) { + path = new File(path).getAbsolutePath(); + if (load(path, libName1, message)) return; + if (load(path, libName2, message)) return; + } + + /* Try loading library from java library path */ + if (load(null, libName1, message)) return; + if (load(null, libName2, message)) return; + + /* + * Try loading library from the tmp directory if glpk.library.path is not specified + */ + String fileName1 = mapLibraryName(libName1); + String fileName2 = mapLibraryName(libName2); + if (path == null) { + path = System.getProperty("user.home"); //$NON-NLS-1$ + File dir = new File(path, GLPK_LIB_DIR); + if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { + path = dir.getAbsolutePath(); + } else { + /* fall back to using the home dir directory */ + } + if (load(path, libName1, message)) return; + if (load(path, libName2, message)) return; + } + + /* + * Try extracting and loading library from jar. Embedded jars are organized in sub-directories. + */ + if (path != null) { + if (extractAndLoad(libName1, path + RES_SEPARATOR + fileName1, os() + RES_SEPARATOR + arch() + RES_SEPARATOR + fileName1, message)) return; + if (extractAndLoad(libName2, path + RES_SEPARATOR + fileName2, os() + RES_SEPARATOR + arch() + RES_SEPARATOR + fileName2, message)) return; + } + + /* Failed to find the library */ + throw new UnsatisfiedLinkError("Could not load GLPK library. Reasons: " + message.toString()); //$NON-NLS-1$ + } + + private static String mapLibraryName(String libName) { + /* + * GLPK libraries in the Macintosh use the extension .jnilib but the some VMs map to .dylib. + */ + libName = System.mapLibraryName(libName); + String ext = ".dylib"; //$NON-NLS-1$ + if (libName.endsWith(ext)) { + libName = libName.substring(0, libName.length() - ext.length()) + ".jnilib"; //$NON-NLS-1$ + } + return libName; + } + + private static String os() { + String osName = System.getProperty("os.name"); //$NON-NLS-1$ + if (osName.equals("Linux")) return "linux"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.equals("AIX")) return "aix"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.equals("Solaris") || osName.equals("SunOS")) return "solaris"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ + if (osName.equals("HP-UX")) return "hpux"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.equals("Mac OS X")) return "macosx"; //$NON-NLS-1$ $NON-NLS-2$ + if (osName.startsWith("Win")) return "win"; //$NON-NLS-1$ $NON-NLS-2$ + return osName; + } +} \ No newline at end of file diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKLinearProblem.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKLinearProblem.java new file mode 100644 index 0000000000000000000000000000000000000000..a2294832f047f462041f17218c6b465e8d14a703 --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKLinearProblem.java @@ -0,0 +1,566 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.logging.Logger; + +import org.gnu.glpk.GLPK; +import org.gnu.glpk.GLPKConstants; +import org.gnu.glpk.SWIGTYPE_p_int; +import org.gnu.glpk.glp_prob; + +import com.patrikdufresne.ilp.AbstractLinearProblem; +import com.patrikdufresne.ilp.Constraint; +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.ILPLogger; +import com.patrikdufresne.ilp.ILPPolicy; +import com.patrikdufresne.ilp.IPersistentLinearProblem; +import com.patrikdufresne.ilp.Linear; +import com.patrikdufresne.ilp.Status; +import com.patrikdufresne.ilp.Term; +import com.patrikdufresne.ilp.VarType; +import com.patrikdufresne.ilp.Variable; + +/** + * This implementation represent a GLPK linear problem. + * + * @author Patrik Dufresne + * + */ +public class GLPKLinearProblem extends AbstractLinearProblem implements IPersistentLinearProblem { + + /** + * Value return by glp_get_row_ub, glp_get_row_lb, glp_get_col_ub and glp_get_col_lb when it's not bounded. + */ + static final double DBL_MAX = Double.MAX_VALUE; + + /** + * Determine the column bounding type according to the bounding value. + * + * @param lb + * lower bound value + * @param ub + * upper bound value + * + * @return one of the GLP_DB, GLP_FX, GLP_LO, GLP_UP, GLP_FR + */ + static int boundedType(Number lb, Number ub) { + int type; + if (ub != null && lb != null) { + // Double-bounded + type = GLPKConstants.GLP_DB; + if (ub.doubleValue() == lb.doubleValue()) { + // Fixed + type = GLPKConstants.GLP_FX; + } + } else if (ub == null && lb != null) { + // Lower bounded + type = GLPKConstants.GLP_LO; + } else if (ub != null && lb == null) { + // Upper bounded + type = GLPKConstants.GLP_UP; + } else { + // Free (unbounded) + type = GLPKConstants.GLP_FR; + } + return type; + } + + /** + * Need to keep reference on every constraint (row). + */ + private List constraints; + + private Set constraintNames; + + private Set variableNames; + + /** + * Private reference on the glpk problem. + */ + glp_prob lp; + + /** + * Cached value. True if the problem is a MIP. + */ + Boolean mip; + + /** + * The status of the problem. This value is sets the UNKNOWN when any variable or constraints is changed. + */ + Status status = Status.UNKNOWN;; + + /** + * Need to keep reference on every variable (col). + */ + private List variables; + + /** + * Create a new linear problem. + */ + public GLPKLinearProblem() { + this.lp = GLPK.glp_create_prob(); + } + + /** + * Check if the constraint name is unique. Otherwise throw an exception. + * + * @param name + * the constraint name. + */ + void checkConstraintName(String name) { + if (name == null) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Undefined constraint name."); + } + if (this.constraintNames != null && this.constraintNames.contains(name)) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Duplicate constraint name: " + name); + } + } + + /** + * Check if the variable name is unique. Otherwise throw an exception. + * + * @param name + * the constraint name. + */ + void checkVariableName(String name) { + if (name == null) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Undefined variable name."); + } + if (this.variableNames != null && this.variableNames.contains(name)) { + throw new ILPException(ILPException.ERROR_DUPLICATE_NAME, "Duplicate variable name: " + name); + } + } + + /** + * Should be called for every new instance of GLPKVariable + * + * @param var + * the variable to be added to the problem. + */ + synchronized void addCol(GLPKVariable var, String name) { + this.mip = null; + if (this.variables == null) { + this.variables = new ArrayList(); + } + if (this.variableNames == null) { + this.variableNames = new HashSet(); + } + + // Create a new column using GLPK API. + var.parent = this; + var.col = GLPK.glp_add_cols(this.lp, 1); + + if (var.col != this.variables.size() + 1) { + throw new RuntimeException("GLPKVariable.col is not set properly."); //$NON-NLS-1$ + } + this.variables.add(var); + this.variableNames.add(name); + } + + @Override + public Constraint addConstraint(String name) { + checkProblem(); + checkConstraintName(name); + GLPKConstraint c = new GLPKConstraint(this, name); + return c; + } + + /** + * Should be called for every instance of GLPKConstraint. + * + * @param constraint + * the constraint to be added to the problem. + */ + synchronized void addRow(GLPKConstraint constraint, String name) { + if (this.constraints == null) { + this.constraints = new ArrayList(); + } + if (this.constraintNames == null) { + this.constraintNames = new HashSet(); + } + + constraint.parent = this; + constraint.row = GLPK.glp_add_rows(this.lp, 1); + + if (constraint.row != this.constraints.size() + 1) { + throw new RuntimeException("GLPKConstraint.row is not set properly."); //$NON-NLS-1$ + } + this.constraints.add(constraint); + this.constraintNames.add(name); + } + + /** + * Add a new variables to the problem. + */ + @Override + public Variable addVariable(String name, VarType type) { + checkProblem(); + checkVariableName(name); + GLPKVariable v = new GLPKVariable(this, name); + v.setType(type); + if (VarType.INTEGER.equals(type) || VarType.REAL.equals(type)) { + v.setLowerBound(null); + v.setUpperBound(null); + } + return v; + } + + /** + * Check if the problem is disposed. + */ + void checkProblem() { + if (isDisposed()) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + } + + /** + * Check the solution state. Throw an exception if the solution is not available. + */ + void checkSolution() { + Status status = getStatus(); + if (!status.equals(Status.FEASIBLE) && !status.equals(Status.OPTIMAL)) { + throw new ILPException("solution not available"); //$NON-NLS-1$ + } + } + + @Override + public void dispose() { + // Free the lp problem. + if (this.lp != null) { + GLPK.glp_delete_prob(this.lp); + } + this.lp = null; + } + + /** + * Return the variable for the given column index. + * + * @param col + * the column index. + * @return the variable object + */ + Variable getCol(int col) { + GLPKVariable var = this.variables.get(col - 1); + if (var.col != col) { + throw new ILPException("Variables list corrupted"); //$NON-NLS-1$ + } + return var; + } + + /** + * Return an unmodifiable collection of constraints. + */ + @Override + public Collection getConstraints() { + if (this.constraints == null) { + return Collections.EMPTY_LIST; + } + return Collections.unmodifiableList(this.constraints); + } + + /** + * Return the problem name. + */ + @Override + public String getName() { + checkProblem(); + return GLPK.glp_get_prob_name(this.lp); + } + + /** + * Return the problem's direction. + * + * @return + */ + @Override + public int getObjectiveDirection() { + + checkProblem(); + + int direction = GLPK.glp_get_obj_dir(this.lp); + if (direction == GLPKConstants.GLP_MAX) { + return MAXIMIZE; + } + return MINIMIZE; + + } + + /** + * This implementation rebuild the linear object. + * + * @return + */ + + @Override + public Linear getObjectiveLinear() { + checkProblem(); + + // Get the number of columns + int count = GLPK.glp_get_num_cols(this.lp); + + if (count == 0) { + return createLinear(); + } + + // Get the coefficient of each column. + Linear linear = createLinear(); + for (int col = 1; col < count + 1; col++) { + double coef = GLPK.glp_get_obj_coef(this.lp, col); + if (coef != 0) { + linear.add(createTerm(coef, getCol(col))); + } + } + + if (linear.size() == 0) { + return null; + } + + return linear; + } + + public String getObjectiveName() { + checkProblem(); + return GLPK.glp_get_obj_name(this.lp); + } + + /** + * This implementation return the objective value. + */ + @Override + public Double getObjectiveValue() { + checkProblem(); + + checkSolution(); + + if (isMIP()) { + return Double.valueOf(GLPK.glp_mip_obj_val(this.lp)); + } + + return Double.valueOf(GLPK.glp_get_obj_val(this.lp)); + } + + /** + * Get the problem status + */ + @Override + public Status getStatus() { + checkProblem(); + if (this.status == null) { + return Status.UNKNOWN; + } + return this.status; + } + + @Override + public Collection getVariables() { + if (this.variables == null) { + return Collections.EMPTY_LIST; + } + return Collections.unmodifiableList(this.variables); + } + + /** + * Return true if lp is null. + */ + @Override + public boolean isDisposed() { + return this.lp == null; + } + + /** + * Cached version of this function to avoid calling JNI over and over. + */ + @Override + public boolean isMIP() { + + if (this.mip == null) { + this.mip = Boolean.valueOf(super.isMIP()); + } + return this.mip.booleanValue(); + + } + + /** + * This implementations read the file as CPLEX format using glp_read_lp() function. + */ + @Override + public void load(File file) throws IOException { + checkProblem(); + + if (file == null) { + throw new NullPointerException(); + } + + if (GLPK.glp_read_lp(this.lp, null, file.getAbsolutePath()) != 0) { + // TODO retrieved the error message + throw new IOException("Error reading the problem from file."); //$NON-NLS-1$ + } + + } + + /** + * Remove the column fr om the linear problem. + * + * @param col + */ + synchronized void removeCol(GLPKVariable var) { + int index; + if (this.variables == null || (index = this.variables.indexOf(var)) < 0) { + throw new RuntimeException("GLPKVariable not in the variable list."); //$NON-NLS-1$ + } + + String name = var.getName(); + SWIGTYPE_p_int cols = GLPK.new_intArray(2); + GLPK.intArray_setitem(cols, 1, var.col); + GLPK.glp_del_cols(this.lp, 1, cols); + + this.variables.remove(index); + this.variableNames.remove(name); + + var.col = 0; + var.parent = null; + + for (; index < this.variables.size(); index++) { + GLPKVariable sub = this.variables.get(index); + sub.col = index + 1; + } + + } + + synchronized void removeRow(GLPKConstraint constraint) { + int index; + if (this.constraints == null || (index = this.constraints.indexOf(constraint)) < 0) { + throw new RuntimeException("GLPKConstraint not in the constraint list."); //$NON-NLS-1$ + } + + String name = constraint.getName(); + SWIGTYPE_p_int rows = GLPK.new_intArray(2); + GLPK.intArray_setitem(rows, 1, constraint.row); + GLPK.glp_del_rows(this.lp, 1, rows); + + this.constraints.remove(index); + this.constraintNames.remove(name); + + constraint.row = 0; + constraint.parent = null; + + for (; index < this.constraints.size(); index++) { + GLPKConstraint sub = this.constraints.get(index); + sub.row = index + 1; + } + + } + + /** + * This implementation is writing the problem in GLPK LP/MIP format to text file. + */ + @Override + public void save(File file) throws IOException { + checkProblem(); + + if (file == null) { + throw new NullPointerException(); + } + + if (GLPK.glp_write_lp(this.lp, null, file.getAbsolutePath()) != 0) { + // TODO retrieved the error message + throw new IOException("Error writing the problem to file."); //$NON-NLS-1$ + } + + } + + /** + * Sets the problem's name + */ + void setName(String name) { + checkProblem(); + + // Check string size + if (name != null && name.length() > 255) { + throw new IndexOutOfBoundsException("name > 255"); //$NON-NLS-1$ + } + GLPK.glp_set_prob_name(this.lp, name); + } + + /** + * Sets the objective direction. + */ + @Override + public void setObjectiveDirection(int direction) { + checkProblem(); + switch (direction) { + case MAXIMIZE: + GLPK.glp_set_obj_dir(this.lp, GLPKConstants.GLP_MAX); + break; + case MINIMIZE: + GLPK.glp_set_obj_dir(this.lp, GLPKConstants.GLP_MIN); + break; + default: + throw new IllegalArgumentException(); + } + } + + /** + * This implementation sets the objective name and coefficient. + */ + @Override + public void setObjectiveLinear(Linear objective) { + checkProblem(); + + // Sets all the coefs to zero + int colCount = GLPK.glp_get_num_cols(this.lp); + if (colCount > 0) { + for (int i = 1; i <= colCount; i++) { + GLPK.glp_set_obj_coef(this.lp, i, 0); + } + } + + if (objective == null || objective.size() == 0) { + return; + } + + // Then sets the real coef value + for (Term term : objective) { + GLPK.glp_set_obj_coef(this.lp, ((GLPKVariable) term.getVariable()).col, term.getCoefficient().doubleValue()); + } + + } + + /** + * Sets the objective name + */ + public void setObjectiveName(String name) { + checkProblem(); + // Check string size + if (name != null && name.length() > 255) { + throw new IndexOutOfBoundsException("name > 255"); //$NON-NLS-1$ + } + GLPK.glp_set_obj_name(this.lp, name); + } + +} diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolver.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolver.java new file mode 100644 index 0000000000000000000000000000000000000000..15358ba563f7fa448f85b648890191c2b0a6c9e0 --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolver.java @@ -0,0 +1,348 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import java.util.ArrayList; +import java.util.List; + +import org.gnu.glpk.GLPK; +import org.gnu.glpk.GLPKConstants; +import org.gnu.glpk.GlpkCallback; +import org.gnu.glpk.GlpkCallbackListener; +import org.gnu.glpk.GlpkTerminal; +import org.gnu.glpk.GlpkTerminalListener; +import org.gnu.glpk.glp_iocp; +import org.gnu.glpk.glp_prob; +import org.gnu.glpk.glp_smcp; + +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.ILPLogger; +import com.patrikdufresne.ilp.ILPPolicy; +import com.patrikdufresne.ilp.LinearProblem; +import com.patrikdufresne.ilp.Solver; +import com.patrikdufresne.ilp.SolverOption; +import com.patrikdufresne.ilp.Status; + +/** + * This class may be used to create new instance of glpk problems. + * + * @author Patrik Dufresne + * + */ +public class GLPKSolver implements Solver { + + static { + GLPKLibrary.load(); + } + + /** + * Private listener to send message trough Policy logger. + */ + private static GlpkTerminalListener terminalListener; + + /** + * Convert the status code into {@link Status} object. + * + * @param status + * the status code return by {@link GLPK#glp_get_status(glp_prob)}. + * @return a Status object + */ + private static Status status(int status) { + if (status == GLPKConstants.GLP_UNDEF) { + // solution is undefined + return Status.UNKNOWN; + } else if (status == GLPKConstants.GLP_FEAS) { + return Status.FEASIBLE; + } else if (status == GLPKConstants.GLP_INFEAS) { + return Status.INFEASIBLE; + } else if (status == GLPKConstants.GLP_NOFEAS) { + return Status.INFEASIBLE; + } else if (status == GLPKConstants.GLP_OPT) { + // solution is optimal + return Status.OPTIMAL; + } else if (status == GLPKConstants.GLP_UNBND) { + return Status.UNBOUNDED; + } + return Status.UNKNOWN; + } + + /** + * Attach the listener. Notice, the terminal listener doesn't required to be release, because the listener is shared + * across all thread and GLPKSolver. + */ + private static void attachTerminalListener() { + + // According to glpk-java, glp_term_hook should be called to register + // the callback function for every thread access. + GLPK.glp_term_hook(null, null); + + // Check if the listener already exists. + if (terminalListener != null) return; + + // Create a new terminal listener to redirect the terminal output into + // the ILogger framework. + terminalListener = new GlpkTerminalListener() { + @Override + public boolean output(String str) { + String message = str; + if (message.endsWith("\n")) { //$NON-NLS-1$ + message = message.substring(0, str.length() - 1); + } + ILPPolicy.log(ILPPolicy.getLog().getLevel(), message); + return false; + } + }; + + // Add the listener + GlpkTerminal.addListener(terminalListener); + + } + + /** + * Check the return code of glp_simplex() and glp_exact(). + * + * @param code + * the return code + */ + static void checkSolverReturnCode(int code) { + if (code == 0) { + return; + } else if (code == GLPKConstants.GLP_EBADB) { + throw new ILPException("Unable to start the search, because " + + "the initial basis specified in the problem " + + "object is invalid -- the number of basic (auxiliary " + + "and structural) variables is not the same as the " + + "number of rows in the problem object."); + } else if (code == GLPKConstants.GLP_ESING) { + throw new ILPException("Unable to start the search, because the " + + "basis matrix corresponding to the initial basis is " + + "singular within the working precision."); + } else if (code == GLPKConstants.GLP_ECOND) { + throw new ILPException("Unable to start the search, because the " + + "basis matrix corresponding to the initial basis is " + + "ill-conditioned, i.e. its condition number " + + "is too large."); + } else if (code == GLPKConstants.GLP_EBOUND) { + throw new ILPException("Unable to start the search, because some " + + "double-bounded (auxiliary or structural) variables " + + "have incorrect bounds."); + } else if (code == GLPKConstants.GLP_EFAIL) { + throw new ILPException("The search was prematurely terminated due " + "to the solver failure."); + } else if (code == GLPKConstants.GLP_EOBJLL) { + throw new ILPException("The search was prematurely terminated, " + + "because the objective function being " + + "maximized has reached its lower limit and " + + "continues decreasing (the dual simplex only)."); + } else if (code == GLPKConstants.GLP_EOBJUL) { + throw new ILPException("The search was prematurely terminated, " + + "because the objective function being " + + "minimized has reached its upper limit and " + + "continues increasing (the dual simplex only)."); + } else if (code == GLPKConstants.GLP_EITLIM) { + throw new ILPException("The search was prematurely terminated, " + "because the simplex iteration limit has been exceeded."); + } else if (code == GLPKConstants.GLP_ETMLIM) { + throw new ILPException("The search was prematurely terminated, " + "because the time limit has been exceeded."); + } else if (code == GLPKConstants.GLP_ENODFS) { + throw new ILPException("The LP problem instance has no dual " + "feasible solution (only if the LP presolver is used)."); + } else if (code == GLPKConstants.GLP_ENOPFS) { + throw new ILPException("Unable to start the search, because LP " + "relaxation of the MIP problem instance has no primal " + "feasible solution."); + } else { + throw new ILPException("unknown error occur during the " + "optimization process."); + } + + } + + private List listeners; + + /** + * Default constructor. + */ + public GLPKSolver() { + // Nothing to do + } + + /** + * This function is used to add a callback listener to GLPK. This function also make sure to keep track of every + * listeners attached to all of them can be detach after the solving process. + * + * @param listener + */ + private void addCallbackListener(GlpkCallbackListener listener) { + if (this.listeners == null) { + this.listeners = new ArrayList(); + } + this.listeners.add(listener); + GlpkCallback.addListener(listener); + } + + /** + * Create a new GLPK linear prolem. + */ + @Override + public LinearProblem createLinearProblem() { + return new GLPKLinearProblem(); + } + + /** + * Create a new GLPK solver option. + * + * @return + */ + public SolverOption createSolverOption() { + return new GLPKSolverOption(); + } + + @Override + public void dispose() { + // Nothing to dispose. + } + + /** + * Return the log level according to the ILPLogger log level. + * + *

+     * GLP_MSG_OFF—no output;
+     * GLP_MSG_ERR—error and warning messages only;
+     * GLP_MSG_ON —normal output;
+     * GLP_MSG_ALL—full output (including informational messages).
+     * 
+ */ + private int logLevel() { + switch (ILPPolicy.getLog().getLevel()) { + case ILPLogger.DEBUG: + return GLPKConstants.GLP_MSG_ALL; + case ILPLogger.INFO: + case ILPLogger.WARNING: + default: + return GLPKConstants.GLP_MSG_ERR; + } + } + + /** + * This function is used to remove any previously added listener from GLPK. Does nothing it there wasn't any + * listener added using {@link #addCallbackListener(GlpkCallbackListener)}. + * + */ + private void removeAllCallbackListener() { + if (this.listeners == null) { + return; + } + for (GlpkCallbackListener listener : this.listeners) { + GlpkCallback.removeListener(listener); + } + } + + /** + * This implementation solve the GLPK linear problem. + *

+ * If the problem is identified as MIP, using the function {@link LinearProblem#isMIP()}, the function glp_intopt() + * is used instead of glp_simplex() to solve the problem. + */ + @Override + public boolean solve(LinearProblem lp, SolverOption option) { + if (!(lp instanceof GLPKLinearProblem)) { + throw new IllegalArgumentException("lp should be a GLPKLinearProblem"); + } + if (!(option instanceof GLPKSolverOption)) { + throw new IllegalArgumentException("option should be a GLPKSolverOption"); + } + GLPKLinearProblem glpklp = (GLPKLinearProblem) lp; + GLPKSolverOption glpkopt = (GLPKSolverOption) option; + + // Since GLPK is not thread safe, make sure only one thread is accessing + // the solver. + synchronized (GLPKSolverFactory.instance()) { + + // Check the problem + if (lp.isDisposed()) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + + // Make the problem as clear if a solution was found + glpklp.status = null; + + // Attach a terminal listener. + attachTerminalListener(); + + int returns; + if (glpklp.isMIP()) { + + glp_iocp iocp = new glp_iocp(); + GLPK.glp_init_iocp(iocp); + iocp.setPresolve(GLPKConstants.GLP_ON); + iocp.setMsg_lev(logLevel()); + + // Set the branching technique + if (glpkopt.brTech != null) { + iocp.setBr_tech(GLPKSolverOption.brTech(glpkopt.brTech)); + } + + try { + // Attach listener if a custom heuristic is provided + if (glpkopt.brTech instanceof GlpkCallbackListener) { + addCallbackListener((GlpkCallbackListener) glpkopt.brTech); + } + + // Enable/disable feasibility pump heuristic according to + // fpump value + iocp.setFp_heur(glpkopt.fpump ? GLPKConstants.GLP_ON : GLPKConstants.GLP_OFF); + + // Copy the problem, and solve it. Otherwise, their is a + // data corruption. + glp_prob copy = GLPK.glp_create_prob(); + GLPK.glp_copy_prob(copy, glpklp.lp, GLPKConstants.GLP_ON); + GLPK.glp_delete_prob(glpklp.lp); + glpklp.lp = copy; + returns = GLPK.glp_intopt(glpklp.lp, iocp); + if (returns == GLPKConstants.GLP_ENOPFS) { + glpklp.status = Status.INFEASIBLE; + } else { + // Generate exception according to return code + checkSolverReturnCode(returns); + // Get the MIP status + glpklp.status = status(GLPK.glp_mip_status(glpklp.lp)); + } + + } finally { + // Remove listeners, otherwise listener keep referencing + // this solver. + removeAllCallbackListener(); + } + + } else { + glp_smcp parm = new glp_smcp(); + GLPK.glp_init_smcp(parm); + + // Run the simplex algorithm + returns = GLPK.glp_simplex(glpklp.lp, parm); + + // Generate exception according to return code + checkSolverReturnCode(returns); + + // Get the solver status. + glpklp.status = status(GLPK.glp_get_status(glpklp.lp)); + + } + + return glpklp.status.equals(Status.FEASIBLE) || glpklp.status.equals(Status.OPTIMAL); + + } + + } + +} diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolverFactory.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolverFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..d63650a848480c0185264d7671fd2b7c9a32b107 --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolverFactory.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import com.patrikdufresne.ilp.SolverFactory; +import com.patrikdufresne.ilp.Solver; + +/** + * This implementation create instance of GLPK solver. + * + * @author Patrik Dufresne + * + */ +public class GLPKSolverFactory implements SolverFactory { + + private static GLPKSolverFactory instance; + + /** + * Private constructor for singleton. + */ + private GLPKSolverFactory() { + // Nothing to do. + } + + /** + * Return the unique instance of this class. + * + * @return + */ + public static GLPKSolverFactory instance() { + if (instance == null) { + instance = new GLPKSolverFactory(); + } + return instance; + } + + @Override + public Solver createSolver() { + return new GLPKSolver(); + } + +} diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolverOption.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolverOption.java new file mode 100644 index 0000000000000000000000000000000000000000..bf88b76a6a2b9b87a8cd34f7341c197a815c8bcc --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKSolverOption.java @@ -0,0 +1,127 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import org.gnu.glpk.GLPK; +import org.gnu.glpk.GLPKConstants; +import org.gnu.glpk.GlpkCallbackListener; +import org.gnu.glpk.glp_tree; + +import com.patrikdufresne.ilp.IBranchingTechniqueLast; +import com.patrikdufresne.ilp.IBranchingTechniqueLastAlwaysDown; +import com.patrikdufresne.ilp.IFeasibilityPumpHeuristic; +import com.patrikdufresne.ilp.SolverOption; + +/** + * This implementation of {@link SolverOption} may be used with GLPK solver. + * + * @author Patrik Dufresne + * + */ +public class GLPKSolverOption implements IFeasibilityPumpHeuristic, IBranchingTechniqueLast, IBranchingTechniqueLastAlwaysDown { + + /** + * Constant value for branching last. + */ + static final String BRANCHING_LAST = "last"; //$NON-NLS-1$ + + /** + * Callback function implementing last always down branching technique. + */ + static final GlpkCallbackListener BRANCHING_LAST_ALWAYS_DOWN = new GlpkCallbackListener() { + @Override + public void callback(glp_tree tree) { + int reason = GLPK.glp_ios_reason(tree); + if (reason == GLPKConstants.GLP_IBRANCH) { + int n = GLPK.glp_get_num_cols(GLPK.glp_ios_get_prob(tree)); + int j; + for (j = n; j >= 1; j--) { + if (GLPK.glp_ios_can_branch(tree, j) != 0) break; + } + if (j < 1) { + return; + } + GLPK.glp_ios_branch_upon(tree, j, GLPKConstants.GLP_DN_BRNCH); + } + } + }; + + /** + * Used to convert the internal constant value to the GLPK constant value + * + * @param technique + * the technique or null if not set + * @return one of the GLP_BR_* constant + */ + static int brTech(Object technique) { + if (BRANCHING_LAST.equals(technique)) { + return GLPKConstants.GLP_BR_LFV; + } + return GLPKConstants.GLP_BR_DTH; + } + + /** + * Define the branching technique used by this solver. May be constant value or a custom heuristic. + */ + Object brTech; + + /** + * True to enabled Feasibility pump heuristic. + */ + boolean fpump; + + /** + * This implementation check if the constant value matchs the technique. + */ + @Override + public boolean getBranchingLast() { + return BRANCHING_LAST.equals(this.brTech); + } + + @Override + public boolean getBranchingLastAlwaysDown() { + return this.brTech == BRANCHING_LAST_ALWAYS_DOWN; + } + + @Override + public boolean getFeasibilityPumpHeuristic() { + return this.fpump; + } + + /** + * This implementation sets the interval variable to a constant value. + */ + @Override + public void setBranchingLast(boolean enabled) { + this.brTech = enabled ? BRANCHING_LAST : null; + } + + @Override + public void setBranchingLastAlwaysDown(boolean enabled) { + this.brTech = enabled ? BRANCHING_LAST_ALWAYS_DOWN : null; + } + + /** + * This implementation enable the feasibility pump for this solver. + */ + @Override + public void setFeasibilityPumpHeuristic(boolean enabled) { + this.fpump = enabled; + } + +} diff --git a/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKVariable.java b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKVariable.java new file mode 100644 index 0000000000000000000000000000000000000000..91c7f4978aafd02d6271f6d8c35416fc276fff54 --- /dev/null +++ b/ilp/ilp-glpk/src/main/java/com/patrikdufresne/ilp/glpk/GLPKVariable.java @@ -0,0 +1,227 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import org.gnu.glpk.GLPK; +import org.gnu.glpk.GLPKConstants; + +import com.patrikdufresne.ilp.ILPException; +import com.patrikdufresne.ilp.Status; +import com.patrikdufresne.ilp.VarType; +import com.patrikdufresne.ilp.Variable; + +/** + * This class is a complete implementation of the {@link Variable} interface for GLPK solver. + * + * @author Patrik Dufresne + * + */ +public class GLPKVariable implements Variable { + + /** + * The col index. + */ + int col; + + GLPKLinearProblem parent; + + /** + * Create a new variable. + * + * @param parent + * the parent problem. + */ + GLPKVariable(GLPKLinearProblem parent, String name) { + if (parent == null) { + throw new NullPointerException(); + } + parent.checkProblem(); + + // Call the parent function to complete the opperation. + parent.addCol(this, name); + setName(name); + } + + /** + * Check if the variable is disposed. + */ + void checkVariable() { + if (isDisposed()) { + throw new ILPException(ILPException.ERROR_RESOURCE_DISPOSED); + } + this.parent.checkProblem(); + } + + /** + * This implementation remove the column from the linear problem. + */ + @Override + public void dispose() { + if (isDisposed()) { + return; + } + // Call the parent function to complete the operation. + this.parent.removeCol(this); + } + + @Override + public Double getLowerBound() { + checkVariable(); + + double value = GLPK.glp_get_col_lb(this.parent.lp, this.col); + if (value == -GLPKLinearProblem.DBL_MAX) { + return null; + } + return Double.valueOf(value); + } + + @Override + public String getName() { + this.parent.checkProblem(); + return GLPK.glp_get_col_name(this.parent.lp, this.col); + } + + @Override + public VarType getType() { + checkVariable(); + + int kind = GLPK.glp_get_col_kind(this.parent.lp, this.col); + + if (kind == GLPKConstants.GLP_BV) { + return VarType.BOOL; + } else if (kind == GLPKConstants.GLP_IV) { + return VarType.INTEGER; + } else if (kind == GLPKConstants.GLP_CV) { + return VarType.REAL; + } + + throw new ILPException("glp_get_col_kind() returns invalid value"); //$NON-NLS-1$ + } + + @Override + public Double getUpperBound() { + checkVariable(); + + double value = GLPK.glp_get_col_ub(this.parent.lp, this.col); + if (value == GLPKLinearProblem.DBL_MAX) { + return null; + } + return Double.valueOf(value); + } + + /** + * Retrieve the column primal value. + *

+ * Report components of the solution to LP relaxation. Ref.: + * http://lists.gnu.org/archive/html/help-glpk/2011-09/msg00034.html + *

+ */ + @Override + public Double getValue() { + checkVariable(); + this.parent.checkSolution(); + if (this.parent.isMIP()) { + return Double.valueOf(GLPK.glp_mip_col_val(this.parent.lp, this.col)); + } + return Double.valueOf(GLPK.glp_get_col_prim(this.parent.lp, this.col)); + } + + /** + * This implementation check if the {@link #col} property is set to zero (0) and if the parent is nul. + */ + @Override + public boolean isDisposed() { + return this.parent == null || this.col == 0; + } + + /** + * Sets the columns bounding type and bounds. + */ + @Override + public void setLowerBound(Number lb) { + checkVariable(); + + Double ub = getUpperBound(); + int type = GLPKLinearProblem.boundedType(lb, ub); + + GLPK.glp_set_col_bnds(this.parent.lp, this.col, type, lb != null ? lb.doubleValue() : 0, ub != null ? ub.doubleValue() : 0); + } + + /** + * Sets the variable name. + * + * @param name + */ + private void setName(String name) { + checkVariable(); + + if (name != null && name.length() > 255) { + throw new IllegalArgumentException("name > 255"); //$NON-NLS-1$ + } + + GLPK.glp_set_col_name(this.parent.lp, this.col, name); + } + + /** + * Sets the variable type. + * + * @param type + */ + public void setType(VarType type) { + checkVariable(); + + if (type.equals(VarType.BOOL)) { + + GLPK.glp_set_col_kind(this.parent.lp, this.col, GLPKConstants.GLP_IV); + GLPK.glp_set_col_bnds(this.parent.lp, this.col, GLPKConstants.GLP_DB, 0, 1); + + } else if (type.equals(VarType.INTEGER)) { + + GLPK.glp_set_col_kind(this.parent.lp, this.col, GLPKConstants.GLP_IV); + + } else if (type.equals(VarType.REAL)) { + + GLPK.glp_set_col_kind(this.parent.lp, this.col, GLPKConstants.GLP_CV); + + this.parent.mip = null; + + } + } + + /** + * Sets the columns bounding type and bounds + */ + @Override + public void setUpperBound(Number ub) { + checkVariable(); + + Double lb = getLowerBound(); + int type = GLPKLinearProblem.boundedType(lb, ub); + + GLPK.glp_set_col_bnds(this.parent.lp, this.col, type, lb != null ? lb.doubleValue() : 0, ub != null ? ub.doubleValue() : 0); + } + + @Override + public String toString() { + if (isDisposed()) { + return "GLPKVariable [disposed]"; //$NON-NLS-1$ + } + return getName(); + } + +} diff --git a/ilp/ilp-glpk/src/main/resources/linux/x86_64/libglpk.so b/ilp/ilp-glpk/src/main/resources/linux/x86_64/libglpk.so new file mode 100644 index 0000000000000000000000000000000000000000..c50d1fc1782b93e741b4f5e1f8de9a3f308d930e Binary files /dev/null and b/ilp/ilp-glpk/src/main/resources/linux/x86_64/libglpk.so differ diff --git a/ilp/ilp-glpk/src/main/resources/linux/x86_64/libglpk_java.so b/ilp/ilp-glpk/src/main/resources/linux/x86_64/libglpk_java.so new file mode 100644 index 0000000000000000000000000000000000000000..cc0072bada495964bf586083007c246a9b1e025c Binary files /dev/null and b/ilp/ilp-glpk/src/main/resources/linux/x86_64/libglpk_java.so differ diff --git a/ilp/ilp-glpk/src/main/resources/win/x86/glpk_4_51.dll b/ilp/ilp-glpk/src/main/resources/win/x86/glpk_4_51.dll new file mode 100644 index 0000000000000000000000000000000000000000..9188aab01377e57905ed7e6a6a813e8e013f271f Binary files /dev/null and b/ilp/ilp-glpk/src/main/resources/win/x86/glpk_4_51.dll differ diff --git a/ilp/ilp-glpk/src/main/resources/win/x86/glpk_4_51_java.dll b/ilp/ilp-glpk/src/main/resources/win/x86/glpk_4_51_java.dll new file mode 100644 index 0000000000000000000000000000000000000000..d8831f5ffbad65fe55e171fb9562f9ae05c57e56 Binary files /dev/null and b/ilp/ilp-glpk/src/main/resources/win/x86/glpk_4_51_java.dll differ diff --git a/ilp/ilp-glpk/src/main/resources/win/x86_64/glpk_4_51.dll b/ilp/ilp-glpk/src/main/resources/win/x86_64/glpk_4_51.dll new file mode 100644 index 0000000000000000000000000000000000000000..6ee0beb6ce1dfe04fb722aaa29ec66b5fd95389a Binary files /dev/null and b/ilp/ilp-glpk/src/main/resources/win/x86_64/glpk_4_51.dll differ diff --git a/ilp/ilp-glpk/src/main/resources/win/x86_64/glpk_4_51_java.dll b/ilp/ilp-glpk/src/main/resources/win/x86_64/glpk_4_51_java.dll new file mode 100644 index 0000000000000000000000000000000000000000..5d6c073f5b54cedf570a56445d3c22307bc48886 Binary files /dev/null and b/ilp/ilp-glpk/src/main/resources/win/x86_64/glpk_4_51_java.dll differ diff --git a/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/AllTests.java b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/AllTests.java new file mode 100644 index 0000000000000000000000000000000000000000..42703de2ab1919c84665645b9069be29ef049ef2 --- /dev/null +++ b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/AllTests.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ GLPKLinearProblemTest.class, GLPKSolverTest.class, GLPKVariableTest.class, GLPKConstraintTest.class }) +public class AllTests { + +} diff --git a/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKConstraintTest.java b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKConstraintTest.java new file mode 100644 index 0000000000000000000000000000000000000000..adac797dc99856d3a633e4bf8136ef184a1646f1 --- /dev/null +++ b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKConstraintTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import com.patrikdufresne.ilp.ConstraintTest; +import com.patrikdufresne.ilp.SolverFactory; + +public class GLPKConstraintTest extends ConstraintTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return GLPKSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKLinearProblemTest.java b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKLinearProblemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e1aeb0039052f106c1bfee78955744a72a97fb03 --- /dev/null +++ b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKLinearProblemTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import com.patrikdufresne.ilp.LinearProblemTest; +import com.patrikdufresne.ilp.SolverFactory; + +public class GLPKLinearProblemTest extends LinearProblemTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return GLPKSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKSolverTest.java b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKSolverTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6fdc29e2ba185848c47f8b1255935d83d7c29c4b --- /dev/null +++ b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKSolverTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import com.patrikdufresne.ilp.SolverFactory; +import com.patrikdufresne.ilp.SolverTest; + +public class GLPKSolverTest extends SolverTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return GLPKSolverFactory.instance(); + } + +} diff --git a/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKVariableTest.java b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKVariableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a75df97826d7ee1ea7309bd3fed9081db8f6cc13 --- /dev/null +++ b/ilp/ilp-glpk/src/test/java/com/patrikdufresne/ilp/glpk/GLPKVariableTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2019 Patrik Dufresne Service Logiciel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package com.patrikdufresne.ilp.glpk; + +import com.patrikdufresne.ilp.SolverFactory; +import com.patrikdufresne.ilp.VariableTest; + +public class GLPKVariableTest extends VariableTest { + + @Override + protected SolverFactory doGetSolverFactory() { + return GLPKSolverFactory.instance(); + } + +} diff --git a/ilp/pom.xml b/ilp/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..8ce9f8cbef639f25fe568c153956f13500b6d0cc --- /dev/null +++ b/ilp/pom.xml @@ -0,0 +1,40 @@ + + 4.0.0 + + com.patrikdufresne + planimod-parent + ${revision} + + com.patrikdufresne + ilp-parent + pom + + + + patrikdufresne + http://nexus.patrikdufresne.com/content/repositories/public/ + + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + + + ilp-core + ilp-glpk + ilp-cbc + + \ No newline at end of file diff --git a/license-header.txt b/license-header.txt new file mode 100644 index 0000000000000000000000000000000000000000..a52ca17a47b106d9aefc7f58d238f23c4f0f67fb --- /dev/null +++ b/license-header.txt @@ -0,0 +1,15 @@ +Copyright (C) 2019 Patrik Dufresne Service Logiciel + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. \ No newline at end of file diff --git a/pom.xml b/pom.xml index 87d12b20a80764f18345a75a3ee3015777d12be9..41ce233f91c6f5109167e16cc1d89a33ed05aae5 100644 --- a/pom.xml +++ b/pom.xml @@ -9,12 +9,14 @@ planimod http://patrikdufresne.com/fr/planimod + ilp planimod-icons com.patrikdufresne.planimod com.patrikdufresne.planimod-installation-package + 1.8 1.8 UTF-8 @@ -58,6 +60,16 @@ ${swt.version} provided + + com.mycila.maven-license-plugin + maven-license-plugin + 1.9.0 + + + com.googlecode.maven-java-formatter-plugin + maven-java-formatter-plugin + 0.3.1 + \ No newline at end of file