Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy built in types #62

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,18 @@
<module>praxiscore-script</module>
<module>praxiscore-launcher</module>
<module>praxiscore-project</module>
<module>praxiscore-data</module>
<module>praxiscore-video</module>
<module>praxiscore-video-code</module>
<module>praxiscore-video-components</module>
<module>praxiscore-video-gstreamer</module>
<module>praxiscore-video-pgl</module>
<module>praxiscore-video-pgl-natives</module>
<module>praxiscore-video-pgl-code</module>
<module>praxiscore-internal-osc</module>
<module>praxiscore-hub-net</module>
<module>praxiscore-audio</module>
<module>praxiscore-audio-code</module>
<module>praxiscore-audio-components</module>
<module>praxiscore-tinkerforge</module>
<module>praxiscore-gui</module>
<module>praxiscore-midi</module>
<module>praxiscore-osc</module>
<module>praxiscore-code-mima</module>
<module>praxiscore-launcher-jline</module>
<module>praxiscore-purl</module>
Expand Down
20 changes: 0 additions & 20 deletions praxiscore-bin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@
<artifactId>praxiscore-components</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-data</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-gui</artifactId>
Expand All @@ -141,26 +136,11 @@
<artifactId>praxiscore-launcher-jline</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-midi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-project</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-osc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-tinkerforge</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>praxiscore-video</artifactId>
Expand Down
18 changes: 9 additions & 9 deletions praxiscore-code/src/main/java/org/praxislive/code/userapi/T.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,7 +19,6 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/

package org.praxislive.code.userapi;

import java.lang.annotation.ElementType;
Expand All @@ -30,19 +29,20 @@
/**
* Mark a field or method as a trigger (action). A control and port will be
* automatically created unless otherwise overridden. The @T annotation may be
* used on zero-parameter methods, and fields of type {@link Trigger} and boolean.
* NB. Note that boolean fields will be set to true when the trigger occurs and
* must be manually set back to false.
* used on zero-parameter methods, and fields of type {@link Trigger} and
* boolean. NB. Note that boolean fields will be set to true when the trigger
* occurs and must be manually set back to false.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface T {

/**
* Relative position compared to other @T elements. Values must be unique.
* They do not have to be contiguous.
* Relative weight compared to other {@code @T} elements. Elements will be
* sorted by weight, and then alphabetically. Higher weight elements will
* sort after lower weight elements.
*
* @return position
* @return weight
*/
int value();
int value() default 0;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2023 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -24,6 +24,7 @@
import org.praxislive.code.AbstractComponentFactory;
import org.praxislive.core.code.CoreCode;
import org.praxislive.core.code.CoreCodeDelegate;
import org.praxislive.core.code.DataCode;
import org.praxislive.core.services.ComponentFactory;
import org.praxislive.core.services.ComponentFactoryProvider;

Expand All @@ -49,7 +50,7 @@ private void build() {

// custom
add("core:custom", CoreCustom.class, CoreCustom.TEMPLATE_PATH);

// built-in
// CORE
add("core:property", CoreProperty.class, CoreProperty.TEMPLATE_PATH);
Expand Down Expand Up @@ -85,11 +86,20 @@ private void build() {
add(CoreCode.containerBase().create(
"core:container", CoreContainer.class,
source(CoreContainer.TEMPLATE_PATH)));

// ROOT
addRoot(CoreCode.rootContainerBase().create(
"root:custom", CoreRootCustom.class,
source(CoreRootCustom.TEMPLATE_PATH)));

// DATA (non-realtime)
add(DataCode.base().create(
"data:custom", DataCustom.class,
source(DataCustom.TEMPLATE_PATH)));
addRoot(DataCode.rootContainerBase().create(
"root:data", DataRootCustom.class,
source(DataRootCustom.TEMPLATE_PATH)));

}

private void add(String type, Class<? extends CoreCodeDelegate> cls, String path) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2020 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,10 +19,11 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/
package org.praxislive.tinkerforge.components;
package org.praxislive.core.components;

import org.praxislive.code.GenerateTemplate;
import org.praxislive.tinkerforge.TFCodeDelegate;

import org.praxislive.core.code.CoreCodeDelegate;

// default imports
import java.util.*;
Expand All @@ -31,23 +32,20 @@
import org.praxislive.core.*;
import org.praxislive.core.types.*;
import org.praxislive.code.userapi.*;
import com.tinkerforge.*;
import org.praxislive.tinkerforge.userapi.*;
import static org.praxislive.code.userapi.Constants.*;
import static org.praxislive.tinkerforge.userapi.Constants.*;
import org.praxislive.core.code.DataCodeDelegate;

/**
*
* Acts as a base type for a custom component with non-realtime safe behaviour.
*/
@GenerateTemplate(TFCustom.TEMPLATE_PATH)
public class TFCustom extends TFCodeDelegate {
@GenerateTemplate(DataCustom.TEMPLATE_PATH)
public class DataCustom extends DataCodeDelegate {

final static String TEMPLATE_PATH = "resources/custom.pxj";
final static String TEMPLATE_PATH = "resources/data_custom.pxj";

// PXJ-BEGIN:body

@Override
public void setup() {
public void init() {

}

Expand All @@ -56,10 +54,5 @@ public void update() {

}

@Override
public void dispose() {

}

// PXJ-END:body
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2020 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,10 +19,11 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/
package org.praxislive.tinkerforge.components;
package org.praxislive.core.components;

import org.praxislive.code.GenerateTemplate;
import org.praxislive.tinkerforge.TFCodeDelegate;

import org.praxislive.core.code.CoreRootContainerDelegate;

// default imports
import java.util.*;
Expand All @@ -31,56 +32,23 @@
import org.praxislive.core.*;
import org.praxislive.core.types.*;
import org.praxislive.code.userapi.*;
import com.tinkerforge.*;
import org.praxislive.tinkerforge.userapi.*;

import static org.praxislive.code.userapi.Constants.*;
import static org.praxislive.tinkerforge.userapi.Constants.*;
import org.praxislive.core.code.DataRootContainerDelegate;

/**
*
* Acts as a base type for a custom root supporting non-realtime safe behaviour.
*/
@GenerateTemplate(TFDualRelay.TEMPLATE_PATH)
public class TFDualRelay extends TFCodeDelegate {
@GenerateTemplate(DataRootCustom.TEMPLATE_PATH)
public class DataRootCustom extends DataRootContainerDelegate {

final static String TEMPLATE_PATH = "resources/dual_relay.pxj";
final static String TEMPLATE_PATH = "resources/root_data.pxj";

// PXJ-BEGIN:body

@TinkerForge BrickletDualRelay relays;

@P(1) @OnChange("refresh")
boolean relay1;
@P(2) @OnChange("refresh")
boolean relay2;

boolean needsUpdate;

@Override
public void setup() {
needsUpdate = true;
}

@Override
public void update() {
if (needsUpdate) {
try {
relays.setState(relay1, relay2);
} catch (TinkerforgeException ex) {
}
needsUpdate = false;
}
}

@Override
public void dispose() {
try {
relays.setState(false, false);
} catch (TinkerforgeException ex) {
}
}
@SupportedTypes(filter = "core:*|data:*")
public void init() {

private void refresh() {
needsUpdate = true;
}

// PXJ-END:body
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2023 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -26,7 +26,7 @@
import org.praxislive.code.CodeUtils;

/**
* Code code utility functions.
* Core code component utility functions.
*/
public class CoreCode {

Expand All @@ -41,7 +41,7 @@ public class CoreCode {
= CodeFactory.containerBase(CoreContainerDelegate.class,
DEFAULT_IMPORTS,
(task, delegate) -> new CoreContainerCodeContext(new CoreContainerCodeConnector(task, delegate)));

private final static CodeFactory.Base<CoreRootContainerDelegate> ROOT_CONTAINER_BASE
= CodeFactory.rootContainerBase(CoreRootContainerDelegate.class,
DEFAULT_IMPORTS,
Expand All @@ -58,7 +58,7 @@ private CoreCode() {
public static CodeFactory.Base<CoreCodeDelegate> base() {
return BASE;
}

/**
* Access {@link CodeFactory.Base} for {@link CoreContainerDelegate}.
*
Expand All @@ -67,7 +67,7 @@ public static CodeFactory.Base<CoreCodeDelegate> base() {
public static CodeFactory.Base<CoreContainerDelegate> containerBase() {
return CONTAINER_BASE;
}

/**
* Access {@link CodeFactory.Base} for {@link CoreRootContainerDelegate}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -26,11 +26,7 @@
import org.praxislive.code.CodeConnector;
import org.praxislive.code.CodeFactory;

/**
*
*
*/
public class CoreCodeConnector extends CodeConnector<CoreCodeDelegate> {
class CoreCodeConnector extends CodeConnector<CoreCodeDelegate> {

private final static String UPDATE = "update";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2023 Neil C Smith.
* Copyright 2024 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -26,11 +26,7 @@
import org.praxislive.core.ExecutionContext;
import org.praxislive.core.services.LogLevel;

/**
*
*
*/
public class CoreCodeContext extends CodeContext<CoreCodeDelegate> {
class CoreCodeContext extends CodeContext<CoreCodeDelegate> {

public CoreCodeContext(CoreCodeConnector connector) {
super(connector);
Expand Down
Loading
Loading