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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:28:34+00:00 2026-06-17T21:28:34+00:00

Just trying to convert some Java code into Objective-C. Here is a snippet of

  • 0

Just trying to convert some Java code into Objective-C.

Here is a snippet of the code for the constructor of a class called ‘bone’ written in Java.

public class Bone {

public static double            RADS_TO_DEGS =
                                Quaternion.RADS_TO_DEGS;
public static double            DEGS_TO_RADS =
                                Quaternion.DEGS_TO_RADS;

public static int               LUPA_4CC =
                                FourCCUtil.fourCCInt("LUPA");
public static int               RUPA_4CC =
                                FourCCUtil.fourCCInt("RUPA");
public static int               LLRA_4CC =
                                FourCCUtil.fourCCInt("LLRA");
public static int               RLRA_4CC =
                                FourCCUtil.fourCCInt("RLRA");

protected float                 length;
protected Bone                  parent;
protected Bone[]                childBones;
protected int                   fourCCName;
protected int                   parentFourCCName;
protected float[]               translation;

Here is my attempt at rewriting this code in objective-c:

bone.h

@interface Bone : NSObject{

@property static double         RADS_TO_DEGS;
@property static double         DEGS_TO_RADS;

@property static int                LUPA_4CC;
@property static int                RUPA_4CC;
@property static int                LLRA_4CC;
@property static int                RLRA_4CC;


@protected {
    @property float length;
    @property Bone parent;
    @property Bone[] childBones ;
    @property int fourCCName;
    @property int parentFourCCName;
    @property float[] translation;

bone.m

@implementation VA_Bone

-(id)init{

    self=[super init];
    if(self){

        VA_4ccUtil       *FCC       = [[VA_4ccUtil alloc] init];
        VA_Bone          *Bone      = [[VA_Bone alloc] init];
        VA_TRTransform   *TRTform   = [[VA_TRTransform alloc] init];
        VA_TRUtil        *TRUtil    = [[VA_TRUtil alloc] init];
        VA_Quaternion    *Quat      = [[VA_Quaternion alloc] init]];           

       [Bone setDEGS_TO_RADS: [Quat DEGS_TO_RADS]];
       [Bone setRADS_TO_DEGS: [Quat RADS_TO_DEGS]];

       [Bone setLUPA_4CC: [TRUtil fourCCInt:"LUPA"]];
       [Bone setRUPA_4CC: [TRUtil fourCCInt:"RUPA"]];
       [Bone setLLRA_4CC: [TRUtil fourCCInt:"LLRA"]];
       [Bone setRLRA_4CC: [TRUtil fourCCInt:"RLRA"]];

        [self setParent:NULL];
        [self setFourCCName:0];
        [self setParentFourCCName:0];
        [self setTranslation:NULL];
        [self setLength:0];

    }
    return self;
}

My questions are:

1) Have I declared the static methods correctly?

2) Is it possible to assign class types or is it better to use an array such as NSMutableArray instead of Bone[]?

I am still trying to get my head around how to construct a class in objective-c since I am currently converting some Java code into objective c.

Kind Regards,
Sam

  • 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-17T21:28:35+00:00Added an answer on June 17, 2026 at 9:28 pm

    Have I declared the static methods correctly?

    No. There is no such thing as @property static in Objective C. You need to declare them as class methods:

    +(double)RADS_TO_DEGS; // This is a getter
    

    If you need a setter, write one more method:

    +(void)setRADS_TO_DEGS:(double)val; // This is a setter
    

    Is it possible to assign class types or is it better to use an array such as NSMutableArray instead of Bone[]?

    Plain C arrays are problematic because of the ownership problem. You will be better served with a NSArray property: it would give you the same flexibility, provide your clients with fast enumeration, and deal with resource cleanup in ways idiomatic to Objective C.

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

Sidebar

Related Questions

I have some C code that I'm trying to convert/wrap into a C++ class.
I am trying to convert some code to Objective-C from Java and I'm getting
I am trying to convert some Ruby code into C# but I do not
I'm trying to convert some python code to java and need to setup a
I'm trying to convert some existing C# code into a CLR stored procedure. The
I'm trying to convert some code from just creating a new thread to run
I am using this code for on android just trying to convert string to
I was just trying to convert a PPT using the following URL http://code.google.com/p/qifei/wiki/PDFConverter python
i'm trying to convert my log4j.properties into log4j.xml because i need to use some
I'm trying to convert some VC++ 6 code to a console app using only

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.