xzel23 commented on PR #184:
URL: https://github.com/apache/pdfbox/pull/184#issuecomment-1934602716

   Nice find.
   
   For the flag thing, how about just changing isValid to this? 
   ```
       public boolean isValid()
       {
           return value != Long.MAX_VALUE && value != Long.MIN_VALUE;
       }
   ```
   
   This would also make the constructor and where it is called a little bit 
shorter because there'd be no need to pass the `valid`parameter.
   
   And the `STATIC` array could just be initialised in a static block, IMHO 
that wouldn't cost too much memory, and get(long) would be much simpler:
   
   ```
       public static COSInteger get(long val)
       {
           if (LOW <= val && val <= HIGH)
           {
               return STATIC[(int) val - LOW];
           }
           return new COSInteger(val, true);
       }
   ```
   
   `getInvalid(boolean maxValue)` can also be removed and we use just
   ```
       protected static final COSInteger OUT_OF_RANGE_MAX = 
getInvalid(Long.MAX_VALUE);
       protected static final COSInteger OUT_OF_RANGE_MIN = 
getInvalid(Long.MIN_VALUE);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to