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 650049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:00:38+00:00 2026-05-13T22:00:38+00:00

I have this class: public class Source extends Node { protected DistributionSampler delay ;

  • 0

I have this class:

public class Source extends Node {
  protected DistributionSampler delay ;
  protected DistributionSampler batchsize ;


/**
 * @param name The name of the source node
 * @param d The {@link DistributionSampler} used to generate the
 *          inter-arrival times
*/
  public Source( String name, DistributionSampler d ) {
    super( name ) ;
    delay = d ;
    batchsize = new Deterministic( 1 ) ;
    Sim.schedule( new Arrival( Sim.now() + delay.next() ) ) ;
  }

/**
 * @param name The name of the source node
 * @param d The {@link DistributionSampler} used to generate the
 *          inter-arrival times
 * @param b The {@link DistributionSampler} used to generate the
            batch sizes
*/
  public Source( String name, DistributionSampler d, DistributionSampler b ) {
    super( name ) ;
    delay = d ;
    batchsize = b ;
    Sim.schedule( new Arrival( Sim.now() + delay.next() ) ) ;
  }

   ....
}

DistributionSampler is an AbstractClass.

At the time of conversion from XML to Java Object, I will know which concrete implementation of my abstract class to use (via the bean name).

However, I’m not entirely sure how to write the mapping file to tell castor how to do the translation.

Any help would be much appreciated.

  • 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-05-13T22:00:38+00:00Added an answer on May 13, 2026 at 10:00 pm
    <class name="network.Source">
            <description xmlns="">
                Default mapping for class network.Source
            </description>
    
            <map-to xml="Source"/>
    
            <field name="name" type="java.lang.String" required="true">
                <bind-xml  node="element" />
            </field>
    
            <field name="delay" type="tools.DistributionSampler" required="true" set-method="initialiseDelay" get-method="getDelay">
                <bind-xml  auto-naming="deriveByClass" node="element" location="delay"/>
            </field>
    
            <field name="batchSize" type="tools.DistributionSampler">
                <bind-xml  auto-naming="deriveByClass" node="element" location="batchSize"/>
            </field>
        </class>
    

    The auto-naming=”deriveByClass” part means that if we send it will bind node name for the element embedded inside delay to an equivalent class which it hopes extends distributionSampler.

    So passing its happy to process the following xml:

    <Source name="asd">
        <delay>
            <Deterministic time="234" />
        </delay>
    
        <batchSize>
            <Erlang K="234" Theta="234" />
        </batchSize>
    </Source>
    

    Will use the mapping files for Deterministic and Erlang to map it to the class instances whihc extend DistributionSampler.

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

Sidebar

Ask A Question

Stats

  • Questions 343k
  • Answers 343k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try this: CREATE PROCEDURE usp_GetCourseSummary @Course nvarchar(100) AS SET NOCOUNT… May 14, 2026 at 5:27 am
  • Editorial Team
    Editorial Team added an answer That is the correct href, but the method should be… May 14, 2026 at 5:27 am
  • Editorial Team
    Editorial Team added an answer You want to use strcmp() == 0 to compare strings… May 14, 2026 at 5:27 am

Related Questions

I'm aiming to create a set of objects, each of which has a unique
I have this test app: import java.applet.*; import java.awt.*; import java.net.URL; public class Test
I have the following class subclass of FilterInputStream with only one method overrided. However
So I have another noodle-scratcher (for me anyway). I'm trying to create my own
I want to create a dialog that contains some kind of text element (JLabel/JTextArea

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.