code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static Vector2dfx convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2dfx) {
return (Vector2dfx) tuple;
}
return new Vector2dfx(tuple.getX(), tuple.getY());
} | java |
public static Point2d convert(Tuple2D<?> tuple) {
if (tuple instanceof Point2d) {
return (Point2d) tuple;
}
return new Point2d(tuple.getX(), tuple.getY());
} | java |
public static <R, C, V, C2> ImmutableTable<R, C2, V> columnTransformerByCell(
final Table<R, C, V> table,
final Function<Table.Cell<R, C, V>, C2> columnTransformer) {
final ImmutableTable.Builder<R, C2, V> newTable = ImmutableTable.builder();
for(Table.Cell<R, C, V> cell : table.cellSet()) {
C... | java |
public static double setDistanceEpsilon(double newPrecisionValue) {
if ((newPrecisionValue >= 1) || (newPrecisionValue <= 0)) {
throw new IllegalArgumentException();
}
final double old = distancePrecision;
distancePrecision = newPrecisionValue;
return old;
} | java |
@Pure
public static boolean epsilonEqualsDistance(double value1, double value2) {
return value1 >= (value2 - distancePrecision) && value1 <= (value2 + distancePrecision);
} | java |
@Pure
public static int epsilonCompareToDistance(double distance1, double distance2) {
final double min = distance2 - distancePrecision;
final double max = distance2 + distancePrecision;
if (distance1 >= min && distance1 <= max) {
return 0;
}
if (distance1 < min) {
return -1;
}
return 1;
} | java |
@Pure
public static String makeInternalId(float x, float y) {
final StringBuilder buf = new StringBuilder("point"); //$NON-NLS-1$
buf.append(x);
buf.append(';');
buf.append(y);
return Encryption.md5(buf.toString());
} | java |
@Pure
public static String makeInternalId(UUID uid) {
final StringBuilder buf = new StringBuilder("nowhere(?"); //$NON-NLS-1$
buf.append(uid.toString());
buf.append("?)"); //$NON-NLS-1$
return Encryption.md5(buf.toString());
} | java |
@Pure
public static String makeInternalId(float minx, float miny, float maxx, float maxy) {
final StringBuilder buf = new StringBuilder("rectangle"); //$NON-NLS-1$
buf.append('(');
buf.append(minx);
buf.append(';');
buf.append(miny);
buf.append(")-("); //$NON-NLS-1$
buf.append(maxx);
buf.append(';');
... | java |
public static String get2BitCrid(String str) {
if (str != null) {
String crid = LookupCodes.lookupCode("CRID", str, "DSSAT");
if (crid.equals(str) && crid.length() > 2) {
crid = def2BitVal;
}
return crid.toUpperCase();
} else {
... | java |
public static String get3BitCrid(String str) {
if (str != null) {
// return LookupCodes.modelLookupCode("DSSAT", "CRID", str).toUpperCase();
return LookupCodes.lookupCode("CRID", str, "code", "DSSAT").toUpperCase();
} else {
return def3BitVal;
}
// if (s... | java |
private static CharBuffer decodeString(byte[] bytes, Charset charset, int referenceLength) {
try {
final Charset autodetectedCharset;
final CharsetDecoder decoder = charset.newDecoder();
final CharBuffer buffer = decoder.decode(ByteBuffer.wrap(bytes));
if ((decoder.isAutoDetecting())
&& (decoder.isCh... | java |
@Override
@Pure
public Iterator<E> iterator(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) {
return new BoundedElementIterator<>(bounds, iterator());
} | java |
@Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
ArrayList<HashMap> expArr = new ArrayList<HashMap>();
HashMap<String, HashMap> files = readObvData(brMap);
// compressData(file);
ArrayList<HashMap> obvData;
HashMap ... | java |
public Path normalizeOutputPath(FileResource resource) {
Path resourcePath = resource.getPath();
Path rel = Optional.ofNullable((contentDir.relativize(resourcePath)).getParent())//
.orElseGet(() -> resourcePath.getFileSystem().getPath(""));
String finalOutput = rel.resolve(finalOutputName(res... | java |
public void setModel(Progression model) {
this.model.removeProgressionListener(new WeakListener(this, this.model));
if (model == null) {
this.model = new DefaultProgression();
} else {
this.model = model;
}
this.previousValue = this.model.getValue();
this.model.addProgressionListener(new WeakListener(... | java |
@SuppressWarnings("static-method")
protected String buildMessage(double progress, String comment, boolean isRoot, boolean isFinished,
NumberFormat numberFormat) {
final StringBuilder txt = new StringBuilder();
txt.append('[');
txt.append(numberFormat.format(progress));
txt.append("] "); //$NON-NLS-1$
if (... | java |
public boolean setLeftChild(N newChild) {
final N oldChild = this.left;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(0, oldChild);
}
if (newChild != null) {
final N oldPare... | java |
public boolean setMiddleChild(N newChild) {
final N oldChild = this.middle;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(1, oldChild);
}
if (newChild != null) {
final N old... | java |
@Pure
public boolean hasChild(N potentialChild) {
if ((this.left == potentialChild) || (this.middle == potentialChild) || (this.right == potentialChild)) {
return true;
}
return false;
} | java |
@Override
protected void getHeights(int currentHeight, List<Integer> heights) {
if (isLeaf()) {
heights.add(new Integer(currentHeight));
} else {
if (this.left != null) {
this.left.getHeights(currentHeight + 1, heights);
}
if (this.middle != null) {
this.middle.getHeights(currentHeight + 1, hei... | java |
private static Iterable<List<Map.Entry<Symbol, File>>> splitToNChunks(
final ImmutableMap<Symbol, File> inputMap, int numChunks) {
checkArgument(numChunks > 0);
final List<Map.Entry<Symbol, File>> emptyChunk = ImmutableList.of();
if (inputMap.isEmpty()) {
return Collections.nCopies(numChunks, e... | java |
private static ImmutableMap<Symbol, File> loadDocIdToFileMap(
final Optional<File> inputFileListFile,
final Optional<File> inputFileMapFile) throws IOException {
checkArgument(inputFileListFile.isPresent() || inputFileMapFile.isPresent());
final Optional<ImmutableList<File>> fileList;
if (input... | java |
@Override
public void writeFile(String arg0, Map result) {
// Initial variables
HashMap culData; // Data holder for one site of cultivar data
ArrayList<HashMap> culArr; // Data holder for one site of cultivar data
BufferedWriter bwC; // ou... | java |
public static CodepointMatcher anyOf(final String sequence) {
switch (sequence.length()) {
case 0:
return none();
case 1:
return is(sequence);
default:
return new AnyOf(sequence);
}
} | java |
public final String removeFrom(String s) {
final StringBuilder sb = new StringBuilder();
for (int offset = 0; offset < s.length(); ) {
final int codePoint = s.codePointAt(offset);
if (!matches(codePoint)) {
sb.appendCodePoint(codePoint);
}
offset += Character.charCount(codePoint... | java |
public final String trimFrom(String s) {
int first;
int last;
// removes leading matches
for (first = 0; first < s.length(); ) {
final int codePoint = s.codePointAt(first);
if (!matches(codePoint)) {
break;
}
first += Character.charCount(codePoint);
}
//remove t... | java |
private UTF16Offset codeUnitOffsetFor(final CharOffset codePointOffset) {
int charOffset = 0;
int codePointsConsumed = 0;
for (; charOffset < utf16CodeUnits().length() && codePointsConsumed < codePointOffset.asInt();
++codePointsConsumed) {
final int codePoint = utf16CodeUnits().codePointAt(... | java |
public static void expandAll(JTree tree, TreePath path, boolean expand)
{
TreeNode node = (TreeNode)path.getLastPathComponent();
if (node.getChildCount() >= 0)
{
Enumeration<?> enumeration = node.children();
while (enumeration.hasMoreElements())
{
TreeNode n = (TreeNode)enumeration.nextElement();
... | java |
protected void fireValidityChangedFor(Object changedObject, int index, BusPrimitiveInvalidity oldReason,
BusPrimitiveInvalidity newReason) {
resetBoundingBox();
final BusChangeEvent event = new BusChangeEvent(
// source of the event
this,
// type of the event
BusChangeEventType.VALIDITY,
chan... | java |
@Pure
public int getColor(int defaultColor) {
final Integer c = getRawColor();
if (c != null) {
return c;
}
final BusContainer<?> container = getContainer();
if (container != null) {
return container.getColor();
}
return defaultColor;
} | java |
@SuppressWarnings("unlikely-arg-type")
protected final void setPrimitiveValidity(BusPrimitiveInvalidity invalidityReason) {
if ((invalidityReason == null && this.invalidityReason != null)
|| (invalidityReason != null
&& !invalidityReason.equals(BusPrimitiveInvalidityType.VALIDITY_NOT_CHECKED)
&& !invalid... | java |
public UnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new UnitVectorProperty(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
}
return this.saxis;
} | java |
@Pure
public DoubleProperty firstAxisExtentProperty() {
if (this.extentR == null) {
this.extentR = new SimpleDoubleProperty(this, MathFXAttributeNames.FIRST_AXIS_EXTENT) {
@Override
protected void invalidated() {
if (get() < 0.) {
set(0.);
}
}
};
}
return this.extentR;
} | java |
@Pure
public DoubleProperty secondAxisExtentProperty() {
if (this.extentS == null) {
this.extentS = new SimpleDoubleProperty(this, MathFXAttributeNames.SECOND_AXIS_EXTENT) {
@Override
protected void invalidated() {
if (get() < 0.) {
set(0.);
}
}
};
}
return this.extentS;
} | java |
public View<?, ?> getRootParentView()
{
View<?, ?> currentView = this;
while (currentView.hasParent())
{
currentView = currentView.getParent();
}
return currentView;
} | java |
public Optional<CoreNLPParseNode> terminalHead() {
if (terminal()) {
return Optional.of(this);
}
if (immediateHead().isPresent()) {
return immediateHead().get().terminalHead();
}
return Optional.absent();
} | java |
@Pure
public static AbstractPathElement3D newInstance(PathElementType type, Point3d last, Point3d[] coords) {
switch(type) {
case MOVE_TO:
return new MovePathElement3d(coords[0]);
case LINE_TO:
return new LinePathElement3d(last, coords[0]);
case QUAD_TO:
return new QuadPathElement3d(last, coords[0], c... | java |
protected void extractConfigValues(Map<String, Object> yaml, List<ConfigMetadataNode> configs) {
for (final ConfigMetadataNode config : configs) {
Configs.defineConfig(yaml, config, this.injector);
}
} | java |
@SuppressWarnings("static-method")
protected String generateYaml(Map<String, Object> map) throws JsonProcessingException {
final YAMLFactory yamlFactory = new YAMLFactory();
yamlFactory.configure(Feature.WRITE_DOC_START_MARKER, false);
final ObjectMapper mapper = new ObjectMapper(yamlFactory);
return mapper.wr... | java |
@SuppressWarnings("static-method")
protected String generateJson(Map<String, Object> map) throws JsonProcessingException {
final ObjectMapper mapper = new ObjectMapper();
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
} | java |
@SuppressWarnings({"static-method"})
protected String generateXml(Map<String, Object> map) throws JsonProcessingException {
final XmlMapper mapper = new XmlMapper();
return mapper.writerWithDefaultPrettyPrinter().withRootName(XML_ROOT_NAME).writeValueAsString(map);
} | java |
@SuppressWarnings("unchecked")
private void parseOptionsFromFile(String optionFileName)
throws ParseException {
List<String> options = OptionsFileLoader.loadOptions(optionFileName);
options.addAll(commandLine.getArgList());
commandLine = cliParser.parse(cliOptions, options.toArray(new String[0]));
... | java |
void disconnect() {
final DefaultProgression parentInstance = getParent();
if (parentInstance != null) {
parentInstance.disconnectSubTask(this, this.maxValueInParent, this.overwriteCommentWhenDisconnect);
}
this.parent = null;
} | java |
private void initOptions() {
List<CLIOption> options = new ArrayList<CLIOption>();
options.addAll(Arrays.asList(ProxyDestroyOptions.values()));
initOptions(options);
} | java |
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
void updateSizes(int fieldLength, int decimalPointPosition) {
switch (this.type) {
case STRING:
if (fieldLength > this.length) {
this.length = fieldLength;
}
break;
case FLOATING_NUMBER:
case NUMBER:
if (decimalPointPosition > this.decimal) {... | java |
@Override
public int compare(HashMap m1, HashMap m2) {
double val1;
double val2;
for (String sortId : sortIds) {
val1 = getValue(m1, sortId);
val2 = getValue(m2, sortId);
if (val1 > val2) {
return decVal;
} else if (val1 < val2)... | java |
private double getValue(HashMap m, String key) {
try {
return Double.parseDouble(getValueOr(m, key, ""));
} catch (Exception e) {
return Double.MIN_VALUE;
}
} | java |
protected void onNext()
{
stateMachine.next();
updateButtonState();
final String name = getStateMachine().getCurrentState().getName();
final CardLayout cardLayout = getWizardContentPanel().getCardLayout();
cardLayout.show(getWizardContentPanel(), name);
} | java |
protected void onPrevious()
{
stateMachine.previous();
updateButtonState();
final String name = getStateMachine().getCurrentState().getName();
final CardLayout cardLayout = getWizardContentPanel().getCardLayout();
cardLayout.show(getWizardContentPanel(), name);
} | java |
protected void updateButtonState()
{
getNavigationPanel().getBtnPrevious()
.setEnabled(getStateMachine().getCurrentState().hasPrevious());
getNavigationPanel().getBtnNext().setEnabled(getStateMachine().getCurrentState().hasNext());
} | java |
public final void conjugate(Quaternion q1) {
this.x = -q1.x;
this.y = -q1.y;
this.z = -q1.z;
this.w = q1.w;
} | java |
public final void inverse(Quaternion q1) {
double norm;
norm = 1f/(q1.w*q1.w + q1.x*q1.x + q1.y*q1.y + q1.z*q1.z);
this.w = norm*q1.w;
this.x = -norm*q1.x;
this.y = -norm*q1.y;
this.z = -norm*q1.z;
} | java |
public final void inverse() {
double norm;
norm = 1f/(this.w*this.w + this.x*this.x + this.y*this.y + this.z*this.z);
this.w *= norm;
this.x *= -norm;
this.y *= -norm;
this.z *= -norm;
} | java |
public final void normalize(Quaternion q1) {
double norm;
norm = (q1.x*q1.x + q1.y*q1.y + q1.z*q1.z + q1.w*q1.w);
if (norm > 0f) {
norm = 1f/Math.sqrt(norm);
this.x = norm*q1.x;
this.y = norm*q1.y;
this.z = norm*q1.z;
this.w = norm*q1.w;
} else {
this.x = 0f;
this.y = 0f;
this.z = 0f;
... | java |
public final void normalize() {
double norm;
norm = (this.x*this.x + this.y*this.y + this.z*this.z + this.w*this.w);
if (norm > 0f) {
norm = 1f / Math.sqrt(norm);
this.x *= norm;
this.y *= norm;
this.z *= norm;
this.w *= norm;
} else {
this.x = 0f;
this.y = 0f;
this.z = 0f;
this.w =... | java |
public final void setFromMatrix(Matrix4f m1) {
double ww = 0.25f*(m1.m00 + m1.m11 + m1.m22 + m1.m33);
if (ww >= 0) {
if (ww >= EPS2) {
this.w = Math.sqrt(ww);
ww = 0.25f/this.w;
this.x = (m1.m21 - m1.m12)*ww;
this.y = (m1.m02 - m1.m20)*ww;
this.z = (m1.m10 - m1.m01)*ww;
return;
}
... | java |
@Pure
public final Vector3f getAxis() {
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
double invMag = 1f/mag;
return new Vector3f(
this.x*invMag,
this.y*invMag,
this.z*invMag);
}
return new Vector3f(0f, 0f, 1f);
} | java |
@Pure
public final double getAngle() {
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
return (2.f*Math.atan2(mag, this.w));
}
return 0f;
} | java |
@SuppressWarnings("synthetic-access")
@Pure
public final AxisAngle getAxisAngle() {
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
double invMag = 1f/mag;
return new AxisAngle(
this.x*invMag,
this.y*invMag,
this.z*invMag,
(2.*M... | java |
public final void interpolate(Quaternion q1, double alpha) {
// From "Advanced Animation and Rendering Techniques"
// by Watt and Watt pg. 364, function as implemented appeared to be
// incorrect. Fails to choose the same quaternion for the double
// covering. Resulting in change of direction for rotations.
... | java |
@SuppressWarnings("synthetic-access")
@Pure
public EulerAngles getEulerAngles(CoordinateSystem3D system) {
// See http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
// Standard used: XZY_RIGHT_HAND
Quaternion q = new Quaternion(this);
system.toSystem(q, CoordinateSy... | java |
public static void writeRoadNetwork(Element xmlNode, RoadNetwork primitive, URL geometryURL,
MapMetricProjection mapProjection, URL attributeURL, XMLBuilder builder,
PathBuilder pathBuilder, XMLResources resources) throws IOException {
final ContainerWrapper w = new ContainerWrapper(primitive);
w.setElementGe... | java |
@SuppressWarnings("static-method")
protected void printSynopsis(HelpAppender out, String name, String argumentSynopsis) {
out.printSectionName(SYNOPSIS);
assert name != null;
if (Strings.isNullOrEmpty(argumentSynopsis)) {
out.printText(name, OPTION_SYNOPSIS);
} else {
out.printText(name, OPTION_SYNOPSI... | java |
@SuppressWarnings("static-method")
protected void printDetailedDescription(SynopsisHelpAppender out, String detailedDescription) {
if (!Strings.isNullOrEmpty(detailedDescription)) {
out.printSectionName(DETAILED_DESCRIPTION);
out.printLongDescription(detailedDescription.split("[\r\n\f]+")); //$NON-NLS-1$
}
... | java |
protected Drawer<? super T> draw(ZoomableGraphicsContext gc, GISElementContainer<T> primitive, Drawer<? super T> drawer) {
Drawer<? super T> drw = drawer;
final Iterator<T> iterator = primitive.iterator(gc.getVisibleArea());
while (iterator.hasNext()) {
final T mapelement = iterator.next();
if (drw == null)... | java |
@Pure
public static boolean intersectsSolidSphereOrientedBox(
double sphereCenterx, double sphereCentery, double sphereCenterz, double sphereRadius,
double boxCenterx, double boxCentery, double boxCenterz,
double boxAxis1x, double boxAxis1y, double boxAxis1z,
double boxAxis2x, double boxAxis2y, double boxA... | java |
@Pure
public static boolean intersectsSphereCapsule(
double sphereCenterx, double sphereCentery, double sphereCenterz, double sphereRadius,
double capsuleAx, double capsuleAy, double capsuleAz,
double capsuleBx, double capsuleBy, double capsuleBz,
double capsuleRadius) {
// Compute (squared) distance bet... | java |
@Pure
public static boolean containsSpherePoint(double cx, double cy, double cz, double radius,
double px, double py, double pz) {
return FunctionalPoint3D.distanceSquaredPointPoint(
px, py, pz,
cx, cy, cz) <= (radius * radius);
} | java |
@Pure
public static boolean containsSphereAlignedBox(
double cx, double cy, double cz, double radius,
double bx, double by, double bz, double bsx, double bsy, double bsz) {
double rcx = (bx + bsx/2f);
double rcy = (by + bsy/2f);
double rcz = (bz + bsz/2f);
double farX;
if (cx<=rcx) farX = bx + bsx;
e... | java |
@Pure
public static boolean intersectsSphereSphere(
double x1, double y1, double z1, double radius1,
double x2, double y2, double z2, double radius2) {
double r = radius1+radius2;
return FunctionalPoint3D.distanceSquaredPointPoint(x1, y1, z1, x2, y2, z2) < (r*r);
} | java |
@Pure
public static boolean intersectsSphereLine(
double x1, double y1, double z1, double radius,
double x2, double y2, double z2,
double x3, double y3, double z3) {
double d = AbstractSegment3F.distanceSquaredLinePoint(x2, y2, z2, x3, y3, z3, x1, y1, z1);
return d<(radius*radius);
} | java |
@Pure
public static boolean intersectsSphereSegment(
double x1, double y1, double z1, double radius,
double x2, double y2, double z2,
double x3, double y3, double z3) {
double d = AbstractSegment3F.distanceSquaredSegmentPoint(x2, y2, z2, x3, y3, z3, x1, y1, z1);
return d<(radius*radius);
} | java |
protected String encodeCookie(SerializableHttpCookie cookie) {
if (cookie == null)
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ObjectOutputStream outputStream = new ObjectOutputStream(os);
outputStream.writeObject(cookie);
... | java |
protected Cookie decodeCookie(String cookieString) {
byte[] bytes = hexStringToByteArray(cookieString);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
Cookie cookie = null;
try {
ObjectInputStream objectInputStream = new ObjectInputStream(byteArr... | java |
@Pure
public static <T> Collection<Class<? super T>> getSuperClasses(Class<T> className) {
assert className != null;
final Collection<Class<? super T>> list = new ArrayList<>();
Class<? super T> type = className.getSuperclass();
while (type != null && !Object.class.equals(type)) {
list.add(type);
type = ... | java |
public static Class<?> getCommonType(Class<?> type1, Class<?> type2) {
if (type1 == null) {
return type2;
}
if (type2 == null) {
return type1;
}
Class<?> top = type1;
while (!top.isAssignableFrom(type2)) {
top = top.getSuperclass();
assert top != null;
}
return top;
} | java |
@Pure
public static Class<?> getCommonType(Object instance1, Object instance2) {
if (instance1 == null) {
return instance2 == null ? null : instance2.getClass();
}
if (instance2 == null) {
return instance1.getClass();
}
Class<?> top = instance1.getClass();
while (!top.isInstance(instance2)) {
top ... | java |
@Pure
@SuppressWarnings({"checkstyle:returncount", "npathcomplexity"})
public static Class<?> getOutboxingType(Class<?> type) {
if (void.class.equals(type)) {
return Void.class;
}
if (boolean.class.equals(type)) {
return Boolean.class;
}
if (byte.class.equals(type)) {
return Byte.class;
}
if (c... | java |
@Pure
public static boolean matchesParameters(Class<?>[] formalParameters, Object... parameterValues) {
if (formalParameters == null) {
return parameterValues == null;
}
if (parameterValues != null && formalParameters.length == parameterValues.length) {
for (int i = 0; i < formalParameters.length; ++i) {
... | java |
@Pure
@Inline(value = "ReflectionUtil.matchesParameters(($1).getParameterTypes(), ($2))", imported = {ReflectionUtil.class})
public static boolean matchesParameters(Method method, Object... parameters) {
return matchesParameters(method.getParameterTypes(), parameters);
} | java |
public static void toJson(Object object, JsonBuffer output) {
if (object == null) {
return;
}
for (final Method method : object.getClass().getMethods()) {
try {
if (!method.isSynthetic() && !Modifier.isStatic(method.getModifiers()) && method.getParameterCount() == 0
&& (method.getReturnType().isPri... | java |
@Pure
@Override
public Point3d getCenter() {
return new Point3d(
(this.medial1.getX() + this.medial2.getX()) / 2.,
(this.medial1.getY() + this.medial2.getY()) / 2.,
(this.medial1.getZ() + this.medial2.getZ()) / 2.);
} | java |
protected void onSetColumnNames()
{
columnNames = ReflectionExtensions.getDeclaredFieldNames(getType(), "serialVersionUID");
for(int i = 0; i < columnNames.length; i++){
columnNames[i] = StringUtils.capitalize(columnNames[i]);
}
} | java |
protected void onSetCanEdit()
{
Field[] fields = ReflectionExtensions.getDeclaredFields(getType(), "serialVersionUID");
canEdit = new boolean[fields.length];
for (int i = 0; i < fields.length; i++)
{
canEdit[i] = false;
}
} | java |
@Override
public boolean setChildAt(int index, N newChild) throws IndexOutOfBoundsException {
final N oldChild = (index < this.children.length) ? this.children[index] : null;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNul... | java |
public void addIterator(SizedIterator<? extends M> iterator) {
if (this.iterators.add(iterator)) {
this.total += iterator.totalSize();
this.update = true;
}
} | java |
public void write(Collection<? extends MapLayer> layers) throws IOException {
if (this.progression != null) {
this.progression.setProperties(0, 0, layers.size() + 1, false);
}
// Write the header
if (!this.isHeaderWritten) {
this.isHeaderWritten = true;
writeHeader();
}
if (this.progression != nu... | java |
protected void writeHeader() throws IOException {
this.tmpOutput.write(HEADER_KEY.getBytes());
this.tmpOutput.write(new byte[]{MAJOR_SPEC_NUMBER, MINOR_SPEC_NUMBER});
this.tmpOutput.write(new byte[] {0, 0, 0, 0});
} | java |
protected static String runCommand(String... command) {
try {
final Process p = Runtime.getRuntime().exec(command);
if (p == null) {
return null;
}
final StringBuilder bStr = new StringBuilder();
try (InputStream standardOutput = p.getInputStream()) {
final byte[] buffer = new byte[BUFFER_SIZE]... | java |
protected static String grep(String selector, String text) {
if (text == null || text.isEmpty()) {
return null;
}
final StringBuilder line = new StringBuilder();
final int textLength = text.length();
char c;
String string;
for (int i = 0; i < textLength; ++i) {
c = text.charAt(i);
if (c == '\n' |... | java |
protected static String cut(String delimiter, int column, String lineText) {
if (lineText == null || lineText.isEmpty()) {
return null;
}
final String[] columns = lineText.split(Pattern.quote(delimiter));
if (columns != null && column >= 0 && column < columns.length) {
return columns[column].trim();
}
... | java |
@Pure
protected static Plane3D<?> toPlane(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3) {
Vector3f norm = new Vector3f();
FunctionalVector3D.crossProduct(
tx2 - tx1,
ty2 - ty1,
tz2 - tz1,
tx3 - tx1,
ty3 - ty1,
tz3 - tz1... | java |
@Unefficient
public static void computeClosestPointTrianglePoint(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3,
double px, double py, double pz,
Point3D closestPoint) {
if (containsTrianglePoint(
tx1, ty1, tz1,
tx2, ty2, tz2,
tx... | java |
@Pure
@Unefficient
public static double distanceSquaredTriangleSegment(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3,
double sx1, double sy1, double sz1,
double sx2, double sy2, double sz2) {
double t = getTriangleSegmentIntersectionFactor... | java |
@Pure
@Unefficient
public static boolean intersectsTriangleCapsule(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3,
double cx1, double cy1, double cz1,
double cx2, double cy2, double cz2,
double radius) {
double d = distanceSquaredTriangl... | java |
@Pure
public static boolean intersectsTriangleOrientedBox(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3,
double cx, double cy, double cz,
double ax1, double ay1, double az1,
double ax2, double ay2, double az2,
double ax3, double ay3, d... | java |
@Pure
public static boolean intersectsTriangleSegment(
double tx1, double ty1, double tz1,
double tx2, double ty2, double tz2,
double tx3, double ty3, double tz3,
double sx1, double sy1, double sz1,
double sx2, double sy2, double sz2) {
double factor = getTriangleSegmentIntersectionFactorWithJimenezAl... | java |
@Pure
private static boolean containsTrianglePoint(
int i0, int i1, double[] v, double[] u1, double[] u2, double[] u3) {
// is T1 completly inside T2?
// check if V0 is inside tri(U0,U1,U2)
double a = u2[i1] - u1[i1];
double b = -(u2[i0] - u1[i0]);
double c = -a * u1[i0] - b * u1[i1];
double d0 = a *... | java |
@Pure
private static boolean intersectsCoplanarTriangle(
int i0, int i1, int con, double[] s1, double[] s2, double[] u1, double[] u2, double[] u3) {
double Ax,Ay;
Ax = s2[i0] - s1[i0];
Ay = s2[i1] - s1[i1];
// test edge U0,U1 against V0,V1
if (intersectEdgeEdge(i0, i1, con, Ax, Ay, s1, u1, u2)) return t... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.