Fix some style guide violations

This commit is contained in:
Klaus Reimer 2014-02-23 14:11:02 +01:00
parent 1cb11d479b
commit e843d73b60
12 changed files with 56 additions and 38 deletions

View File

@ -131,7 +131,8 @@ public final class BosDevCapabilityDescriptor
return false;
}
final BosDevCapabilityDescriptor other = (BosDevCapabilityDescriptor) obj;
final BosDevCapabilityDescriptor other =
(BosDevCapabilityDescriptor) obj;
return new EqualsBuilder()
.append(this.bLength(), other.bLength())

View File

@ -40,7 +40,8 @@ public final class ContainerIdDescriptor
/**
* Constructs a new Container Id descriptor which can be passed to the
* {@link LibUsb#getContainerIdDescriptor(Context, BosDevCapabilityDescriptor, ContainerIdDescriptor)}
* {@link LibUsb#getContainerIdDescriptor(Context,
* BosDevCapabilityDescriptor, ContainerIdDescriptor)}
* method.
*/
public ContainerIdDescriptor()

View File

@ -59,8 +59,8 @@ public final class DeviceHandle
{
final int prime = 31;
int result = 1;
result = (prime * result)
+ (int) (this.deviceHandlePointer ^ (this.deviceHandlePointer >>> 32));
result = (prime * result) + (int) (this.deviceHandlePointer ^
(this.deviceHandlePointer >>> 32));
return result;
}

View File

@ -41,5 +41,6 @@ public interface HotplugCallback
* @return Whether this callback is finished processing events. Returning 1
* will cause this callback to be deregistered.
*/
int processEvent(Context context, Device device, int event, Object userData);
int processEvent(Context context, Device device, int event,
Object userData);
}

View File

@ -61,8 +61,8 @@ public final class HotplugCallbackHandle
{
final int prime = 31;
int result = 1;
result = (prime * result)
+ (int) (this.hotplugCallbackHandleValue ^ (this.hotplugCallbackHandleValue >>> 32));
result = (prime * result) + (int) (this.hotplugCallbackHandleValue ^
(this.hotplugCallbackHandleValue >>> 32));
return result;
}

View File

@ -84,8 +84,8 @@ public final class IsoPacketDescriptor
{
final int prime = 31;
int result = 1;
result = (prime * result)
+ (int) (this.isoPacketDescriptorPointer ^ (this.isoPacketDescriptorPointer >>> 32));
result = (prime * result) + (int) (this.isoPacketDescriptorPointer ^
(this.isoPacketDescriptorPointer >>> 32));
return result;
}

View File

@ -442,7 +442,8 @@ public final class LibUsb
/** We unwrap the BOS => define its maximum size. */
public static final byte DT_BOS_MAX_SIZE = ((DT_BOS_SIZE)
+ (BT_USB_2_0_EXTENSION_SIZE) + (BT_SS_USB_DEVICE_CAPABILITY_SIZE) + (BT_CONTAINER_ID_SIZE));
+ (BT_USB_2_0_EXTENSION_SIZE) + (BT_SS_USB_DEVICE_CAPABILITY_SIZE)
+ (BT_CONTAINER_ID_SIZE));
// Endpoint direction. Values for bit 7 of the endpoint address scheme.
@ -624,13 +625,15 @@ public final class LibUsb
/**
* Hotplug callbacks (to correctly manage calls and additional data).
*/
private static final ConcurrentMap<Long, ImmutablePair<HotplugCallback, Object>> hotplugCallbacks =
private static final ConcurrentMap<Long,
ImmutablePair<HotplugCallback, Object>> hotplugCallbacks =
new ConcurrentHashMap<Long, ImmutablePair<HotplugCallback, Object>>();
/**
* Pollfd listeners (to support different listeners for different contexts).
*/
private static final ConcurrentMap<Long, ImmutablePair<PollfdListener, Object>> pollfdListeners =
private static final ConcurrentMap<Long,
ImmutablePair<PollfdListener, Object>> pollfdListeners =
new ConcurrentHashMap<Long, ImmutablePair<PollfdListener, Object>>();
static
@ -943,7 +946,8 @@ public final class LibUsb
* {@link #ERROR_NO_DEVICE} if the device has been disconnected
* another error on other failure
*/
public static native int open(final Device device, final DeviceHandle handle);
public static native int open(final Device device,
final DeviceHandle handle);
/**
* Convenience function for finding a device with a particular
@ -1535,7 +1539,8 @@ public final class LibUsb
* @param companionDescriptor
* Output location for the superspeed endpoint companion
* descriptor. Only valid if 0 was returned. Must be freed with
* {@link #freeSsEndpointCompanionDescriptor(SsEndpointCompanionDescriptor)}
* {@link #freeSsEndpointCompanionDescriptor
* (SsEndpointCompanionDescriptor)}
* after use.
* @return {@link #SUCCESS} on success, {@link #ERROR_NOT_FOUND} if the
* descriptor does not exist, another error code on error
@ -1546,8 +1551,8 @@ public final class LibUsb
/**
* Free a superspeed endpoint companion descriptor obtained from
* {@link #getSsEndpointCompanionDescriptor(Context, EndpointDescriptor, SsEndpointCompanionDescriptor)}
* .
* {@link #getSsEndpointCompanionDescriptor(Context, EndpointDescriptor,
* SsEndpointCompanionDescriptor)}.
*
* It is safe to call this function with a NULL parameter, in which case the
* function simply returns.
@ -1597,8 +1602,8 @@ public final class LibUsb
* @param extensionDescriptor
* Output location for the USB 2.0 Extension descriptor. Only
* valid if 0 was returned. Must be freed with
* {@link #freeUsb20ExtensionDescriptor(Usb20ExtensionDescriptor)}
* after use.
* {@link #freeUsb20ExtensionDescriptor(
* Usb20ExtensionDescriptor)} after use.
* @return 0 on success a LIBUSB_ERROR code on error
*/
public static native int getUsb20ExtensionDescriptor(final Context context,
@ -1607,8 +1612,8 @@ public final class LibUsb
/**
* Free a USB 2.0 Extension descriptor obtained from
* {@link #getUsb20ExtensionDescriptor(Context, BosDevCapabilityDescriptor, Usb20ExtensionDescriptor)}
* .
* {@link #getUsb20ExtensionDescriptor(Context, BosDevCapabilityDescriptor,
* Usb20ExtensionDescriptor)}.
*
* It is safe to call this function with a NULL parameter, in which case
* the function simply returns.
@ -1631,8 +1636,8 @@ public final class LibUsb
* Output location for the SuperSpeed USB Device Capability
* descriptor. Only valid if {@link #SUCCESS} was returned.
* Must be freed with
* {@link #freeSsUsbDeviceCapabilityDescriptor(SsUsbDeviceCapabilityDescriptor)}
* after use.
* {@link #freeSsUsbDeviceCapabilityDescriptor(
* SsUsbDeviceCapabilityDescriptor)} after use.
* @return {@link #SUCCESS} on success, an error code on error.
*/
public static native int getSsUsbDeviceCapabilityDescriptor(
@ -1642,8 +1647,8 @@ public final class LibUsb
/**
* Free a SuperSpeed USB Device Capability descriptor obtained from
* {@link #getSsUsbDeviceCapabilityDescriptor(Context, BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}
* .
* {@link #getSsUsbDeviceCapabilityDescriptor(Context,
* BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}.
*
* It is safe to call this function with a NULL parameter,
* in which case the function simply returns.
@ -1675,8 +1680,8 @@ public final class LibUsb
/**
* Free a Container ID descriptor obtained from
* {@link #getContainerIdDescriptor(Context, BosDevCapabilityDescriptor, ContainerIdDescriptor)}
* .
* {@link #getContainerIdDescriptor(Context, BosDevCapabilityDescriptor,
* ContainerIdDescriptor)}.
*
* It is safe to call this function with a NULL parameter, in which case
* the function simply returns.
@ -2834,8 +2839,8 @@ public final class LibUsb
: (vendorId & 0xFFFF),
(productId == LibUsb.HOTPLUG_MATCH_ANY) ? (LibUsb.HOTPLUG_MATCH_ANY)
: (productId & 0xFFFF),
(deviceClass == LibUsb.HOTPLUG_MATCH_ANY) ? (LibUsb.HOTPLUG_MATCH_ANY)
: (deviceClass & 0xFF),
(deviceClass == LibUsb.HOTPLUG_MATCH_ANY) ?
(LibUsb.HOTPLUG_MATCH_ANY) : (deviceClass & 0xFF),
callbackHandle, globalHotplugId);
if (result == LibUsb.SUCCESS)

View File

@ -149,7 +149,8 @@ public final class Loader
}
throw new LoaderException("Unable to determine the shared library "
+ "file extension for operating system '" + os
+ "'. Please specify Java parameter -D" + key + "=<FILE-EXTENSION>");
+ "'. Please specify Java parameter -D" + key
+ "=<FILE-EXTENSION>");
}
/**
@ -265,7 +266,8 @@ public final class Loader
* The library name to extract (For example "libusb0.dll")
* @return The absolute path to the extracted library.
*/
private static String extractLibrary(final String platform, final String lib)
private static String extractLibrary(final String platform,
final String lib)
{
// Extract the usb4java library
final String source = '/'

View File

@ -36,7 +36,8 @@ public final class SsEndpointCompanionDescriptor
/**
* Constructs a new descriptor which can be passed to the
* {@link LibUsb#getSsEndpointCompanionDescriptor(Context, EndpointDescriptor, SsEndpointCompanionDescriptor)}
* {@link LibUsb#getSsEndpointCompanionDescriptor(Context,
* EndpointDescriptor, SsEndpointCompanionDescriptor)}
* method.
*/
public SsEndpointCompanionDescriptor()
@ -143,7 +144,8 @@ public final class SsEndpointCompanionDescriptor
return false;
}
final SsEndpointCompanionDescriptor other = (SsEndpointCompanionDescriptor) obj;
final SsEndpointCompanionDescriptor other =
(SsEndpointCompanionDescriptor) obj;
return new EqualsBuilder()
.append(this.bLength(), other.bLength())

View File

@ -38,7 +38,8 @@ public final class SsUsbDeviceCapabilityDescriptor
/**
* Constructs a new SuperSpeed USB Device Capability descriptor which can
* be passed to the
* {@link LibUsb#getSsUsbDeviceCapabilityDescriptor(Context, BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}
* {@link LibUsb#getSsUsbDeviceCapabilityDescriptor(Context,
* BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}
* method.
*/
public SsUsbDeviceCapabilityDescriptor()
@ -172,7 +173,8 @@ public final class SsUsbDeviceCapabilityDescriptor
return false;
}
final SsUsbDeviceCapabilityDescriptor other = (SsUsbDeviceCapabilityDescriptor) obj;
final SsUsbDeviceCapabilityDescriptor other =
(SsUsbDeviceCapabilityDescriptor) obj;
return new EqualsBuilder()
.append(this.bLength(), other.bLength())

View File

@ -36,7 +36,8 @@ public final class Usb20ExtensionDescriptor
/**
* Constructs a new USB 2.0 Extension descriptor which can be passed to the
* {@link LibUsb#getUsb20ExtensionDescriptor(Context, BosDevCapabilityDescriptor, Usb20ExtensionDescriptor)}
* {@link LibUsb#getUsb20ExtensionDescriptor(Context,
* BosDevCapabilityDescriptor, Usb20ExtensionDescriptor)}
* method.
*/
public Usb20ExtensionDescriptor()

View File

@ -23,7 +23,8 @@ import org.usb4java.LibUsb;
public final class DescriptorUtils
{
/** Mapping from USB class id to USB class name. */
private static final Map<Byte, String> CLASS_NAMES = new HashMap<Byte, String>();
private static final Map<Byte, String> CLASS_NAMES =
new HashMap<Byte, String>();
static
{
@ -40,7 +41,8 @@ public final class DescriptorUtils
CLASS_NAMES.put(LibUsb.CLASS_SMART_CARD, "Smart Card");
CLASS_NAMES.put(LibUsb.CLASS_CONTENT_SECURITY, "Content Security");
CLASS_NAMES.put(LibUsb.CLASS_VIDEO, "Video");
CLASS_NAMES.put(LibUsb.CLASS_PERSONAL_HEALTHCARE, "Personal Healthcare");
CLASS_NAMES.put(LibUsb.CLASS_PERSONAL_HEALTHCARE,
"Personal Healthcare");
CLASS_NAMES.put(LibUsb.CLASS_DIAGNOSTIC_DEVICE, "Diagnostic Device");
CLASS_NAMES.put(LibUsb.CLASS_WIRELESS, "Wireless");
CLASS_NAMES.put(LibUsb.CLASS_APPLICATION, "Application");
@ -392,6 +394,7 @@ public final class DescriptorUtils
* @return The direction name.
*/
public static String getDirectionName(final byte bEndpointAddress) {
return ((bEndpointAddress & LibUsb.ENDPOINT_IN) == 0) ? ("OUT") : ("IN");
return ((bEndpointAddress & LibUsb.ENDPOINT_IN) == 0) ?
("OUT") : ("IN");
}
}