Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:26:36+00:00 2026-06-18T16:26:36+00:00

I have a quad tree* which I would like to use across several different

  • 0

I have a quad tree* which I would like to use across several different machines. Calling the constructor (ie building the tree) takes a long time. I don’t want to build the tree each time I need to use it.

I am looking for a way to persist my tree in hard disk, send that to each node, and then quickly load it into memory so that I can perform lookups.

Can serialization help me with this? I know that I can serialize the tree, save it to disk then deserialize (that’s about all I know about serialization). To the best of my knowledge, the deserilization step needs a default constructor to build the tree. Since building the tree is computationally expensive, this is of no use to me.

Is there some way I can import the persisted tree without having to rebuild it each time?

*quad tree base code that I used: https://bitbucket.org/utcompling/textgrounder/src/f38150c7f33a/src/main/java/ags/utils/KdTree.java

Apologies if this is too basic, it’s closely related to: https://stackoverflow.com/questions/14701245/how-do-i-perform-kd-tree-lookups-in-hadoop

edit: So, it looks like the no-arg constructor of the least-inherited class is the one that will be called. Here’s my hirearchy:

abstract KDTree

QuadTree extends KdTree

SpecialQuadTree ( has an instance of QuadTree)

Now, I am only able to serialize SpecialQuadTree when I make everything Serializable (otherwise I’m getting NotSerizable or InvalidClassException no valid constructor):

abstract KDTree implements Serializable

QuadTree extends KdTree implements Serializable

SpecialQuadTree implements Serializable ( has an instance of QuadTree)

So, I suppose I can take the Serializable off the KdTree and then give it a do-nothing no-args constructor? That’s not easy, I didn’t write and don’t understand the KdTree class. I suppose I could subclass it, give the subclass a do-nothing no-args constructor, and inherit the QuadTree from that…

edit: Ok so, I have an abstract class
abstract KDTree implements Serializable

and from that I extend:
QuadTree extends KdTree implements Serializable

From all my experiments, I need to implement Serializable on both. Now,

public QuadTree() {
    super(2, 1000000);
    System.out.println("QuadTree no-args!");
}

and

protected KdTree(int dimensions, Integer sizeLimit) {
    System.out.println("KdTree, constructor!");

Since I never see it print out (aside from the initial construction…), I guess it’s all good.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:26:37+00:00Added an answer on June 18, 2026 at 4:26 pm

    To the best of my knowledge, the deserilization step needs a default constructor to build the tree

    Not if you’re taking about Java Object Serialization it doesn’t.

    it looks like the no-arg constructor of the least-inherited class is the one that will be called.

    No. The no-args constructor of the nearest non-serializable base class is called.

    I suppose I can take the Serializable off the KdTree and then give it a do-nothing no-args constructor?

    Why? Just leave it alone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quad and I would like to use the gradient it produces
I have a quad core machine and would like to write some code to
I have an image with 2D projection(green one) of a 3D quad(blue one), like
If I have a class like this: typedef union { __m128 quad; float numbers[4];
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
I use a quad tree as a datastructure to store points. As I need
I have a quad processor. I coded something like that in java; Some.java; public
I have a quad type which is defined as: typedef struct __point { float
I have a quad core computer; and I use the parallel computing toolbox. I
I have a Intel i7 quad-core processor. Is it possible to use multiple cores

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.