GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added print() method to PMatrix (Fixes #811) by Sumamasonia · Pull Request #1355 · processing/processing4

Conversation

@Sumamasonia

@Sumamasonia Sumamasonia commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

Hi,

I noticed this issue (#811) was inactive for a while, so I went ahead and implemented the fix.

Changes:
Added default print() method to PMatrix interface.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Sumamasonia
Add print method to PMatrix interface
140e8fc
Added a default method to print matrix data.
@catilac
catilac requested a review from Stefterv December 10, 2025 13:19
@catilac
catilac self-requested a review January 29, 2026 13:06
catilac
catilac requested changes Jan 29, 2026
View reviewed changes

@catilac catilac left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Sumamasonia Thank you so much! So my review is this:

The solution is a little simpler, than what you have, but it's the right idea. Since we're dealing with the interface of PMatrix java's polymorphism allows you to simply declare public void print(); and it will know what to do. Once you make this change i'll merge it in!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@catilac
catilac removed the request for review from Stefterv January 29, 2026 13:13
Sumamasonia added 3 commits January 29, 2026 22:23
@Sumamasonia
docs: add print() method declaration to PMatrix interface
125bc8e
@Sumamasonia
refactor: implement toString and override print in PMatrix2D
02ba4c1
@Sumamasonia
refactor: implement toString and override print in PMatrix3D
da0faa6
@Sumamasonia

Sumamasonia commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi @catilac, I have finished the updates. Added the print() declaration to the PMatrix interface and implemented formatted toString() methods in both PMatrix2D and PMatrix3D. This makes the solution simpler and polymorphic as suggested. Ready for your review!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@catilac

catilac commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator

@Sumamasonia Hi! Can you help me understand the changes you made in PMatrix2d.java and PMatrix3D.java? I don't think you need to make any changes to the implementations there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Sumamasonia

Sumamasonia commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi @catilac! The reason I updated the implementations is to leverage polymorphism properly as you suggested.

Previously, both classes had their own independent print() logic. By adding public void print() to the PMatrix interface, I added the @OverRide annotation to the existing methods in PMatrix2D and PMatrix3D to explicitly link them.

Also, I refactored the formatting logic into toString(). This makes the code cleaner and allows developers to use System.out.println(matrix) as well as matrix.print(), with both using the same formatting logic. Let me know if you’d prefer me to revert the implementation changes and keep the original print() methods as they were!

Stefterv reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@catilac

catilac commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator

@Sumamasonia ohhhh I see what you've done. That's really cool. Sorry I didn't understand it

Sumamasonia reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

catilac
catilac approved these changes Jan 29, 2026
View reviewed changes
@Sumamasonia

Sumamasonia commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @catilac! I'm glad you liked the approach. I wanted to make sure the fix follows Java's best practices for polymorphism. Looking forward to seeing it merged! 🙌

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@catilac
catilac merged commit e03e31b into processing:main Jan 30, 2026
6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@catilac

catilac commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

@all-contributors please add @Sumamasonia for Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allcontributors

allcontributors Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

@catilac

This project's configuration file has malformed JSON: .all-contributorsrc. Error:: Unexpected token : in JSON at position 45082

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@catilac

catilac commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

https://github.com/all-contributors please add @Sumamasonia for Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@catilac

catilac commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

@all-contributors please add @Sumamasonia for Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allcontributors allcontributors Bot mentioned this pull request Jan 30, 2026
docs: add Sumamasonia as a contributor for code #1396
Merged
@allcontributors

allcontributors Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

@catilac

I've put up a pull request to add @Sumamasonia! 🎉

catilac and Sumamasonia reacted with hooray emoji
All reactions
  • 🎉 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Sumamasonia

Sumamasonia commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

Thank you so much @catilac for the merge and for adding me as a contributor! It was a great learning experience. Looking forward to contributing more to Processing in the future! 🎉

catilac reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Sumamasonia
Sumamasonia deleted the patch-1 branch February 10, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@catilac catilac catilac approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Sumamasonia @catilac
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.