B4J Library jPermutation - Get all Permutations of a String

This is a B4J Library based on my B4A Version of it.

Permutation
Version:
1
  • Permutation
    Methods:
    • permute (s As String) As List


B4X:
  Dim l As List = perm.permute("ABC")
  For i = 0 To l.Size -1
      Log(l.Get(i))
  Next

The code does not raise an error so i guess it is working in B4J but i dont get any log-output. Maybe i´m doing something wrong.

PLEASE if anyone using B4J test this lib and tell me whether it is working or not. Maybe you can create a small b4j example using this library?


BCA
BAC
CBA
ABC
ACB
CAB
 

Attachments

  • jPermutationV1.0.0.zip
    2.1 KB · Views: 469

Roycefer

Well-Known Member
Licensed User
Longtime User
Your code works fine on my end. Are you able to get ANY logging output (even just logging plain String literals)?
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Dim perm As Permutation
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    Log("Test")
    Log(perm.permute("ABC"))
  Dim l As List = perm.permute("ABC")
  For i = 0 To l.Size -1
      Log(l.Get(i))
  Next

    MainForm.Show
End Sub

Does not show any Logoutput here

But i must say i´m using b4j not often... Maybe i´m just doing some stupid nooberror!?
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Very strange. Is it displaying a blank form on the screen? You're calling MainForm.Show without a layout loaded (this shouldn't interfere with the logging, though).

Try putting that code in a non-UI project and see if you get any logging output in there.
 

DonManfred

Expert
Licensed User
Longtime User
Try putting that code in a non-UI project
I hope i understand right; i´ve tried
B4X:
Sub Process_Globals
    'Private fx As JFX
    'Private MainForm As Form
    Dim perm As Permutation
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    'MainForm = Form1
    'MainForm.SetFormStyle("UNIFIED")
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    Log("Test")
    Log(perm.permute("ABC"))
  Dim l As List = perm.permute("ABC")
  For i = 0 To l.Size -1
      Log(l.Get(i))
  Next

    'MainForm.Show
End Sub

It does not show any window on my desktop. It gives no error. And it does not show ANY log output.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
No, a non-UI project is a separate type of project. You have to go to File>New>Non-UI(Console) and select that. It will create a console application with no JavaFX components, whatsoever.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
It looks like your Log window is scrunched down to 0 height and all the height is used up by the Warnings window. Try pulling the Warnings window's bottom edge up a little.
 
Top