code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static double getToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) {
LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage);
double longitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingB... | java |
public static LatLngBoundingBox buildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) {
// Get the screen width and height a click occurs from a feature
int width = (int) Math.round(view.getWidth() * screenClickPercentage);
int height = (int) Math.rou... | java |
public static boolean isPointOnShape(LatLng point,
GoogleMapShape shape, boolean geodesic, double tolerance) {
boolean onShape = false;
switch (shape.getShapeType()) {
case LAT_LNG:
onShape = isPointNearPoint(point, (LatLng) shape.g... | java |
public static boolean isPointNearMarker(LatLng point, MarkerOptions shapeMarker, double tolerance) {
return isPointNearPoint(point, shapeMarker.getPosition(), tolerance);
} | java |
public static boolean isPointNearPoint(LatLng point, LatLng shapePoint, double tolerance) {
return SphericalUtil.computeDistanceBetween(point, shapePoint) <= tolerance;
} | java |
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance) {
boolean near = false;
for (LatLng multiPoint : multiLatLng.getLatLngs()) {
near = isPointNearPoint(point, multiPoint, tolerance);
if (near) {
break;
... | java |
public static boolean isPointOnPolyline(LatLng point, PolylineOptions polyline, boolean geodesic, double tolerance) {
return PolyUtil.isLocationOnPath(point, polyline.getPoints(), geodesic, tolerance);
} | java |
public static boolean isPointOnMultiPolyline(LatLng point, MultiPolylineOptions multiPolyline, boolean geodesic, double tolerance) {
boolean near = false;
for (PolylineOptions polyline : multiPolyline.getPolylineOptions()) {
near = isPointOnPolyline(point, polyline, geodesic, tolerance);
... | java |
public static boolean isPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance) {
boolean onPolygon = PolyUtil.containsLocation(point, polygon.getPoints(), geodesic) ||
PolyUtil.isLocationOnEdge(point, polygon.getPoints(), geodesic, tolerance);
if (onPo... | java |
public static boolean isPointOnMultiPolygon(LatLng point, MultiPolygonOptions multiPolygon, boolean geodesic, double tolerance) {
boolean near = false;
for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) {
near = isPointOnPolygon(point, polygon, geodesic, tolerance);
... | java |
public Calendar getTime() {
Calendar result = Calendar.getInstance();
result.set(Calendar.HOUR_OF_DAY, hour);
result.set(Calendar.MINUTE, minute);
return result;
} | java |
public static BoundedOverlay getBoundedOverlay(TileDao tileDao, float density) {
BoundedOverlay overlay = null;
if (tileDao.isGoogleTiles()) {
overlay = new GoogleAPIGeoPackageOverlay(tileDao);
} else {
overlay = new GeoPackageOverlay(tileDao, density);
}
... | java |
public static BoundedOverlay getBoundedOverlay(TileDao tileDao, float density, TileScaling scaling) {
return new GeoPackageOverlay(tileDao, density, scaling);
} | java |
public static CompositeOverlay getCompositeOverlay(TileDao tileDao, BoundedOverlay overlay) {
List<TileDao> tileDaos = new ArrayList<>();
tileDaos.add(tileDao);
return getCompositeOverlay(tileDaos, overlay);
} | java |
public static CompositeOverlay getCompositeOverlay(Collection<TileDao> tileDaos, BoundedOverlay overlay) {
CompositeOverlay compositeOverlay = getCompositeOverlay(tileDaos);
compositeOverlay.addOverlay(overlay);
return compositeOverlay;
} | java |
public static CompositeOverlay getCompositeOverlay(Collection<TileDao> tileDaos) {
CompositeOverlay compositeOverlay = new CompositeOverlay();
for (TileDao tileDao : tileDaos) {
BoundedOverlay boundedOverlay = GeoPackageOverlayFactory.getBoundedOverlay(tileDao);
compositeOverla... | java |
public static BoundedOverlay getLinkedFeatureOverlay(FeatureOverlay featureOverlay, GeoPackage geoPackage) {
BoundedOverlay overlay;
// Get the linked tile daos
FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
List<TileDao> tileDaos = linker.getTileDaosForFeature... | java |
public static Tile getTile(GeoPackageTile geoPackageTile) {
Tile tile = null;
if (geoPackageTile != null) {
tile = new Tile(geoPackageTile.getWidth(), geoPackageTile.getHeight(), geoPackageTile.getData());
}
return tile;
} | java |
public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) {
if (geometryData.getGeometry() != null) {
try {
SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class);
... | java |
private DataColumnsDao getDataColumnsDao() {
DataColumnsDao dataColumnsDao = null;
try {
dataColumnsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), DataColumns.class);
if (!dataColumnsDao.isTableExists()) {
dataColumnsDao = null;
}... | java |
private String getColumnName(DataColumnsDao dataColumnsDao, FeatureRow featureRow, String columnName) {
String newColumnName = columnName;
if (dataColumnsDao != null) {
try {
DataColumns dataColumn = dataColumnsDao.getDataColumn(featureRow.getTable().getTableName(), columnN... | java |
private FeatureIndexResults fineFilterResults(FeatureIndexResults results, double tolerance, LatLng clickLocation) {
FeatureIndexResults filteredResults = null;
if (ignoreGeometryTypes.contains(geometryType)) {
filteredResults = new FeatureIndexListResults();
} else if (clickLocatio... | java |
public boolean delete(Marker marker) {
boolean deleted = false;
if (contains(marker)) {
deleted = true;
ShapeMarkers shapeMarkers = shapeMarkersMap.remove(marker.getId());
if (shapeMarkers != null) {
shapeMarkers.delete(marker);
}
... | java |
public static void addMarkerAsPolygon(Marker marker, List<Marker> markers) {
LatLng position = marker.getPosition();
int insertLocation = markers.size();
if (markers.size() > 2) {
double[] distances = new double[markers.size()];
insertLocation = 0;
distances[0... | java |
public static MarkerOptions createMarkerOptions(IconRow icon, float density, IconCache iconCache) {
MarkerOptions markerOptions = new MarkerOptions();
setIcon(markerOptions, icon, density, iconCache);
return markerOptions;
} | java |
public static Bitmap createIcon(IconRow icon, float density, IconCache iconCache) {
return iconCache.createIcon(icon, density);
} | java |
public static MarkerOptions createMarkerOptions(StyleRow style) {
MarkerOptions markerOptions = new MarkerOptions();
setStyle(markerOptions, style);
return markerOptions;
} | java |
public static boolean setStyle(MarkerOptions markerOptions, StyleRow style) {
boolean styleSet = false;
if (style != null) {
Color color = style.getColorOrDefault();
float hue = color.getHue();
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(hue));
... | java |
public static PolylineOptions createPolylineOptions(FeatureStyle featureStyle, float density) {
PolylineOptions polylineOptions = new PolylineOptions();
setFeatureStyle(polylineOptions, featureStyle, density);
return polylineOptions;
} | java |
public static PolylineOptions createPolylineOptions(StyleRow style, float density) {
PolylineOptions polylineOptions = new PolylineOptions();
setStyle(polylineOptions, style, density);
return polylineOptions;
} | java |
public static PolygonOptions createPolygonOptions(FeatureStyle featureStyle, float density) {
PolygonOptions polygonOptions = new PolygonOptions();
setFeatureStyle(polygonOptions, featureStyle, density);
return polygonOptions;
} | java |
public static PolygonOptions createPolygonOptions(StyleRow style, float density) {
PolygonOptions polygonOptions = new PolygonOptions();
setStyle(polygonOptions, style, density);
return polygonOptions;
} | java |
public static double getLatitudeDistance(double minLatitude,
double maxLatitude) {
LatLng lowerMiddle = new LatLng(minLatitude, 0);
LatLng upperMiddle = new LatLng(maxLatitude, 0);
double latDistance = SphericalUtil.computeDistanceBetween(lowerMiddle,... | java |
private boolean isValid(String request) {
String tmp = decodePercent(request);
if(tmp.indexOf('<') != -1 ||
tmp.indexOf('>') != -1 ) {
return false;
}
return true;
} | java |
private List<String> diff(Collection<String> first, Collection<String> second) {
final ArrayList<String> list = new ArrayList<String>(first);
list.removeAll(second);
return list;
} | java |
public Properties buildConsolidatedProperties() throws IOException {
//Cannot use the spring classes here because they a) use the logger early, which
//scuppers log4j and b) they're designed to do bean value overriding - not to be
//used directly in this fashion
Properties properties = n... | java |
@Override
public void bind(ServiceBindingDescriptor bindingDescriptor) {
String servicePlusMajorVersion=bindingDescriptor.getServiceName() +
"-v" + bindingDescriptor.getServiceVersion().getMajor();
if (serviceBindingDescriptors.containsKey(servicePlusMajorVersion)) {
th... | java |
protected DehydratedExecutionContext resolveExecutionContext(HttpCommand http, CredentialsContainer cc) {
return contextResolution.resolveExecutionContext(protocol, http, cc);
} | java |
public void writeIdentity(List<IdentityToken> tokens, IdentityTokenIOAdapter ioAdapter) {
if (ioAdapter != null && ioAdapter.isRewriteSupported()) {
ioAdapter.rewriteIdentityTokens(tokens);
}
} | java |
protected CougarException handleResponseWritingIOException(Exception e, Class resultClass) {
String errorMessage = "Exception writing "+ resultClass.getCanonicalName() +" to http stream";
IOException ioe = getIOException(e);
if (ioe == null) {
CougarException ce;
if (e in... | java |
public static List<String> parse(String address, String addresses) {
List<String> result;
// backwards compatibility - older clients only send a single address in the single address header and don't supply the multi-address header
if (addresses == null || addresses.isEmpty()) {
addre... | java |
public void introduceServiceToTransports(Iterator<? extends BindingDescriptorRegistrationListener> transports) {
while (transports.hasNext()) {
BindingDescriptorRegistrationListener t = transports.next();
boolean eventTransport = t instanceof EventTransport;
boolean includedE... | java |
public static void resourceToFile(String resourceName, File dest, Class src) {
InputStream is = null;
OutputStream os = null;
try {
is = src.getClassLoader().getResourceAsStream(resourceName);
if (is == null) {
throw new RuntimeException("Could not load resource: " + resource... | java |
private Node getNodeToBeReplaced(Node parametersNode) {
Node toBeReplaced = null;
int responseCount = 0;
NodeList childNodes = parametersNode.getChildNodes();
if (childNodes != null) {
for (int j = 0; j < childNodes.getLength(); j++) {
Node childNode = childNo... | java |
public void validate(Document doc) {
try {
doValidate(doc);
}
catch (Exception e) {
throw new PluginException("Error validating document: " + e, e);
}
} | java |
private void setBufferSizes(HttpConfiguration buffers) {
if (requestHeaderSize > 0) {
LOGGER.info("Request header size set to {} for {}", requestHeaderSize, buffers.getClass().getCanonicalName());
buffers.setRequestHeaderSize(requestHeaderSize);
}
if (responseBufferSize ... | java |
public void registerHandler(HttpServiceBindingDescriptor serviceBindingDescriptor) {
for (ProtocolBinding protocolBinding : protocolBindingRegistry.getProtocolBindings()) {
if (protocolBinding.getProtocol() == serviceBindingDescriptor.getServiceProtocol()) {
String contextPath = prot... | java |
public static java.security.cert.X509Certificate convert(javax.security.cert.X509Certificate cert) {
try {
byte[] encoded = cert.getEncoded();
ByteArrayInputStream bis = new ByteArrayInputStream(encoded);
java.security.cert.CertificateFactory cf
= java.securit... | java |
public static javax.security.cert.X509Certificate convert(java.security.cert.X509Certificate cert) {
try {
byte[] encoded = cert.getEncoded();
return javax.security.cert.X509Certificate.getInstance(encoded);
} catch (java.security.cert.CertificateEncodingException e) {
} ... | java |
@Override
public void writeErrorResponse(HttpCommand command, DehydratedExecutionContext context, CougarException error, boolean traceStarted) {
try {
incrementErrorsWritten();
final HttpServletResponse response = command.getResponse();
try {
long bytesWritte... | java |
public synchronized FutureTask<Boolean> start() {
this.sessionFactory.start();
if (rpcTimeoutChecker != null) {
rpcTimeoutChecker.getThread().start();
}
final FutureTask<Boolean> futureTask = new FutureTask<Boolean>(
new Callable<Boolean>() {
... | java |
private synchronized void notifyConnectionLost(final IoSession session) {
new Thread("Connection-Closed-Notifier") {
@Override
public void run() {
// todo: sml: should consider rationalising these so they're all HandlerListeners..
if (connectedObjectManage... | java |
public void process(final T command) {
boolean traceStarted = false;
incrementCommandsProcessed();
DehydratedExecutionContext ctx = null;
try {
validateCommand(command);
CommandResolver<T> resolver = createCommandResolver(command, tracer);
ctx = resolver.resolveExecutionContext();
... | java |
protected void executeCommand(final ExecutionCommand finalExec, final ExecutionContext finalCtx) {
executionsProcessed.incrementAndGet();
ev.execute(finalCtx,
finalExec.getOperationKey(),
finalExec.getArgs(),
finalExec,
executor... | java |
@Override
public void subscribeToTimeTick(ExecutionContext ctx, Object[] args, ExecutionObserver executionObserver) {
if (getEventTransportIdentity(ctx).getPrincipal().getName().equals(SONIC_TRANSPORT_INSTANCE_ONE)) {
this.timeTickPublishingObserver = executionObserver;
}
} | java |
@Override
public void subscribeToMatchedBet(ExecutionContext ctx, Object[] args, ExecutionObserver executionObserver) {
if (getEventTransportIdentity(ctx).getPrincipal().getName().equals(SONIC_TRANSPORT_INSTANCE_ONE)) {
this.matchedBetObserver = executionObserver;
}
} | java |
@Override
public HttpCommandProcessor getCommandProcessor(Protocol protocol) {
String commandProcessorName = commandProcessorNames.get(protocol);
if (commandProcessorName == null) {
throw new PanicInTheCougar("No HTTP Command Processor has been configured for protocol " + protocol);
}
Ht... | java |
public void publish(Event event, String destinationName, EventServiceBindingDescriptor eventServiceBindingDescriptor) throws CougarException {
try {
EventPublisherRunnable publisherRunnable = new EventPublisherRunnable(event, destinationName, eventServiceBindingDescriptor);
threadPool.ex... | java |
public Future<Boolean> requestConnectionToBroker() {
FutureTask futureTask = new FutureTask(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
boolean ok = false;
try {
getConnection();
ok =... | java |
private boolean isDefinitelyCougarResponse(CougarHttpResponse response) {
String ident = response.getServerIdentity();
if (ident != null && ident.contains("Cougar 2")) {
return true;
}
return false;
} | java |
@ManagedAttribute
public void setSamplingLevel(int samplingLevel) {
if (samplingLevel >= MIN_LEVEL && samplingLevel <= MAX_LEVEL) {
this.samplingLevel = samplingLevel;
} else {
throw new IllegalArgumentException("Sampling level " + samplingLevel + " is not in the range [" + M... | java |
public static long getRandomLong() {
byte[] rndBytes = new byte[8];
SECURE_RANDOM_TL.get().nextBytes(rndBytes);
return ByteBuffer.wrap(rndBytes).getLong();
} | java |
public List<String> getHeapsForSession(IoSession session) {
List<String> ret = new ArrayList<String>();
try {
subTermLock.lock();
Multiset<String> s = heapsByClient.get(session);
if (s != null) {
ret.addAll(s.keySet());
}
} finally ... | java |
private HeapState processHeapStateCreation(final ConnectedResponse result, final String heapUri) {
if (!subTermLock.isHeldByCurrentThread()) {
throw new IllegalStateException("You must have the subTermLock before calling this method");
}
final HeapState newState = new HeapState(resul... | java |
public void terminateSubscription(IoSession session, String heapUri, String subscriptionId, Subscription.CloseReason reason) {
Lock heapUpdateLock = null;
try {
HeapState state = heapStates.get(heapUri);
if (state != null) {
heapUpdateLock = state.getUpdateLock();... | java |
private void terminateSubscriptions(IoSession session, Subscription.CloseReason reason) {
Multiset<String> heapsForThisClient;
try {
subTermLock.lock();
heapsForThisClient = heapsByClient.remove(session);
} finally {
subTermLock.unlock();
}
if... | java |
private void terminateSubscriptions(String heapUri, Subscription.CloseReason reason) {
HeapState state = heapStates.get(heapUri);
if (state != null) {
try {
state.getUpdateLock().lock();
subTermLock.lock();
// if someone got here first, don't b... | java |
private static int[] pad(int[] list) {
double m = list.length / (double)WORD_LENGTH;
int size = (int)Math.ceil(m);
int[] ret = new int[size * WORD_LENGTH];
Arrays.fill(ret, 0);
System.arraycopy(list,0,ret,0,list.length);
return ret;
} | java |
public static int[] listToMap(int[] list) {
list = pad(list);
int[] bitMap = new int[(int)(list.length / WORD_LENGTH)];
Arrays.fill(bitMap, 0);
int j = -1;
for (int i = 0; i < list.length; i++) {
if (i % WORD_LENGTH == 0) {
j++;
}
... | java |
public static int[] mapToList(int[] bitMap) {
int[] list = new int[(int)(bitMap.length * WORD_LENGTH)];
Arrays.fill(list, 0);
int j = -1;
for (int i = 0; i < list.length; i++) {
if (i % WORD_LENGTH == 0) {
j++;
}
list[i] = (bitMap[j] & ... | java |
private Object toEnum(ParameterType parameterType, String enumTextValue, String paramName, boolean hardFailEnumDeserialisation) {
try {
return EnumUtils.readEnum(parameterType.getImplementationClass(), enumTextValue, hardFailEnumDeserialisation);
} catch (Exception e) {
throw XML... | java |
private void processService(Service service) throws Exception {
getLog().info(" Service: " + service.getServiceName());
Document iddDoc = parseIddFile(service.getServiceName());
// 1. validate
if (!isOffline()) {
getLog().debug("Validating XML..");
new XmlVali... | java |
private void initOutputDir(File outputDir) {
if (!outputDir.exists()) {
if (!outputDir.mkdirs()) {
throw new IllegalArgumentException("Output Directory "+outputDir+" could not be created");
}
}
if (!outputDir.isDirectory() || (!outputDir.canWrite())) {
... | java |
private String readNamespaceAttr(Document doc) {
// lazy loading is mostly pointless but it keeps things together
if (namespaceExpr == null) {
namespaceExpr = initNamespaceAttrExpression();
}
String s;
try {
s = namespaceExpr.evaluate(doc);
} catch (XPathExpressionException e) {
throw... | java |
public static boolean isValidIPAddress(String networkAddress) {
if (networkAddress != null) {
String[] split = networkAddress.split("\\.");
if (split.length == 4) {
int[] octets = new int[4];
for (int i=0; i<4; i++) {
try {
octets[i] = Integer.parseInt(split[i]);
} catch (NumberFormatExc... | java |
private static byte[] parseDottedQuad(String address) {
String[] splitString = address.split("\\.");
if (splitString.length == 4) {
int[] ints = new int[4];
byte[] bytes = new byte[4];
for (int i=0; i<4; i++) {
ints[i] = Integer.parseInt(splitString[i]);
if (ints[i] < 0 || ints[i] > 255) {
t... | java |
public static final Set fromMap(Map map, Object... keys) {
if (keys != null && map != null) {
Set answer = new HashSet();
for (Object key : keys) {
if (map.containsKey(key)) {
answer.add(map.get(key));
}
}
return... | java |
public static final Set<String> fromCommaSeparatedValues(String csv) {
if (csv == null || csv.isEmpty()) {
return Collections.EMPTY_SET;
}
String[] tokens = csv.split(",");
return new HashSet<String>(Arrays.asList(tokens));
} | java |
private void mergeExtensionsIntoDocument(Node target, Node extensions) throws Exception {
final XPathFactory factory = XPathFactory.newInstance();
final NodeList nodes = (NodeList) factory.newXPath().evaluate("//extensions", extensions, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLengt... | java |
private void removeUndefinedOperations(Node target, Node extensions) throws Exception {
final XPathFactory factory = XPathFactory.newInstance();
final NodeList nodes = (NodeList) factory.newXPath().evaluate("//operation", target, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i+... | java |
public Map<String, Set<ServiceDefinition>> getNamespaceServiceDefinitionMap() {
Map<String, Set<ServiceDefinition>> namespaceServiceDefinitionMap = new HashMap<String, Set<ServiceDefinition>>();
for (String namespace : serviceImplementationMap.keySet()) {
Set<ServiceDefinition> serviceDefin... | java |
public Set<SocketAddress> getCurrentSessionAddresses() {
Set<SocketAddress> result = new HashSet<SocketAddress>();
synchronized (lock) {
result.addAll(sessions.keySet());
result.addAll(pendingConnections.keySet());
}
return result;
} | java |
public IoSession getSession() {
synchronized (lock) {
if (sessions.isEmpty()) {
return null;
} else {
final Object[] keys = sessions.keySet().toArray();
for (int i = 0; i < sessions.size(); i++) { //
counter++;
... | java |
public void openSession(SocketAddress endpoint) {
synchronized (lock) {
// Submit a reconnect task for this address if one is not already present
if (!pendingConnections.containsKey(endpoint)) {
final ReconnectTask task = new ReconnectTask(endpoint);
pendi... | java |
public void closeSession(SocketAddress endpoint, boolean reconnect) {
synchronized (lock) {
// Submit a reconnect task for this address if one is not already present
if (pendingConnections.containsKey(endpoint)) {
final ReconnectTask task = pendingConnections.get(endpoint... | java |
@Override
public final String getMessage() {
String additional = additionalInfo();
return additional == null ? super.getMessage() : super.getMessage() + ": " + additional;
} | java |
public List<String> listClasses() throws WMIException {
List<String> wmiClasses = new ArrayList<String>();
String rawData;
try {
rawData = getWMIStub().listClasses(this.namespace, this.computerName);
String[] dataStringLines = rawData.split(NEWLINE_REGEX);
for (String line : dataStringLines) {
if (... | java |
public List<String> listProperties(String wmiClass) throws WMIException {
List<String> foundPropertiesList = new ArrayList<String>();
try {
String rawData = getWMIStub().listProperties(wmiClass, this.namespace, this.computerName);
String[] dataStringLines = rawData.split(NEWLINE_REGEX);
for (final String... | java |
public String getRawWMIObjectOutput(String wmiClass) throws WMIException {
String rawData;
try {
if (this.properties != null || this.filters != null) {
rawData = getWMIStub().queryObject(wmiClass, this.properties, this.filters, this.namespace,
this.computerName);
} else {
rawData = getWMIStub().... | java |
public SF readStructuredField() throws IOException {
int buf = 0;
long thisOffset = offset;
if(leadingLengthBytes == -1) {
// we haven't tested for mvs download leading length bytes
// we don't need them and don't want to see them
int leadingLength = 0;
do {
buf = read(); offset++;
lead... | java |
public static Formdef scan(AfpInputStream in) throws IOException {
Formdef formdef = new FormdefImpl();
SF sf;
LinkedList<SF> sfbuffer = null;
while((sf = in.readStructuredField()) != null) {
log.trace("{}", sf);
switch(sf.eClass().getClassifierID()) {
case AfplibPackage.ERG:
case AfplibPackage.... | java |
public static String decode(String urlString) {
StringBuilder s = new StringBuilder();
UrlDecoderState state = UrlDecoderState.INITIAL;
int hiNibble = 0;
int lowNibble = 0;
int length = urlString.length();
for (int i = 0; i < length; i++) {
char c = urlString.charAt(i);
switch (state) {
ca... | java |
public SF next() throws IOException {
int remaining = afpData.remaining();
if(remaining == 0) return null;
if(remaining < 9) throw new IOException("trailing garbage at the end of file.");
byte buf;
long thisOffset = afpData.position();
try {
if(leadingLengthBytes == -1) {
// we haven't tested fo... | java |
public static BankCardMagneticTrack from(final String rawTrackData)
{
final Track1FormatB track1 = Track1FormatB.from(rawTrackData);
final Track2 track2 = Track2.from(rawTrackData);
final Track3 track3 = Track3.from(rawTrackData);
return new BankCardMagneticTrack(rawTrackData, track1, track2, track3)... | java |
public BankCard toBankCard()
{
final AccountNumber pan;
if (track1.hasAccountNumber())
{
pan = track1.getAccountNumber();
}
else
{
pan = track2.getAccountNumber();
}
final Name name;
if (track1.hasName())
{
name = track1.getName();
}
else
{
... | java |
public boolean isConsistentWith(final BaseBankCardTrackData other)
{
if (this == other)
{
return true;
}
if (other == null)
{
return false;
}
boolean equals = true;
if (hasAccountNumber() && other.hasAccountNumber())
{
if (!getAccountNumber().equals(other.getAcco... | java |
public static Track1FormatB from(final String rawTrackData)
{
final Matcher matcher = track1FormatBPattern
.matcher(trimToEmpty(rawTrackData));
final String rawTrack1Data;
final AccountNumber pan;
final ExpirationDate expirationDate;
final Name name;
final ServiceCode serviceCode;
f... | java |
public static Track3 from(final String rawTrackData)
{
final Matcher matcher = track3Pattern.matcher(trimToEmpty(rawTrackData));
final String rawTrack3Data;
final String discretionaryData;
if (matcher.matches())
{
rawTrack3Data = getGroup(matcher, 1);
discretionaryData = getGroup(matc... | java |
public static Track2 from(final String rawTrackData)
{
final Matcher matcher = track2Pattern.matcher(trimToEmpty(rawTrackData));
final String rawTrack2Data;
final AccountNumber pan;
final ExpirationDate expirationDate;
final ServiceCode serviceCode;
final String discretionaryData;
if (ma... | java |
void ensureRequiredZnodesExist(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
mkdirp(zookeeper, znode);
createIfNotThere(zookeeper, QUEUE_NODE);
createIfNotThere(zookeeper, POOL_NODE);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.