OSDN Git Service

Class name cleanup. (1/3)
authorMarius Renn <renn@google.com>
Wed, 31 Aug 2011 23:49:47 +0000 (16:49 -0700)
committerMarius Renn <renn@google.com>
Wed, 31 Aug 2011 23:49:47 +0000 (16:49 -0700)
Addresses bug 5214502.

Change-Id: I82321ad516b93e98047fce361a97da020b7ac09e

18 files changed:
mca/filterfw/java/android/filterfw/basefilters/ObjectSource.java
mca/filterfw/java/android/filterfw/core/Filter.java
mca/filterfw/java/android/filterfw/core/FrameFormat.java
mca/filterfw/java/android/filterfw/core/GLFrame.java
mca/filterfw/java/android/filterfw/core/JavaProgram.java [deleted file]
mca/filterfw/java/android/filterfw/core/NativeFrame.java
mca/filterfw/java/android/filterfw/core/SerializedFrame.java
mca/filterfw/java/android/filterfw/core/SimpleFrame.java [moved from mca/filterfw/java/android/filterfw/core/JavaFrame.java with 91% similarity]
mca/filterfw/java/android/filterfw/core/SimpleFrameManager.java
mca/filterfw/java/android/filterfw/format/ImageFormat.java
mca/filterpacks/imageproc/java/CropFilter.java
mca/filterpacks/imageproc/java/DrawOverlayFilter.java
mca/filterpacks/imageproc/java/DrawRectFilter.java
mca/filterpacks/numeric/java/SinWaveFilter.java
mca/filterpacks/performance/java/ThroughputFilter.java
mca/filterpacks/text/java/StringLogger.java
mca/filterpacks/text/java/StringSource.java
mca/filterpacks/text/java/ToUpperCase.java

index 6b5451e..d511e44 100644 (file)
@@ -60,7 +60,7 @@ public class ObjectSource extends Filter {
             if (mObject == null) {
                 throw new NullPointerException("ObjectSource producing frame with no object set!");
             }
-            FrameFormat outputFormat = ObjectFormat.fromObject(mObject, FrameFormat.TARGET_JAVA);
+            FrameFormat outputFormat = ObjectFormat.fromObject(mObject, FrameFormat.TARGET_SIMPLE);
             mFrame = context.getFrameManager().newFrame(outputFormat);
             mFrame.setObjectValue(mObject);
             mFrame.setTimestamp(Frame.TIMESTAMP_UNKNOWN);
index b5792c0..73b009d 100644 (file)
@@ -367,7 +367,7 @@ public abstract class Filter {
         // Create format for this input
         if (mLogVerbose) Log.v(TAG, "Filter " + this + " adding " + fieldPort);
         MutableFrameFormat format = ObjectFormat.fromClass(field.getType(),
-                                                           FrameFormat.TARGET_JAVA);
+                                                           FrameFormat.TARGET_SIMPLE);
         fieldPort.setPortFormat(format);
 
         // Add port
@@ -388,7 +388,7 @@ public abstract class Filter {
         // Create format for this input
         if (mLogVerbose) Log.v(TAG, "Filter " + this + " adding " + programPort);
         MutableFrameFormat format = ObjectFormat.fromClass(varType,
-                                                           FrameFormat.TARGET_JAVA);
+                                                           FrameFormat.TARGET_SIMPLE);
         programPort.setPortFormat(format);
 
         // Add port
@@ -621,7 +621,7 @@ public abstract class Filter {
         if (mLogVerbose) Log.v(TAG, "Setting immediate value " + value + " for port " + name + "!");
         FilterPort port = getInputPort(name);
         port.open();
-        port.setFrame(JavaFrame.wrapObject(value, null));
+        port.setFrame(SimpleFrame.wrapObject(value, null));
     }
 
     private final void transferInputFrames(FilterContext context) {
@@ -631,7 +631,7 @@ public abstract class Filter {
     }
 
     private final Frame wrapInputValue(String inputName, Object value) {
-        MutableFrameFormat inputFormat = ObjectFormat.fromObject(value, FrameFormat.TARGET_JAVA);
+        MutableFrameFormat inputFormat = ObjectFormat.fromObject(value, FrameFormat.TARGET_SIMPLE);
         if (value == null) {
             // If the value is null, the format cannot guess the class, so we adjust it to the
             // class of the input port here
@@ -649,7 +649,7 @@ public abstract class Filter {
         // Create frame wrapper
         Frame frame = shouldSerialize
             ? new SerializedFrame(inputFormat, null)
-            : new JavaFrame(inputFormat, null);
+            : new SimpleFrame(inputFormat, null);
         frame.setObjectValue(value);
         return frame;
     }
index f3de53d..8f619be 100644 (file)
@@ -39,7 +39,7 @@ public class FrameFormat {
     public static final int TYPE_OBJECT      = 8;
 
     public static final int TARGET_UNSPECIFIED  = 0;
-    public static final int TARGET_JAVA         = 1;
+    public static final int TARGET_SIMPLE       = 1;
     public static final int TARGET_NATIVE       = 2;
     public static final int TARGET_GPU          = 3;
     public static final int TARGET_VERTEXBUFFER = 4;
@@ -358,7 +358,7 @@ public class FrameFormat {
     public static String targetToString(int target) {
         switch (target) {
             case TARGET_UNSPECIFIED:  return "unspecified";
-            case TARGET_JAVA:         return "java";
+            case TARGET_SIMPLE:       return "simple";
             case TARGET_NATIVE:       return "native";
             case TARGET_GPU:          return "gpu";
             case TARGET_VERTEXBUFFER: return "vbo";
@@ -386,8 +386,8 @@ public class FrameFormat {
             return FrameFormat.TARGET_NATIVE;
         } else if (targetString.equalsIgnoreCase("GPU")) {
             return FrameFormat.TARGET_GPU;
-        } else if (targetString.equalsIgnoreCase("JAVA")) {
-            return FrameFormat.TARGET_JAVA;
+        } else if (targetString.equalsIgnoreCase("SIMPLE")) {
+            return FrameFormat.TARGET_SIMPLE;
         } else if (targetString.equalsIgnoreCase("VERTEXBUFFER")) {
             return FrameFormat.TARGET_VERTEXBUFFER;
         } else if (targetString.equalsIgnoreCase("UNSPECIFIED")) {
index b37c51b..1558cc6 100644 (file)
@@ -266,7 +266,7 @@ public class GLFrame extends Frame {
             nativeCopyFromNative((NativeFrame)frame);
         } else if (frame instanceof GLFrame) {
             nativeCopyFromGL((GLFrame)frame);
-        } else if (frame instanceof JavaFrame) {
+        } else if (frame instanceof SimpleFrame) {
             setObjectValue(frame.getObjectValue());
         } else {
             super.setDataFromFrame(frame);
diff --git a/mca/filterfw/java/android/filterfw/core/JavaProgram.java b/mca/filterfw/java/android/filterfw/core/JavaProgram.java
deleted file mode 100644 (file)
index 4a32e71..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package android.filterfw.core;
-
-import android.filterfw.core.Frame;
-import android.filterfw.core.KeyValueMap;
-import android.filterfw.core.Program;
-
-/**
- * @hide
- */
-public abstract class JavaProgram extends Program {
-
-    private KeyValueMap mHostVariables;
-
-    public JavaProgram() {
-        mHostVariables = new KeyValueMap();
-    }
-
-    @Override
-    public abstract void process(Frame[] inputs, Frame output);
-
-    @Override
-    public void setHostValue(String variableName, Object value) {
-        mHostVariables.put(variableName, value);
-    }
-
-    @Override
-    public Object getHostValue(String variableName) {
-        return mHostVariables.get(variableName);
-    }
-
-}
index 693c9ad..bfd09ba 100644 (file)
@@ -214,7 +214,7 @@ public class NativeFrame extends Frame {
             nativeCopyFromNative((NativeFrame)frame);
         } else if (frame instanceof GLFrame) {
             nativeCopyFromGL((GLFrame)frame);
-        } else if (frame instanceof JavaFrame) {
+        } else if (frame instanceof SimpleFrame) {
             setObjectValue(frame.getObjectValue());
         } else {
             super.setDataFromFrame(frame);
index 211d043..f493fd2 100644 (file)
@@ -182,7 +182,7 @@ public class SerializedFrame extends Frame {
     }
 
     static SerializedFrame wrapObject(Object object, FrameManager frameManager) {
-        FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_JAVA);
+        FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_SIMPLE);
         SerializedFrame result = new SerializedFrame(format, frameManager);
         result.setObjectValue(object);
         return result;
@@ -30,19 +30,19 @@ import java.nio.ByteBuffer;
 /**
  * @hide
  */
-public class JavaFrame extends Frame {
+public class SimpleFrame extends Frame {
 
     private Object mObject;
 
-    JavaFrame(FrameFormat format, FrameManager frameManager) {
+    SimpleFrame(FrameFormat format, FrameManager frameManager) {
         super(format, frameManager);
         initWithFormat(format);
         setReusable(false);
     }
 
-    static JavaFrame wrapObject(Object object, FrameManager frameManager) {
-        FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_JAVA);
-        JavaFrame result = new JavaFrame(format, frameManager);
+    static SimpleFrame wrapObject(Object object, FrameManager frameManager) {
+        FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_SIMPLE);
+        SimpleFrame result = new SimpleFrame(format, frameManager);
         result.setObjectValue(object);
         return result;
     }
@@ -147,7 +147,7 @@ public class JavaFrame extends Frame {
         } else if (!format.getObjectClass().isAssignableFrom(object.getClass())) {
             throw new RuntimeException(
                 "Attempting to set object value of type '" + object.getClass() + "' on " +
-                "JavaFrame of type '" + format.getObjectClass() + "'!");
+                "SimpleFrame of type '" + format.getObjectClass() + "'!");
         }
 
         // Set the object value
@@ -156,6 +156,6 @@ public class JavaFrame extends Frame {
 
     @Override
     public String toString() {
-        return "JavaFrame (" + getFormat() + ")";
+        return "SimpleFrame (" + getFormat() + ")";
     }
 }
index e1d5060..e2b9047 100644 (file)
@@ -22,7 +22,7 @@ import android.filterfw.core.FrameFormat;
 import android.filterfw.core.FrameManager;
 import android.filterfw.core.GLFrame;
 import android.filterfw.core.NativeFrame;
-import android.filterfw.core.JavaFrame;
+import android.filterfw.core.SimpleFrame;
 import android.filterfw.core.VertexFrame;
 
 /**
@@ -59,8 +59,8 @@ public class SimpleFrameManager extends FrameManager {
     private Frame createNewFrame(FrameFormat format) {
         Frame result = null;
         switch(format.getTarget()) {
-            case FrameFormat.TARGET_JAVA:
-                result = new JavaFrame(format, this);
+            case FrameFormat.TARGET_SIMPLE:
+                result = new SimpleFrame(format, this);
                 break;
 
             case FrameFormat.TARGET_NATIVE:
index b777c7a..d57f47c 100644 (file)
@@ -42,7 +42,7 @@ public class ImageFormat {
         result.setDimensions(width, height);
         result.setBytesPerSample(bytesPerSample);
         result.setMetaValue(COLORSPACE_KEY, colorspace);
-        if (target == FrameFormat.TARGET_JAVA) {
+        if (target == FrameFormat.TARGET_SIMPLE) {
             result.setObjectClass(Bitmap.class);
         }
         return result;
index 031cb67..5222d9c 100644 (file)
@@ -77,7 +77,7 @@ public class CropFilter extends Filter {
     @Override
     public void setupPorts() {
         addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA));
-        addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_JAVA));
+        addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_SIMPLE));
         addOutputBasedOnInput("image", "image");
     }
 
index e947cf3..3f1711e 100644 (file)
@@ -49,7 +49,7 @@ public class DrawOverlayFilter extends Filter {
                                                          FrameFormat.TARGET_GPU);
         addMaskedInputPort("source", imageFormatMask);
         addMaskedInputPort("overlay", imageFormatMask);
-        addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_JAVA));
+        addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_SIMPLE));
         addOutputBasedOnInput("image", "source");
     }
 
index d7b1fe6..83c9348 100644 (file)
@@ -71,7 +71,7 @@ public class DrawRectFilter extends Filter {
     public void setupPorts() {
         addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA,
                                                        FrameFormat.TARGET_GPU));
-        addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_JAVA));
+        addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_SIMPLE));
         addOutputBasedOnInput("image", "image");
     }
 
index a44143e..7e2b4cf 100644 (file)
@@ -22,7 +22,6 @@ import android.filterfw.core.FilterContext;
 import android.filterfw.core.Frame;
 import android.filterfw.core.FrameFormat;
 import android.filterfw.core.GenerateFieldPort;
-import android.filterfw.core.JavaFrame;
 import android.filterfw.format.ObjectFormat;
 
 import java.lang.Math;
@@ -45,7 +44,7 @@ public class SinWaveFilter extends Filter {
 
     @Override
     public void setupPorts() {
-        mOutputFormat = ObjectFormat.fromClass(Float.class, FrameFormat.TARGET_JAVA);
+        mOutputFormat = ObjectFormat.fromClass(Float.class, FrameFormat.TARGET_SIMPLE);
         addOutputPort("value", mOutputFormat);
     }
 
index 9e70766..ac837ed 100644 (file)
@@ -22,7 +22,6 @@ import android.filterfw.core.FilterContext;
 import android.filterfw.core.Frame;
 import android.filterfw.core.FrameFormat;
 import android.filterfw.core.GenerateFieldPort;
-import android.filterfw.core.JavaFrame;
 import android.filterfw.format.ObjectFormat;
 import android.os.SystemClock;
 
@@ -51,7 +50,7 @@ public class ThroughputFilter extends Filter {
         addInputPort("frame");
 
         // Add output ports
-        mOutputFormat = ObjectFormat.fromClass(Throughput.class, FrameFormat.TARGET_JAVA);
+        mOutputFormat = ObjectFormat.fromClass(Throughput.class, FrameFormat.TARGET_SIMPLE);
         addOutputBasedOnInput("frame", "frame");
         addOutputPort("throughput", mOutputFormat);
     }
index b270224..dc12db6 100644 (file)
@@ -21,7 +21,6 @@ import android.filterfw.core.Filter;
 import android.filterfw.core.FilterContext;
 import android.filterfw.core.Frame;
 import android.filterfw.core.FrameFormat;
-import android.filterfw.core.JavaFrame;
 import android.filterfw.format.ObjectFormat;
 import android.util.Log;
 
@@ -36,7 +35,8 @@ public class StringLogger extends Filter {
 
     @Override
     public void setupPorts() {
-        addMaskedInputPort("string", ObjectFormat.fromClass(String.class, FrameFormat.TARGET_JAVA));
+        addMaskedInputPort("string", ObjectFormat.fromClass(String.class,
+                                                            FrameFormat.TARGET_SIMPLE));
     }
 
     @Override
index de0d67d..cc33b89 100644 (file)
@@ -24,7 +24,6 @@ import android.filterfw.core.FrameFormat;
 import android.filterfw.core.GenerateFieldPort;
 import android.filterfw.core.KeyValueMap;
 import android.filterfw.core.MutableFrameFormat;
-import android.filterfw.core.JavaFrame;
 import android.filterfw.format.ObjectFormat;
 
 /**
@@ -43,7 +42,7 @@ public class StringSource extends Filter {
 
     @Override
     public void setupPorts() {
-        mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_JAVA);
+        mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_SIMPLE);
         addOutputPort("string", mOutputFormat);
     }
 
index 388883d..0cf3477 100644 (file)
@@ -21,7 +21,6 @@ import android.filterfw.core.Filter;
 import android.filterfw.core.FilterContext;
 import android.filterfw.core.Frame;
 import android.filterfw.core.FrameFormat;
-import android.filterfw.core.JavaFrame;
 import android.filterfw.format.ObjectFormat;
 
 /**
@@ -37,7 +36,7 @@ public class ToUpperCase extends Filter {
 
     @Override
     public void setupPorts() {
-        mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_JAVA);
+        mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_SIMPLE);
         addMaskedInputPort("mixedcase", mOutputFormat);
         addOutputPort("uppercase", mOutputFormat);
     }