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

  • Home
  • SEARCH
  • 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 8190773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:45:02+00:00 2026-06-07T03:45:02+00:00

So basically I have different scientific models (algorithms) for calculating a certain value. Each

  • 0

So basically I have different scientific models (algorithms) for calculating a certain value. Each algorithm can have a different set of Parameters to fine-tune the model. These parameters must be changeable by the user. (for now it will be a simple properties file). Language I’m using is Java.

So I tried to follow this publication

http://www.hillside.net/plop/2010/papers/sobajic.pdf

Here a code sample from above pdf, I asssume it is C#:

abstract class Algorithm
{
    public Algorithm()
        { }
    protected Parameter[] parameters;
    public Parameter[] getParameters()
        { return parameters.copy(); }
    public abstract void execute();
}

abstract class Parameter
{
    private string name;
    public string GetName()
        { return name; }
    public Parameter(string name)
        { this.name = name; }
}
class BoolParameter : Parameter
{
    private bool Value;
    public bool GetValue()
        { return Value; }
    public void SetValue(bool value)
        { Value = value; }
    public BoolParameter(string name, bool defaultvalue)
        : base(name)
    {
    Value = defaultvalue;
    }
}
class IntParameter : Parameter
{
private int min;
    private int max;
    private int Value;
    public int GetValue()
        { return Value; }
    public void SetValue(int value)
    {
        if (value < min)
        throw new ArgumentOutOfRange(GetName() + " can’t be less than " + min);
        if (value > max)
        throw new ArgumentOutOfRange(GetName() + " can’t be greater than " + max);
        Value = value;
    }
    public IntParameter(string name, int min, int max, int defaultvalue) : base(name)
    {
        this.min = min;
        this.max = max;
        Value = defaultvalue;
    }
}

How do i set the Parameters values? Assume the concrete algorithm returns an array or list of 2 Parameters, one an IntegerParameter, the other a StringParameter. However the Parameter interface in above explained pattern has no setValue method and hence how can the Client set the parameters value and know its type?

  • 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-07T03:45:03+00:00Added an answer on June 7, 2026 at 3:45 am

    I would treat all parameter as an int or double even if there is only two possible values e.g. use 0 and 1 instead of true and false.

    Your algo needs a collection a parameters which can altered so it can produce a result.

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

Sidebar

Related Questions

How to create dynamic color list for charts Basically i have a different value
Basically I have 2 SQL queries from 2 different databases and I am trying
I have a .NET application available in several different language. i basically load and
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I basically have to do a update of a record. I have a set
Basically i am trying to have different transition time when the item is hovered
I'm writing my own CSS for jQuery UI. Basically, I need to have different
Basically I have different images for different months in the year, what I'm trying
In my project I currently have different models (Project, Message, etc) that: has_many :assets,
I basically have 3 layers ( Window > Scene > View ) that each

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.