You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Felix Knecht <fe...@otego.com> on 2010/11/20 23:23:10 UTC

I'm confused

What's the meaning of this method WRT to its comment and its naming 
(value is declared as int):

/**
  * @return The hex value for this flag, in its position.
  * For instance, getting the flag 5 will return 0x0000 0010
  */
public int getHexValue()
{
     return 1 << value;
}

- IMO a hex is an alphanumeric pattern (abcdef0123456789), so how can 
this method return an int representing a hex?
- 'value' represents all set flags, nto a specific one, but no method 
parameter is given to specifiy a specific flag ...

Any ideas ?
Felix

PS
Taken from 
apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java

Re: I'm confused

Posted by Felix Knecht <fe...@apache.org>.
C'mon guys

It's Sunday evening and I removed the method in question :-)


On 11/21/2010 07:04 PM, Alex Karasulu wrote:
> On Sunday, November 21, 2010, Emmanuel Lecharny<el...@gmail.com>  wrote:
>> On 11/21/10 12:29 AM, Alex Karasulu wrote:
>>
>> On Sun, Nov 21, 2010 at 12:23 AM, Felix Knecht<fe...@otego.com>    wrote:
>>
>>
>> What's the meaning of this method WRT to its comment and its naming (value
>> is declared as int):
>>
>> /**
>>    * @return The hex value for this flag, in its position.
>>    * For instance, getting the flag 5 will return 0x0000 0010
>>    */
>> public int getHexValue()
>> {
>>      return 1<<    value;
>> }
>>
>> - IMO a hex is an alphanumeric pattern (abcdef0123456789), so how can this
>> method return an int representing a hex?
>> - 'value' represents all set flags, nto a specific one, but no method
>> parameter is given to specifiy a specific flag ...
>>
>> Any ideas ?
>>
>>
>> Yeah that's pretty cryptic. You're just multiplying by 2 here.
>>
>> no. It's 2 power2 value. What the method does is that it set a bit in the fifth position.
>
> I have no idea where u are coming from here. A bit shift to the right
> doubles the value and yes I know it's a pow2 thing. Just what point
> are you trying to make?
>
>>
>> Not sure it's useful though.
>>
>> First off this method is never used anywhere so you can delete it. I have no
>> idea where it came from or where it might have been used if at all.
>>
>> +1
>>
>> The javadoc example is all dorked too. The hex value shown is not 5 which
>> should be 0x0000 0101. Maybe the bit shift was intended in the other
>> direction by the javadoc. The history on this is lost from svn blame so hard
>> to tell what it was about. Regardless the end result should be 0x0000 1010
>> which is 8+2 or 10.
>>
>> nope, the end result is correct. But anyway, this is typically an over-engineered piece of code, a YAGNI
>
> My point was the javadoc is not consistent with what this stupid
> method does. The javadoc comment example would be a bit shift to the
> right, not to the left as is done.
>
> Anyways this is not a big deal. I think your tired and not
> understanding what I am writing and just saying no or nope to
> everything I write.
>
>
>


Re: I'm confused

Posted by Alex Karasulu <ak...@apache.org>.
On Sunday, November 21, 2010, Emmanuel Lecharny <el...@gmail.com> wrote:
> On 11/21/10 12:29 AM, Alex Karasulu wrote:
>
> On Sun, Nov 21, 2010 at 12:23 AM, Felix Knecht<fe...@otego.com>  wrote:
>
>
> What's the meaning of this method WRT to its comment and its naming (value
> is declared as int):
>
> /**
>   * @return The hex value for this flag, in its position.
>   * For instance, getting the flag 5 will return 0x0000 0010
>   */
> public int getHexValue()
> {
>     return 1<<  value;
> }
>
> - IMO a hex is an alphanumeric pattern (abcdef0123456789), so how can this
> method return an int representing a hex?
> - 'value' represents all set flags, nto a specific one, but no method
> parameter is given to specifiy a specific flag ...
>
> Any ideas ?
>
>
> Yeah that's pretty cryptic. You're just multiplying by 2 here.
>
> no. It's 2 power2 value. What the method does is that it set a bit in the fifth position.

I have no idea where u are coming from here. A bit shift to the right
doubles the value and yes I know it's a pow2 thing. Just what point
are you trying to make?

>
> Not sure it's useful though.
>
> First off this method is never used anywhere so you can delete it. I have no
> idea where it came from or where it might have been used if at all.
>
> +1
>
> The javadoc example is all dorked too. The hex value shown is not 5 which
> should be 0x0000 0101. Maybe the bit shift was intended in the other
> direction by the javadoc. The history on this is lost from svn blame so hard
> to tell what it was about. Regardless the end result should be 0x0000 1010
> which is 8+2 or 10.
>
> nope, the end result is correct. But anyway, this is typically an over-engineered piece of code, a YAGNI

My point was the javadoc is not consistent with what this stupid
method does. The javadoc comment example would be a bit shift to the
right, not to the left as is done.

Anyways this is not a big deal. I think your tired and not
understanding what I am writing and just saying no or nope to
everything I write.



-- 
Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org
To set up a meeting with me: http://tungle.me/AlexKarasulu

Re: I'm confused

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 11/21/10 12:29 AM, Alex Karasulu wrote:
> On Sun, Nov 21, 2010 at 12:23 AM, Felix Knecht<fe...@otego.com>  wrote:
>
>> What's the meaning of this method WRT to its comment and its naming (value
>> is declared as int):
>>
>> /**
>>   * @return The hex value for this flag, in its position.
>>   * For instance, getting the flag 5 will return 0x0000 0010
>>   */
>> public int getHexValue()
>> {
>>     return 1<<  value;
>> }
>>
>> - IMO a hex is an alphanumeric pattern (abcdef0123456789), so how can this
>> method return an int representing a hex?
>> - 'value' represents all set flags, nto a specific one, but no method
>> parameter is given to specifiy a specific flag ...
>>
>> Any ideas ?
>>
> Yeah that's pretty cryptic. You're just multiplying by 2 here.
no. It's 2 power2 value. What the method does is that it set a bit in 
the fifth position.

Not sure it's useful though.
> First off this method is never used anywhere so you can delete it. I have no
> idea where it came from or where it might have been used if at all.
+1
> The javadoc example is all dorked too. The hex value shown is not 5 which
> should be 0x0000 0101. Maybe the bit shift was intended in the other
> direction by the javadoc. The history on this is lost from svn blame so hard
> to tell what it was about. Regardless the end result should be 0x0000 1010
> which is 8+2 or 10.
nope, the end result is correct. But anyway, this is typically an 
over-engineered piece of code, a YAGNI syndrom.

This should be removed.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: I'm confused

Posted by Alex Karasulu <ak...@apache.org>.
On Sun, Nov 21, 2010 at 12:23 AM, Felix Knecht <fe...@otego.com> wrote:

> What's the meaning of this method WRT to its comment and its naming (value
> is declared as int):
>
> /**
>  * @return The hex value for this flag, in its position.
>  * For instance, getting the flag 5 will return 0x0000 0010
>  */
> public int getHexValue()
> {
>    return 1 << value;
> }
>
> - IMO a hex is an alphanumeric pattern (abcdef0123456789), so how can this
> method return an int representing a hex?
> - 'value' represents all set flags, nto a specific one, but no method
> parameter is given to specifiy a specific flag ...
>
> Any ideas ?
>

Yeah that's pretty cryptic. You're just multiplying by 2 here.

First off this method is never used anywhere so you can delete it. I have no
idea where it came from or where it might have been used if at all.

The javadoc example is all dorked too. The hex value shown is not 5 which
should be 0x0000 0101. Maybe the bit shift was intended in the other
direction by the javadoc. The history on this is lost from svn blame so hard
to tell what it was about. Regardless the end result should be 0x0000 1010
which is 8+2 or 10.


> PS
> Taken from
> apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java
>

I am confused as well :-\

-- 
Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org
To set up a meeting with me: http://tungle.me/AlexKarasulu