Questions tagged [primitive]

A primitive type is a data type provided by a programming language as a basic building block.

The actual range of primitive data types that is available is dependent upon the specific programming language that is being used. For example, in C, strings are a composite but built-in data type, whereas in modern dialects of BASIC and in JavaScript, they are assimilated to a primitive data type that is both basic and built-in.

Classic basic primitive types may include:


  • (character, char)
  • (integer, int, short, long, byte) with a variety of precisions
  • number (float, double, real, double precision)
  • number (fixed) with a variety of precisions and a programmer-selected scale
  • , logical values (true, false)

Reference

977 questions
0
votes
2 answers

Scaling Flex Graphic Object via UI

I have basic shapes created using flex primitives classes like ellipse rectangle etc. Each of these are added into a graphic object. Now i am in search of a mechanism to select it and scale it (as in Photoshop Transform -dragable corners and edges,…
Saju
  • 402
  • 3
  • 11
  • 30
0
votes
1 answer

primitive accessors in this example

Could someone help me understand the primitive accessors with this example : i don't understand what is automatically set and the order of those methods : 1.after a person is created, is willSave the first method called? (i guess so, because save:…
Paul
  • 6,108
  • 14
  • 72
  • 128
-1
votes
3 answers

Drawing a circle segment

I am wondering if anyone here can help me with some pseudocode or at least point me in the right direction on how to draw a circle segment without anti-aliasing.
Mattivc
  • 9
  • 1
  • 5
-1
votes
1 answer

Collision between sphere and rounded cone faster?

Is there a faster way to do this? I have a routine that detects if a sphere collides with a rounded cone: bool Math3D::DoesSphereIntersectRoundedCone(Vector spherePos, float sphereRadius, Vector coneStart, float coneStartRadius, Vector coneEnd,…
KiraHoneybee
  • 495
  • 3
  • 12
-1
votes
2 answers

Why do I need to convert from Integer[] to int[]?

I have the following code public static int[] readCSV() { ArrayList entries = new ArrayList<>(); try { File file = new File("someDataFile.csv"); FileReader fr = new FileReader(file); BufferedReader br = new…
-1
votes
1 answer

Primitive type of 32.0 % 6 in Java

I'm taking an intro to Java class that asks the following question: Select the primitive type of this expression's result: 32.0 % 6 choices: int, float, double, long I chose float, but the correct answer is double. I don't understand; 32.0 % 6 =…
-1
votes
3 answers

OBSOLETE: React: setState for primitive value doesn't work with ===

EDIT: Obsolete, I made some mistake in another piece of code and the received data had the wrong data type. I have a variable that stores the index of a selected item. I used a conditional expression based on that variable to add/remove a class name…
akrinah
  • 119
  • 1
  • 8
-1
votes
1 answer

How to check if an object is a primitive data type in Rust?

I am a C++ developer who is making the transition to Rust, I am looking for something analogous to bool isPrimitive = std::is_fundamental. I haven't had much luck in finding a standard way to do this. I suppose I could hand roll my own…
-1
votes
1 answer

Java syntax and logic help "?" and ":"

What does this line do? Mainly, I'm confused about the use of "?" and ":" and what they do (what are they called?). Integer b1 = b.length > 0 ? b[0] : 0; Apologies if the question is repeated I haven't been able to find anything related.
Shervin Rad
  • 460
  • 9
  • 21
-1
votes
2 answers

How to make a reference point to the address of primitive and access it through the member?

export function createZeroVector(){ let out = [0, 0, 0] out.x = out[0] out.y = out[1] out.z = out[2] return out } I created a vec3 domain as shown above, and I want to x, y, and z to point to 0th, 1st, and 2nd indexes of the…
-1
votes
2 answers

Unable to convert from int to Integer in Java

I have an Integer Stack and I'm working on a method to insert elements into it from a JOptionPane. However, JOptionPane returns a string, so I parsed it into an int, but then I tried to insert the value in the stack and apparently, I need to convert…
Dasphillipbrau
  • 524
  • 2
  • 8
  • 17
-1
votes
1 answer

SFML c++ How change Sprites per Primitives on Asteroid Game Code(Have Sprite Code Working)

I have some code that when compiled, runs an Asteroid Game. I want to make some changes. In place of sprites for the ship, I would like to use trianges. For a bullet, I'd like to use a small rectangle, and finally, a polygon for the asteroids. The…
-1
votes
1 answer

What are some reasons not to alter js prototypes?

I use certain algorithms so often that I am considering adding them to prototypes in my app. For example, the last value in an array. array.last() is so convenient compared to writing arr[arr.length -1] every time I want the last value in the array.…
Jeremy Gottfried
  • 1,061
  • 13
  • 28
-1
votes
1 answer

what's the usecase for int.class, double.class?

I understand the class literals and the getClass() methods how they help with generics and reflection but I don't understand why the same would apply for primitives as well? For example, for int, I can use int.class but not sure what you could do…
Bogdan T.
  • 668
  • 6
  • 13
-1
votes
1 answer

Expression Error on OCaml functional language

I am defining a primitive type in OCaml, this is a homework. Everything works fine but I got an error with implemented Dict type. The code: type ide = string;; type exp = Eint of int | Ebool of bool | Den of ide | Prod of exp * exp | Sum of exp *…
user4789408
  • 1,196
  • 3
  • 14
  • 31