-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/con 650 #389
base: develop
Are you sure you want to change the base?
Feature/con 650 #389
Changes from 6 commits
e79a31a
c81bfc8
b13e528
4c1b6c7
c314195
9630f51
c2679eb
85160af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2013-2019 Cinchapi Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.cinchapi.concourse; | ||
|
||
import javax.annotation.concurrent.Immutable; | ||
|
||
@Immutable | ||
public final class Point { | ||
|
||
/** | ||
* Valid latitude values are between -90 and 90, both inclusive. | ||
*/ | ||
public static float MIN_Y = Float.valueOf("-90.0000"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are there min and max values if a Point is generic as opposed to being lat/long? |
||
public static float MAX_Y = Float.valueOf("90.0000"); | ||
|
||
/** | ||
* Valid longitude values are between -180 and 180, both inclusive. | ||
*/ | ||
public static float MIN_X = Float.valueOf("-180.0000"); | ||
public static float MAX_X = Float.valueOf("180.0000"); | ||
|
||
private float x; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these should be doubles instead of floats |
||
private float y; | ||
|
||
public Point(float x, float y) { | ||
if(isValidY(x) && isValidX(y)) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
else { | ||
throw new IllegalArgumentException( | ||
"The specified x and y contain inproper values, please respect min, max values."); | ||
} | ||
} | ||
|
||
public static Point to(float x, float y) { | ||
return new Point(x, y); | ||
} | ||
|
||
public float getY() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just name this method |
||
return y; | ||
} | ||
|
||
public float getX() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just name this method |
||
return x; | ||
} | ||
|
||
public static boolean isValidY(float y) { | ||
return y >= MIN_Y && y <= MAX_Y; | ||
} | ||
|
||
public static boolean isValidX(float x) { | ||
return x >= MIN_X && x <= MAX_X; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,8 @@ enum Operator { | |
BETWEEN = 9, | ||
LINKS_TO = 10, | ||
LIKE = 11, | ||
NOT_LIKE = 12 | ||
NOT_LIKE = 12, | ||
WITHIN = 13 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this, since this PR is not tackling operators for Points |
||
} | ||
|
||
/** | ||
|
@@ -65,6 +66,7 @@ enum Type { | |
TAG = 8, | ||
NULL = 9, | ||
TIMESTAMP = 10, | ||
POINT = 11 | ||
} | ||
|
||
/** When re-constructing the state of a record/field/index from some base state, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be more javadoc in this class. Please see other classes in the codebase for conventions on how methods, etc javadoced