/[fenfire]/fenfire/org/fenfire/util/PaperMillFunction.java
ViewVC logotype

Diff of /fenfire/org/fenfire/util/PaperMillFunction.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tjl, Fri Oct 31 12:30:35 2003 UTC revision 1.4 by tjl, Sat Nov 8 19:45:09 2003 UTC
# Line 28  package org.fenfire.util; Line 28  package org.fenfire.util;
28  import org.nongnu.libvob.gl.PaperMill;  import org.nongnu.libvob.gl.PaperMill;
29  import org.nongnu.libvob.gl.SpecialPapers;  import org.nongnu.libvob.gl.SpecialPapers;
30  import org.fenfire.functional.Function;  import org.fenfire.functional.Function;
31    import org.fenfire.functional.PureFunction;
32  import org.fenfire.functional.Functional;  import org.fenfire.functional.Functional;
33    
34  /** Adapt a PaperMill into the Function API.  /** Adapt a PaperMill into the Function API.
35   * Input: any object. Output an org.nongnu.libvob.gl.Paper object   * Input: any object. Output an org.nongnu.libvob.gl.Paper object
36   * based on the hashcode of the object.   * based on the hashcode of the object.
37   */   */
38  public class PaperMillFunction implements Function {  public class PaperMillFunction implements PureFunction {
39      private boolean useOptimized;      /** Whether we should request optimized papers from the papermill.
40      private PaperMill paperMill;       */
41        private final boolean useOptimized;
42        /** The offset to add to the hashcode.
43         */
44        private final int offset;
45    
46        /** The papermill to use.
47         */
48        private final PaperMill paperMill;
49    
50      static public Functional.Hints functionalHints =      static public Functional.Hints functionalHints =
51          (new Functional.HintsMaker())          (new Functional.HintsMaker())
# Line 44  public class PaperMillFunction implement Line 53  public class PaperMillFunction implement
53              .setHint(Functional.HINT_PLACEHOLDER, null)              .setHint(Functional.HINT_PLACEHOLDER, null)
54              .make();              .make();
55    
56        /** Create a new PaperMillFunction.
57         * @param paperMill The papermill to use
58         * @param useOptimized Whether to return optimized or non-optimized
59         *                  papers from the papermill
60         */
61      public PaperMillFunction(PaperMill paperMill, boolean useOptimized) {      public PaperMillFunction(PaperMill paperMill, boolean useOptimized) {
62            this(paperMill, useOptimized, 0);
63        }
64    
65        /** Create a new PaperMillFunction.
66         * @param paperMill The papermill to use
67         * @param useOptimized Whether to return optimized or non-optimized
68         *                  papers from the papermill
69         * @param offset The offset to add to the hashCode before calling
70         *                  getPaper or getOptimizedPaper.
71         */
72        public PaperMillFunction(PaperMill paperMill, boolean useOptimized,
73                                int offset) {
74          this.paperMill = paperMill;          this.paperMill = paperMill;
75          this.useOptimized = useOptimized;          this.useOptimized = useOptimized;
76            this.offset = offset;
77      }      }
78    
79      public Object f(Object input) {      public Object f(Object input) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26