sebwrede commented on a change in pull request #1051:
URL: https://github.com/apache/systemds/pull/1051#discussion_r486399379



##########
File path: src/main/java/org/apache/sysds/runtime/privacy/PrivacyPropagator.java
##########
@@ -414,4 +591,25 @@ else if ( inst instanceof SqlCPInstruction )
                        instructionOutputNames = new 
String[]{((SqlCPInstruction) inst).getOutputVariableName()};
                return instructionOutputNames;
        }
+
+       private static ArrayList<CPOperand> getOutputOperands(Instruction inst){
+               // The order of the following statements is important
+               if ( inst instanceof 
MultiReturnParameterizedBuiltinCPInstruction )
+                       return ((MultiReturnParameterizedBuiltinCPInstruction) 
inst).getOutputs();
+               else if ( inst instanceof MultiReturnBuiltinCPInstruction )
+                       return ((MultiReturnBuiltinCPInstruction) 
inst).getOutputs();
+               else if ( inst instanceof ComputationCPInstruction )
+                       return getSingletonList(((ComputationCPInstruction) 
inst).getOutput());
+               else if ( inst instanceof VariableCPInstruction )
+                       return getSingletonList(((VariableCPInstruction) 
inst).getOutput());
+               else if ( inst instanceof SqlCPInstruction )
+                       return getSingletonList(((SqlCPInstruction) 
inst).getOutput());
+               return new ArrayList<CPOperand>();

Review comment:
       The alternative is to have a method in Instruction called "getOutputs" 
and then implement it in the subclasses. This is however not the general design 
we use at the moment, but it would make much of the code cleaner to look at. 
For instance, most of the switch statements in this class could also be avoided 
if we changed the design and used Java inheritance instead. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to